Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Field-Groups ; How does it work with loops

prabhu_s2
Active Contributor
0 Likes
661

Hi ,

I had been with couple of examples on field groups but one thing i couldnt understand is how it is working with the loops and sort. is there any documentation you can help me with please? some of the post i really found it repetitive or being posted again b copying from other thread and no useful info provided....

Regards

Prabhu

Hi ,

I had been with couple of examples on field groups but one thing i couldnt understand is how it is working with the loops and sort. is there any documentation you can help me with please? some of the post i really found it repetitive or being posted again b copying from other thread and no useful info provided....

Regards

Prabhu

1 REPLY 1
Read only

Sandra_Rossi
Active Contributor
0 Likes
418

Hi Prabhu,

a little summary of how work extracts (that's the official name, field groups are one of the components):

- FIELD-GROUPS fieldGroupName defines the name of a field group. There's a special group named "header" that is important for sorting, all its fields will be implicitly part of all field groups.

- INSERT globvar1 globvar2 ... INTO fieldGroupName defines (once for each field group, at the top of the program) which global variables are assigned to a field group (see them as a transmission of their data references). Note that you may share the same global variables as the ones of the "header" field group, so that to sort them

- EXTRACT fieldGroupName writes one "line" to the extract dataset, which contains the field group name and the contents of all its assigned global variables

- The program must have generated the whole extract dataset first, so that to then be able to read it, once (EXTRACT after SORT will dump)

- SORT BY globvar1 ... sorts the extract dataset by these global variables which must belong to the "header" field group (must have been defined by INSERT)

- LOOP (without any keyword) starts reading the extract, one "line" at a time. That fills the global variables of the corresponding field group

- Within the loop, you may use AT fieldGroupName to process data based on the filled global variables, and you may also use AT globvar1 which have been defined in the SORT command.

I hope to be clear enough.

BR

Sandra

PS: extracts are obsolete (but still widely used in R/3)

Edited by: Sandra Rossi , 2 minutes later

Doc: [SAP Library: Extract|http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9ed135c111d1829f0000e829fbfe/frameset.htm]