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

ZMM PO Release Report Overview

This document describes a report that summarizes purchase order release information. It defines database tables, data structures, and selection options to retrieve and display purchase order data including document number, vendor, material, and user who released the order. The data is retrieved from various application tables, consolidated into an internal table, then formatted and displayed in an ALV grid for user review. Field categories are defined to control the columns and layout of the output.

Uploaded by

shubendubarwe
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 DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
543 views14 pages

ZMM PO Release Report Overview

This document describes a report that summarizes purchase order release information. It defines database tables, data structures, and selection options to retrieve and display purchase order data including document number, vendor, material, and user who released the order. The data is retrieved from various application tables, consolidated into an internal table, then formatted and displayed in an ALV grid for user review. Field categories are defined to control the columns and layout of the output.

Uploaded by

shubendubarwe
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 DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

ZMM_po_releasereport

*&---------------------------------------------------------------------* *& Report ZMM_PO_RELEASEREPORT *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZMM_PO_RELEASEREPORT.

TYPE-POOLS : slis. TABLES : ekko,ekpo,lfa1,marc,nast,makt.

DATA : BEGIN OF it_cdhdr OCCURS 100 , OBJECTCLAS TYPE CDHDR-OBJECTCLAS, OBJECTID TYPE CDHDR-OBJECTID , CHANGENR TYPE CDHDR-CHANGENR , USERNAME TYPE CDHDR-USERNAME, UDATE TYPE CDHDR-UDATE , UTIME TYPE CDHDR-UTIME , TCODE TYPE CDHDR-TCODE , TABNAME TYPE CDpos-TABNAME, TABKEY TYPE CDpos-TABKEY, FNAME TYPE CDpos-FNAME, VALUE_NEW TYPE CDpos-VALUE_NEW , EBELN TYPE EKKO-EBELN , END OF it_cdhdr .

DATA : BEGIN OF it_cdpos OCCURS 100 , OBJECTCLAS TYPE CDHDR-OBJECTCLAS, OBJECTID TYPE CDHDR-OBJECTID , CHANGENR TYPE CDHDR-CHANGENR , TABNAME TYPE CDpos-TABNAME, TABKEY TYPE CDpos-TABKEY, FNAME TYPE CDpos-FNAME, VALUE_NEW TYPE CDpos-VALUE_NEW , end of it_cdpos.

DATA : BEGIN OF it_NAST OCCURS 0. DATA ebeln TYPE ekko-ebeln . INCLUDE STRUCTURE NAST.

ZMM_po_releasereport
DATA END OF it_NAST. DATA : BEGIN OF REL_EKKO OCCURS 0. INCLUDE STRUCTURE EKKO. DATA END OF REL_EKKO. DATA : "ekko EBELN ekorg bedat BEGIN OF it_alvdata OCCURS 0 , TYPE ekko-EBELN , TYPE ekko-ekorg, TYPE ekko-bedat,

lifnr TYPE ekko-lifnr, bsart TYPE ekko-bsart, * RLWRT TYPE ekko-RLWRT, ekgrp TYPE ekko-ekgrp, "ekpo matnr type ekpo-matnr, mtart type ekpo-mtart, banfn type ekpo-banfn, pstyp type ekpo-pstyp, werks TYPE ekpo-werks , txz01 type ekpo-txz01, EFFWR TYPE ekpo-EFFWR, "lfa1 name1 TYPE lfa1-name1, ort01 TYPE lfa1-ort01, ort02 TYPE lfa1-ort02, land1 TYPE lfa1-land1, pstlz TYPE lfa1-pstlz, regio TYPE lfa1-regio, telf1 TYPE lfa1-telf1, adrnr TYPE lfa1-adrnr, mail TYPE adr6-smtp_addr ,

erdat usnam ERUHR

TYPE nast-erdat,"created on date TYPE nast-usnam, TYPE nast-ERUHR ,"created on time

dispo TYPE marc-dispo , " makt maktx TYPE makt-maktx, rtxt TYPE string , Ctxt TYPE string , " adr6 smtp_addr TYPE adr6-smtp_addr,

ZMM_po_releasereport

END OF it_alvdata.

DATA : "ekko EBELN ekorg bedat lifnr bsart RLWRT ekgrp "ekpo matnr mtart banfn werks pstyp txz01 EFFWR "lfa1 name1 ort01 ort02 land1 pstlz regio telf1

BEGIN OF it_order OCCURS 0 , TYPE TYPE TYPE TYPE TYPE TYPE TYPE type type type TYPE type type TYPE ekko-EBELN , ekko-ekorg, ekko-bedat, ekko-lifnr, ekko-bsart, ekko-RLWRT, ekko-ekgrp, ekpo-matnr, ekpo-mtart, ekpo-banfn, ekpo-werks , ekpo-pstyp, ekpo-txz01, ekpo-EFFWR,

