Handling of several change request and entity data.
DATA :
lr_crequest TYPE REF TO if_usmd_crequest_api,
lr_gov_api TYPE REF TO if_usmd_gov_api,
t_crequest_obj_list TYPE usmd_gov_api_t_ent_struc,
lr_adpostal_detail_key_str TYPE REF TO data,
lr_adpostal_detail_key_tab TYPE REF TO data,
lr_adpostal_detail_data_str TYPE REF TO data,
lr_adpostal_detail_data_tab TYPE REF TO data,
w_crequest_obj_list TYPE usmd_gov_api_s_ent_struc,
ls_crequest TYPE usmd_s_crequest.
FIELD-SYMBOLS :
<fs_t_adpostal_detail_key> TYPE ANY TABLE,
<fs_w_adpostal_detail_key> TYPE any,
<fs_t_adpostal_detail_data> TYPE INDEX TABLE,
<fs_w_adpostal_detail_data> TYPE any.
"Get API Instance:
CALL METHOD cl_usmd_crequest_api=>get_instance
EXPORTING
iv_crequest = im_cr_id
IMPORTING
re_inst_crequest_api = lr_crequest.
"CR Request Details:
CALL METHOD lr_crequest->read_crequest
IMPORTING
es_crequest = ls_crequest.
ex_crequest = ls_crequest.
"Get Instance of Model:
lr_gov_api = cl_usmd_gov_api=>get_instance( iv_model_name = im_modelname ).
"Get Object List:
lr_gov_api->get_object_list( EXPORTING iv_crequest_id = im_cr_id
IMPORTING et_object_list = t_crequest_obj_list ).
"Check with Entity Type:
READ TABLE t_crequest_obj_list INTO w_crequest_obj_list WITH KEY entity = im_entity.
IF sy-subrc <> 0.
* RETURN.
ENDIF.
CLEAR : lr_adpostal_detail_key_str,lr_adpostal_detail_key_tab.
"Get KeyStr and KeyTab:
lr_gov_api->create_data_reference( EXPORTING iv_entity_name = im_entity
iv_struct = lr_gov_api->gc_struct_key
IMPORTING er_structure = lr_adpostal_detail_key_str
er_table = lr_adpostal_detail_key_tab ).
"Get AdPostal data:
lr_gov_api->create_data_reference( EXPORTING iv_entity_name = im_entity
iv_struct = lr_gov_api->gc_struct_key_attr
IMPORTING er_structure = lr_adpostal_detail_data_str
er_table = lr_adpostal_detail_data_tab ).
ASSIGN lr_adpostal_detail_key_str->* TO <fs_w_adpostal_detail_key>.
ASSIGN lr_adpostal_detail_key_tab->* TO <fs_t_adpostal_detail_key>.
ASSIGN w_crequest_obj_list-r_struc->* TO <fs_w_adpostal_detail_key>.
INSERT <fs_w_adpostal_detail_key> INTO TABLE <fs_t_adpostal_detail_key>.
ASSIGN lr_adpostal_detail_data_str->* TO <fs_w_adpostal_detail_data>.
ASSIGN lr_adpostal_detail_data_tab->* TO <fs_t_adpostal_detail_data>.
"AD_postal Detail Data:
TRY.
lr_gov_api->read_entity( EXPORTING iv_entity_name = im_entity
it_key = <fs_t_adpostal_detail_key>
iv_crequest_id = im_cr_id
if_active_data = abap_false
IMPORTING et_data = <fs_t_adpostal_detail_data> ).
CATCH cx_usmd_gov_api_core_error cx_usmd_gov_api.
* EXIT.
ENDTRY.
IF <fs_t_adpostal_detail_data> IS NOT INITIAL.
"Read Index 1.
READ TABLE <fs_t_adpostal_detail_data> INDEX 1 INTO <fs_w_adpostal_detail_data>.
CLEAR <fs_t_adpostal_detail_data>.
IF sy-subrc EQ 0 .
ex_cr_data = <fs_w_adpostal_detail_data>.
ENDIF.
ENDIF.
Amazing Content with very useful information we are awaiting for your next blog.
ReplyDeleteDigital Marketing
Amazing Content with very useful information we are awaiting for your next blog.
ReplyDeleteWebsite Development
Amazing content with very useful information awaits your next blog.
ReplyDeleteCLOUD BASED SOLUTIONS
Amazing content with very useful information awaits your next blog.
ReplyDeleteTechnology Solutions
Amazing content with very useful information awaits your next blog.
ReplyDeleteIT Consulting
Amazing content with very useful information awaits your next blog.
ReplyDeleteIT Security
Amazing content with very useful information awaits your next blog.
ReplyDeleteIT Governance
Amazing content with very useful information awaits your next blog.
ReplyDeleteIT Project Management
Amazing content with very useful information awaits your next blog.
ReplyDeleteGrow Your Business