‎2008 Aug 06 8:31 AM
hi,
can anyone tell me in brief what is field group and how is it related to extracts? and what is record types in that?
i just have a brief idea of field groups as i went thru the SDN search.
‎2008 Aug 06 11:40 AM
Hi Poonam,
An extract dataset consists of a sequence of records. These records may have different structures. All records with the same structure form a record type. You must define each record type of an extract dataset as a field group, using the FIELD-GROUPS statement.
FIELD-GROUPS <fg>.
This statement defines a field group <fg>. A field group combines several fields under one name. For clarity, you should declare your field groups at the end of the declaration part of your program.
A field group does not reserve storage space for the fields, but contains pointers to existing fields. When filling the extract dataset with records, these pointers determine the contents of the stored records.
You can also define a special field group called HEADER:
FIELD-GROUPS HEADER.
This group is automatically placed before any other field groups when you fill the extract. This means that a record of a field group <fg> always contains the fields of the field group HEADER. When sorting the extract dataset, the system uses these fields as the default sort key.
Regards,
Swapna.
‎2008 Aug 06 8:35 AM
Hi Poonam,
Plz refer to the links below:
http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb43e6455611d189710000e8322d00/content.htm
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9ede35c111d1829f0000e829fbfe/content.htm
http://www.geocities.com/SiliconValley/Grid/4858/sap/ABAPCode/Fieldgroups.htm
With luck,
Pritam.
‎2008 Aug 06 10:25 AM
Hi Poonam,
Field groups are groups similar fileds together in one name. Field groups works in conjuction with
INSERT ,
EXTRACT,
SORT BY,
LOOP
ENDLOOP.
EXTRACT : This will combine all the fields in filed groups & write them in a sequential dataset in a single record.
‎2008 Aug 06 11:35 AM
REPORT ZSPFLI LINE-SIZE 132 LINE-COUNT 65(3)
NO STANDARD PAGE HEADING.
TABLES:SPFLI,SCARR, SFLIGHT, SBOOK.
SELECT-OPTIONS: MYCARRID FOR SPFLI-CARRID.
FIELD-GROUPS: HEADER, SPFLI_FG, SFLIGHT_FG, SBOOK_FG.
INSERT:
SPFLI-CARRID
SPFLI-CONNID
SFLIGHT-FLDATE
SBOOK-BOOKID
INTO HEADER,
SPFLI-CARRID
SPFLI-CONNID
SPFLI-CITYFROM
SPFLI-AIRPFROM
SPFLI-CITYTO
SPFLI-AIRPTO
SPFLI-DEPTIME
SCARR-CARRNAME
INTO SPFLI_FG,
SFLIGHT-FLDATE
SFLIGHT-SEATSMAX
SFLIGHT-SEATSOCC
SFLIGHT-PRICE
INTO SFLIGHT_FG,
SBOOK-BOOKID
SBOOK-CUSTOMID
SBOOK-CUSTTYPE
SBOOK-SMOKER
INTO SBOOK_FG.
SELECT * FROM SPFLI WHERE CARRID IN MYCARRID.
SELECT SINGLE * FROM SCARR WHERE CARRID = SPFLI-CARRID.
EXTRACT SPFLI_FG.
SELECT * FROM SFLIGHT
WHERE CARRID = SPFLI-CARRID AND CONNID = SPFLI-CONNID.
EXTRACT SFLIGHT_FG.
SELECT * FROM SBOOK
WHERE CARRID = SFLIGHT-CARRID AND
CONNID = SFLIGHT-CONNID AND FLDATE = SFLIGHT-FLDATE.
EXTRACT SBOOK_FG.
CLEAR SBOOK.
ENDSELECT.
CLEAR SFLIGHT.
ENDSELECT.
CLEAR SPFLI.
ENDSELECT.
SORT.
LOOP.
AT SPFLI_FG.
FORMAT COLOR COL_HEADING.
WRITE: / SCARR-CARRNAME,
SPFLI-CONNID, SPFLI-CITYFROM,
SPFLI-AIRPFROM, SPFLI-CITYTO, SPFLI-AIRPTO, SPFLI-DEPTIME.
FORMAT COLOR OFF.
ENDAT.
AT SFLIGHT_FG.
WRITE: /15 SFLIGHT-FLDATE, SFLIGHT-PRICE, SFLIGHT-SEATSMAX,
SFLIGHT-SEATSOCC.
ENDAT.
AT SBOOK_FG.
WRITE: /30 SBOOK-BOOKID, SBOOK-CUSTOMID,
SBOOK-CUSTTYPE, SBOOK-SMOKER.
ENDAT.
ENDLOOP.
‎2008 Aug 06 11:40 AM
Hi Poonam,
An extract dataset consists of a sequence of records. These records may have different structures. All records with the same structure form a record type. You must define each record type of an extract dataset as a field group, using the FIELD-GROUPS statement.
FIELD-GROUPS <fg>.
This statement defines a field group <fg>. A field group combines several fields under one name. For clarity, you should declare your field groups at the end of the declaration part of your program.
A field group does not reserve storage space for the fields, but contains pointers to existing fields. When filling the extract dataset with records, these pointers determine the contents of the stored records.
You can also define a special field group called HEADER:
FIELD-GROUPS HEADER.
This group is automatically placed before any other field groups when you fill the extract. This means that a record of a field group <fg> always contains the fields of the field group HEADER. When sorting the extract dataset, the system uses these fields as the default sort key.
Regards,
Swapna.
‎2008 Aug 06 12:27 PM
Hi ,
Check this link.
http://help.sap.com/saphelp_46c/helpdata/en/9f/db9ede35c111d1829f0000e829fbfe/content.htm
Regards,
Muneesh Gitta.
‎2008 Aug 07 6:32 AM
hi,
If there is no field group specified after EXTRACT, then the field group header is implicitly added.
At the first execution of the EXTRACT-statement of a program, the extract dataset is created and the first line added. After execution of an EXTRACT-statement, it is not allowed to incorporate other fields to the specified field group field_group with the INSERT statement. If you do so, an uncatchable exception will be raised at the next EXTRACT-statement for the same field group.
EXTRACT [ header | field_group ].
‎2008 Aug 07 6:37 AM
poonam,
this is from SAP help:
http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb43e6455611d189710000e8322d00/content.htm
and this is with example:
http://sap.niraj.tripod.com/id26.html
Amit.