TYPE TYPE TYPE TYPE TYPE TYPE TYPE

lfa1-name1, lfa1-ort01, lfa1-ort02, lfa1-land1, lfa1-pstlz, lfa1-regio, lfa1-telf1,

" marc dispo TYPE marc-dispo ,

" makt maktx TYPE makt-maktx, *" adr6 *smtp_addr TYPE adr6-smtp_addr, END OF it_order.

DATA : it_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv,

ZMM_po_releasereport
wa_fieldcat TYPE slis_fieldcat_alv, wa_layout TYPE slis_layout_alv. SELECT-OPTIONS : s_ekorg FOR ekko-ekorg, s_udate for ekko-bedat, s_lifnr for ekko-lifnr, s_bsart for ekko-bsart, s_ekgrp for ekko-ekgrp, s_ebeln for ekko-ebeln, s_dispo for marc-dispo, s_matnr for ekpo-matnr, s_mtart for ekpo-mtart, s_werks for ekpo-werks, s_banfn for ekpo-banfn, s_usnam for nast-usnam, s_erdat for nast-erdat, s_pstyp for ekpo-pstyp.

PERFORM get_data. PERFORM get_fieldcat. PERFORM build_layout. PERFORM list_display. *&---------------------------------------------------------------------* *& Form GET_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form GET_DATA . SELECT * FROM cdhdr INTO CORRESPONDING FIELDS OF TABLE it_cdhdr WHERE UDATE in s_UDATE and TCODE in ('ME29N', 'ME28' ) and objectclas = 'EI NKBELEG' . * IF it_cdhdr[] is not INITIAL . SELECT * from cdpos into CORRESPONDING FIELDS OF TABLE it_cdpos FOR ALL ENTRIES IN it_cdhdr WHERE OBJECTCLAS = it_cdhdr-OBJECTCLAS and OBJECTID = it_cdhdr-OBJECTID and CHANGENR = it_cdhdr-CHANGENR and TABNAME = 'EKKO' AND fname = 'FRGKE' and

ZMM_po_releasereport
value_new = 'G' . ENDIF. LOOP AT it_cdpos WHERE value_new = 'G' AND OBJECTCLAS = 'EINKBELEG' . READ TABLE it_cdhdr WITH KEY OBJECTCLAS = it_cdposOBJECTCLAS OBJECTID = it_cdpos-OBJECTID CHANGENR = it_cdpos-CHANGENR . IF SY-SUBRC = 0. MOVE-CORRESPONDING it_cdpos TO it_cdhdr . it_cdhdr-EBELN = it_cdpos-OBJECTID . MODIFY it_cdhdr INDEX SY-TABIX. ENDIF.

ENDLOOP.

DELETE it_cdhdr WHERE value_new <> 'G' .

IF it_cdhdr[] is not INITIAL . "ekko SELECT a~EBELN a~ekorg a~bedat a~lifnr a~bsart a~ekgrp a~RLWRT "ekpo b~matnr b~mtart b~werks b~banfn b~pstyp b~txz01 b~EFFWR * b~netwr "lfa1 c~name1 c~ort01 c~ort02 c~land1 c~pstlz

ZMM_po_releasereport
c~regio c~telf1

" marc d~dispo

" makt e~maktx INTO CORRESPONDING FIELDS OF TABLE it_order FROM ekko as a INNER JOIN ekpo as b on a~ebeln = b~ebeln INNER JOIN lfa1 as c on a~lifnr = c~lifnr INNER JOIN marc as d on d~matnr = b~matnr and d~werks = b~werks INNER JOIN makt AS e ON e~matnr = b~matnr FOR ALL ENTRIES IN it_cdhdr WHERE a~ebeln = it_cdhdr-EBELN AND "it_NAST-ebeln and a~FRGKE = 'G' AND " STATUS a~BSTYP = 'F' AND "PO order a~ebeln in s_ebeln and a~lifnr in s_lifnr and * a~bedat in s_bedat and a~ekgrp in s_ekgrp and a~ekorg in s_ekorg and a~bsart in s_bsart and b~matnr in s_matnr AND b~werks in s_werks and d~dispo in s_dispo .

ENDIF. sort it_order ASCENDING by ebeln. delete ADJACENT DUPLICATES FROM it_order COMPARING ebeln . LOOP AT it_order. MOVE-CORRESPONDING it_order to it_alvdata . APPEND it_alvdata . ENDLOOP.

*BREAK-POINT . LOOP AT it_alvdata. select SINGLE adrnr name1 from lfa1 into (it_alvdata-adrnr,it_alvdataname1) where lifnr = it_alvdata-lifnr.

