Application Development 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: 

extract code help

Former Member
0 Kudos

Please refer to the following link

http://help.sap.com/saphelp_46c/helpdata/en/7b/fb96c8882811d295a90000e8353423/frameset.htm

I have "2" questions:-

q1] What is the purpose of the GET Event?

q2] Why does the Extract look like that, ie., with repeatations of the same pattern-is it not so that the output should serially?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

GET is the event similar to SELECT statement to fetch the data using thr Logical data bases (LDB) goto SE36 tcode and see the doc of it

A logical database is a special ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.

LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.

Less coding s required to retrieve data compared to normal internel tables.

Tables used LDB are in hierarchial structure.

Mainly we used LDBs in HR Abap Programming.

Where all tables are highly inter related so LDBs can optimize the performance there.

Check this Document. All abt LDB's

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=...

GO THROUGH LINKS -

http://www.sap-basis-abap.com/saptab.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm

/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases

www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html

www.sap-img.com/abap/abap-interview-question.htm

www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm

Gothru the blog which provides info on LDB's:

/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases

Sample code

TABLES: SPFLI,

SFLIGHT,

SBOOK,

SCARR.

START-OF-SELECTION.

GET SPFLI.

WRITE:/ ’SPFLI: ’, SPFLI-CARRID, SPFLI-CONNID,

SPFLI-AIRPFROM, SPFLI-AIRPTO.

GET SFLIGHT.

WRITE:/ ’ SFLIGHT: ’, SFLIGHT-CARRID, SFLIGHT-CONNID, SFLIGHT-FLDATE.

GET SBOOK.

WRITE:/ ’ SBOOK: ’, SBOOK-CARRID, SBOOK-CONNID,

SBOOK-FLDATE, SBOOK-BOOKID.

GET SFLIGHT LATE.

WRITE:/ ’ GET SFLIGHT LATE: ’, SFLIGHT-FLDATE.

EXTRACT

It is the key word used in Field Groups data fetching similar to the SELECT and GET statement

Field groups are useful when handling huge data when the internal tables are not useful due to memory problems see this

fieldgroups

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_gr.htm

http://www.geocities.com/SiliconValley/Grid/4858/sap/ABAPCode/Fieldgroups.htm

Sample Report Code

REPORT demo_extract.

NODES: spfli, sflight.

FIELD-GROUPS: header, flight_info, flight_date.

START-OF-SELECTION.

INSERT: spfli-carrid spfli-connid sflight-fldate

INTO header,

spfli-cityfrom spfli-cityto

INTO flight_info.

GET spfli.

EXTRACT flight_info.

GET sflight.

EXTRACT flight_date.

END-OF-SELECTION.

SORT STABLE.

LOOP.

AT FIRST.

WRITE / 'Flight list'.

ULINE.

ENDAT.

AT flight_info WITH flight_date.

WRITE: / spfli-carrid , spfli-connid, sflight-fldate,

spfli-cityfrom, spfli-cityto.

ENDAT.

AT flight_date.

WRITE: / spfli-carrid , spfli-connid, sflight-fldate.

ENDAT.

AT LAST.

ULINE.

WRITE: cnt(spfli-carrid), 'Airlines'.

ULINE.

ENDAT.

ENDLOOP.

Regards

Anji

1 REPLY 1

Former Member
0 Kudos

Hi

GET is the event similar to SELECT statement to fetch the data using thr Logical data bases (LDB) goto SE36 tcode and see the doc of it

A logical database is a special ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.

LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.

Less coding s required to retrieve data compared to normal internel tables.

Tables used LDB are in hierarchial structure.

Mainly we used LDBs in HR Abap Programming.

Where all tables are highly inter related so LDBs can optimize the performance there.

Check this Document. All abt LDB's

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=...

GO THROUGH LINKS -

http://www.sap-basis-abap.com/saptab.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm

/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases

www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html

www.sap-img.com/abap/abap-interview-question.htm

www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm

Gothru the blog which provides info on LDB's:

/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases

Sample code

TABLES: SPFLI,

SFLIGHT,

SBOOK,

SCARR.

START-OF-SELECTION.

GET SPFLI.

WRITE:/ ’SPFLI: ’, SPFLI-CARRID, SPFLI-CONNID,

SPFLI-AIRPFROM, SPFLI-AIRPTO.

GET SFLIGHT.

WRITE:/ ’ SFLIGHT: ’, SFLIGHT-CARRID, SFLIGHT-CONNID, SFLIGHT-FLDATE.

GET SBOOK.

WRITE:/ ’ SBOOK: ’, SBOOK-CARRID, SBOOK-CONNID,

SBOOK-FLDATE, SBOOK-BOOKID.

GET SFLIGHT LATE.

WRITE:/ ’ GET SFLIGHT LATE: ’, SFLIGHT-FLDATE.

EXTRACT

It is the key word used in Field Groups data fetching similar to the SELECT and GET statement

Field groups are useful when handling huge data when the internal tables are not useful due to memory problems see this

fieldgroups

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_gr.htm

http://www.geocities.com/SiliconValley/Grid/4858/sap/ABAPCode/Fieldgroups.htm

Sample Report Code

REPORT demo_extract.

NODES: spfli, sflight.

FIELD-GROUPS: header, flight_info, flight_date.

START-OF-SELECTION.

INSERT: spfli-carrid spfli-connid sflight-fldate

INTO header,

spfli-cityfrom spfli-cityto

INTO flight_info.

GET spfli.

EXTRACT flight_info.

GET sflight.

EXTRACT flight_date.

END-OF-SELECTION.

SORT STABLE.

LOOP.

AT FIRST.

WRITE / 'Flight list'.

ULINE.

ENDAT.

AT flight_info WITH flight_date.

WRITE: / spfli-carrid , spfli-connid, sflight-fldate,

spfli-cityfrom, spfli-cityto.

ENDAT.

AT flight_date.

WRITE: / spfli-carrid , spfli-connid, sflight-fldate.

ENDAT.

AT LAST.

ULINE.

WRITE: cnt(spfli-carrid), 'Airlines'.

ULINE.

ENDAT.

ENDLOOP.

Regards

Anji