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: 

How to use a extract?

Former Member
0 Kudos
112

Hi ,

Can i use EXTRACT (FIELD GROUPS) in a ordinary select without any logical database?

If yes, send me some sample for that.

Thanks,

Nithya.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
75

Hi Nithya,

Refer the following code:

tables: mara.

types : begin of str_mara,

matnr type matnr,

mtart type mtart,

meins type meins,

matkl type matkl,

ernam type ernam,

mbrsh type mbrsh,

bstme type bstme,

end of str_mara.

data: wa_mara type str_mara,

it_mara type standard table of str_mara.

field-groups: fld_grp.

start-of-selection.

insert mara-matnr mara-mtart mara-meins

mara-matkl mara-ernam mara-mbrsh mara-bstme into fld_grp.

select matnr mtart meins matkl ernam mbrsh bstme from mara into

correspoNDING FIELDS OF mara.

extract fld_grp.

endselect.

*SORT ASCENDING .

clear mara.

loop.

at fld_grp .

wa_mara-matnr = mara-matnr.

wa_mara-mtart = mara-mtart.

wa_mara-meins = mara-meins.

wa_mara-matkl = mara-matkl.

wa_mara-ernam = mara-ernam.

wa_mara-mbrsh = mara-mbrsh.

wa_mara-bstme = mara-bstme.

append wa_mara to it_mara.

endat.

endloop.

loop at it_mara into wa_mara.

write:/ wa_mara-matnr, wa_mara-mtart, wa_mara-meins.

endloop.

Regards,

Nitin.

4 REPLIES 4

Former Member
0 Kudos
76

Hi Nithya,

Refer the following code:

tables: mara.

types : begin of str_mara,

matnr type matnr,

mtart type mtart,

meins type meins,

matkl type matkl,

ernam type ernam,

mbrsh type mbrsh,

bstme type bstme,

end of str_mara.

data: wa_mara type str_mara,

it_mara type standard table of str_mara.

field-groups: fld_grp.

start-of-selection.

insert mara-matnr mara-mtart mara-meins

mara-matkl mara-ernam mara-mbrsh mara-bstme into fld_grp.

select matnr mtart meins matkl ernam mbrsh bstme from mara into

correspoNDING FIELDS OF mara.

extract fld_grp.

endselect.

*SORT ASCENDING .

clear mara.

loop.

at fld_grp .

wa_mara-matnr = mara-matnr.

wa_mara-mtart = mara-mtart.

wa_mara-meins = mara-meins.

wa_mara-matkl = mara-matkl.

wa_mara-ernam = mara-ernam.

wa_mara-mbrsh = mara-mbrsh.

wa_mara-bstme = mara-bstme.

append wa_mara to it_mara.

endat.

endloop.

loop at it_mara into wa_mara.

write:/ wa_mara-matnr, wa_mara-mtart, wa_mara-meins.

endloop.

Regards,

Nitin.

former_member184119
Active Contributor
0 Kudos
75

Nikita Can you justify your requirement please...

Regards

sas

Former Member
0 Kudos
75

Hello,

check the code .....its an SAP std code or

write extract and press F1 for help

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.

Thank u,'

santhosh

Former Member
0 Kudos
75

hi,

please check this link

your answer is here

thanks