ZMM_po_releasereport

SELECT SINGLE bezei FROM t005u INTO it_alvdata-rtxt WHERE spras = 'EN' AND land1 = 'IN' AND bland = it_alvdata-regio .

select single LANDX from t005T into it_alvdata-Ctxt where spras = 'EN' and land1 = it_alvdata-land1 .

select single smtp_addr from adr6 into it_alvdatamail where ADDRNUMBER = it_alvdata-adrnr. READ TABLE it_cdhdr WITH IF sy-subrc = 0. KEY ebeln = it_alvdata-ebeln.

* *

it_alvdata-parnr = it_cdhdr-parnr. it_alvdata-parvw = it_cdhdr-parvw . it_alvdata-erdat = it_cdhdr-udate . it_alvdata-usnam = it_cdhdr-username it_alvdata-ERUHR = it_cdhdr-utime . it_alvdata-DATVR = it_cdhdr-DATVR . it_alvdata-UHRVR = it_cdhdr-UHRVR .

* *

ENDIF.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = it_alvdata-matnr IMPORTING OUTPUT = it_alvdata-matnr .

MODIFY it_alvdata . ENDLOOP.

ZMM_po_releasereport
endform. " GET_DATA *&---------------------------------------------------------------------* *& Form GET_FIELDCAT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form GET_FIELDCAT .

wa_fieldcat-fieldname = 'EBELN'. wa_fieldcat-key = 'X' . wa_fieldcat-seltext_m = 'Pur Doc'. wa_fieldcat-seltext_l = 'Pur Doc'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'EKORG'. wa_fieldcat-seltext_m = 'Pur Org'. * wa_fieldcat-hotspot = 'X' . wa_fieldcat-seltext_l = 'Pur Org'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. wa_fieldcat-fieldname = 'BEDAT'. wa_fieldcat-seltext_m = 'PO Date'. wa_fieldcat-seltext_l = 'PO Date'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. wa_fieldcat-fieldname = 'LIFNR'. wa_fieldcat-seltext_m = 'Vendor'. wa_fieldcat-seltext_l = 'Vendor'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'BSART'. wa_fieldcat-seltext_m = 'Pur Doc Type'. wa_fieldcat-seltext_l = 'Pur Doc Type'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname

= 'EKGRP'.

ZMM_po_releasereport
wa_fieldcat-seltext_m = 'Pur Grp'. wa_fieldcat-seltext_l = 'Pur Grp'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'DISPO'. wa_fieldcat-seltext_m = 'Mrp Cntrl'. wa_fieldcat-seltext_l = 'Mrp Cntrl'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. wa_fieldcat-fieldname = 'MATNR'. wa_fieldcat-seltext_m = 'Material'. wa_fieldcat-seltext_l = 'Mareial'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'MAKTX'. wa_fieldcat-seltext_m = 'Mat Des'. wa_fieldcat-seltext_l = 'Mat Des'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

* * * * *

wa_fieldcat-fieldname = 'RLWRT'. wa_fieldcat-seltext_m = 'Po Amoumt'. wa_fieldcat-seltext_l = 'Po Amoumt'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'EFFWR'. wa_fieldcat-seltext_m = 'Effective Value'. wa_fieldcat-seltext_l = 'Effective Value'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. * wa_fieldcat-fieldname = 'NETWR'. * wa_fieldcat-seltext_m = 'Net Value'. * wa_fieldcat-seltext_l = 'Net Value'. * append wa_fieldcat to it_fieldcat. * clear wa_fieldcat.

ZMM_po_releasereport

wa_fieldcat-fieldname = 'MTART'. wa_fieldcat-seltext_m = 'Material Type' . wa_fieldcat-seltext_l = 'Mareial Type'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'BANFN'. wa_fieldcat-seltext_m = 'Pur Req No'. wa_fieldcat-seltext_l = 'Pur Req No'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'USNAM'. wa_fieldcat-seltext_m = 'Username'. wa_fieldcat-seltext_l = 'Useranme'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'ERDAT'. wa_fieldcat-seltext_m = 'Po.Rel.Date'. wa_fieldcat-seltext_l = 'Po.Release Date'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'ERUHR'. wa_fieldcat-seltext_m = 'Po.Rel.Time'. wa_fieldcat-seltext_l = 'Po.Release Time'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

* * * * *

wa_fieldcat-fieldname = 'PSTYP'. wa_fieldcat-seltext_m = 'Item Cat'. wa_fieldcat-seltext_l = 'Item Cat'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

* *

wa_fieldcat-fieldname wa_fieldcat-seltext_m

= 'OBJKY'. = 'Object ky'.

ZMM_po_releasereport
* * * wa_fieldcat-seltext_l = 'obj ky'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'LIFNR'. wa_fieldcat-seltext_m = 'Vendor'. wa_fieldcat-seltext_l = 'Vendor'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'NAME1'. wa_fieldcat-seltext_m = 'Vendor'. wa_fieldcat-seltext_l = 'Vendor Name'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

* * * * *

wa_fieldcat-fieldname = 'PARVW'. wa_fieldcat-seltext_m = 'Partner Role'. wa_fieldcat-seltext_l = 'Partner Role'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

* * * * * * * * * *

wa_fieldcat-fieldname = 'ERUHR'. wa_fieldcat-seltext_m = 'CREATED AT'. wa_fieldcat-seltext_l = 'CREATED AT'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. wa_fieldcat-fieldname = 'DSNAM'. wa_fieldcat-seltext_m = 'NAME'. wa_fieldcat-seltext_l = 'NAME'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. wa_fieldcat-fieldname = 'WERKS'. wa_fieldcat-seltext_m = 'Plant'. wa_fieldcat-seltext_l = 'Plant'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname wa_fieldcat-seltext_m

= 'ORT01'. = 'City'.

ZMM_po_releasereport
wa_fieldcat-seltext_l = 'City'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. wa_fieldcat-fieldname = 'ORT02'. wa_fieldcat-seltext_m = 'Dist'. wa_fieldcat-seltext_l = 'Dist'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. wa_fieldcat-fieldname = 'LAND1'. wa_fieldcat-seltext_m = 'Country'. wa_fieldcat-seltext_l = 'Country'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'CTXT'. wa_fieldcat-seltext_m = 'Country Name'. wa_fieldcat-seltext_l = 'Country Name'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. wa_fieldcat-fieldname = 'PSTLZ'. wa_fieldcat-seltext_m = 'Postal Code'. wa_fieldcat-seltext_l = 'Postal Code'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. wa_fieldcat-fieldname = 'REGIO'. wa_fieldcat-seltext_m = 'Region'. wa_fieldcat-seltext_l = 'Region'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. wa_fieldcat-fieldname = 'RTXT'. wa_fieldcat-seltext_m = 'Region'. wa_fieldcat-seltext_l = 'Region'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'TELF1'. wa_fieldcat-seltext_m = 'Telephone'. wa_fieldcat-seltext_l = 'Telephone'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

ZMM_po_releasereport
wa_fieldcat-fieldname = 'TXZ01'. wa_fieldcat-seltext_m = 'Manf Des'. wa_fieldcat-seltext_l = 'Manf Des'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

wa_fieldcat-fieldname = 'MAIL'. wa_fieldcat-seltext_m = 'E-mail'. wa_fieldcat-seltext_l = 'E-mail'. append wa_fieldcat to it_fieldcat. clear wa_fieldcat.

endform. " GET_FIELDCAT *&---------------------------------------------------------------------* *& Form BUILD_LAYOUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form BUILD_LAYOUT . WA_LAYOUT-ZEBRA = 'X'. endform. " BUILD_LAYOUT *&---------------------------------------------------------------------* *& Form LIST_DISPLAY *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form LIST_DISPLAY . CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING

i_callback_program I_CALLBACK_PF_STATUS_SET * i_callback_user_command i_callback_top_of_page is_layout it_fieldcat i_default = 'X' i_save = 'X'

= sy-repid = ' ' = 'GET_USER_COMMANDS' = 'TOP_OF_PAGE' = wa_layout = it_fieldcat

ZMM_po_releasereport

tables t_outtab ENDFORM. " LIST_DISPLAY

= IT_alvdata ."

it_po.

form top_of_page . types : ilistheader type slis_listheader. data : wa_listheader type ilistheader. data : it_listheader type standard table of ilistheader. data: t_header type slis_t_listheader, wa_header type slis_listheader, t_line like wa_listheader-info, ld_lines type i, ld_linesc(10) type c.

wa_listheader-info = 'PO Release Report.'. wa_listheader-typ = 'H'. append wa_listheader to it_listheader . clear wa_listheader. data : text(10) type c. concatenate sy-datum+6(2) '.' sy-datum+4(2) '.' sy-datum(4) into text. wa_listheader-info = text. wa_listheader-typ = 'S'. wa_listheader-key = 'DATE'. append wa_listheader to it_listheader . clear wa_listheader.

"todays date

call function 'REUSE_ALV_COMMENTARY_WRITE' exporting it_list_commentary = it_listheader. * I_LOGO = * I_END_OF_LIST_GRID = * I_ALV_FORM = refresh it_listheader. . endform. " TOP_OF_PAGE

You might also like