11-07-2014 3:16 AM
Hi all,
I have this standard SAP program copied into a custom program where in there is a LOOP function but I don't see any condition in the loop. I don't know how this works. Below is the code for the loop and how icdhdr is defined.
data: begin of icdhdr occurs 100. "Änderungsbelege: Header
include structure cdhdr.
data: end of icdhdr.
loop.
if sort <> '4'.
perform zahlen_linksbuendig.
endif.
perform zahlen_initialisieren.
clear gs_outtab.
move : icdhdr-udate to gs_outtab-udate,
icdhdr-utime to gs_outtab-utime,
icdhdr-username to gs_outtab-username,
icdpos-lifnr to gs_outtab-lifnr,
fldtext to gs_outtab-fname,
icdpos-bukrs to gs_outtab-bukrs,
icdpos-ekorg to gs_outtab-ekorg,
icdpos-f_old to gs_outtab-f_old,
icdpos-f_new to gs_outtab-f_new,
icdpos-f_old+35 to gs_outtab-f_old_35,
icdpos-f_new+35 to gs_outtab-f_new_35.
perform poszeile2_ausgeben changing gs_outtab-dscrp
gs_outtab-tabfeld
gs_outtab-other_keys.
append gs_outtab to gt_outtab.
endloop.
Thank you for your help.
11-07-2014 3:51 AM
Hi Mario,
This is (one of) the problems of cloning standard programs: you got a few obsolete statements with you. From online help:
The LOOP and ENDLOOP statements define a loop around a statement block. The loop is passed for each row from the extract dataset until it is exited using one of the statements from the section Exit Loops. In each loop pass, the LOOP statement assigns the contents of the components from the current row of the extract dataset to the data objects that make up the field group of the row. If the extract dataset is not sorted, the order in which the rows are read is the same in which they were appended using the EXTRACT statement. If the extract dataset is sorted using SORT, the read order is the same as the sort order.
There's more in the help, just do the <f1> on the loop and you will see.
Regards,
Custodio
11-07-2014 3:47 AM
11-07-2014 3:51 AM
Hi Mario,
This is (one of) the problems of cloning standard programs: you got a few obsolete statements with you. From online help:
The LOOP and ENDLOOP statements define a loop around a statement block. The loop is passed for each row from the extract dataset until it is exited using one of the statements from the section Exit Loops. In each loop pass, the LOOP statement assigns the contents of the components from the current row of the extract dataset to the data objects that make up the field group of the row. If the extract dataset is not sorted, the order in which the rows are read is the same in which they were appended using the EXTRACT statement. If the extract dataset is sorted using SORT, the read order is the same as the sort order.
There's more in the help, just do the <f1> on the loop and you will see.
Regards,
Custodio
11-07-2014 4:25 AM
Hi Custodio,
How do I identify this extract dataset? So when ICDHDR is filled up via the EXTRACT statement, the loop will already know that it will go through this extract dataset?
Regards,
Mario
11-07-2014 4:35 AM
Hi Mario,
To be honest I don't know how exactly it works as I either have not used it or have used/touched this more than 10 years ago and don't remember . But I know that you will have to search your program for keywords EXTRACT. You will also have the fields defined in FIELD-GROUPS.
Good luck on your searches.
Regards,
Custodio
11-07-2014 4:55 AM
Hi Custodio,
I see. Alright. This helps me a lot. Thank you so much for your help.
Regards,
Mario