Sample ALV report required for FI module
Hello friends,
I am develoing ALV report for FI module for that i need some sample ALV report. If someone have than please send it to me.
Thanx & Regards,
Rahul Talele
HI,
SEE THE SAMPLE REPORT
Fringe Benefit Tax Report
Program Name :
Object ID :
Functional Analyst :
Programmer :
Start date :
Initial CTS :
Description : FRINGE Benefit Tax
Includes :
Function Modules :
Logical database :
Transaction Code :
External references :
Modification Log
Date | Modified by | CTS number | Comments
| | | Initial Version *
REPORT ZFI_FBT NO STANDARD PAGE HEADING LINE-SIZE 255.
TYPE-POOLS: SLIS.
TYPES : BEGIN OF
T_BSIS,
BUKRS TYPE BUKRS, " Company Code
HKONT TYPE HKONT, " General Ledger Account
GJAHR TYPE GJAHR,
BELNR TYPE BELNR_D, " Accounting Document Number
BUDAT TYPE BUDAT, " Posting Date in the Document
BLDAT TYPE BLDAT, " Document Date in Document
XBLNR TYPE XBLNR1, " Reference Document Number
BSCHL TYPE BSCHL, " Posting Key
DMBTR TYPE DMBTR, " Amount in Local Currency
AUFNR TYPE AUFNR_NEU, " Order Number
NONFBT TYPE DMBTR, " non fbt amount
SUBFBT TYPE DMBTR, " subject to fbt amount
ZFI_FBT TYPE ZFI_FBT, " Qualifying amount.
AMOUNT TYPE DMBTR,
FBTPAY TYPE DMBTR,
ZFI_PAY TYPE ZFI_PAY,
END OF T_BSIS,
T_IT_BSIS TYPE STANDARD TABLE OF T_BSIS.
TYPES : BEGIN OF T_FRINGE,
ZFI_HKONT TYPE HKONT,
ZFI_FBT TYPE ZFI_FBT,
ZFI_PAY TYPE ZFI_PAY,
END OF T_FRINGE,
T_IT_FRINGE TYPE STANDARD TABLE OF T_FRINGE.
DATA : GIT_FRINGE TYPE T_IT_FRINGE,
GWA_FRINGE TYPE T_FRINGE.
DATA : GIT_BSIS TYPE T_IT_BSIS,
GWA_BSIS TYPE T_BSIS.
DATA : G_HKONT TYPE HKONT,
G_BUDAT TYPE BUDAT,
G_AUFNR TYPE AUFNR_NEU.
FIELD-SYMBOLS : <BSIS> TYPE T_BSIS.
DATA : G_REPID TYPE SY-REPID,
GIT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
GWA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV.
GS_LAYOUT-ZEBRA = 'X'.
GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CONSTANTS : C_50(2) TYPE C VALUE '50'.
SELECTION SCREEN DEFINITIONS
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_BUKRS TYPE BUKRS DEFAULT 'H901' OBLIGATORY.
SELECT-OPTIONS : S_HKONT FOR G_HKONT,
S_BUDAT FOR G_BUDAT.
*PARAMETERS : P_AUFNR TYPE AUFNR_NEU DEFAULT '000000100001' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
EVENTS
INITIALIZATION.
INITIALIZATION.
G_REPID = SY-REPID.
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
PERFORM GET_ZTABLE. " get data from ZFII_FRINGE table
START-OF-SELECTION.
START-OF-SELECTION.
PERFORM GET_DATA. " get data from BSIS table
IF NOT GIT_BSIS IS INITIAL.
PERFORM GET_PERCENTAGE. " to get the percentages from table ZFII_FRINGE
PERFORM CHK4_INTERNAL. " checking for the posting key wheather th document is reversed
" and checking wheather internal order is FBT or non-FBT
ENDIF.
END-OF-SELECTION.
END-OF-SELECTION.
IF NOT GIT_BSIS IS INITIAL.
PERFORM DISPLAY. " display ALV GRID display
ENDIF.
*& Form get_data
text
--> p1 text
<-- p2 text
FORM GET_DATA .
SELECT
BUKRS
HKONT
GJAHR
BELNR
BUDAT
BLDAT
XBLNR
BSCHL
DMBTR
AUFNR FROM BSIS
INTO TABLE GIT_BSIS
WHERE BUKRS EQ P_BUKRS AND
HKONT IN S_HKONT AND
BUDAT IN S_BUDAT.
IF SY-SUBRC NE 0.
MESSAGE I000(ZFI) WITH 'No data exist'.
EXIT.
ENDIF.
ENDFORM. " get_data
*& Form display
FORM DISPLAY .
PERFORM BUILD_FIELD_CATALOUGE.
PERFORM GET_EVENTS.
PERFORM DETERMINE_SORT_SEQUENCE.
PERFORM SUB_COMMENTERY_BUILD.
PERFORM ALV_DISPLAY.
ENDFORM. " display
*& Form build_field_catalouge
FORM BUILD_FIELD_CATALOUGE.
DATA : L_POS TYPE I.
L_POS = 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'HKONT' " InTab Field Name
'GIT_BSIS' " InTab Name
'10' " Output Length
'GL Account' " Column Name Text
' ' " Datatype
'X' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
' '. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'BELNR' " InTab Field Name
'GIT_BSIS' " InTab Name
'10' " Output Length
'Document No.' " Column Name Text
' ' " Datatype
'X' " Key?
'1' " Row Position
'X' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
' '. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'BUDAT' " InTab Field Name
'GIT_BSIS' " InTab Name
'10' " Output Length
'Posting Date' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
' '. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'BLDAT' " InTab Field Name
'GIT_BSIS' " InTab Name
'10' " Output Length
'Docu. Date' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
' '. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'XBLNR' " InTab Field Name
'GIT_BSIS' " InTab Name
'16' " Output Length
'Ref. Doc. Number' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'DMBTR' " InTab Field Name
'GIT_BSIS' " InTab Name
'16' " Output Length
'Gross Amount' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'SUBFBT' " InTab Field Name
'GIT_BSIS' " InTab Name
'16' " Output Length
'FBT Amount' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'NONFBT' " InTab Field Name
'GIT_BSIS' " InTab Name
'16' " Output Length
'Non FBT Amount' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'ZFI_FBT' " InTab Field Name
'GIT_BSIS' " InTab Name
'12' " Output Length
'Percentage' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
' '. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'AMOUNT' " InTab Field Name
'GIT_BSIS' " InTab Name
'16' " Output Length
'Qualifying Amount' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
L_POS = L_POS + 1 .
PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[] " Field Catalog
L_POS " Column Position
'FBTPAY' " InTab Field Name
'GIT_BSIS' " InTab Name
'12' " Output Length
'FBT payable' " Column Name Text
' ' " Datatype
' ' " Key?
'1' " Row Position
' ' " Hotspot
' ' " Emphasize
' ' " key_sel
' ' " justification
'X'. " Sum field?
ENDFORM. " build_field_catalouge
*& Form init_field_catalog
text
FORM INIT_FIELD_CATALOG USING P_GIT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV
PV_POS LIKE GWA_FIELDCAT-COL_POS
PV_FIELDNAME LIKE GWA_FIELDCAT-FIELDNAME
PV_TABNAME LIKE GWA_FIELDCAT-TABNAME
PV_OUTPUT LIKE GWA_FIELDCAT-OUTPUTLEN
PV_SELTEXT LIKE GWA_FIELDCAT-SELTEXT_M
PV_DATATYPE LIKE GWA_FIELDCAT-DATATYPE
PV_KEY LIKE GWA_FIELDCAT-KEY
PV_ROW LIKE GWA_FIELDCAT-ROW_POS
PV_HOTSPOT LIKE GWA_FIELDCAT-HOTSPOT
PV_EMPHASIZE LIKE GWA_FIELDCAT-EMPHASIZE
PV_KEY_SEL LIKE GWA_FIELDCAT-KEY_SEL
PV_JUST LIKE GWA_FIELDCAT-JUST
PV_SUM LIKE GWA_FIELDCAT-DO_SUM.
DATA: LT_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
LT_FIELDCAT-OUTPUTLEN = PV_OUTPUT.
LT_FIELDCAT-COL_POS = PV_POS.
LT_FIELDCAT-FIELDNAME = PV_FIELDNAME.
LT_FIELDCAT-TABNAME = PV_TABNAME.
LT_FIELDCAT-SELTEXT_M = PV_SELTEXT.
LT_FIELDCAT-KEY = PV_KEY.
LT_FIELDCAT-ROW_POS = PV_ROW.
LT_FIELDCAT-HOTSPOT = PV_HOTSPOT.
LT_FIELDCAT-EMPHASIZE = PV_EMPHASIZE.
LT_FIELDCAT-KEY_SEL = PV_KEY_SEL.
LT_FIELDCAT-DO_SUM = PV_SUM.
LT_FIELDCAT-JUST = PV_JUST.
LT_FIELDCAT-DATATYPE = PV_DATATYPE.
APPEND LT_FIELDCAT TO P_GIT_FIELDCAT.
CLEAR LT_FIELDCAT.
ENDFORM. " init_field_catalog
*& Form alv_display
text
--> p1 text
<-- p2 text
FORM ALV_DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
i_grid_title = 'Fringe Benefit Tax'
I_GRID_SETTINGS =
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GIT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = GIT_BSIS
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.
ENDFORM. " alv_display
*& Form chk4_internal
text
--> p1 text
<-- p2 text
FORM CHK4_INTERNAL .
LOOP AT GIT_BSIS ASSIGNING <BSIS>.
IF <BSIS> IS ASSIGNED.
IF <BSIS>-BSCHL = C_50.
<BSIS>-DMBTR = <BSIS>-DMBTR * -1.
ENDIF.
IF NOT <bsis>-aufnr IS INITIAL.
IF <BSIS>-AUFNR = '000000100000'. " P_AUFNR.
<BSIS>-SUBFBT = <BSIS>-DMBTR.
<BSIS>-AMOUNT = ( <BSIS>-SUBFBT * <BSIS>-ZFI_FBT ) / 100.
ELSE.
IF <bsis>-aufnr = '000000100020'.
<BSIS>-NONFBT = <BSIS>-DMBTR.
ENDIF.
ENDIF.
<BSIS>-FBTPAY = ( <BSIS>-AMOUNT * <BSIS>-ZFI_PAY ) / 100.
ENDIF.
ENDLOOP.
UNASSIGN <BSIS>.
ENDFORM. " chk4_internal
*& Form get_ztable
text
--> p1 text
<-- p2 text
FORM GET_ZTABLE .
REFRESH : GIT_FRINGE.
SELECT HKONT
ZFI_FBT
ZFI_PAY
FROM ZFI_FBT_DETL
INTO TABLE GIT_FRINGE
FOR ALL ENTRIES IN s_hkont
WHERE HKONT IN S_HKONT.
CHECK SY-SUBRC EQ 0.
SORT GIT_FRINGE BY ZFI_HKONT.
ENDFORM. " get_ztable
*& Form get_percentage
text
--> p1 text
<-- p2 text
FORM GET_PERCENTAGE .
CLEAR : GWA_FRINGE.
LOOP AT GIT_BSIS ASSIGNING <BSIS>.
IF <BSIS> IS ASSIGNED.
READ TABLE GIT_FRINGE INTO GWA_FRINGE WITH KEY
ZFI_HKONT = <BSIS>-HKONT
BINARY SEARCH.
CHECK SY-SUBRC EQ 0.
<BSIS>-ZFI_FBT = GWA_FRINGE-ZFI_FBT.
<BSIS>-ZFI_PAY = GWA_FRINGE-ZFI_PAY.
ENDIF.
ENDLOOP.
UNASSIGN <BSIS>.
ENDFORM. " get_percentage
*& Form determine_sort_sequence
text
--> p1 text
<-- p2 text
FORM DETERMINE_SORT_SEQUENCE .
DATA : LS_SORT TYPE SLIS_SORTINFO_ALV.
LS_SORT-SPOS = 1. " Sort order
LS_SORT-FIELDNAME = 'HKONT'.
LS_SORT-TABNAME = 'GIT_BSIS'.
LS_SORT-UP = 'X'.
LS_SORT-SUBTOT = 'X'. " Sub total allowed
APPEND LS_SORT TO GT_SORT.
CLEAR LS_SORT.
ENDFORM. " determine_sort_sequence
*& Form get_events
text
--> p1 text
<-- p2 text
FORM GET_EVENTS .
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
GC_FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = GT_EVENTS.
READ TABLE GT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO GT_EVENTS.
ENDIF.
READ TABLE GT_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_USER_COMMAND TO LS_EVENT-FORM.
APPEND LS_EVENT TO GT_EVENTS.
ENDIF.
ENDFORM. " get_events
*& Form sub_commentery_build
text
--> p1 text
<-- p2 text
FORM SUB_COMMENTERY_BUILD .
DATA: LS_LINE TYPE SLIS_LISTHEADER.
DATA : L_LOW TYPE CHAR10,
L_HIGH TYPE CHAR10,
L_DATE TYPE CHAR25.
CONCATENATE S_BUDAT-LOW6(2) '.' S_BUDAT-LOW4(2) '.' S_BUDAT-LOW+0(4) INTO L_LOW.
CONCATENATE S_BUDAT-HIGH6(2) '.' S_BUDAT-HIGH4(2) '.' S_BUDAT-HIGH+0(4) INTO L_HIGH.
CONCATENATE L_LOW ' - ' L_HIGH INTO L_DATE.
***header
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Fringe Benefit Tax'.
APPEND LS_LINE TO GT_LIST_TOP_OF_PAGE.
***Selection
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Company Code'.
LS_LINE-INFO = P_BUKRS.
APPEND LS_LINE TO GT_LIST_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Posting Date'.
LS_LINE-INFO = L_DATE.
APPEND LS_LINE TO GT_LIST_TOP_OF_PAGE.
ENDFORM. " sub_commentery_build
FORM TOP_OF_PAGE *
When TOP-OF-PAGE will be fired , this event will be called and it
will use the contents of i_list_top_of_page for output in the header
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'ENJOYSAP_LOGO'
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM. "top_of_page
*& Form USER_COMMAND
Called from within the ALV processes. Currently, '&IC1' is used to
process the hotspot and display the document 'picked' by the user.
FORM USER_COMMAND USING PV_UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CLEAR : GWA_BSIS.
CASE PV_UCOMM.
WHEN '&IC1'.
READ TABLE GIT_BSIS INTO GWA_BSIS INDEX SELFIELD-TABINDEX.
CASE SELFIELD-SEL_TAB_FIELD.
WHEN 'GIT_BSIS-BELNR'.
IF NOT GWA_BSIS-BELNR IS INITIAL.
SET PARAMETER ID: 'BUK' FIELD GWA_BSIS-BUKRS,
'BLN' FIELD GWA_BSIS-BELNR,
'GJR' FIELD GWA_BSIS-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
WHEN OTHERS.
ENDCASE.
WHEN OTHERS.
ENDCASE.
CLEAR : GWA_BSIS.
ENDFORM. "user_command
*& Form SET_PF_STATUS
text
FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'.
ENDFORM. "SET_PF_STATUSENDFORM. "SET_PF_STATUS
AWARD POINTS IF USEFUL....
Similar Messages
-
ALV report requirement for peculiar SUBTOTAL
The following table is required for ALV report for inventory calculation.
The last column is the physical balance.
No......A.......... B....... C......D (D=A+B-C)
1......50........8........ 2.......56
2...... 20.........3.........1......22
3.......56.........10.......6...... 60
........50........21...... 9...... 60 (SUBTOTAL ROW)
Requirement for the subtotal row:
The subtotal for column A should be 50, It should take the first value 50 in the opening column in 1st row.
The subtotal for D column should be 60, It should be same as the value 60, in the LAST row that is 60
all other column subtotals are mathemetical totals as usual.
thanx
gaut
Edited by: gautam gautam on May 6, 2009 1:31 AMHi,
Try this
In side the loop
at new matnr.
capture the column1 (A)value into one variable
at end of matnr
capture the column 4 (D) value into one variable
and print it in subtotal row
Regards
Krishna -
Hi,
Please help me with some sample ALV reports for SAP HR.
Rgds
Preeti SaunHi,
See the sample report and design with HR data
report ZRGRIRNA no standard page heading
line-count 65
line-size 255
message-id mm.
GR IR Detail Report *
Description : The output has to be displayed
in the ALV Grid format with the Selection *
screen appearing on the output. In The Output *
Subtotals for Vendor, Plant, Period, Material,*
Valuation Class, Purchase Order,Cost Center, *
Cost Element and Receipt Date are displayed *
after sorting the data by same fields. *
Declaration for Tables
tables: t001, " Company Codes
t001w, " Plants/Branches
lfa1, " Vendor Master
ska1, " GL Account Master
mara, " Material Master
mbew, " Material Valuation
ekko, " PO Header Data
cska, " Cost Elements
csks, " Cost Centers
bsis, " GL Accounts: Open Items Data
bkpf. " Accounting Doc: Header Data
Type-pools
Type pools for ALV display
type-pools : slis.
Global variables
data: g_repid like sy-repid,
g_exit type c,
g_events type slis_t_event,
g_list_top_of_page type slis_t_listheader,
g_exit_caused_by_caller,
g_exit_caused_by_user type slis_exit_by_user,
g_top_of_page type slis_formname value 'TOP_OF_PAGE',
g_variant like disvariant,
g_save.
Declaration for Constants
constants : c_x type c value 'X', " Flag
c_c type c value 'C', " Flag
c_l type c value 'L', " Flag
c_a type c value 'A', " Line Type
c_h type c value 'H', " Dr/Cr
c_s type c value 'S', " Line Type
c_mkpf(4) type c value 'MKPF'. " Table
Declaration of Internal Tables
Internal Table for BSIS Table data
data: begin of i_bsis occurs 0,
bukrs like bsis-bukrs, " Company Code
hkont like bsis-hkont, " GR IR Account
gjahr like bsis-gjahr, " Fiscal Year
belnr like bsis-belnr, " Acc Document
buzei like bsis-buzei, " Item No
budat like bsis-budat, " Receipt Date(Posting)
monat like bsis-monat, " Period
end of i_bsis.
Internal Table for BSEG Table data
data: begin of i_bseg occurs 0,
bukrs like bsis-bukrs, " Company Code
belnr like bsis-belnr, " Acc Document
buzei like bsis-buzei, " Item No
gjahr like bsis-gjahr, " Fiscal Year
shkzg like bseg-shkzg, " Dr/Cr Indicator
lifnr like bseg-lifnr, " Vendor Code
matnr like bseg-matnr, " Material No
ebeln like bseg-ebeln, " Purchase Order
ebelp like bseg-ebelp, " PO Item
werks like bseg-werks, " Plant
menge like bseg-menge, " PO Quantity
meins like bseg-meins, " UOM
dmbtr like bseg-dmbtr, " Amount in Local Currency
wrbtr like bseg-wrbtr, " Amount in Trans.Currency
end of i_bseg.
Internal Table for BKPF Table data
data: begin of i_bkpf occurs 0,
bukrs like bkpf-bukrs, " Company Code
belnr like bkpf-belnr, " Acc Document
gjahr like bkpf-gjahr, " Fiscal Year
waers like bkpf-waers, " Trans. Currency
awkey like bkpf-awkey, " Object Key
awtyp like bkpf-awtyp, " Reference Procedure
end of i_bkpf.
Internal Table for MSEG Table data
data: begin of i_mseg occurs 0,
mblnr like mseg-mblnr, " Material Document
mjahr like mseg-mjahr, " Fiscal Year
bwart like mseg-bwart, " Movement Type
matnr like mseg-matnr, " Material No
menge like mseg-menge, " PO Quantity
meins like mseg-meins, " UOM
end of i_mseg.
Internal Table for MBEW Table data
data: begin of i_mbew occurs 0,
matnr like mbew-matnr, " Material No
werks like mbew-bwkey, " Plant
bklas like mbew-bklas, " Valuation Class
end of i_mbew.
Internal Table for EKPO Table data
data: begin of i_ekpo occurs 0,
ebeln like ekpo-ebeln, " Purchase Order
ebelp like ekpo-ebelp, " PO Item
matnr like ekpo-matnr, " Material No
txz01 like ekpo-txz01, " Material Text
end of i_ekpo.
Internal Table for EKKN Table data
data: begin of i_ekkn occurs 0,
ebeln like ekkn-ebeln, " Purchase Order
ebelp like ekkn-ebelp, " PO Item
kostl like ekkn-kostl, " Cost Center
sakto like ekkn-sakto, " Cost Element
end of i_ekkn.
Internal Table for LFA1 Table data
data: begin of i_lfa1 occurs 0,
lifnr like lfa1-lifnr, " Vendor
name1 like lfa1-name1, " Name
end of i_lfa1.
Declaration of Output Internal Table
data: begin of i_final occurs 0,
lifnr like lfa1-lifnr, " Vendor
werks like bseg-werks, " Plant
monat like bsis-monat, " Period
matnr like mara-matnr, " Material Number
bklas like mbew-bklas, " Val Class
ebeln like bseg-ebeln, " PO
kostl like ekkn-kostl, " Cost Center
sakto like ekkn-sakto, " Cost Element
budat like bsis-budat, " Rec. Date
name1 like lfa1-name1, " Vendor Name
belnr like bsis-belnr, " FI Document
bwart like mseg-bwart, " Movement Type
txz01 like ekpo-txz01, " Material Text
menge like bseg-menge, " Quantity
meins like bseg-meins, " UOM
dmbtr like bseg-dmbtr, " Local Amount
wrbtr like bseg-wrbtr, " Tran.Amount
waers like bkpf-waers, " Tran.Currency
status type c, " Material Status
end of i_final.
Internal table to hold field catgory data
data: i_fldcat type slis_t_fieldcat_alv. " Table - field catgory
Internal table to hold Sort/Subtotals criteria data
data: i_sort type slis_t_sortinfo_alv. " Table - sort/Subtotals
Structure
data: x_layout type slis_layout_alv, " Structure-layout
x_fldcat like line of i_fldcat, " Structure-field catagory
x_sort like line of i_sort. " Structure-Sort/Subtotals
Selection screen
selection-screen : begin of block b1 with frame title text-000.
parameters:
p_bukrs like t001-bukrs obligatory, " Company Code
p_grira like ska1-saknr default '0241101000' obligatory. " Account
select-options:
s_budat for bkpf-budat, " Posting Date
s_werks for t001w-werks, " Plant
s_lifnr for lfa1-lifnr, " Vendor
s_matnr for mara-matnr, " Material Number
s_kostl for csks-kostl, " Cost Center
s_kstar for cska-kstar, " Cost Element
s_ebeln for ekko-ebeln, " Purchase Order
s_monat for bsis-monat. " Period
selection-screen skip.
parameters:
p_incmt as checkbox default 'X',
p_incnm as checkbox default 'X'.
selection-screen end of block b1.
Initialization
initialization.
g_repid = sy-repid.
perform layout_init using x_layout.
perform eventtab_build using g_events[].
g_variant-report = g_repid.
g_save = 'A'.
At selection screen
at selection-screen.
Validation of Selection Screen Fields
perform validate_screen.
Start of selection
start-of-selection.
Read Data from Database Tables
perform read_data.
End of selection
end-of-selection.
Build layout report layout.
perform populate_layout_stucture.
Perform build_field_catalog and Sort Table
perform build_field_catalog.
perform build_sort_totals.
List Header for Top-Of-Page
perform comment_build using g_list_top_of_page[].
Call list viewer function module
perform call_list_viewer .
****************Form - Routines**************************************
Form : layout_init
Description : Form to Build layout for list display
form layout_init using rs_layout type slis_layout_alv.
rs_layout-detail_popup = c_x.
endform.
Form : Eventtab_build
Description : Registration of events to happen during list display
form eventtab_build using rt_events type slis_t_event.
Registration of events to happen during list display
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = rt_events.
read table rt_events with key name = slis_ev_top_of_page
into ls_event.
if sy-subrc = 0.
move g_top_of_page to ls_event-form.
append ls_event to rt_events.
endif.
endform. "eventtab_build
Form : top_of_page
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
I_LOGO = 'ENJOYSAP_LOGO'
it_list_commentary = g_list_top_of_page.
endform.
Form validate_screen
Validation of Selection Screen fields
form validate_screen.
Validation of Company Code
clear t001.
if not p_bukrs is initial.
select single bukrs
into t001-bukrs
from t001
where bukrs eq p_bukrs.
if sy-subrc <> 0.
message e899 with 'Enter Valid Company Code'(012).
endif.
endif.
Validation of GL Account (GR/IR)
clear ska1.
if not p_grira is initial.
select saknr
into ska1-saknr
from ska1
up to 1 rows
where saknr eq p_grira.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid GR/IR Account'(013).
endif.
endif.
Validation of Vendor Code
clear lfa1.
if not s_lifnr[] is initial.
select single lifnr
into lfa1-lifnr
from lfa1
where lifnr in s_lifnr.
if sy-subrc <> 0.
message e899 with 'Enter Valid Vendor'(001).
endif.
endif.
Validation of Plant Code
clear t001w.
if not s_werks[] is initial.
select single werks
into t001w-werks
from t001w
where werks in s_werks.
if sy-subrc <> 0.
message e899 with 'Enter Valid Plant'(014).
endif.
endif.
Validation of Material Code
clear mara.
if not s_matnr[] is initial.
select single matnr
into mara-matnr
from mara
where matnr in s_matnr.
if sy-subrc <> 0.
message e899 with 'Enter Valid Material'(015).
endif.
endif.
Validation of Purchase Order
clear ekko.
if not s_ebeln[] is initial.
select single ebeln
into ekko-ebeln
from ekko
where ebeln in s_ebeln.
if sy-subrc <> 0.
message e899 with 'Enter Valid Purchase Order'(016).
endif.
endif.
Validation of Cost Center
clear csks.
if not s_kostl[] is initial.
select kostl
into csks-kostl
from csks
up to 1 rows
where kostl in s_kostl.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid Cost Center'(017).
endif.
endif.
Validation of Cost Element
clear cska.
if not s_kstar[] is initial.
select kstar
into cska-kstar
from cska
up to 1 rows
where kstar in s_kstar.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid Cost Element'(018).
endif.
endif.
endform. "validate_screen
*& Form read_data
Read the Data from the database Tables
form read_data.
Get the Accounting Documents for the GR/IR Account Entered on
Selection Screen
clear i_bsis.
refresh i_bsis.
select bukrs " Company Code
hkont " GR IR Account
gjahr " Fiscal Year
belnr " Acc Document
buzei " Item No
budat " Receipt Date(Posting)
monat " Period
into table i_bsis
from bsis
where bukrs = p_bukrs
and hkont = p_grira
and budat in s_budat
and monat in s_monat .
if sy-subrc <> 0.
message i899 with 'No data found'(043).
g_exit = c_x.
stop.
endif.
sort i_bsis by bukrs hkont gjahr belnr buzei.
Get the Vendor,PO,Material,Qty details from BSEG Table
if not i_bsis[] is initial.
clear i_bseg.
refresh i_bseg.
select bukrs " Company Code
belnr " Acc Document
buzei " Item No
gjahr " Fiscal Year
shkzg " Dr/Cr Indicator
lifnr " Vendor Code
matnr " Material No
ebeln " Purchase Order
ebelp " PO Item
werks " Plant
menge " PO Quantity
meins " UOM
dmbtr " Amount in Local Currency
wrbtr " Amount in Trans.Currency
into table i_bseg
from bseg
for all entries in i_bsis
where bukrs = p_bukrs
and belnr = i_bsis-belnr
and gjahr = i_bsis-gjahr
and buzei = i_bsis-buzei
and lifnr in s_lifnr
and werks in s_werks
and matnr in s_matnr
and ebeln in s_ebeln.
sort i_bseg by bukrs belnr buzei gjahr.
Select the Trans.Currency from BKPF Table
clear i_bkpf.
refresh i_bkpf.
select bukrs " Company Code
belnr " Acc Document
gjahr " Fiscal Year
waers " Trans. Currency
awkey " Object Key
awtyp " Reference Procedure
into table i_bkpf
from bkpf
for all entries in i_bsis
where bukrs = p_bukrs
and belnr = i_bsis-belnr
and gjahr = i_bsis-gjahr.
endif.
sort i_bkpf by bukrs belnr gjahr.
Get the Quantity and UOM of Material from MSEG Table
if not i_bkpf[] is initial.
clear i_mseg.
refresh i_mseg.
select mblnr " Material Document
mjahr " Fiscal Year
bwart " Movement Type
matnr " Material No
menge " PO Quantity
meins " UOM
into table i_mseg
from mseg
for all entries in i_bkpf
where mblnr = i_bkpf-awkey(10).
endif.
sort i_mseg by mblnr mjahr.
Get the Material And Description from EKPO Table
if not i_bseg[] is initial.
clear i_ekpo.
refresh i_ekpo.
select ebeln " Purchase Order
ebelp " PO Item
matnr " Material No
txz01 " Material Text
into table i_ekpo
from ekpo
for all entries in i_bseg
where ebeln = i_bseg-ebeln
and ebelp = i_bseg-ebelp.
sort i_ekpo by ebeln ebelp.
Get the Valuation Class from MBEW Table
clear i_mbew.
refresh i_mbew.
select matnr " Material No
bwkey " Plant
bklas " Valuation Class
into table i_mbew
from mbew
for all entries in i_bseg
where matnr = i_bseg-matnr
and bwkey = i_bseg-werks.
sort i_mbew by matnr werks.
Get the Cost Center and Cost Element of the PO from EKKN Table
clear i_ekkn.
refresh i_ekkn.
select ebeln " Purchase Order
ebelp " PO Item
kostl " Cost Center
sakto " Cost Element
into table i_ekkn
from ekkn
for all entries in i_bseg
where ebeln = i_bseg-ebeln
and ebelp = i_bseg-ebelp
and kostl in s_kostl
and sakto in s_kstar.
sort i_ekkn by ebeln ebelp.
Get the Vendor Name
clear i_lfa1.
refresh i_lfa1.
select lifnr " Vendor
name1 " Name
into table i_lfa1
from lfa1
for all entries in i_bseg
where lifnr = i_bseg-lifnr.
endif.
sort i_lfa1 by lifnr.
Move the data to Final Output Internal Table
loop at i_bsis.
i_final-belnr = i_bsis-belnr. " FI Document
i_final-monat = i_bsis-monat. " Period
i_final-budat = i_bsis-budat. " Rec. Date
Read the Transaction Currency from BKPF Internal Table
read table i_bkpf with key bukrs = i_bsis-bukrs
belnr = i_bsis-belnr
gjahr = i_bsis-gjahr
binary search.
if sy-subrc = 0.
i_final-waers = i_bkpf-waers. " Tran.Currency
Read the Movement Type for all Material Related
Documents from MSEG Internal Table
if i_bkpf-awtyp = c_mkpf.
read table i_mseg with key mblnr = i_bkpf-awkey(10)
mjahr = i_bkpf-awkey+10(4).
if sy-subrc = 0.
i_final-bwart = i_mseg-bwart. " Movement Type
endif.
endif.
endif.
Read Vendor, Plant, PO Document, Local And Trans.Amounts
from BSEG Internal Table
read table i_bseg with key bukrs = i_bsis-bukrs
belnr = i_bsis-belnr
gjahr = i_bsis-gjahr
buzei = i_bsis-buzei
binary search.
if sy-subrc = 0.
i_final-lifnr = i_bseg-lifnr. " Vendor
i_final-werks = i_bseg-werks. " Plant
i_final-ebeln = i_bseg-ebeln. " PO
i_final-dmbtr = i_bseg-dmbtr. " Local Amount
i_final-wrbtr = i_bseg-wrbtr. " Tran.Amount
i_final-menge = i_bseg-menge. " Quantity
i_final-meins = i_bseg-meins. " UOM
For Credit Indicator(SHKZG = H) amounts should be (-)ve
if i_bseg-shkzg = c_h.
i_final-dmbtr = i_final-dmbtr * -1.
i_final-wrbtr = i_final-wrbtr * -1.
i_final-menge = i_final-menge * -1.
endif.
Read the Material and its Description from EKPO Internal Table
read table i_ekpo with key ebeln = i_bseg-ebeln
ebelp = i_bseg-ebelp
matnr = i_bseg-matnr
binary search.
if sy-subrc = 0.
i_final-matnr = i_ekpo-matnr. " Material Number
i_final-txz01 = i_ekpo-txz01. " Material Text
Populate the Material Status depending on the Input Checkbox
On Selection Screen
if not i_ekpo-matnr is initial.
i_final-status = c_x.
endif.
endif.
Read the PO related Cost Element and Cost Centers
from EKKN Internal Table
read table i_ekkn with key ebeln = i_bseg-ebeln
ebelp = i_bseg-ebelp
binary search.
if sy-subrc = 0.
i_final-kostl = i_ekkn-kostl. " Cost Center
i_final-sakto = i_ekkn-sakto. " Cost Element
endif.
Read the Valuation Class from MBEW Internal Table
read table i_mbew with key matnr = i_bseg-matnr
werks = i_bseg-werks
binary search.
if sy-subrc = 0.
i_final-bklas = i_mbew-bklas. " Val Class
endif.
Read the Vendor Name from LFA1 Internal Table
read table i_lfa1 with key lifnr = i_bseg-lifnr
binary search.
if sy-subrc = 0.
i_final-name1 = i_lfa1-name1. " Vendor Name
endif.
endif.
append i_final.
clear i_final.
endloop.
sort i_final by lifnr werks monat matnr.
Depending on the check Box Selected display the data
if p_incmt = c_x and p_incnm ne c_x.
delete i_final where matnr eq space.
elseif p_incnm = c_x and p_incmt ne c_x.
delete i_final where matnr ne space.
endif.
endform. "Read Data
Form : populate_layout_stucture
Description : Populating the layout structure
form populate_layout_stucture.
clear x_layout .
Layout properties
x_layout-zebra = c_x.
x_layout-detail_popup = c_x.
x_layout-detail_initial_lines = c_x.
x_layout-colwidth_optimize = c_x.
endform. " populate_layout_stucture
Form : build_field_catalog
Description : Building the field catalog data
form build_field_catalog.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = g_repid
i_internal_tabname = 'I_FINAL'
i_inclname = g_repid
changing
ct_fieldcat = i_fldcat
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Getting the Header text for the coloums
loop at i_fldcat into x_fldcat where fieldname = 'LIFNR' or
fieldname = 'NAME1' or
fieldname = 'WERKS' or
fieldname = 'MONAT' or
fieldname = 'MATNR' or
fieldname = 'BKLAS' or
fieldname = 'EBELN' or
fieldname = 'KOSTL' or
fieldname = 'SAKTO' or
fieldname = 'BUDAT' or
fieldname = 'BELNR' or
fieldname = 'BWART' or
fieldname = 'TXZ01' or
fieldname = 'MENGE' or
fieldname = 'MEINS' or
fieldname = 'DMBTR' or
fieldname = 'WRBTR' or
fieldname = 'WAERS' or
fieldname = 'STATUS'.
if x_fldcat-fieldname = 'LIFNR'.
x_fldcat-seltext_l = 'Vendor'(003).
x_fldcat-seltext_m = 'Vendor'(003).
x_fldcat-seltext_s = 'Vendor'(003).
x_fldcat-reptext_ddic = 'Vendor'(003).
x_fldcat-inttype = c_c.
endif.
if x_fldcat-fieldname = 'NAME1'.
x_fldcat-seltext_l = 'Vendor Name'(002).
x_fldcat-seltext_m = 'Vendor Name'(002).
x_fldcat-seltext_s = 'Vendor Name'(002).
x_fldcat-reptext_ddic = 'Vendor Name'(002).
x_fldcat-inttype = c_c.
endif.
if x_fldcat-fieldname = 'WERKS'.
x_fldcat-seltext_l = 'Plant'(010).
x_fldcat-seltext_m = 'Plant'(010).
x_fldcat-seltext_s = 'Plant'(010).
x_fldcat-reptext_ddic = 'Plant'(010).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'MONAT'.
x_fldcat-seltext_l = 'Period'(011).
x_fldcat-seltext_m = 'Period'(011).
x_fldcat-seltext_s = 'Period'(011).
x_fldcat-reptext_ddic = 'Period'(011).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'MATNR'.
x_fldcat-seltext_l = 'Material'(004).
x_fldcat-seltext_m = 'Material'(004).
x_fldcat-seltext_s = 'Material'(004).
x_fldcat-reptext_ddic = 'Material'(004).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'BKLAS'.
x_fldcat-seltext_l = 'Valuation Class'(009).
x_fldcat-seltext_m = 'Valuation Class'(009).
x_fldcat-seltext_s = 'Valuation Class'(009).
x_fldcat-reptext_ddic = 'Valuation Class'(009).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'EBELN'.
x_fldcat-seltext_l = 'Purchase Order'(005).
x_fldcat-seltext_m = 'Purchase Order'(005).
x_fldcat-seltext_s = 'Purchase Order'(005).
x_fldcat-reptext_ddic = 'Purchase Order'(005).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'KOSTL'.
x_fldcat-seltext_l = 'Cost Center'(006).
x_fldcat-seltext_m = 'Cost Center'(006).
x_fldcat-seltext_s = 'Cost Center'(006).
x_fldcat-reptext_ddic = 'Cost Center'(006).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'SAKTO'.
x_fldcat-seltext_l = 'Cost Element'(007).
x_fldcat-seltext_m = 'Cost Element'(007).
x_fldcat-seltext_s = 'Cost Element'(007).
x_fldcat-reptext_ddic = 'Cost Element'(007).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'BUDAT'.
x_fldcat-seltext_l = 'Receipt Date'(008).
x_fldcat-seltext_m = 'Receipt Date'(008).
x_fldcat-seltext_s = 'Receipt Date'(008).
x_fldcat-reptext_ddic = 'Receipt Date'(008).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'BELNR'.
x_fldcat-seltext_l = 'Acc.Document'(100).
x_fldcat-seltext_m = 'Acc.Document'(100).
x_fldcat-seltext_s = 'Acc.Document'(100).
x_fldcat-reptext_ddic = 'Acc.Document'(100).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'BWART'.
x_fldcat-seltext_l = 'Movement Type'(101).
x_fldcat-seltext_m = 'Movement Type'(101).
x_fldcat-seltext_s = 'Movement Type'(101).
x_fldcat-reptext_ddic = 'Movement Type'(101).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'TXZ01'.
x_fldcat-seltext_l = 'Material Text'(102).
x_fldcat-seltext_m = 'Material Text'(102).
x_fldcat-seltext_s = 'Material Text'(102).
x_fldcat-reptext_ddic = 'Material Text'(102).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'MENGE'.
x_fldcat-seltext_l = 'Quantity'(103).
x_fldcat-seltext_m = 'Quantity'(103).
x_fldcat-seltext_s = 'Quantity'(103).
x_fldcat-reptext_ddic = 'Quantity'(103).
x_fldcat-ddictxt = c_l.
x_fldcat-do_sum = c_x.
endif.
if x_fldcat-fieldname = 'MEINS'.
x_fldcat-seltext_l = 'UOM'(104).
x_fldcat-seltext_m = 'UOM'(104).
x_fldcat-seltext_s = 'UOM'(104).
x_fldcat-reptext_ddic = 'UOM'(104).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'DMBTR'.
x_fldcat-seltext_l = 'Amount in Local Curr'(105).
x_fldcat-seltext_m = 'Amount in Local Curr'(105).
x_fldcat-seltext_s = 'Amount in Local Curr'(105).
x_fldcat-reptext_ddic = 'Amount in Local Curr'(105).
x_fldcat-ddictxt = c_l.
x_fldcat-do_sum = c_x.
endif.
if x_fldcat-fieldname = 'WRBTR'.
x_fldcat-seltext_l = 'Amount in Trans.Curr'(106).
x_fldcat-seltext_m = 'Amount in Trans.Curr'(106).
x_fldcat-seltext_s = 'Amount in Trans.Curr'(106).
x_fldcat-reptext_ddic = 'Amount in Trans.Curr'(106).
x_fldcat-ddictxt = c_l.
x_fldcat-do_sum = c_x.
endif.
if x_fldcat-fieldname = 'WAERS'.
x_fldcat-seltext_l = 'Trans.Currency'(107).
x_fldcat-seltext_m = 'Trans.Currency'(107).
x_fldcat-seltext_s = 'Trans.Currency'(107).
x_fldcat-reptext_ddic = 'Trans.Currency'(107).
x_fldcat-ddictxt = c_l.
endif.
if x_fldcat-fieldname = 'STATUS'.
x_fldcat-seltext_l = 'Material Status'(019).
x_fldcat-seltext_m = 'Material Status'(019).
x_fldcat-seltext_s = 'Material Status'(019).
x_fldcat-reptext_ddic = 'Material Status'(019).
x_fldcat-ddictxt = c_l.
endif.
modify i_fldcat from x_fldcat index sy-tabix.
endloop.
endform. " build_field_catalog
Form : build_sort_totals
Description : Building the Criteria for Sort/Subtotals
form build_sort_totals.
x_sort-fieldname = 'LIFNR'.
x_sort-tabname = 'I_FINAL'.
x_sort-spos = 1.
x_sort-up = c_x.
x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'WERKS'.
x_sort-tabname = 'I_FINAL'.
x_sort-spos = 2.
x_sort-up = c_x.
x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'MONAT'.
x_sort-tabname = 'I_FINAL'.
x_sort-spos = 3.
x_sort-up = c_x.
x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'MATNR'.
x_sort-tabname = 'I_FINAL'.
x_sort-spos = 4.
x_sort-up = c_x.
x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'BKLAS'.
x_sort-tabname = 'I_FINAL'.
x_sort-spos = 5.
x_sort-up = c_x.
x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'EBELN'.
x_sort-tabname = 'I_FINAL'.
x_sort-spos = 6.
x_sort-up = c_x.
x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'KOSTL'.
x_sort-tabname = 'I_FINAL'.
x_sort-spos = 7.
x_sort-up = c_x.
x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'SAKTO'.
x_sort-tabname = 'I_FINAL'.
x_sort-spos = 8.
x_sort-up = c_x.
x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
x_sort-fieldname = 'BUDAT'.
x_sort-tabname = 'I_FINAL'.
x_sort-spos = 9.
x_sort-up = c_x.
x_sort-subtot = c_x.
append x_sort to i_sort.
clear x_sort.
endform. " build_sort_totals
Form : comment_build
Description : This form is used to display the Report Header(ALV)
form comment_build using lt_top_of_page type
slis_t_listheader.
data: l_line type slis_listheader,
l_heading1 like rs38m-repti,
l_date(10), l_time(8).
clear l_line.
l_heading1 = 'GR/IR DETAIL REPORT'(021).
g_repid = sy-repid.
write sy-uzeit to l_time.
write sy-datum to l_date.
l_line-typ = c_h.
move l_heading1 to l_line-info.
append l_line to lt_top_of_page.
clear l_line.
l_line-typ = c_s.
concatenate 'System:'(023) sy-sysid
'Date:'(024) l_date
' Time:'(025)
l_time into l_line-info.
append l_line to lt_top_of_page.
concatenate 'Report:'(026) g_repid
' User:'(027) sy-uname into
l_line-info.
append l_line to lt_top_of_page.
l_line-typ = c_a.
move 'SELECTION CRITERIA:'(028) to l_line-info.
append l_line to lt_top_of_page.
concatenate ' Company Code : '(029)
p_bukrs into l_line-info.
append l_line to lt_top_of_page.
concatenate ' GR/IR Account: '(030)
p_grira into l_line-info.
append l_line to lt_top_of_page.
concatenate ' Posting Date : '(032) s_budat-low
' To: '(031) s_budat-high into l_line-info.
append l_line to lt_top_of_page.
concatenate ' Plant : '(033) s_werks-low
' To: '(031) s_werks-high into l_line-info.
append l_line to lt_top_of_page.
concatenate ' Vendor: '(034) s_lifnr-low
' To: '(031) s_lifnr-high into l_line-info.
append l_line to lt_top_of_page.
concatenate ' Material: '(035) s_matnr-low
' To: '(031) s_matnr-high into l_line-info.
append l_line to lt_top_of_page.
concatenate ' Cost Center : '(036) s_kostl-low
' To: '(031) s_kostl-high into l_line-info.
append l_line to lt_top_of_page.
concatenate ' Cost Element: '(037) s_kstar-low
' To: '(031) s_kstar-high into l_line-info.
append l_line to lt_top_of_page.
concatenate ' Purchase Order: '(038) s_ebeln-low
' To: '(031) s_ebeln-high into l_line-info.
append l_line to lt_top_of_page.
concatenate ' Period : '(039) s_monat-low
' To: '(031) s_monat-high into l_line-info.
append l_line to lt_top_of_page.
concatenate ' Include Material Items: '(040)
p_incmt into l_line-info.
append l_line to lt_top_of_page.
concatenate ' Include Non-Material Items: '(041)
p_incnm into l_line-info.
append l_line to lt_top_of_page.
endform.
Form : call_list_viewer
Description : This form is used to display the grid through ALV
form call_list_viewer.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = g_repid
is_layout = x_layout
it_fieldcat = i_fldcat[]
i_default = c_x
it_sort = i_sort[]
i_save = g_save
is_variant = g_variant
it_events = g_events[]
importing
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = g_exit_caused_by_user
tables
t_outtab = i_final
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
write: / 'Problem in calling the ALV report'(042).
endif.
endform. " call_list_viewer
reward if useful
regards,
Anji -
Alv report scenarios for PP?
anyone let me know the ALV report scenarios for Production planning?
Also, let me know the exits in PP? thanku.hi,
these are the exits related to production order.
Exit name
CCOWB001
COIB0001
COZF0001
COZF0002
PPCO0001
PPCO0002
PPCO0003
PPCO0004
PPCO0005
PPCO0006
PPCO0007
PPCO0008
PPCO0009
PPCO0010
PPCO0012
PPCO0013
PPCO0015
PPCO0016
PPCO0017
PPCO0018
PPCO0019
PPCO0021
PPCO0022
PPCO0023
STATTEXT
just go through the TCODE COOIS for the alv report scenarios
reward if helpful.
Regards.
Praveen -
Regarding report painter for PP module
HI every one,
Is it there any report painter for PP module.
Report painter is available for FI module. Like that is it there any thing for PP module.
Other than SQL Query. Plz suggest me because function people want to do that .
full points will be awarded for correct answer
Thanks and Regards,
P.Naganjana Reddyplz urgent help me in thhis case.
-
Combined debt reports required for 'associated' customers showing amountof
Combined debt reports required for 'associated' customers showing amountof debt and aged by month
Mugunthan
Yes we have applied 11i.AZ.H.2. I am getting several errors still that we trying to resolve
One of them is
===========>>>
Uploading snapshot to central instance failed, with 3 different messages
Error: An invalid status '-1' was passed to fnd_concurrent.set_completion_status. The valid statuses are: 'NORMAL', 'WARNING', 'ERROR'FND at oracle.apps.az.r12.util.XmlTransmorpher.<init>(XmlTransmorpher.java:301)
at oracle.apps.az.r12.extractor.cpserver.APIExtractor.insertGenericSelectionSet(APIExtractor.java:231)
please assist.
regards
girish -
Standard And Customized BEx Reports & workbooks for the Modules FI,SD,MM
Hi..All
Can any one explain about Standard and customized BEx Reports and workbooks which were frequently used in implementation projects for the modules SD,MM and FI?
Thanks & Regards
JonnHi John,
Find below some of FI(AP) queries....
1.Accounts Receivable: Payment History -0FIAR_C05_Q0001
2.Accounts Receivable: Overdue Analysis -0FIAR_C03_Q0005
3.Accounts Receivable: Days Agreed / Days Taken -0FIAR_C03_Q0001
you can find some queries in help.sap.com
I don;t remember the queries used for other modules...you can refer the below link and identify the queries most usefull for your requirements...
help.sap.com/bw
thanks,
vachan -
Hi,
Is report painter can be use by MM,PP,SD module ?
in ECC6, we can use report painter for module FI, how about module MM,SD and PP ?
if it can use for those module too, how is the step?Hello Callia Raissa,
Yes report writer can be used in logistics also. One of the way which I am aware of is described below.
Flexible analyses allow you to can tailor the way in which key figures are combined and aggregated. This means that it is possible to both provide administrators with detailed information and management with aggregated information.
Flexible analyses enable easy access to the Report Writer, a user-friendly tool with which you can create reports for various analyses. The Report Writer is integrated in other SAP applications, such as Extended General Ledger and Cost Center Accounting.
Evaluation structures form the interface to the Report Writer. Evaluation structures consist of characteristics and key figures and are easy to construct.An evaluation structure with the same name exists for each information structure in the standard system.Even the self-defined information structures created in Customizing can be evaluated via the flexible analyses.
Evaluations:You can create an evaluation on the basis of the evaluation structure.
To define an evaluation, all you need to do is select the characteristics and key figures you require (pick-up technique).One of the especially useful features here is that you have the option of tailoring the layout of your report to suit your particular requirements. You can also define extra key figures for the reports, which are derived from existing key figures by means of calculation formulas. You can thereby multiply the key figures or divide one key figure by another.
============================================================
In addition to the above you can also edit a report in logistics module with the help of a report writer. below mentioned is the process for it.
It is now possible to edit your report data using the Report Writer. You can also change the layout of the report. The most important functions of the layout design are summarized below.
Summation levels:In the report screen, you can use the menu sequence View ->Summation level to specify the number of summation used to calculate total values. All totals that do not lie within the specified interval will be hidden. A summation level corresponds to a hierarchical level (for example, material level). Summation level 1 is the lowest hierarchical level. Summation level 2 is the next level up, and so on. The individual values are on the summation level 0.
The summation levels can be specified both universally (for the entire report) or locally (for specific blocks of rows). In this case, the local settings overwrite global values.
Report views:If a report is displayed on the screen, the Report Writer will then set page breaks so that exactly one page fits into the current window. This view will be defined as the standard view. As the Report Writer always processes exactly one page, you can only use the page keys and page icons to page up and down; the scroll bars cannot be used.
The page view can be determined via Settings-> Page view. The page breaks in the page view correspond to those defined in the report layout.
Hide and show rows:The function Edit->Hide rows exclude certain preselected areas of your report from the display. You can undo this command with Edit ® Show rows.
Expanding and collapsing report rows:View-> Hierarchy->Collapse allows you to hide the report rows of the sub-trees that are located underneath. View->Hierarchy ->Expand allows you to undo this command level by level.
If you want to display all the report rows that were hidden by collapsing the hierarchy or restricting the summation levels, select, View->Hierarchy-> Expand all.
View->Collapse all allows you to reduced every row block to the highest summation level.
Texts and Annotations:You can create an annotation for your report.
Select: Extras->Annotation.
You branch into the text editor of the Report Writer.
Via the menu sequence Settings->Texts, you can create and format a title page, the last page, as well as headers and footers using word processing functions.
For example, you can store variables in the header for the author of the report, the date of the selection or the name of the person who last changed the report.
Layout parameters:Using the menu sequence Settings->Layout you can specify the page format, display form, rows and columns of the report according to your needs and you can determine the settings for the graphics function. You can make these layout settings with Report->Save settings.
Hope I had been able to help you to some extent. please assign points as reward.
Rgds
Manish -
To find the custom reports existing for a module
Hi All,
We have a requirement wherein we want to find the custom reports existing for a particular module.
I would like to confirm will the following query help :
SELECT doc_id, doc_name, doc_developer_key, doc_folder_id
FROM eul5_us.eul5_documents doc
WHERE doc_name LIKE <Workbook Name>
Does the table 'eul5_documents' contain data for standard reports also. If it is so what specific check I need to apply to fetch only the Custom reports.
Regards,
ShrutiHi shruti,
find the custom reports existing for a particular module.The query you wrote works fine.But for particular module as you said,you add the fnd_responsibility to the query.
So you will ge the details of the custom reports.
There is no such thing of specific check to find custom reports.
Hope this helps.Any more issues do let us know.
Best Wishes,
Kranthi. -
Report Requirment for YTD and individual fisc periods
Hi Team,
I have a requirement in the report that should have the below structure
Fiscal Year Actual Actual Actual Actual Actual Actual
YTD 2008 2009 2010 2011 2012
Char1 Char1 FiscalPer APR 2010 MAY2010 .... MAR2011
Fiscal Year and Fisc period are in column and Char1 and Char2 are in Rows of the report.
For a particular year alone, I need the actual amount splitted on fiscal year period and rest of the past and furture years the actual amount should be aggregated for the year.
Please let me know if have come across this scenario.
Regards,
Ramesh
Edited by: ramesh kumar on Aug 10, 2010 5:52 AMHi Ramesh,
I am assuming your scenario as followes -
If User enters year(user entry variable) - 'Y1', You need to display key figs by - 'Y1Period 1'....... 'Y1Period 12'. For rest of the years(future and past from Y1), data should be aggregated and displayed per year.
The solutions would be -
Create Restricted Key Figs, for Y1Period1 - restrict it to user entry variable for year(Y1) and then to posting period hard coded to 1. Similalry create rest of the key figs for each period by changing the hard coded period value for 1 through 12.
Create restricted key fig for past years from Y1 - restrict it to user entry variable for year(Y1) and then add offset of '-1'. Simmilarly create rest of key figs for other previous years by increaing offset -2, -3 so on.
Create restricted key fig for future years from Y1 - restrict it to user entry variable for year(Y1) and then add offset of '+1'. Simmilarly create rest of key figs for other future years by increaing offset +2, +3 so on.
Hope this helps.
Regards,
Pritesh. -
Printing ALV Report output through Function Modules
Hi All,
I want to print my ALV Grid output through function modules/statement (not through print option in menu).
This is because, i am generating a PDF from spool when user clicks on a button. If any changes happened in the ALV output layout, they will be captured in spool through printing it.
So can you please tell me how to print the ALV Output through FMs or sending the ALV output to spool.
Thanks & Regards,
Senthil.
Edited by: senthil nathan on May 17, 2010 2:49 PMHi Dev,
Thanks for the reply.
I want to print the ALV when the user clicks on a button in toolbar. Lets say the user has made some changes to the layout, (E.g hiding a field) and when i print that output it should use the changed layout, If i use the FM suggested by you, i cant acheive this.
If you try to print this manually, the system uses the changed layout and not the original. Thats why i want to know FMs/statement to print.
Regards,
Senthil. -
Help regarding attaching smartform to a report program for QM module
Hii,
I have developed a certifiacate of analysis smartform for QM module and i attached it to a output type ...but i need to attach this smartform to a standard report RQCAAP01. can anyone help me what customizations i should do in report program in order to attach smartform.
Regards,
Venkat Akella.I attached smartform in NACE to LQCB output type but i should also make changes in report program RQCAAP01..can u please let me know what customizations i should do in tht report program to attach the smartform..
-
Report requirement, for count before the input selection.
Hi All,
I have a requirement:
And in infoprovider we have :
in 07.2011, 10 records were created.
in 08.2011, 40 records were created.
in 09.2011, 50 records were created.
in 10.2011, 70 records were created.
User enters month interval like 07.2011 - 10.2011
and wants outout like:
Calmonth:... 07.2011....08.2011.......09.2011.......10.2011
Count : ........30010.......30050...........30100..........30170
Means.in report 07.2011 should show all the count upto 07.2011,
Similarly 08.2011 show all counts upto 08.2011 month. And in same way others also.
Since input is 07.2011 to 10.2011, so report is considering only data between this range only.
How do i get count before 07.2011 in report and meet report requirement.
Please suggest and let me know if more information is required.
Thanks,
Jitender.Hi Jitender,
It is not possible to generate the query columns dynamically in the output based on the user input.
For getting the aggregated value what you can do is, create a customer exit variable on fiscal period and restrict it from some starting period till user entered period.
In your example let us say you have data from 07.2009 then your customer exit variable will have range from 07.2009 till 07.2011. Use this variable in a RKF with count as key figure and period as customer exit variable here you will get the output as 30010.
For getting the next columns you can change the period range by using offset. But you will have to create different columns beforehand in the query design itself. The only thing you can do is based on the user input different columns will be populated even you can keep the dynamic text using text variable so that you will get dynamic period heading but dynamic creation of columns is not possible.
Regards,
Durgesh. -
Custom reports required for bangladesh.
Hi All,
What are custom reports normally required for Bangladesh considering their statutory norms?
Regds
RK.Hi Sharvari,
This report is most sought and important report because now C Form and F form collection has become online and accurate data have to be provide to the sales tax authorities based on which these forms will be issued.
On this matter I suggest you don't spend time in questing reports for these forms because standard system does not provide. It is better that you sit with an ABAPer spending logical effort and get the customized report which will be great ease to sales tax processing.
Regards,
Chintan Joshi. -
hi
can anyone send me a simple and easily understandable ALV report.
points will be rewarded....Hi,
I think this will help u a lot...Plz reward if helpful to u...
REPORT ZSDR_SOSA NO STANDARD PAGE HEADING
LINE-COUNT 65 LINE-SIZE 100.
--Tables--
tables: vbap, vbak, vbpa, vbkd, makt,konv.
--Data Fetching--
TYPE-POOLS: slis.
data:begin of i_vbap occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
arktx like vbap-arktx,
kdmat like vbap-kdmat,
taxm1 like vbap-taxm1,
end of i_vbap.
data:begin of i_vbak occurs 0,
vbeln like vbak-vbeln,
audat like vbak-audat,
vbtyp like vbak-vbtyp,
vkorg like vbak-vkorg,
knumv like vbak-knumv,
kunnr like vbak-kunnr,
end of i_vbak.
data:begin of i_vbpa occurs 0,
vbeln like vbpa-vbeln,
posnr like vbpa-posnr,
parvw like vbpa-parvw,
kunnr like vbpa-kunnr, "SH
kunnr1 like vbpa-kunnr, "SP
end of i_vbpa.
data:begin of i_konv occurs 0,
knumv like konv-knumv,
kschl like konv-kschl,
kbetr like konv-kbetr,
mwsk1 like konv-mwsk1,
end of i_konv.
data:begin of i_vbkd occurs 0,
vbeln like vbkd-vbeln,
posnr like vbkd-posnr,
bstkd like vbkd-bstkd,
bstdk like vbkd-bstdk,
end of i_vbkd.
data:begin of i_makt occurs 0,
matnr like makt-matnr,
spras like makt-spras,
maktx like makt-maktx, "MAt. Desc
maktx1 like makt-maktx, "Cust mat. no.
end of i_makt.
data:wa_makt like makt.
DATA:BEGIN OF itab OCCURS 0,
vbeln like vbap-vbeln, "SD no.
audat like vbak-audat, "Order date
kunnr like vbpa-kunnr, "sold to party
kunnr1 like vbpa-kunnr, "ship to party
matnr like vbap-matnr, "Mat. No.
maktx like makt-maktx, "Material Desc.
kdmat like vbap-kdmat, "Cust. Mat.no.
maktx1 like makt-maktx, "Customer Mat. desc.
bstkd like vbkd-bstkd, "PO number
bstdk like vbkd-bstdk, "PO date
kbetr like konv-kbetr, "Basic Price
knumv like vbak-knumv,
vkorg like vbak-vkorg,
vbtyp like vbak-vbtyp,
parvw like vbpa-parvw,
kschl like konv-kschl,
mwsk1 like konv-mwsk1,
posnr like vbap-posnr,
arktx like vbap-arktx,
taxm1 like vbap-taxm1,
END OF itab.
--ALV DECLARATION--
DATA :v_pgm LIKE sy-repid.
DATA :col_pos TYPE i.
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid,
gt_events TYPE slis_t_event,
gd_prntparams TYPE slis_print_alv.
DATA:fcat TYPE slis_t_fieldcat_alv,
fcat1 TYPE slis_t_fieldcat_alv,
fcat2 TYPE slis_t_fieldcat_alv,
eve TYPE slis_t_event,
eve1 TYPE slis_t_event,
subtot TYPE slis_t_sortinfo_alv,
g_subtot LIKE LINE OF subtot.
--SELECTION SCREEN--
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_audat FOR vbak-audat,
s_vkorg for vbak-vkorg,
s_kunnr for vbak-kunnr.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS:p_sorder RADIOBUTTON GROUP rad1,
p_agree RADIOBUTTON GROUP rad1,
p_order radiobutton group rad1.
SELECTION-SCREEN END OF BLOCK b2.
--Initialization--
INITIALIZATION.
v_pgm = sy-repid.
--Start-of-selection--
Start-of-selection.
if p_sorder = 'X'.
perform get_sorder_data.
perform process_data.
perform display_data1.
elseif p_agree = 'X'.
perform get_agree_data.
perform process_data.
perform display_data1.
elseif p_order = 'X'.
perform get_order_data.
perform process_data.
perform display_data1.
endif.
*& Form get_sorder_data
text
--> p1 text
<-- p2 text
FORM get_sorder_data .
*Get from VBAK table.
select vbeln audat vbtyp vkorg knumv kunnr
from vbak into table i_vbak
where audat in s_audat
and vkorg in s_vkorg
and kunnr in s_kunnr
and vbtyp in ('C','E').
*Get from VBAP table.
if not i_vbak[] is initial.
clear:i_vbap. refresh:i_vbap.
select vbeln posnr matnr arktx kdmat taxm1
from vbap into table i_vbap
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
*Get from VBPA table.
if not i_vbap[] is initial.
clear:i_vbpa. refresh:i_vbpa.
select vbeln posnr parvw kunnr
from vbpa into table i_vbpa
for all entries in i_vbap
where vbeln = i_vbap-vbeln
and parvw in ('AG','KB','RE','RG','VE','WE','ZM').
endif.
*Get from KONV table.
if not i_vbak[] is initial.
clear:i_konv. refresh:i_konv.
select knumv kschl kbetr mwsk1
from konv into table i_konv
for all entries in i_vbak
where knumv = i_vbak-knumv
and kschl = 'PR00'.
endif.
*Get from VBKD table.
if not i_vbak[] is initial.
clear:i_vbkd. refresh:i_vbkd.
select vbeln posnr bstkd bstdk
from vbkd into table i_vbkd
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
**Get from MAKT table.
if not i_vbap[] is initial.
clear:i_makt. refresh:i_makt.
select single maktx
from makt into i_makt
for all entries in i_vbap
where matnr = i_vbap-matnr
and spras = sy-langu.
endif.
ENDFORM. " get_sorder_data
*& Form process_data
text
--> p1 text
<-- p2 text
FORM process_data .
Loop at i_vbap.
itab-vbeln = i_vbap-vbeln.
itab-posnr = i_vbap-posnr.
itab-matnr = i_vbap-matnr.
itab-arktx = i_vbap-arktx.
itab-kdmat = i_vbap-kdmat.
itab-taxm1 = i_vbap-taxm1.
*Get from MAKT table.
select single maktx from makt
into wa_makt-maktx
where matnr = itab-matnr
and spras = sy-langu.
if sy-subrc = 0.
itab-maktx = wa_makt-maktx.
itab-maktx1 = wa_makt-maktx.
endif.
read table i_vbak with key vbeln = itab-vbeln.
if sy-subrc = 0.
itab-audat = i_vbak-audat.
itab-knumv = i_vbak-knumv.
itab-vkorg = i_vbak-vkorg.
itab-vbtyp = i_vbak-vbtyp.
endif.
read table i_vbpa with key vbeln = itab-vbeln.
if sy-subrc = 0.
itab-parvw = i_vbpa-parvw.
itab-kunnr = i_vbpa-kunnr.
itab-kunnr1 = i_vbpa-kunnr.
endif.
read table i_konv with key knumv = itab-knumv.
if sy-subrc = 0.
itab-kschl = i_konv-kschl.
itab-kbetr = i_konv-kbetr.
itab-mwsk1 = i_konv-mwsk1.
endif.
read table i_vbkd with key vbeln = itab-vbeln.
if sy-subrc = 0.
itab-bstkd = i_vbkd-bstkd.
itab-bstdk = i_vbkd-bstdk.
endif.
read table i_makt with key matnr = itab-matnr.
if sy-subrc = 0.
itab-maktx = i_makt-maktx.
itab-maktx1 = i_makt-maktx1.
endif.
append itab.
clear itab.
endloop.
delete itab where not audat in s_audat.
delete itab where not vkorg in s_vkorg.
delete itab where not kunnr in s_kunnr.
ENDFORM. " process_data
*& Form display_data1
text
--> p1 text
<-- p2 text
FORM display_data1 .
PERFORM get_buildfieldcat1.
PERFORM display_alv.
ENDFORM. " display_data1
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
IF itab[] IS INITIAL.
MESSAGE 'No Data Exist' TYPE 'E'.
ENDIF.
DATA: title TYPE lvc_title
, datelow(10) TYPE c
, datehigh(10) TYPE c
DATA: gd_repid LIKE sy-repid
, gd_layout TYPE slis_layout_alv
***************Layout Formatting***************
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-zebra = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
***************Layout Formatting***************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_pgm
i_callback_top_of_page = 'ALV_TOP_OF_PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND' "'ALV_USER_COMMAND'
i_grid_title = title
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
it_sort = subtot
is_variant = z_template
TABLES
t_outtab = itab
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.
ENDFORM. " display_alv
*& Form ALV_TOP_OF_PAGE
ALV Report Header *
--> p1 text
<-- p2 text
FORM alv_top_of_page .
*ALV Header declarations
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
FORM alv_top_of_page1 .
DATA: i_header TYPE slis_t_listheader,
wa1_header TYPE slis_listheader,
i_line LIKE wa1_header-info,
lld_lines TYPE i,
lld_linesc(10) TYPE c.
Title
wa1_header-typ = 'H'.
wa1_header-info = 'Schedule Line-Basic Price Details'.
APPEND wa1_header TO t_header.
CLEAR wa1_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
APPEND wa_header TO t_header.
CLEAR: wa_header.
wa_header-typ = 'S'.
wa_header-key = 'Time: '.
CONCATENATE
sy-uzeit(2) ':'
sy-uzeit+2(2) ':'
sy-uzeit+4(2) INTO wa_header-info. "time
APPEND wa_header TO t_header.
CLEAR: wa_header.
wa_header-typ = 'A'.
wa_header-info = t_line.
APPEND wa_header TO t_header.
CLEAR: wa_header, t_line.
Total No. of Rows Displayed
DESCRIBE TABLE itab LINES ld_lines.
ld_linesc = ld_lines.
CONCATENATE 'Total No. of Rows: ' ld_linesc
INTO t_line SEPARATED BY space.
wa_header-typ = 'A'.
wa_header-info = t_line.
APPEND wa_header TO t_header.
CLEAR: wa_header, t_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header
i_logo = 'Z_LOGO'
ENDFORM. "alv_top_of_page
*& Form get_buildfieldcat1
text
--> p1 text
<-- p2 text
FORM get_buildfieldcat1 .
DATA position TYPE i.
position = -1.
position = position + 1.
fieldcatalog-fieldname = 'VBELN'.
fieldcatalog-seltext_m = 'Sales Order No.'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'AUDAT'.
fieldcatalog-seltext_m = 'Order Date'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 15.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'KUNNR'.
fieldcatalog-seltext_m = 'Sold to Party'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'KUNAG'.
fieldcatalog-seltext_m = 'Ship to Party'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material No.'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'MAKTX'.
fieldcatalog-seltext_m = 'Material Desc.'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'KDMAT'.
fieldcatalog-seltext_m = 'Customer Material No.'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'MAKTX1'.
fieldcatalog-seltext_m = 'Customer Material Desc'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'BSTKD'.
fieldcatalog-seltext_m = 'Purchase Order No.'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'BSTDK'.
fieldcatalog-seltext_m = 'Purchase Order Date'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
position = position + 1.
fieldcatalog-fieldname = 'KBETR'.
fieldcatalog-seltext_m = 'Basic Price'.
fieldcatalog-col_pos = position.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " get_buildfieldcat1
*& Form get_agree_data
text
--> p1 text
<-- p2 text
FORM get_agree_data .
*Get from VBAK table.
select vbeln audat vbtyp vkorg knumv kunnr
from vbak into table i_vbak
where audat in s_audat
and vkorg in s_vkorg
and kunnr in s_kunnr
and vbtyp in ('C','E').
*Get from VBAP table.
if not i_vbak[] is initial.
clear:i_vbap. refresh:i_vbap.
select vbeln posnr matnr arktx kdmat taxm1
from vbap into table i_vbap
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
*Get from VBPA table.
if not i_vbap[] is initial.
clear:i_vbpa. refresh:i_vbpa.
select vbeln posnr parvw kunnr
from vbpa into table i_vbpa
for all entries in i_vbap
where vbeln = i_vbap-vbeln
and parvw in ('AG','KB','RE','RG','VE','WE','ZM').
endif.
*Get from KONV table.
if not i_vbak[] is initial.
clear:i_konv. refresh:i_konv.
select knumv kschl kbetr mwsk1
from konv into table i_konv
for all entries in i_vbak
where knumv = i_vbak-knumv
and kschl = 'PR00'.
endif.
*Get from VBKD table.
if not i_vbak[] is initial.
clear:i_vbkd. refresh:i_vbkd.
select vbeln posnr bstkd bstdk
from vbkd into table i_vbkd
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
ENDFORM. " get_agree_data
*& Form get_order_data
text
--> p1 text
<-- p2 text
FORM get_order_data .
*Get from VBAK table.
select vbeln audat vbtyp vkorg knumv kunnr
from vbak into table i_vbak
where audat in s_audat
and vkorg in s_vkorg
and kunnr in s_kunnr
and vbtyp in ('C','E').
*Get from VBAP table.
if not i_vbak[] is initial.
clear:i_vbap. refresh:i_vbap.
select vbeln posnr matnr arktx kdmat taxm1
from vbap into table i_vbap
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
*Get from VBPA table.
if not i_vbap[] is initial.
clear:i_vbpa. refresh:i_vbpa.
select vbeln posnr parvw kunnr
from vbpa into table i_vbpa
for all entries in i_vbap
where vbeln = i_vbap-vbeln
and parvw in ('AG','KB','RE','RG','VE','WE','ZM').
endif.
*Get from KONV table.
if not i_vbak[] is initial.
clear:i_konv. refresh:i_konv.
select knumv kschl kbetr mwsk1
from konv into table i_konv
for all entries in i_vbak
where knumv = i_vbak-knumv
and kschl = 'PR00'.
endif.
*Get from VBKD table.
if not i_vbak[] is initial.
clear:i_vbkd. refresh:i_vbkd.
select vbeln posnr bstkd bstdk
from vbkd into table i_vbkd
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
ENDFORM. " get_order_data
With Regards,
Seevangi
Maybe you are looking for
-
Everytime I reboot or shutdown my computer, Mavericks forgets the arrangement of my six monitors. It's getting a bit old having to manually adjust them EVERY **** time I start-up Mavericks. Is Apple even aware of this problem that has existed since L
-
How to overwrite source files, or use source file names?
Hi all I would like AME (5.5.1.12, under Windows 7) to overwrite the source files that it is encoding, or if that's not possible, save the exported files to a different folder with the same file names as the sources. However I can see no way to do th
-
Scanned Grayscale files not loading into iPhoto
I have just purchased a new iMac, having not been a Mac User before. I have been importing photos from an external (Windows formatted) hard drive with apparent success. However, on attempting to import some scanned jpegs (Epson Perfection V700 Photo
-
Detecting Before and After Field Images
Is there a way within ADDT to find the value of screen fields prior to update? I've tried using the custom trigger BEFORE and STARTER events; BEFORE is too late, the field is already changed, STARTER is too early, the field value is NULL. I don't be
-
Problem running SRDemoSampleADFBC.
Hi all. I'm trying to run the SRDemoSampleADFBC under JDev 10.1.3.1.0 but I have the following error. Anyone has an idea ? Thanks for any help. 500 Internal Server Error java.lang.NoSuchMethodError: oracle.adf.share.perf.StateTracker.isActive()Z