2023 Aug 24 6:40 AM
Hi experts,
Can any one tell me use Corresponding, Base and Mapping in the same syntax.
Kindly suggest me a Advance syntax.
Scenario :
LOOP AT it_kunnr INTO wa_kunnr.
CALL FUNCTION 'BAPI_AR_ACC_GETOPENITEMS'
EXPORTING
companycode = wa_kunnr-bukrs " P_BUKRS
customer = wa_kunnr-kunnr
keydate = p_date
* NOTEDITEMS = ' '
* SECINDEX = ' '
IMPORTING
return = wa_returns
TABLES
lineitems = it_lineitems.
.
LOOP AT it_lineitems INTO wa_lineitems.
MOVE-CORRESPONDING wa_lineitems TO wa_final.
wa_final-buzei = wa_lineitems-item_num.
wa_final-bldate = wa_lineitems-bline_date.
wa_final-inv_ref = wa_lineitems-inv_ref.
wa_final-inv_ryear = wa_lineitems-inv_year.
* wa_final-item_text = WA_LINEITEMS-item_text.
APPEND wa_final TO it_final.
CLEAR wa_final.
ENDLOOP.
ENDLOOP.
I need to replace second loop with advance syntax, Please suggest me ASAP.
Regards,
Bharathi
2023 Aug 24 7:01 AM
The "advance syntax" is unclear.
You have ABAP syntax by version number, like 7.40, 7.50, 7.57, etc.
You can also use the right terms, like you want a VALUE #( FOR ... ) constructor expression.
What do you know of constructor expressions? What did you try? What is your exact problem?
2023 Aug 24 7:01 AM
Please edit your question (Actions>Edit), select your code and press the button [CODE], which makes the code appear colored/indented, it'll be easier for people to look at it. Thanks!
2023 Aug 24 11:35 AM
You can find documentation for CORRESPONDING basic form here.
For example instead of second loop you could use below code:
DATA wt_final LIKE lt_final.
wt_final = CORRESPONDING #( it_lineitems MAPPING buzei = item_num
bldate = bline_date
inv_ryear = inv_ryear ).
APPEND LINES OF wt_final TO lt_final.
REFRESH: it_lineitems, wt_final.