Created
August 18, 2012 02:05
-
-
Save jasper07/3383918 to your computer and use it in GitHub Desktop.
abap_gw_contacts_get_entityset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
METHOD contacts_get_entityset. | |
DATA: | |
lt_contacts TYPE STANDARD TABLE OF zat_contacts, | |
lra_handle TYPE RANGE OF zat_handle, | |
lra_firstname TYPE RANGE OF ad_namefir, | |
lra_lastname TYPE RANGE OF ad_namelas, | |
lv_property TYPE string. | |
FIELD-SYMBOLS: | |
<fs_contacts> LIKE LINE OF lt_contacts, | |
<fs_entityset> LIKE LINE OF et_entityset, | |
<fs_filter_select_options> LIKE LINE OF it_filter_select_options, | |
<fs_select_options> TYPE /iwbep/s_cod_select_option, | |
<fs_handle> LIKE LINE OF lra_handle, | |
<fs_firstname> LIKE LINE OF lra_firstname, | |
<fs_lastname> LIKE LINE OF lra_lastname. | |
*--- build select options from the filter select options passed | |
LOOP AT it_filter_select_options ASSIGNING <fs_filter_select_options>. | |
LOOP AT <fs_filter_select_options>-select_options ASSIGNING <fs_select_options>. | |
lv_property = to_upper( <fs_filter_select_options>-property ). | |
CASE lv_property. | |
WHEN 'HANDLE'. | |
APPEND INITIAL LINE TO lra_handle ASSIGNING <fs_handle>. | |
MOVE-CORRESPONDING <fs_select_options> TO <fs_handle>. | |
WHEN 'FIRSTNAME'. | |
APPEND INITIAL LINE TO lra_firstname ASSIGNING <fs_firstname>. | |
MOVE-CORRESPONDING <fs_select_options> TO <fs_firstname>. | |
WHEN 'LASTNAME'. | |
APPEND INITIAL LINE TO lra_lastname ASSIGNING <fs_lastname>. | |
MOVE-CORRESPONDING <fs_select_options> TO <fs_lastname>. | |
WHEN OTHERS. | |
CONTINUE. | |
ENDCASE. | |
ENDLOOP. | |
ENDLOOP. | |
*--- select contacts | |
SELECT * | |
INTO TABLE lt_contacts | |
FROM zat_contacts | |
WHERE handle IN lra_handle | |
AND firstname IN lra_firstname | |
AND lastname IN lra_lastname. | |
DATA: lv_host TYPE string, | |
lv_port TYPE string, | |
lv_protocol TYPE string. | |
*--- move contacts to the entityset | |
LOOP AT lt_contacts ASSIGNING <fs_contacts>. | |
APPEND INITIAL LINE TO et_entityset ASSIGNING <fs_entityset>. | |
MOVE-CORRESPONDING <fs_contacts> TO <fs_entityset>. | |
*--- give avatar a fully qualified url | |
cl_http_server=>get_location( IMPORTING host = lv_host | |
port = lv_port | |
out_protocol = lv_protocol ). | |
<fs_entityset>-avatar = |{ lv_protocol }://{ lv_host }:{ lv_port }{ <fs_entityset>-avatar }|. | |
ENDLOOP. | |
ENDMETHOD. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment