Replacing 'Loop' with 'Do'...
How can I replace the following with DO/ENDO?
<b>loop</b> at i_po_text.
v_length = strlen( v_text ).
if v_length > 6000.
concatenate v_text i_po_text-tdline into v_text separated by space.
move: v_text to i_matl_details-po_text.
Srinivas Adavi replied
I am assuming you are talking in the context of your program that reads the change documents to find all the materials that changed. You then pull information regarding all those materials from the materials master tables except the PO text which you are getting from calling READ_TEXT. Here you get the text in an internal table and you want to convert that into a string before updating your final internal table.
loop at materials_that_changed. get po text in internal table for the current loop material. loop at the potext internal table. prepare the string. endloop. move the string to materials_that_changed internal table field, po_text. modify. endloop.
Is this accurate description?
If it is true, doing a loop within a loop will not hurt the performance, because at any point of time, your po_text internal table will contain only the text for one material and I guess that should not be more than a couple of records.