2007 Dec 28 6:16 AM
Hi,
Pls solve this issue...
I'm getting output without using ALV ....
but if i use ALV im getting error...
pls correct the code...(alv part)
REPORT ZPAYABLES_AGING_TRAIL no standard page heading line-count 65(30) line-size 150.
type-pools : slis.
tables : payr, bsik, rfpdo.
data : begin of itab1 occurs 0, "payr table
znme1 like payr-znme1, "vendor name
end of itab1.
data : begin of itab2 occurs 0, "bsik table
lifnr like bsik-lifnr, "vendor number
bukrs like bsik-bukrs, "company code
ZUONR like bsik-zuonr, "assignment number
belnr like bsik-belnr, "account document number
blart like bsik-blart, "document type
budat like bsik-budat, "posting date in a document
bldat like bsik-bldat, "document date in document
bschl like bsik-bschl, "posting key
skfbt like bsik-skfbt, "cash discount
zfbdt like bsik-zfbdt, "base line date
dmbtr like bsik-dmbtr, "amount in local currency
wrbtr like bsik-wrbtr, "amount in document currency
waers like bsik-waers, "currency key
shkzg like bsik-shkzg, "debit/credit indicator
end of itab2.
data: begin of itab3 occurs 0, " bsik(rfpdo)
budat1 like bsik-budat, "open items at key date
end of itab3.
data: begin of itab4 occurs 0,
znme1 like itab1-znme1, "vendor name
lifnr like itab2-lifnr, "vendor number
bukrs like itab2-bukrs, "company code
budat1 like itab3-budat1, "open items at key date
ZUONR like itab2-zuonr, "assignment number
belnr like itab2-belnr, "account document number
blart like itab2-blart, "document type
budat like itab2-budat, "posting date in a document
bldat like itab2-bldat, "document date in document
bschl like itab2-bschl, "posting key
skfbt like itab2-skfbt, "cash discount
zfbdt like itab2-zfbdt, "base line date
dmbtr like itab2-dmbtr, "amount in local currency
wrbtr like itab2-wrbtr, "amount in document currency
waers like itab2-waers, "currency key
shkzg like itab2-shkzg, "debit/credit indicator
end of itab4.
DATA: it_fldcat TYPE slis_t_fieldcat_alv.
DATA: wa_fldcat TYPE slis_fieldcat_alv.
DATA : it_sort TYPE slis_t_sortinfo_alv.
DATA : wa_sort TYPE slis_sortinfo_alv.
DATA: it_events TYPE slis_t_event,
wa_events TYPE slis_alv_event.
select-options :
s_znme1 for payr-znme1,
s_lifnr for bsik-lifnr,
s_bukrs for bsik-bukrs.
select * from payr into corresponding fields of table itab4 for all entries in itab1
where znme1 = itab1-znme1 and znme1 in s_znme1.
*loop at itab1.
*write : / itab1-znme1.
*endloop.
select * from bsik into corresponding fields of table itab4 for all entries in itab2
where
lifnr = itab2-lifnr and
bukrs = itab2-bukrs and
ZUONR = itab2-zuonr and
belnr = itab2-belnr and
blart = itab2-blart and
budat = itab2-budat and
bldat = itab2-bldat and
bschl = itab2-bschl and
skfbt = itab2-skfbt and
zfbdt = itab2-zfbdt and
dmbtr = itab2-dmbtr and
wrbtr = itab2-wrbtr and
waers = itab2-waers and
shkzg = itab2-shkzg.
*lifnr in s_lifnr and bukrs in s_bukrs.
*loop at itab2.
write : / itab2-lifnr, itab2-bukrs, itab2-zuonr, itab2-belnr, itab2-blart, itab2-budat, itab2-bldat, itab2-bschl,itab2-skfbt,
itab2-zfbdt, itab2-dmbtr, itab2-wrbtr,itab2-waers,itab2-shkzg.
endloop.
*select * from bsik into corresponding fields of table itab4 for all entries in itab3
where bukrs = itab3-bukrs.
loop at itab4.
write : / itab4-znme1, itab4-lifnr, itab4-bukrs, itab4-zuonr, itab4-belnr, itab4-blart, itab4-budat,
itab4-bldat, itab4-bschl,itab4-skfbt,
itab4-zfbdt, itab4-dmbtr, itab4-wrbtr,itab4-waers,itab4-shkzg, itab4-bukrs.
endloop.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' "Displaying data in grid format
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fldcat "fieldcatalog
it_sort = it_sort[] "Sort
it_events = it_events
TABLES
t_outtab = itab4 "internal table to output
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DEFINE bld_fcat. "Macro to create manual field catalog
wa_fldcat-col_pos = &1.
wa_fldcat-fieldname = &2.
wa_fldcat-outputlen = &3.
wa_fldcat-seltext_s = &4.
wa_fldcat-ddictxt = &5.
append wa_fldcat to it_fldcat.
clear wa_fldcat.
END-OF-DEFINITION.
bld_fcat 1 'znme1' 35 'Name of the Vendor' 'L'.
bld_fcat 2 'lifnr' 10 'Vendor Number' 'L'.
bld_fcat 3 'bukrs' 4 'Comp Code' 'L'.
bld_fcat 4 'zuonr' 18 'Assignment Number' 'L'.
bld_fcat 5 'belnr' 10 'Account Document Number' 'L'.
bld_fcat 6 'blart' 2 'Document Type' 'L'.
bld_fcat 7 'budat' 8 'Posting date in the document' 'L'.
bld_fcat 8 'bldat' 8 'Document date in the document' 'L'.
bld_fcat 9 'dmbtr' 13 'Amt Local Curr' 'L'.
bld_fcat 10 'WRBTR' 13 'Amt Document Curr' 'L'.
bld_fcat 11 'WAERS' 5 'Curr Key' 'L'.
bld_fcat 12 'bschl' 2 'Posting Key' 'L'.
bld_fcat 13 'skfbt' 2 'Amount Eligible for Cash Discount in Document Currency' 'L'.
bld_fcat 14 'shkzg' 1 'Debit/Credit Indicator' 'L'.
bld_fcat 15 'zfbdt' 8 'Baseline Date for Due Date Calculation' 'L'.
bld_fcat 16 'bukrs' 4 'Open line item dates' 'L'.
2007 Dec 28 6:22 AM
looks like u dint generate a field catalog... use reuse_fieldcatalog_merge or generate field catalog like this
sales order number
afield-fieldname = 'VBELN'.
afield-seltext_s = 'Sales #'.
afield-ref_tabname = 'VBAK'.
APPEND afield TO xfield. CLEAR afield.
sales ITEM number
afield-fieldname = 'POSNR'.
afield-seltext_s = 'Item #'.
afield-ref_tabname = 'VBAP'.
APPEND afield TO xfield. CLEAR afield.
Material Number
afield-fieldname = 'MATNR'.
afield-seltext_s = 'Material #'.
afield-ref_tabname = 'VBAP'.
afield-outputlen = 10.
APPEND afield TO xfield. CLEAR afield.
*Vendor Number
afield-fieldname = 'LIFNR'.
afield-seltext_s = 'Vendor Num.'.
afield-ref_tabname = 'EKKO'.
APPEND afield TO xfield. CLEAR afield.
ship-to-party
afield-fieldname = 'SH'.
afield-seltext_s = 'Ship-to'.
afield-ref_tabname = 'VBPA'.
APPEND afield TO xfield. CLEAR afield.
sold-to-party
afield-fieldname = 'SP'.
afield-seltext_s = 'Sold-to'.
afield-ref_tabname = 'VBPA'.
APPEND afield TO xfield. CLEAR afield.
*PO number
afield-fieldname = 'BSTNK'.
afield-seltext_s = 'PO NUM'.
afield-ref_tabname = 'EKKO'.
APPEND afield TO xfield. CLEAR afield.
*PO status
afield-fieldname = 'PO_STAT'.
afield-seltext_s = 'Step'.
afield-ref_tabname = 'zbacklog_v2'.
APPEND afield TO xfield.
Xfield[] need to be passed into reuse_alv_grid
-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' "Displaying data in grid format
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fldcat[] <<<<<<<<<< [ ] missing
>award points if helpful
2007 Dec 28 6:22 AM
looks like u dint generate a field catalog... use reuse_fieldcatalog_merge or generate field catalog like this
sales order number
afield-fieldname = 'VBELN'.
afield-seltext_s = 'Sales #'.
afield-ref_tabname = 'VBAK'.
APPEND afield TO xfield. CLEAR afield.
sales ITEM number
afield-fieldname = 'POSNR'.
afield-seltext_s = 'Item #'.
afield-ref_tabname = 'VBAP'.
APPEND afield TO xfield. CLEAR afield.
Material Number
afield-fieldname = 'MATNR'.
afield-seltext_s = 'Material #'.
afield-ref_tabname = 'VBAP'.
afield-outputlen = 10.
APPEND afield TO xfield. CLEAR afield.
*Vendor Number
afield-fieldname = 'LIFNR'.
afield-seltext_s = 'Vendor Num.'.
afield-ref_tabname = 'EKKO'.
APPEND afield TO xfield. CLEAR afield.
ship-to-party
afield-fieldname = 'SH'.
afield-seltext_s = 'Ship-to'.
afield-ref_tabname = 'VBPA'.
APPEND afield TO xfield. CLEAR afield.
sold-to-party
afield-fieldname = 'SP'.
afield-seltext_s = 'Sold-to'.
afield-ref_tabname = 'VBPA'.
APPEND afield TO xfield. CLEAR afield.
*PO number
afield-fieldname = 'BSTNK'.
afield-seltext_s = 'PO NUM'.
afield-ref_tabname = 'EKKO'.
APPEND afield TO xfield. CLEAR afield.
*PO status
afield-fieldname = 'PO_STAT'.
afield-seltext_s = 'Step'.
afield-ref_tabname = 'zbacklog_v2'.
APPEND afield TO xfield.
Xfield[] need to be passed into reuse_alv_grid
-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' "Displaying data in grid format
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fldcat[] <<<<<<<<<< [ ] missing
>award points if helpful
2007 Dec 28 6:29 AM
Hi,
I suggest u not to use the macro there instead put some perform statement and call them even there i hav not populated the fieldcatlog into it i thnk it will solve ur issue..
Regards,
Sana.