Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Field groups

data: begin of %g00 occurs 100,

AFPO-AUFNR like AFPO-AUFNR,

Aging type p,

end of %g00.

field-groups header.

field-groups %fg01.

data : time type SYUZEIT.

data : Aging type p.

insert AFPO-AUFNR into %fg01.

insert Aging into %fg01.

select AFPOAUFNR AFKOFTRMS

into (AFPO-AUFNR , AFKO-FTRMS ) from ( AFPO

inner join AFKO

on AFKOAUFNR = AFPOAUFNR ).

select single * from AFKO where AUFNR = AFPO-AUFNR.

if sy-subrc = 0.

CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'

EXPORTING

DATE1 = AFKO-FTRMS

TIME1 = time

DATE2 = sy-datum

TIME2 = time

IMPORTING

DATEDIFF = aging

EXCEPTIONS

INVALID_DATETIME = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

ENDIF.

endif.

extract %fg01.

endselect.

In this code i have added aging filed, but it's not fetching the Aging data....Please help me.

Tags:
replied

Hi

Refer this sample 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,

Sravanthi

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question