2006 Jun 21 4:48 PM
Append wa to itab.
clear wa.
perform work.
-
wa is a work area.
itab is an internal table here.
wa keeps getting records from somewhere and will be appended to itab.
I want to perform work only after all the records that wa get are appended to itab. (looks like in the above code, work is performed after each record of wa appended to itab which I don't want like that)
Please suggest me a suitable code here.
Thanks in advance and shall award points.
2006 Jun 21 4:51 PM
This part of the code must be in some loop.
you should get the perform work out of that loop.
-
Append wa to itab.
clear wa.
<b>endloop.</b>
perform work.
Regards,
ravi
2006 Jun 21 4:51 PM
This part of the code must be in some loop.
you should get the perform work out of that loop.
-
Append wa to itab.
clear wa.
<b>endloop.</b>
perform work.
Regards,
ravi
2006 Jun 21 4:51 PM
2006 Jun 21 4:52 PM
You simply have to move the perform outside of the LOOP whereever it is. Somewhere, you must be having some kind of loop(LOOP, DO, WHILE, SELECT etc) introduced. Just move the PERFORM work outside of this loop(ENDLOOP, ENDDO, ENDWHILE, ENDSELECT etc).
2006 Jun 21 4:58 PM
I understand I should take out that perform from a loop.
But here in detail -
The above code is present in the last subroutine of the main program which is dynamically called from outside. I am not allowed to modify anything in that outside code. So, in the present subroutine in which the above code is present, there are no loop statements.
So, now how to perform work only after all the records from wa are appended to itab?
I guess the question is clear now. Thanks.
2006 Jun 21 4:59 PM
2006 Jun 21 5:00 PM
If that is the case, do you at least know when the last record comes in? In that case you can at least put an IF condition around your PERFORM saying if last record then perform.
2006 Jun 21 4:56 PM
hi,
Appending the workarea to internal table should be done in loop -endloop.
Loop at itab.
clear wa.
*populate workarea fields based on some condition.
wa-field1 = a.
wa-field2 = b.
append wa to itab.
endloop.
So, now after coming out of the loop you can perform any work on the internal table.
Hope this helps you.
Regards,
Richa.
2006 Jun 21 4:58 PM
Hi,
show your code fully.
as suggested by Ravi you have to place that perform outside the loop.
Regards
vijay
2006 Jun 21 5:03 PM
Hi,
<b>Existing code:</b>
-
Append wa to itab.
clear wa.
perform work.
-
<b>Modified Code:</b>
-
<b>Loop at <internal table> into wa.</b>
...
...
Append wa to itab.
clear wa.
<b>endloop.</b>
<b>if not <internal table>[] is initial.</b>
perform work.
<b>endif.</b>
-
Can you pls give the piece of ur code?
- Selvapandian Arunachalam
2006 Jun 21 6:02 PM
Hi,
The report is SAPMV75B. I copied it to Z program and have to do some modifications to it.
The place where I need to grab all the records is in the include ZMV75BA00 and the form 020__001 in that include.
I want to grab all those v03rb records into itab. I could do that. Now I have to sort these itab by werks, vbeln, posnr and have still to perform some work on this itab. Now where should I write this perform? If I write in form 020__001 the perform is being done for each record even before the itab is filled up. If I try to come out of that include and write after that include statement in main program, then also it does the same thing. So where should I write this perform succesfully so that it will be performed only after itab is fully filled from wa?
Thanks a lot for your help in advance.
2006 Jun 21 7:28 PM
You already opened another post for this. Can you close this one please?
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |