0% found this document useful (0 votes)
881 views14 pages

Z Pending Pos Report

This document provides a summary of the fields and tables included in a report on pending purchase order positions. It defines an internal table (ITAB) with fields populated from various tables including EKPO, EKKO, EKKN, LFA1, ESSR, MSEG, MKPF and T001W. Selection criteria can be entered for fields like purchase order number, purchase order date, vendor code etc. The data is retrieved and appended to the internal table. Additional fields are calculated for age analysis, balance quantity and value. The internal table is then displayed in an ALV grid.

Uploaded by

olecosas4273
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
881 views14 pages

Z Pending Pos Report

This document provides a summary of the fields and tables included in a report on pending purchase order positions. It defines an internal table (ITAB) with fields populated from various tables including EKPO, EKKO, EKKN, LFA1, ESSR, MSEG, MKPF and T001W. Selection criteria can be entered for fields like purchase order number, purchase order date, vendor code etc. The data is retrieved and appended to the internal table. Additional fields are calculated for age analysis, balance quantity and value. The internal table is then displayed in an ALV grid.

Uploaded by

olecosas4273
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 14

*&---------------------------------------------------------------------* *& Report Z_PENDING_POS_REPORT *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z_PENDING_POS_REPORT. TYPE-POOLS : SLIS.

" SLIS is the type library for ALV grid Tables: EKPO, EKKO, EKKN, LFA1, ESSR, MSEG, MKPF, T001W. Types : BEGIN OF itab, EBELN LIKE *AEDAT LIKE BEDAT LIKE LIFNR LIKE Name1 LIKE KNTTP LIKE PSTYP LIKE MATNR LIKE TXZ01 LIKE EGLKZ LIKE WERKS LIKE P_NAME1 LIKE BUKRS LIKE SAKTO LIKE KOSTL LIKE NPLNR LIKE PS_PSP_PNR LIKE PROJN LIKE ERDAT LIKE LBLNI LIKE BWART LIKE pe BUDAT LIKE MENGE LIKE LMEIN LIKE BPRME LIKE NETWR LIKE WAERS LIKE ERFMG ERFME DMBTR "NETWR LIKE LIKE LIKE LIKE EKPO-EBELN EKPO-AEDAT EKKO-BEDAT EKKO-LIFNR LFA1-NAME1 EKPO-KNTTP EKPO-PSTYP EKPO-MATNR EKPO-TXZ01 EKPO-EGLKZ EKPO-WERKS T001W-NAME1 EKPO-BUKRS EKKN-SAKTO EKKN-KOSTL EKKN-NPLNR EKKN-PS_PSP_PNR EKKN-PROJN ESSR-ERDAT ESSR-LBLNI MSEG-BWART MKPF-BUDAT EKPO-MENGE EKPO-LMEIN EKPO-BPRME EKPO-NETWR EKKO-WAERS MSEG-ERFMG MSEG-ERFME MSEG-DMBTR EKPO-NETWR MSEG-ERFME MSEG-DMBTR MSEG-SALK3, MSEG-SALK3, MSEG-SALK3, MSEG-SALK3, , " PO No , " PO Date , " PO Date , " Vendor Code , " Vendor name , " Account Category , " Item Category , " Material No , " Material Description , " Delivery Date , " Plant Code , " Plant Description , " Company Code , " GL Account , " Cost Center , " Network Activity , " WBSE , " Project No , " SES Date , " SES Doc No , " GR Release Block Stock / Moment Ty , , , , , , " " " " " " GRN Date PO Quantity Unit Unit PO Total Value PO Total Quantity

, " Delivered Quantity , " UNIT , " Delivered Value , , " Quantity , " Value

*BAL_QTY LIKE *BAL_VAL LIKE AGE1 AGE2 AGE3 AGE4 END OF LIKE LIKE LIKE LIKE itab.

data: it_itab TYPE STANDARD TABLE of itab INITIAL SIZE 0 , wa_itab type itab. 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. Selection-screen begin of block B3 with frame title text-001. SELECT-OPTIONS: PR_NO FOR EKPO-EBELN, BEDAT FOR EKKO-BEDAT, LIFNR FOR EKKO-LIFNR, * ITM_CAT FOR LFA1-NAME1. KNTTP FOR EKPO-KNTTP, PSTYP FOR EKPO-PSTYP, MATNR FOR EKPO-MATNR, TXZ01 FOR EKPO-TXZ01, EGLKZ FOR EKPO-EGLKZ, WERKS FOR EKPO-WERKS, BUKRS FOR EKPO-BUKRS, SAKTO FOR EKKN-SAKTO, KOSTL FOR EKKN-KOSTL, NPLNR FOR EKKN-NPLNR, PS_PSP FOR EKKN-PS_PSP_PNR, PROJN FOR EKKN-PROJN, ERDAT FOR ESSR-ERDAT, LBLNI FOR ESSR-LBLNI, BWART FOR MSEG-BWART, BUDAT FOR MKPF-BUDAT, MENGE FOR EKPO-MENGE, LMEIN FOR EKPO-LMEIN, NETWR FOR EKPO-NETWR, WAERS FOR EKKO-WAERS, ERFMG ERFME DMBTR * * COMM GL_ACC FOR MSEG-ERFMG, FOR MSEG-ERFME, FOR MSEG-DMBTR. FOR EKKO-FIPOS, FOR EKKO-SAKTO,

Selection-screen end of block B3. * data: whereClause type STRING. **write / whereClause. Select: DISTINCT EKPO~EBELN * EKPO~AEDAT EKKO~BEDAT EKKO~LIFNR LFA1~NAME1 EKPO~KNTTP " po number " PO date " PO sate " Vendor Code " Vendor Name " Account Catagory

"

EKPO~PSTYP " Item Catagory EKPO~MATNR " Material No EKPO~TXZ01 " Material Description EKPO~EGLKZ " Delivery Date EKPO~WERKS " Plant Code T001W~NAME1 " Plant Description EKPO~BUKRS " Company Code EKKN~SAKTO " GL Account EKKN~KOSTL " Cost center EKKN~NPLNR " Network Activity EKKN~PS_PSP_PNR " WBSE EKKN~PROJN " Project No ESSR~ERDAT " SES Date ESSR~LBLNI " SES Doc No MSEG~BWART " Movement Type MKPF~BUDAT " GRN Date EKPO~MENGE " PO Quantity EKPO~BPRME " unit EKPO~LMEIN " Unit EKPO~NETWR " PO Total Value EKKO~WAERS " Cuurency Key MSEG~ERFMG " Delivered Quantity MSEG~ERFME " UNIT MSEG~DMBTR " Delivered Value EKKO~SAKTO

INTO CORRESPONDING FIELDS OF wa_itab from EKPO INNER join EKKO on EKPO~EBELN = EKKO~EBELN *INNER join LFA1 on EKPO~LIFNR = LFA1~Name1 INNER join EKKN on EKKN~EBELN = EKKO~EBELN INNER join ESSR on EKPO~EBELN = ESSR~EBELN INNER join MSEG ON EKPO~EBELP = MSEG~EBELP INNER JOIN MKPF ON MKPF~MBLNR = MSEG~MBLNR INNER JOIN LFA1 ON LFA1~LIFNR = EKKO~LIFNR INNER JOIN T001W ON T001w~WERKS = EKPO~WERKS *EKPO INNER *Conditions *EKKO-EBELN *EKPO-ANFNR *EKPO-EBELP JOIN INNER JOIN EKKO INNER JOIN EKKN = EKKN-EBELN = EKKO-EBELN = EKKO-LPONR

**UP TO 500 ROWS WHERE EKPO~EBELN EKKO~BEDAT EKKO~LIFNR LFA1~NAME1 EKPO~KNTTP EKPO~PSTYP EKPO~MATNR IN PR_NO AND IN BEDAT AND IN LIFNR AND IN ITM_CAT AND IN KNTTP AND IN PSTYP AND IN MATNR AND

EKPO~TXZ01 EKPO~EGLKZ EKPO~WERKS EKPO~BUKRS EKKN~SAKTO EKKN~KOSTL EKKN~NPLNR EKKN~PS_PSP_PNR EKKN~PROJN IN ESSR~ERDAT IN ESSR~LBLNI IN MSEG~BWART IN MKPF~BUDAT IN EKPO~MENGE IN EKPO~LMEIN IN EKPO~NETWR IN EKKO~WAERS IN MSEG~ERFMG MSEG~ERFMG MSEG~DMBTR

IN TXZ01 AND IN EGLKZ AND IN WERKS AND IN BUKRS AND IN SAKTO AND IN KOSTL AND IN NPLNR AND IN PS_PSP AND PROJN AND ERDAT AND LBLNI AND BWART AND BUDAT AND PROJN AND LMEIN AND NETWR AND WAERS AND

IN ERFMG AND IN ERFME AND IN DMBTR.

* *

EKKO~FIPOS EKKO~SAKTO

IN COMM AND IN GL_ACC AND

APPEND WA_ITAB TO IT_ITAB. Endselect. DATA: BAL_QTY LIKE MSEG-ERFMG. DATA: BAL_VAL LIKE MSEG-DMBTR. DATA: EDAYS LIKE VTBBEWE-ATAGE, EMONTHS LIKE VTBBEWE-ATAGE, EYEARS LIKE VTBBEWE-ATAGE. data: FROMDATE LIKE VTBBEWE-DBERVON. data: TODATE LIKE VTBBEWE-DBERBIS. LOOP AT IT_ITAB INTO WA_ITAB. FROMDATE = wa_itab-BEDAT. call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS' exporting i_date_from = FROMDATE i_date_to = sy-datum IMPORTING E_DAYS = EDAYS E_MONTHS = EMONTHS E_YEARS = EYEARS. if EDAYS < 31. wa_itab-age1 = wa_itab-NETWR.

ELSEIF EDAYS < 61. wa_itab-age2 = wa_itab-NETWR. ELSEIF EDAYS < 91. wa_itab-age3 = wa_itab-NETWR. ELSE. wa_itab-age4 = wa_itab-NETWR. endif. BAL_QTY = EKPO-MENGE - MSEG-ERFMG. " PO Quantity - DELIVERED QTY = BALANCE BAL_VAL = EKPO-NETWR - MSEG-DMBTR. " PO VALUE - DELIVERED VALUE - BAL. VALUE

MODIFY it_itab INDEX sy-tabix FROM wa_itab. ENDLOOP. **perform data_retrieval. perform build_fieldcatalog. perform build_layout. perform build_events. *perform build_print_params. perform display_alv_report.

*&---------------------------------------------------------------------* *& Form BUILD_FIELDCATALOG *&---------------------------------------------------------------------* * Build Fieldcatalog for ALV Report *----------------------------------------------------------------------* form build_fieldcatalog. * * * * * * * * * * * There are a number of ways to create a fieldcat. For the purpose of this example i will build the fieldcatalog manualy by populating the internal table fields individually and then appending the rows. This method can be the most time consuming but can also allow you more control of the final product. Beware though, you need to ensure that all fields required are populated. When using some of functionality available via ALV, such as total. You may need to provide more information than if you were simply displaying the result I.e. Field type may be required in-order for the 'TOTAL' function to work. " field Name " Field heading " col position " output Lenght

