Application Development and Automation 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: 
Read only

How to write read statement inside loop table based on index using 7.4+ syntax

Aravinth02
Explorer
0 Likes
1,518

Hello friends, One of my program I created one custom button using toolbar function. So based on the selection records I want to process BAPI FM. For that I'm trying to learn code using 7.4 syntax.

LOOP AT lt_selected_rows INTO ls_selected_line.


    lv_index ls_selected_line-index.

    READ TABLE gt_mara INDEX lv_index INTO ls_mara.

    PERFORM  BAPI.  


  ENDLOOP.

how to convert this code in ABAP 7.4

Your answer will be more helpful for my learning journey.

 

 

4 REPLIES 4
Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
1,502
LOOP AT lt_selected_rows INTO DATA(ls_selected_line).
  DATA(lv_index) = ls_selected_line-index.
  DATA(ls_mara) = gt_mara[ lv_index ].
  "PERFORM  BAPI.
  call_bapi( ).
ENDLOOP.
-- Tomas --
Read only

0 Likes
1,453

Thank you. This is good

Read only

Sandra_Rossi
Active Contributor
1,457

In fact, the only obsolete part in your code is PERFORM (obsolete since 2010), the rest of your code is perfectly valid. You should use ABAP Objects (method instead of subroutine).

Anyway, rewriting that code is just a waste of time, except just exercising.

Read only

0 Likes
1,451

Thanks for your suggestions Sandra. I will keep it up.