‎2010 Aug 16 6:28 AM
Hi All,
I have an internal table ITAB where WBS element, SKF, Fiscal Period, Fiscal year and Quantity fields are present.
I want to append the WBS elements into other table (ITAB2) for processing the data into Function module to create a posting.
While looping, i have to append all these values for a particular period and then execute Function module.
Whenever a period changes i have to append again and then execute FMs.
Basically, the postings for multiple WBS for a particular Period should be done.
I believe while looping ITAB, i need to control this using a control break statement.
But how to incorporate the logic?
Your help will be appreciated....
Regards
Pavan
‎2010 Aug 16 7:30 AM
Hi ,
Sort your First ITAB with "period" and use AT-New statement inside a loop , to get the next change values.
Cheers ,
Dilum
‎2010 Aug 16 6:34 AM
you can use the control break statements like on change of / at new.
‎2010 Aug 16 7:10 AM
you can use AT-NEW events to control the flow of your program and logic.
Regards
‎2010 Aug 16 7:18 AM
Hi, Sanganal
You can get much help about Control Break Statements after a little search, you can also get by writing AT in your ABAP Editor Press F1 and Double Click on AT - itab, ABAP Statement
Please Reply if any Issue,
Thanks and Regards,
Faisal
‎2010 Aug 16 7:30 AM
Hi ,
Sort your First ITAB with "period" and use AT-New statement inside a loop , to get the next change values.
Cheers ,
Dilum
‎2010 Aug 16 7:35 AM
Hi,
Control break statements :
1. AT NEW f.
2. AT END OF f.
3. AT FIRST.
4. AT LAST.
In a LOOP which processes an internal table, you can use special control structures for control break processing. All these structures begin with AT and end with ENDAT. The sequence of statements which lies between them is then executed if a control break occurs.
Example :
SORT it_final BY belnr.
* To add the Local Currency Amount, Quantity and Quantity in EUn at new Document Number.
LOOP AT it_final INTO wa_final.
wa_final1 = wa_final.
AT NEW belnr.
g_belnr = wa_final1-belnr.
ENDAT.
IF wa_final1-belnr = g_belnr.
g_dmbtr_sum = g_dmbtr_sum + wa_final1-dmbtr.
g_menge_sum = g_menge_sum + wa_final1-menge.
g_erfmg_sum = g_erfmg_sum + wa_final1-erfmg.
ENDIF.
AT END OF belnr.
wa_final1-dmbtr = g_dmbtr_sum.
wa_final1-menge = g_menge_sum.
wa_final1-erfmg = g_erfmg_sum.
g_dmbtr_sum = 0.
g_erfmg_sum = 0.
g_menge_sum = 0.
APPEND wa_final1 TO it_final1.
CLEAR : wa_final,
wa_final1.
ENDAT.
ENDLOOP.Hope this helps.
Thanks,