fieldcatalog-fieldname = 'EBELN'. fieldcatalog-seltext_m = 'Purchase Order'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname fieldcatalog-seltext_m fieldcatalog-col_pos fieldcatalog-outputlen fieldcatalog-emphasize in color) = = = = = 'BEDAT'. 'PO Date'. 0. 10. 'X'.

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'LIFNR'. fieldcatalog-seltext_m = 'Vendor Code'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'NAME1'. fieldcatalog-seltext_m = 'Vendor Name'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. " field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

"field Name "Field heading "col position "output Lenght "Emphasize (highlight columns

fieldcatalog-fieldname = 'KNTTP'. " field Name fieldcatalog-seltext_m = 'Account Assignment Category'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'PSTYP'. fieldcatalog-seltext_m = 'Item Category'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'MATNR'. fieldcatalog-seltext_m = 'Material Code'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'TXZ01'. " field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" " " " "

field Name Field heading col position output Lenght Emphasize (highlight columns

" field Name

fieldcatalog-seltext_m = 'Material Description'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'EGLKZ'. fieldcatalog-seltext_m = 'Delivery Date'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'WERKS'. fieldcatalog-seltext_m = 'Plant Code'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. " field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

fieldcatalog-fieldname = 'P_NAME1'. " field Name fieldcatalog-seltext_m = 'Plant Description'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'BUKRS'. fieldcatalog-seltext_m = 'Company Code'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname fieldcatalog-seltext_m fieldcatalog-col_pos fieldcatalog-outputlen fieldcatalog-emphasize in color) *fieldcatalog-key = = = = = 'SAKTO'. 'GL Account'. 0. 10. 'X'. = 'X'. " field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'KOSTL'. fieldcatalog-seltext_m = 'Cost Center'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. " field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

fieldcatalog-fieldname = 'NPLNR'. fieldcatalog-seltext_m = 'Network Activity'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog.

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

fieldcatalog-fieldname = 'PS_PSP_PNR'. " field Name fieldcatalog-seltext_m = 'WBSE'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'PROJN'. fieldcatalog-seltext_m = 'Project No'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'ERDAT'. fieldcatalog-seltext_m = 'SES Date'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname fieldcatalog-seltext_m = 'LBLNI'. = 'SES Doc No'. " field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading

fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'BWART'. fieldcatalog-seltext_m = 'Movement Type'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'BUDAT'. fieldcatalog-seltext_m = 'GRN Date'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'MENGE'. fieldcatalog-seltext_m = 'PO Quantity'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog.

" col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

fieldcatalog-fieldname = 'ERFME'. " field Name fieldcatalog-seltext_m = 'Unit'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname fieldcatalog-seltext_m fieldcatalog-col_pos fieldcatalog-outputlen fieldcatalog-emphasize in color) *fieldcatalog-key = = = = = 'NETWR'. 'PO Value'. 0. 10. 'X'. = 'X'. " field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'WAERS'. fieldcatalog-seltext_m = 'Currency'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'ERFMG'. fieldcatalog-seltext_m = 'Quantity'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. " field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

fieldcatalog-fieldname = 'ERFME'. " field Name fieldcatalog-seltext_m = 'Unit'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'DMBTR'. fieldcatalog-seltext_m = 'Delivered Value'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'WAERS'. fieldcatalog-seltext_m = 'Currency'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname fieldcatalog-seltext_m = 'BAL_QTY'. = 'Balanced Qty'. " " " " " field Name Field heading col position output Lenght Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading

fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog.

" col position " output Lenght " Emphasize (highlight columns

"fieldcatalog-fieldname = 'ERFME'. "field Name "fieldcatalog-seltext_m = 'Unit'. " Field heading "fieldcatalog-col_pos = 0. " col position "fieldcatalog-outputlen = 10. " output Lenght "fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) "*fieldcatalog-key = 'X'. "append fieldcatalog to fieldcatalog. "clear fieldcatalog. fieldcatalog-fieldname = 'BAL_VAL'. fieldcatalog-seltext_m = 'Balanced Value'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'WAERS'. fieldcatalog-seltext_m = 'Currency'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'AGE1'. fieldcatalog-seltext_m = '0-30 Days'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'AGE2'. fieldcatalog-seltext_m = '31-60 Days'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. " field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

fieldcatalog-fieldname = 'AGE3'. fieldcatalog-seltext_m = '61-90 Days'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog.

" field Name " Field heading " col position " output Lenght " Emphasize (highlight columns

fieldcatalog-fieldname = 'AGE4'. " field Name fieldcatalog-seltext_m = 'More than 90 Days'. " Field heading fieldcatalog-col_pos = 0. " col position fieldcatalog-outputlen = 10. " output Lenght fieldcatalog-emphasize = 'X'. " Emphasize (highlight columns in color) *fieldcatalog-key = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog.

endform.

" BUILD_FIELDCATALOG

*&---------------------------------------------------------------------* *& Form BUILD_LAYOUT *&---------------------------------------------------------------------* * Build layout for ALV grid report *----------------------------------------------------------------------* form build_layout. gd_layout-no_input = 'X'. gd_layout-colwidth_optimize = 'X'. gd_layout-totals_text = 'Totals'(201). * gd_layout-totals_only = 'X'. * gd_layout-f2code = 'DISP'. "Sets fcode for when double * "click(press f2) * gd_layout-zebra = 'X'. * gd_layout-group_change_edit = 'X'. * gd_layout-header_text = 'helllllo'. endform. " BUILD_LAYOUT *&---------------------------------------------------------------------* *& Form DISPLAY_ALV_REPORT *&---------------------------------------------------------------------* * Display report using ALV grid *----------------------------------------------------------------------* form display_alv_report. gd_repid = sy-repid. call function 'REUSE_ALV_GRID_DISPLAY' exporting i_callback_program = gd_repid i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM i_callback_user_command = 'USER_COMMAND' * i_grid_title = outtext is_layout = gd_layout it_fieldcat = fieldcatalog[] * it_special_groups = gd_tabgroup it_events = gt_events

is_print = gd_prntparams i_save = 'X' * is_variant = z_template tables t_outtab = it_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_REPORT *-------------------------------------------------------------------* * Form TOP-OF-PAGE * *-------------------------------------------------------------------* * ALV Report Header * *-------------------------------------------------------------------* Form 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. * Title wa_header-typ = 'H'. wa_header-info = 'Review of Pending POs with Aging'. append wa_header to t_header. clear wa_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. append wa_header to t_header. clear: wa_header.

"todays date

* Total No. of Records Selected describe table it_itab lines ld_lines. ld_linesc = ld_lines. concatenate 'Total No. of Records Selected: ' 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.

*------------------------------------------------------------------* * FORM USER_COMMAND * *------------------------------------------------------------------* * --> R_UCOMM * * --> RS_SELFIELD * *------------------------------------------------------------------* *FORM user_command USING r_ucomm LIKE sy-ucomm * rs_selfield TYPE slis_selfield. * ** Check function code * CASE r_ucomm. * WHEN '&IC1'. ** Check field clicked on within ALVgrid report * IF rs_selfield-fieldname = 'EBELN'. ** Read data table, using index of row user clicked on * READ TABLE itab INTO wa_ekko INDEX rs_selfield-tabindex. ** Set parameter ID for transaction screen field * SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln. ** Sxecute transaction ME23N, and skip initial data entry screen * CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN. * ENDIF. * ENDCASE. *ENDFORM. *&---------------------------------------------------------------------* *& Form BUILD_EVENTS *&---------------------------------------------------------------------* * Build events table *----------------------------------------------------------------------* form build_events. 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_end_of_page into ls_event. if sy-subrc = 0. move 'END_OF_PAGE' to ls_event-form. append ls_event to gt_events. endif. read table gt_events with key name = slis_ev_end_of_list into ls_event. if sy-subrc = 0. move 'END_OF_LIST' to ls_event-form. < p=""> <>

You might also like