Anda di halaman 1dari 21

H**This code is automatically generated by YASH program , please do not make any

changes**
C*&---------------------------------------------------------------------*
C*** Title :
C*** Module :
C*** Functional : -
C*** Author :
C*** Description :
C*** Created Date :
C*** Version :
C*** File Spek :
C*---------------------------------------------------------------------------------
---------------------------*
C*---------------------------------------------------------------------------------
---------------------------*
C*** User Id :
C*** Date :
C*** Change Req. :
C*** Description :
C**--------------------------------------------------------------------------------
---------------------------*
C
C*&---------------------------------------------------------------------*
C*& Report ZRE_MMR001
C*&---------------------------------------------------------------------*
C*&
C*&---------------------------------------------------------------------*
CREPORT ZRE_MMR001 NO STANDARD PAGE HEADING
C LINE-SIZE 255.
C
CINCLUDE zin_authorization_check.
CINCLUDE zin_list_header.
CINCLUDE zin_alv_common.
CINCLUDE zin_bdc.
C
C
C*----------------------------------------------------------------------*
C* Tables *
C*----------------------------------------------------------------------*
CTABLES : eban,
C t161t,
C t024,
C eket,
C ekpo,
C ekko,
C lfa1,
C mara,
C ekkn,
C ekes,
C lips,
C mseg,
C cdpos,
C cdhdr,
C mkpf,
C p0001,
C ekbe.
C
C*----------------------------------------------------------*
C* Global Type Table
C*----------------------------------------------------------*
CTYPES : BEGIN OF ty_eban,
C banfn LIKE eban-banfn,
C bsart like eban-bsart,
C bnfpo LIKE eban-bnfpo,
C ekgrp LIKE eban-ekgrp,
C badat LIKE eban-badat,
C lfdat LIKE eban-lfdat,
C frgzu LIKE eban-frgzu,
C werks LIKE eban-werks,
C lgort LIKE eban-lgort,
C frggr LIKE eban-frggr,
C ebakz LIKE eban-ebakz,
C pstyp LIKE eban-pstyp,
C knttp LIKE eban-knttp,
C matnr LIKE eban-matnr,
C txz01 LIKE eban-txz01,
C menge LIKE eban-menge,
C meins LIKE eban-meins,
CEND OF ty_eban.
C
C*TYPES : BEGIN OF ty_t161t,
C* batxt LIKE t161t-batxt,
C* bstyp like t161t-bstyp,
C* bsart LIKE t161t-bsart,
C*END OF ty_t161t.
C
C*TYPES : BEGIN OF ty_t024,
C* eknam LIKE t024-eknam,
C* ekgrp like t024-ekgrp,
C*END OF ty_t024.
C*
C*TYPES : BEGIN OF ty_cdpos,
C* changenr LIKE cdpos-changenr,
C* objectid LIKE cdpos-objectid,
C* fname LIKE cdpos-fname,
C*END OF ty_cdpos.
C*
C*TYPES : BEGIN OF ty_cdhdr,
C* changenr LIKE cdhdr-changenr,
C* udate LIKE cdhdr-udate,
C* utime LIKE cdhdr-utime,
C*END OF ty_cdhdr.
C
CTYPES : BEGIN OF ty_mara,
C matnr LIKE mara-matnr,
C mtart like mara-mtart,
CEND OF ty_mara.
C
CTYPES : BEGIN OF ty_eket,
C banfn LIKE eket-banfn,
C bnfpo LIKE eket-bnfpo,
C ebeln LIKE eket-ebeln,
C ebelp LIKE eket-ebelp,
C eindt LIKE eket-eindt,
CEND OF ty_eket.
C
CTYPES : BEGIN OF ty_ekbe,
C ebeln LIKE ekbe-ebeln,
C ebelp LIKE ekbe-ebelp,
C belnr LIKE ekbe-belnr,
C budat LIKE ekbe-budat,
C bwart LIKE ekbe-bwart,
C menge LIKE ekbe-menge,
CEND OF ty_ekbe.
C
CTYPES : BEGIN OF ty_ekpo,
C loekz LIKE ekpo-loekz,
C abskz LIKE ekpo-abskz,
C* werks LIKE ekpo-werks,
C ebeln LIKE ekpo-ebeln,
C ebelp LIKE ekpo-ebelp,
C ktmng LIKE ekpo-ktmng,
C meins LIKE ekpo-meins,
C netpr LIKE ekpo-netpr,
C peinh LIKE ekpo-peinh,
C netwr LIKE ekpo-netwr,
C banfn LIKE ekpo-banfn,
C bnfpo LIKE ekpo-bnfpo,
C anfnr LIKE ekpo-anfnr,
C anfps LIKE ekpo-anfps,
C pstyp LIKE ekpo-pstyp,
C knttp LIKE ekpo-knttp,
C werks LIKE ekpo-werks,
C menge LIKE ekpo-menge,
C elikz LIKE ekpo-elikz,
C bstae LIKE ekpo-bstae,
C brtwr LIKE ekpo-brtwr,
C txz01 LIKE ekpo-txz01,
C matnr LIKE ekpo-matnr,
C* txz01 LIKE ekpo-maktx,
CEND OF ty_ekpo.
C
CTYPES : BEGIN OF ty_ekko,
C ebeln LIKE ekko-ebeln,
C bedat LIKE ekko-bedat,
C bukrs LIKE ekko-bukrs,
C waers LIKE ekko-waers,
C ekgrp LIKE ekko-ekgrp,
C bsart LIKE ekko-bsart,
C lifnr LIKE ekko-lifnr,
C frgsx LIKE ekko-frgsx,
C frgzu LIKE ekko-frgzu,
C ADRNR LIKE ekko-ADRNR,
C Aedat LIKE ekko-aedat,
CEND OF ty_ekko.
C
CTYPES : BEGIN OF ty_lfa1,
C lifnr LIKE lfa1-lifnr,
C name1 LIKE lfa1-name1,
CEND OF ty_lfa1.
C
CTYPES : BEGIN OF ty_adrc,
C ADDRNUMBER LIKE adrc-ADDRNUMBER,
C name1 LIKE adrc-name1,
CEND OF ty_adrc.
C
CTYPES : BEGIN OF ty_ekkn,
C ebeln LIKE ekkn-ebeln,
C ebelp LIKE ekkn-ebelp,
C sakto LIKE ekkn-sakto,
C kostl LIKE ekkn-kostl,
C aufnr LIKE ekkn-aufnr,
C vbeln LIKE ekkn-vbeln,
C vbelp LIKE ekkn-vbelp,
C anln1 LIKE ekkn-anln1,
C anln2 LIKE ekkn-anln2,
CEND OF ty_ekkn.
C
CTYPES : BEGIN OF ty_ekes,
C ebeln LIKE ekes-ebeln,
C ebelp LIKE ekes-ebelp,
C vbeln LIKE ekes-vbeln,
C vbelp LIKE ekes-vbelp,
C erdat LIKE ekes-erdat,
C eindt LIKE ekes-eindt,
CEND OF ty_ekes.
C
CTYPES : BEGIN OF ty_lips,
C vbeln LIKE lips-vbeln,
C posnr LIKE lips-posnr,
C lfimg LIKE lips-lfimg,
C meins LIKE lips-meins,
C lgort LIKE lips-lgort,
CEND OF ty_lips.
C
CTYPES : BEGIN OF ty_mseg,
C ebeln LIKE mseg-ebeln,
C ebelp LIKE mseg-ebelp,
C vbeln_im LIKE mseg-vbeln_im,
C vbelp_im LIKE mseg-vbelp_im,
C mblnr LIKE mseg-mblnr,
C smbln LIKE mseg-smbln,
C bwart LIKE mseg-bwart,
C budat_mkpf LIKE mseg-budat_mkpf,
C zeile LIKE mseg-zeile,
C erfmg LIKE mseg-erfmg,
C erfme LIKE mseg-erfme,
C sgtxt LIKE mseg-sgtxt,
C ablad LIKE mseg-ablad,
C meins LIKE mseg-meins,
C matnr LIKE mseg-matnr,
C lifnr LIKE mseg-lifnr,
C menge like mseg-menge,
C* meins like mseg-meins,
CEND OF ty_mseg.
C
CTYPES : BEGIN OF ty_mkpf,
C xblnr LIKE mkpf-xblnr,
C bktxt LIKE mkpf-bktxt,
C mblnr LIKE mkpf-mblnr,
C budat LIKE mkpf-budat,
CEND OF ty_mkpf.
C
CTYPES : BEGIN OF ty_itab,
C bsart LIKE eban-bsart,
C banfn LIKE eban-banfn,
C bnfpo LIKE eban-bnfpo,
C badat LIKE eban-badat,
C matnr LIKE eban-matnr,
C txz01 LIKE eban-txz01,
C werks LIKE eban-werks,
C lgort LIKE eban-lgort,
C menge TYPE p DECIMALS 2,
C meins LIKE eban-meins,
C ebeln LIKE ekpo-ebeln,
C ebelp LIKE ekpo-ebelp,
C aedat LIKE ekko-aedat,
C menge2 TYPE p DECIMALS 2,
C name1 LIKE lfa1-name1,
C mblnr LIKE mseg-mblnr,
C zeile LIKE mseg-zeile,
C budat_mkpf LIKE mseg-budat_mkpf,
C* menge3 LIKE mseg-menge,
C menge3 TYPE p DECIMALS 2,
C meins3 LIKE mseg-meins,
CEND OF ty_itab.
C
Cdata : begin of ty_t001 occurs 0.
C include structure t001.
Cdata : end of ty_t001.
C
Cdata : begin of ty_t001w occurs 0.
C include structure t001w.
Cdata : end of ty_t001w.
C
C*----------------------------------------------------------------------*
C* Global Internal Table
C*----------------------------------------------------------------------*
C*DATA:
C* gi_t161t TYPE TABLE OF ty_t161t,
C* gi_t024 TYPE TABLE OF ty_t024,
C* gi_cdpos TYPE TABLE OF ty_cdpos,
C* gi_cdposX TYPE TABLE OF ty_cdpos,
C* gi_cdhdr TYPE TABLE OF ty_cdhdr,
C* gi_cdhdrX TYPE TABLE OF ty_cdhdr,
C* gi_cdpos2 TYPE TABLE OF ty_cdpos,
C* gi_cdhdr2 TYPE TABLE OF ty_cdhdr,
CDATA: gi_mara TYPE TABLE OF ty_mara,
C gi_eket TYPE TABLE OF ty_eket,
C gi_eban TYPE TABLE OF ty_eban,
C gi_eket2 TYPE TABLE OF ty_eket,
C gi_ekpo TYPE TABLE OF ty_ekpo,
C gi_ekpo2 TYPE TABLE OF ty_ekpo,
C gi_ekko TYPE TABLE OF ty_ekko,
C gi_ekbe TYPE TABLE OF ty_ekbe,
C* gi_t161t_po TYPE TABLE OF ty_t161t,
C* gi_t024_po TYPE TABLE OF ty_t024,
C gi_lfa1 TYPE TABLE OF ty_lfa1,
C gi_ekkn TYPE TABLE OF ty_ekkn,
C gi_ekes TYPE TABLE OF ty_ekes,
C gi_lips TYPE TABLE OF ty_lips,
C gi_mseg TYPE TABLE OF ty_mseg,
C gi_msegB TYPE TABLE OF ty_mseg,
C gi_msegC TYPE TABLE OF ty_mseg,
C gi_mkpf TYPE TABLE OF ty_mkpf,
C gi_adrc TYPE TABLE OF ty_adrc,
C gi_itab TYPE TABLE OF ty_itab.
C
C*----------------------------------------------------------*
C* Global Work Area
C*----------------------------------------------------------*
C*DATA: gw_eban TYPE ty_eban,
C* gw_t161t TYPE ty_t161t,
C* gw_t024 TYPE ty_t024,
C* gw_cdpos TYPE ty_cdpos,
C* gw_cdposX TYPE ty_cdpos,
C* gw_cdhdr TYPE ty_cdhdr,
C* gw_cdhdrX TYPE ty_cdhdr,
C* gw_cdpos2 TYPE ty_cdpos,
C* gw_cdhdr2 TYPE ty_cdhdr,
CDATA: gw_mara TYPE ty_mara,
C gw_eket TYPE ty_eket,
C gw_eban TYPE ty_eban,
C gw_eket2 TYPE ty_eket,
C gw_ekpo TYPE ty_ekpo,
C gw_ekko TYPE ty_ekko,
C gw_ekbe TYPE ty_ekbe,
C gw_ekpo2 TYPE ty_ekpo,
C gw_ekpo3 TYPE ty_ekpo,
C gw_ekko2 TYPE ty_ekko,
C gw_ekko3 TYPE ty_ekko,
C* gw_t161t_po TYPE ty_t161t,
C* gw_t024_po TYPE ty_t024,
C gw_lfa1 TYPE ty_lfa1,
C gw_ekkn TYPE ty_ekkn,
C gw_ekes TYPE ty_ekes,
C gw_lips TYPE ty_lips,
C gw_mseg TYPE ty_mseg,
C gw_msegB TYPE ty_mseg,
C gw_msegC TYPE ty_mseg,
C gw_mkpf TYPE ty_mkpf,
C gw_adrc TYPE ty_adrc,
C gw_itab TYPE ty_itab.
C
C*----------------------------------------------------------*
C* Global Variable *
C*----------------------------------------------------------*
CDATA: gv_startdat LIKE vbak-audat.
CRANGES: gr_audat FOR vbak-audat.
C
CDATA : value LIKE MSEG-ERFMG.
CDATA : value2 LIKE MSEG-ERFMG.
C
CDATA: SPFLI_LINES TYPE I,
C GD_PERCENT TYPE I.
C
CDATA : seldate LIKE VTBBEWE-ATAGE.
C
CDATA : DATE1(10) TYPE C,
C DATE2(10) TYPE C.
C
CDATA : d_value(10) type c.
CDATA : d_value2(10) type c.
C
C*----------------------------------------------------------------------*
C*Input Screen/Selection
C*----------------------------------------------------------------------*
CSELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-101.
C
CSELECT-OPTIONS so_bsart FOR eban-bsart."OBLIGATORY.
CSELECT-OPTIONS so_banfn FOR eban-banfn. " OBLIGATORY.
CSELECT-OPTIONS so_badat FOR eban-badat OBLIGATORY.
CSELECT-OPTIONS so_matnr FOR eban-matnr.
CSELECT-OPTIONS so_werks FOR eban-werks.
C
CSELECTION-SCREEN END OF BLOCK block1.
C
C*----------------------------------------------------------------------*
C* START-OF-SELECTION.
C*----------------------------------------------------------------------*
CSTART-OF-SELECTION.
C PERFORM fm_init_data.
C PERFORM fm_collect_data.
C PERFORM fm_process_data.
C PERFORM fm_display_data.
C*----------------------------------------------------------------------*
C* END-OF-SELECTION.
C*----------------------------------------------------------------------*
CEND-OF-SELECTION.
C*&---------------------------------------------------------------------*
C*& Form FM_INIT_DATA
C*&---------------------------------------------------------------------*
C*& text
C*&---------------------------------------------------------------------*
C*& --> p1 text
C*& <-- p2 text
C*&---------------------------------------------------------------------*
CFORM FM_INIT_DATA .
C* IF so_badat AND so_werks IS INITIAL. " so_banfn IS INITIAL AND
C* CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
C* EXPORTING
C* titel = 'Error'
C* textline1 = 'Mohon Tanggal dan Plant di isi'
C* textline2 = ''
C* start_column = 25
C* start_row = 6.
C* LEAVE LIST-PROCESSING.
C* ENDIF.
CENDFORM.
C*&---------------------------------------------------------------------*
C*& Form FM_COLLECT_DATA
C*&---------------------------------------------------------------------*
C*& text
C*&---------------------------------------------------------------------*
C*& --> p1 text
C*& <-- p2 text
C*&---------------------------------------------------------------------*
CFORM FM_COLLECT_DATA .
C
C clear GI_EBAN.
C SELECT banfn
C bsart
C badat
C bnfpo
C ekgrp
C badat
C lfdat
C frgzu
C frggr
C werks
C lgort
C ebakz pstyp knttp matnr txz01 menge meins
C INTO CORRESPONDING FIELDS OF TABLE gi_eban
C FROM eban
C WHERE banfn IN so_banfn
C AND badat IN so_badat
C AND bsart IN so_bsart
C AND matnr IN SO_MATNR
C AND WERKS IN SO_WERKS
C AND loekz EQ ''.
C IF SY-SUBRC IS INITIAL.
C
C CLEAR GI_EKET.
C SELECT banfn bnfpo ebeln ebelp eindt
C INTO CORRESPONDING FIELDS OF TABLE gi_eket
C FROM eket
C FOR ALL ENTRIES IN gi_eban
C WHERE banfn EQ gi_eban-banfn
C AND bnfpo EQ gi_eban-bnfpo.
C
C CLEAR GI_EKET2.
C gi_eket2[] = gi_eket[].
C
C CLEAR GI_EKPO.
C SELECT ebeln ebelp loekz abskz ktmng meins netpr peinh netwr banfn bnfpo anfnr
anfps pstyp knttp werks menge elikz bstae brtwr mwskz
C INTO CORRESPONDING FIELDS OF TABLE gi_ekpo
C FROM ekpo
C FOR ALL ENTRIES IN gi_eket
C WHERE ebeln = gi_eket-ebeln.
C
C CLEAR GI_EKKO.
C SELECT ebeln bedat waers ekgrp bsart lifnr frgsx frgzu aedat
C INTO CORRESPONDING FIELDS OF TABLE gi_ekko
C FROM ekko
C FOR ALL ENTRIES IN gi_ekpo
C WHERE ebeln = gi_ekpo-ebeln.
C
C CLEAR GI_LFA1.
C SELECT lifnr name1
C INTO CORRESPONDING FIELDS OF TABLE gi_lfa1
C FROM lfa1
C FOR ALL ENTRIES IN gi_ekko
C WHERE lifnr = gi_ekko-lifnr.
C
C CLEAR GI_MSEG.
C SELECT ebeln ebelp vbeln_im vbelp_im mblnr smbln bwart budat_mkpf zeile erfmg
erfme sgtxt ablad menge meins
C INTO CORRESPONDING FIELDS OF TABLE gi_mseg
C FROM mseg
C FOR ALL ENTRIES IN gi_ekpo
C WHERE ebeln = gi_ekpo-ebeln
C AND ebelp = gi_ekpo-ebelp.
C
C CLEAR GI_MKPF.
C SELECT xblnr bktxt mblnr
C INTO CORRESPONDING FIELDS OF TABLE gi_mkpf
C FROM mkpf
C FOR ALL ENTRIES IN gi_mseg
C WHERE mblnr = gi_mseg-mblnr.
C
C ELSE.
C MESSAGE 'Data not found' TYPE 'I' DISPLAY LIKE 'E'.
C LEAVE LIST-PROCESSING.
C ENDIF.
C
CENDFORM.
C
C*&---------------------------------------------------------------------*
C*& Form fm_process_data
C*&---------------------------------------------------------------------*
C*& text
C*&---------------------------------------------------------------------*
C*& --> p1 text
C*& <-- p2 text
C*&---------------------------------------------------------------------*
CFORM fm_process_data .
C
C DATA : VALUE1 LIKE WMTO_S-AMOUNT.
C DATA : VALUE2 LIKE WMTO_S-AMOUNT.
C
C CLEAR GW_EBAN.
C
C LOOP AT GI_EBAN INTO GW_EBAN.
C
C CLEAR GW_EKET.
C
C READ TABLE GI_EKET INTO GW_EKET WITH KEY BANFN = GW_EBAN-BANFN.
C* IF SY-SUBRC IS INITIAL.
C
C gw_itab-banfn = gw_eban-banfn. "PR Number
C gw_itab-bsart = gw_eban-bsart.
C
C CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
C EXPORTING
C INPUT = gw_eban-bnfpo
C IMPORTING
C OUTPUT = gw_eban-bnfpo.
C MOVE gw_eban-bnfpo to gw_itab-bnfpo. " PR Item
C
C gw_itab-badat = gw_eban-badat.
C gw_itab-matnr = gw_eban-matnr.
C shift gw_itab-matnr left deleting leading '0'.
C gw_itab-txz01 = gw_eban-txz01.
C gw_itab-werks = gw_eban-werks.
C gw_itab-lgort = gw_eban-lgort.
C gw_itab-menge = gw_eban-menge.
C gw_itab-meins = gw_eban-meins.
C CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT' "Conversion exit for commercial
(3-char) measurement unit OUTPUT
C EXPORTING
C input = gw_itab-meins
C IMPORTING
C output = gw_itab-meins
C EXCEPTIONS
C UNIT_NOT_FOUND = 1.
C
C CLEAR GW_EKPO.
C
C LOOP AT GI_EKPO INTO GW_EKPO WHERE EBELN EQ GW_EKET-EBELN AND EBELP EQ
GW_EKET-EBELP and LOEKZ eq ''.
C
C IF SY-SUBRC EQ '0'.
C
C gw_itab-ebeln = gw_ekpo-ebeln.
C gw_itab-ebelp = gw_ekpo-ebelp.
C gw_itab-menge2 = gw_ekpo-menge.
C
C CLEAR GW_EKKO.
C
C READ TABLE GI_EKKO INTO GW_EKKO WITH KEY EBELN = GW_EKPO-EBELN.
C IF SY-SUBRC IS INITIAL.
C
C gw_itab-aedat = gw_ekko-aedat.
C ENDIF.
C
C CLEAR GW_LFA1.
C
C READ TABLE gi_lfa1 with key lifnr = gw_ekko-lifnr into gw_lfa1.
C IF SY-SUBRC IS INITIAL.
C gw_itab-name1 = gw_lfa1-name1.
C ENDIF.
C
C CLEAR GW_MSEG.
C
C LOOP AT GI_MSEG INTO GW_MSEG WHERE EBELN EQ gw_ekpo-ebeln AND EBELP EQ
gw_ekpo-ebelp.
C IF sy-subrc EQ '0'.
C gw_itab-mblnr = gw_mseg-mblnr.
C gw_itab-zeile = gw_mseg-zeile.
C gw_itab-budat_mkpf = gw_mseg-budat_mkpf.
C gw_itab-menge3 = gw_mseg-menge.
C gw_itab-meins3 = gw_mseg-meins.
C CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT' "Conversion exit for
commercial (3-char) measurement unit OUTPUT
C EXPORTING
C input = gw_itab-meins3
C IMPORTING
C output = gw_itab-meins3
C EXCEPTIONS
C UNIT_NOT_FOUND = 1.
C
C ENDIF.
C
C ENDLOOP.
C
C ENDIF.
C
C
C ENDLOOP.
C APPEND GW_ITAB TO GI_ITAB.
C CLEAR GW_ITAB.
C* ENDIF.
C
C ENDLOOP.
C
CBREAK ABAPER01.
CENDFORM.
C*&---------------------------------------------------------------------*
C*& Form FM_DISPLAY_DATA
C*&---------------------------------------------------------------------*
C*& text
C*&---------------------------------------------------------------------*
C*& --> p1 text
C*& <-- p2 text
C*&---------------------------------------------------------------------*
CFORM FM_DISPLAY_DATA .
C PERFORM fm_alv TABLES gi_itab.
CENDFORM.
C
C
CFORM fm_alv TABLES ft_report.
C
C PERFORM fm_gui_message USING 'Write Data in Progress ...' ''.
C PERFORM fm_clear_alv_data.
C break wis_abap01.
C PERFORM fm_build_fieldcat. "custom fieldcatalog subroutine to handle coloring
cell
C PERFORM fm_build_layout USING d_layout.
C PERFORM fm_build_sortfield USING t_alv_isort[].
C PERFORM set_cell_colours. "set cell color
C PERFORM header_build USING gt_list_top_of_page[]. "for ALV Grid
C
C PERFORM fm_build_event TABLES t_alv_event[].
C PERFORM fm_build_event_exit.
C PERFORM fm_build_print USING d_print.
C
C
C CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
C EXPORTING
C
C i_callback_program = d_repid
C i_callback_pf_status_set = 'F_SET_PF_STATUS'
C I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
C is_layout = d_layout
C it_fieldcat = t_alv_fieldcat[]
C it_sort = t_alv_isort[]
C i_default = 'X'
C i_save = 'A'
C is_variant = d_alv_variant
C it_events = t_alv_event[]
C it_event_exit = t_event_exit[]
C is_print = d_print
C TABLES
C t_outtab = ft_report
C EXCEPTIONS
C program_error = 1
C OTHERS = 2
C .
C IF sy-subrc <> 0.
C* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
C* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
C ENDIF.
C
CENDFORM. " f_alv
C
C
C
C*&---------------------------------------------------------------------*
C*& Form fm_gui_message
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* -->fu_text1 text
C* -->fu_text2 text
C*----------------------------------------------------------------------*
CFORM fm_gui_message USING fu_text1 fu_text2.
C DATA: ld_text1(100) TYPE c.
C
C CONCATENATE fu_text1 fu_text2 INTO ld_text1
C SEPARATED BY space.
C CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
C EXPORTING
C percentage = 0
C text = ld_text1.
CENDFORM. " fm_gui_message
C*&---------------------------------------------------------------------*
C
C*&---------------------------------------------------------------------*
C*& Form fm_clear_alv_data
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* --> p1 text
C* <-- p2 text
C*----------------------------------------------------------------------*
CFORM fm_clear_alv_data.
C CLEAR:t_alv_fieldcat,
C t_alv_event,
C t_events,
C t_alv_isort,
C t_alv_filter,
C t_event_exit,
C d_alv_isort,
C d_alv_variant,
C d_alv_list_scroll,
C d_alv_sort_postn,
C d_alv_keyinfo,
C d_alv_fieldcat,
C d_alv_formname,
C d_alv_ucomm,
C d_alv_print,
C d_alv_repid,
C d_alv_tabix,
C d_alv_subrc,
C d_alv_screen_start_column,
C d_alv_screen_start_line,
C d_alv_screen_end_column,
C d_alv_screen_end_line,
C d_alv_layout,
C d_layout,
C d_repid,
C d_print.
C
C
C REFRESH: t_alv_fieldcat,
C t_alv_event,
C t_events,
C t_alv_isort,
C t_alv_filter,
C t_event_exit.
C
C d_repid = sy-repid.
CENDFORM. " fm_clear_alv_data
C
C*&---------------------------------------------------------------------*
C*& Form fm_build_fieldcat
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
CFORM fm_build_fieldcat.
C DATA: ld_fieldcat TYPE slis_fieldcat_alv.
C CLEAR: ld_fieldcat.
C DATA: lv_pos type i.
C CLEAR lv_pos.
C lv_pos = 1.
C
C ld_fieldcat-fieldname = 'BSART'.
C ld_fieldcat-seltext_m = 'PR Type'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'BANFN'.
C ld_fieldcat-seltext_m = 'PR Number'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'BNFPO'.
C ld_fieldcat-seltext_m = 'PR Item'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C* ld_fieldcat-key = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C
C ld_fieldcat-fieldname = 'BADAT'.
C ld_fieldcat-seltext_m = 'PR Date'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C* ld_fieldcat-key = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'MATNR'.
C ld_fieldcat-seltext_m = 'Material Number'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C* ld_fieldcat-key = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'TXZ01'.
C ld_fieldcat-seltext_m = 'Material Descriptions'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C* ld_fieldcat-key = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C
C ld_fieldcat-fieldname = 'WERKS'.
C ld_fieldcat-seltext_m = 'Plant'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'LGORT'.
C ld_fieldcat-seltext_m = 'Sloc'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'MENGE'.
C ld_fieldcat-seltext_m = 'PR Qty'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C ld_fieldcat-QFIELDNAME = 'MEINS'.
C ld_fieldcat-QTABNAME = 'GI_ITAB'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'MEINS'.
C ld_fieldcat-seltext_m = 'PR Unit'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'EBELN'.
C ld_fieldcat-seltext_m = 'PO Number'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'EBELP'.
C ld_fieldcat-seltext_m = 'PO Item'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'AEDAT'.
C ld_fieldcat-seltext_m = 'PO Date'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'MENGE2'.
C ld_fieldcat-seltext_m = 'PO QTY'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'NAME1'.
C ld_fieldcat-seltext_m = 'Vendor'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'MBLNR'.
C ld_fieldcat-seltext_m = 'GR Number'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'ZEILE'.
C ld_fieldcat-seltext_m = 'GR Item'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'BUDAT_MKPF'.
C ld_fieldcat-seltext_m = 'GR Date'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'MENGE3'.
C ld_fieldcat-seltext_m = 'GR QTY'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C ld_fieldcat-QFIELDNAME = 'MEINS3'.
C ld_fieldcat-QTABNAME = 'GI_ITAB'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
C ld_fieldcat-fieldname = 'MEINS3'.
C ld_fieldcat-seltext_m = 'GR Unit'.
C ld_fieldcat-col_pos = lv_pos.
C ld_fieldcat-fix_column = 'X'.
C ld_fieldcat-intlen = 'X'.
C APPEND ld_fieldcat TO t_alv_fieldcat.
C CLEAR ld_fieldcat.
C lv_pos = lv_pos + 1.
C
CENDFORM. " fm_build_fieldcat
C
C*&---------------------------------------------------------------------*
C*& Form fm_build_layout
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* -->FU_LAYOUT text
C*----------------------------------------------------------------------*
CFORM fm_build_layout USING fu_layout TYPE slis_layout_alv.
C* fu_layout-f2code = '&ETA'.
C fu_layout-zebra = 'X'.
C fu_layout-colwidth_optimize = 'X'.
C fu_layout-no_colhead = space.
C fu_layout-group_change_edit = 'X'.
C* fu_layout-coltab_fieldname = 'CELL_COLOR'. "coloring cell
CENDFORM. " fm_build_layout
C
C*&---------------------------------------------------------------------*
C*& Form fm_build_sortfield
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* -->FU_SORT text
C*----------------------------------------------------------------------*
CFORM fm_build_sortfield USING fu_sort TYPE slis_t_sortinfo_alv.
C DATA: ld_sort TYPE slis_sortinfo_alv.
C
C ld_sort-fieldname = 'BSART'.
C ld_sort-up = 'X'.
C append ld_sort to fu_sort.
C
C ld_sort-fieldname = 'BANFN'.
C ld_sort-up = 'X'.
C append ld_sort to fu_sort.
C
C ld_sort-fieldname = 'EBELN'.
C ld_sort-up = 'X'.
C append ld_sort to fu_sort.
C
C ld_sort-fieldname = 'MBLNR'.
C ld_sort-up = 'X'.
C append ld_sort to fu_sort.
C
C* ld_sort-fieldname = 'NAME1'.
C* ld_sort-up = 'X'.
C* append ld_sort to fu_sort.
C
C
CENDFORM. " fm_build_sortfield
C
C*&---------------------------------------------------------------------*
C*& Form fm_build_event
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* --> FT_EVENTS
C*----------------------------------------------------------------------*
CFORM fm_build_event TABLES ft_events LIKE t_events.
C REFRESH: ft_events.
C CLEAR ft_events.
C ft_events-name = slis_ev_top_of_page.
C ft_events-form = 'FM_TOP_OF_PAGE'.
C APPEND ft_events.
C
CENDFORM. " fm_build_event
C
C*&---------------------------------------------------------------------*
C*& Form fm_build_event_exit
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* --> p1 text
C* <-- p2 text
C*----------------------------------------------------------------------*
CFORM fm_build_event_exit.
C CLEAR t_event_exit.
C t_event_exit-ucomm = '&OUP'.
C t_event_exit-after = 'X'.
C APPEND t_event_exit.
C
C CLEAR t_event_exit.
C t_event_exit-ucomm = '&ODN'.
C t_event_exit-after = 'X'.
C APPEND t_event_exit.
CENDFORM. " fm_build_event_exit
C
C*&---------------------------------------------------------------------*
C*& Form fm_build_print
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* -->FU_PRINT text
C*----------------------------------------------------------------------*
CFORM fm_build_print USING fu_print TYPE slis_print_alv.
C "fu_print-no_print_listinfos = 'X'.
C "fu_print-no_print_selinfos = 'X'.
C fu_print-no_coverpage = 'X'.
C fu_print-no_print_hierseq_item = 'X'.
CENDFORM. " fm_build_print
C
C*---------------------------------------------------------------------*
C* FORM fm_top_of_page *
C*---------------------------------------------------------------------*
C* ........ *
C*---------------------------------------------------------------------*
CFORM fm_top_of_page.
C
C
C*-------- if using ALV grid
C CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
C EXPORTING "I_LOGO = 'Z_LOGO_GJ'
C i_logo = 'ZBARATALOGO'
C it_list_commentary = gt_list_top_of_page.
C
CENDFORM. "fm_top_of_page
C
C*&---------------------------------------------------------------------*
C*& Form header_build
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* -->P_GT_LIST_TOP_OF_PAGE[] text
C*----------------------------------------------------------------------*
CFORM header_build USING lt_top_of_page TYPE
C slis_t_listheader.
C DATA: ls_line TYPE slis_listheader,
C gltrpl(10), gltrph(10),
C print_tm(8), name1 LIKE t001w-name1.
C
C DATA : lv_ch_jml_nota TYPE char30,
C lv_dash TYPE char2.
C
C DATA : lv_datex TYPE C LENGTH 10.
C DATA : lv_dateY TYPE C LENGTH 10.
C DATA : lv_dateZ TYPE C LENGTH 10.
C
C*if so_bukrs is not initial.
C*
C* select * into table ty_t001 from t001
C* where bukrs eq so_bukrs-low.
C*
C* read table ty_t001 index 1.
C*
C* ls_line-typ = 'H'.
C* ls_line-info = ''.
C* concatenate ls_line-info ty_t001-butxt
C* into ls_line-info
C* separated by ' '.
C* append ls_line to lt_top_of_page.
C*endif.
C
C
C
C CLEAR ls_line.
C ls_line-typ = 'H'.
C ls_line-info = 'Report Tracking Procurement'.
C IF ls_line-info IS NOT INITIAL.
C APPEND ls_line TO lt_top_of_page.
C ENDIF.
C
C if so_werks is not initial.
C
C select * into table ty_t001w from t001w
C where werks eq so_werks-low.
C
C read table ty_t001w index 1.
C
C ls_line-typ = 'S'.
C ls_line-info = ''.
C concatenate ls_line-info ty_t001w-name1
C into ls_line-info
C separated by ' '.
C append ls_line to lt_top_of_page.
Cendif.
C
C CLEAR ls_line.
C ls_line-typ = 'S'.
C ls_line-info = 'Print time: '.
C WRITE sy-uzeit TO print_tm USING EDIT MASK '__:__:__'.
C CONCATENATE ls_line-info print_tm INTO ls_line-info SEPARATED BY space.
C IF ls_line-info IS NOT INITIAL.
C APPEND ls_line TO lt_top_of_page.
C ENDIF.
C
C
C CLEAR ls_line.
C ls_line-typ = 'S'.
C ls_line-info = 'User name: '.
C WRITE sy-uzeit TO print_tm USING EDIT MASK '__:__:__'.
C CONCATENATE ls_line-info sy-uname INTO ls_line-info SEPARATED BY space.
C IF ls_line-info IS NOT INITIAL.
C APPEND ls_line TO lt_top_of_page.
C ENDIF.
C
CENDFORM. " header_build
C*&---------------------------------------------------------------------*
C*& Form f_set_pf_status
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* -->RT_EXTAB text
C*----------------------------------------------------------------------*
CFORM f_set_pf_status USING rt_extab TYPE slis_t_extab.
C SET PF-STATUS 'ZSTANDARD'.
CENDFORM. " F_SET_PF_STATUS
C
C*&---------------------------------------------------------------------*
C*& Form SET_CELL_COLOURS
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* --> p1 text
C* <-- p2 text
C*----------------------------------------------------------------------*
CFORM set_cell_colours .
C* DATA : lv_index TYPE i,
C* lv_max_row TYPE i.
C*
C* lv_max_row = lines( gi_itab ).
C*
C
CENDFORM. " SET_CELL_COLOURS
C
C*&---------------------------------------------------------------------*
C*& Form FM_TAMPILKAN_PESAN
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* -->P_GV_TITLE text
C* -->P_GV_TXT1 text
C* -->P_GV_TXT2 text
C* -->P_GV_TXT3 text
C* -->P_GV_TXT4 text
C*----------------------------------------------------------------------*
CFORM fm_tampilkan_pesan USING p_gv_title
C p_gv_txt1
C p_gv_txt2
C p_gv_txt3
C p_gv_txt4.
C CALL FUNCTION 'POPUP_TO_INFORM'
C EXPORTING
C titel = p_gv_title
C txt1 = p_gv_txt1
C txt2 = p_gv_txt2
C txt3 = p_gv_txt3
C txt4 = p_gv_txt4.
CENDFORM. " FM_TAMPILKAN_PESAN
C
C
C*&---------------------------------------------------------------------*
C*& Form F4IF_INT_TABLE_VALUE_REQUEST2
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* --> p1 text
C* <-- p2 text
C*----------------------------------------------------------------------*
Cform f4if_int_table_value_request2.
C
C
Cendform. " F4IF_INT_TABLE_VALUE_REQUEST2
C
C
C*&---------------------------------------------------------------------*
C*& Form F_USER_COMMAND
C*&---------------------------------------------------------------------*
C* text
C*----------------------------------------------------------------------*
C* --> p1 text
C* <-- p2 text
C*----------------------------------------------------------------------*
Cform f_user_command using r_ucomm type sy-ucomm
C sel_field type slis_selfield.
C
Cendform. " F_USER_COMMAND
C
C*&---------------------------------------------------------------------*
C*& Form PROGRESS_BAR
C*&---------------------------------------------------------------------*
CFORM PROGRESS_BAR USING P_VALUE
C P_TABIX
C P_NLINES.
C DATA: W_TEXT(40),
C W_PERCENTAGE TYPE P,
C W_PERCENT_CHAR(3).
C
C if P_NLINES eq 0.
C P_NLINES = 1.
C endif.
C
C W_PERCENTAGE = ( P_TABIX / P_NLINES ) * 100.
C W_PERCENT_CHAR = W_PERCENTAGE.
C SHIFT W_PERCENT_CHAR LEFT DELETING LEADING ' '.
C CONCATENATE P_VALUE W_PERCENT_CHAR '% Complete'(002) INTO W_TEXT.
C
C IF W_PERCENTAGE GT GD_PERCENT OR P_TABIX EQ 1.
C CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
C EXPORTING
C PERCENTAGE = W_PERCENTAGE
C TEXT = W_TEXT.
C GD_PERCENT = W_PERCENTAGE.
C ENDIF.
CENDFORM. " PROGRESS_BAR