Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

sap abap advance syntax

rbharathi123
Explorer
0 Kudos
558

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

3 REPLIES 3

Sandra_Rossi
Active Contributor
0 Kudos
487

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?

Sandra_Rossi
Active Contributor
487

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!

fprokopiuk
Active Participant
0 Kudos
487

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.