Reputation: 111
I have a table containing 'n' rows with strings. I have to select one row and use the value inside it for my method as input, once my method processes the string, I have to select the next row and do the same thing until every row of my table gets processed, all the results have to be exported into a table.
I tried using a while loop to increment the row number 'n' and on every loop it should take the 'n' row, but I don't know how to use the SELECT
statement for this part.
How could I do that?
Upvotes: 1
Views: 814
Reputation: 1380
For example
SELECT vbeln, vbelp, ebeln, ebelp
FROM ekkn
WHERE vbeln = @ls_lips-vgbel
AND vbelp = @ls_lips-vgpos
INTO @DATA(lt_ekkn).
LOOP AT lt_ekkn ASSIGNING FIELD-SYMBOL(<fs_ekkn>).
CALL METHOD cl_class=>do_something
EXPORTING
some_input = <fs_ekkn>-ebeln
IMPORTING
some_output = value.
ENDLOOP.
Upvotes: 4
Reputation: 37
you can use "SELECT ... call method(). ENDSELECT." For this...
For example
SELECT VBELN from VBAK into lv_vbeln where VBAK = '001'.
call method print_vbeln(lv_vbeln).
ENDSELECT.
It will call the method for every document.
Please consider to use an internal table as buffer instead, but for some extreme cases this way is very helpful.
Upvotes: 1