on 09-10-2008 4:46 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi subramanyam
Check this code the data is getting displayed
TABLES:
afpo,
afko.
DATA:
BEGIN OF %g00 OCCURS 100,
aufnr type afpo-aufnr,
END OF %g00.
DATA:
aging TYPE p,
time TYPE sy-uzeit.
FIELD-GROUPS :
fg_afpo. " Field group afpo
insert AFPO-AUFNR Aging into fg_afpo.
select AFPO~AUFNR
AFKO~FTRMS
into (AFPO-AUFNR , AFKO-FTRMS )
from ( AFPO inner join AFKO
on AFKO~AUFNR = AFPO~AUFNR ).
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 eq 0.
ENDIF.
endif.
extract fg_afpo.
write:
/ afpo-aufnr,
afko-ftrms.
endselect.
Regards,
Sravanthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got solution. We have to maintain structure fields as a referrence in declaration of any variables which are using to pass ALV report. Means in my case i have to show new field in ALV report and had to do calculation on that field. So i can't declare Aging(10) type p.
we have to create new structure with aging field and have to take reference like below..
Aging type ZAGING-AGING.
ZAGING is the dictionary structure...
Thanks
Hi subramanyam,
Your way of declaration is also correct.
Just check with your Function Module..Whether it is returning correct value or not.
And just go to se38 (ABAP Editor : Initial Screen)
Environment -> Examples -> ABAP Examples
Go to The ABAP Programming Language -> Processing Large Dataset -> Extracts.
Here you will get some good examples on field groups.
Just double click on Extracts, This will take you to a very nice documentation of Field groups.
Hope this will help.
Regards,
Nitin,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Dont use two different insert statement just use one insert statement
insert AFPO-AUFNR Aging into %fg01.
In your code you have declared aging twice one in the structure and other after time sy-uzeit.
Regards,
Sravanthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You can add field in the field-groups using insert
Insert AFPO-AUFNR Aging into %fg01.
Regards,
Sravanthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Subramanyam,
In case of field groups, You can not add any field after execution of EXTRACT statement.
If you want to add any field, you'll have to add it in INSERT....INTO statement only before EXTRACT statement.
Regards,
Nitin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please any body give solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.