*&---------------------------------------------------------------------*
*& Report ZVVF_MR001_TOCTROI *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZVVF_MR001_TOCTROI
NO STANDARD PAGE HEADING LINE-SIZE 215 LINE-COUNT 30(3).
*---------------------------------------------------------------------**
* MODULE MM.
**---------------------------------------------------------------------*
* Objective : REPORT ON DETAILS OF VARIOUS COST INCURRED DURING
* PURHASE
** Program : Updates Tables ( ) Downloads data ( ) **
* Outputs List ( ) **
* Technical Spec No
* Date Created 25/01/2005
*** Author
* Developer
*** Location **
* LDB .....
**---------------------------------------------------------------------*
* External Dependencies
**---------------------------------------------------------------------*
*
**---------------------------------------------------------------------*
* Amendment History
**---------------------------------------------------------------------*
* Who Change ID Reason
*** ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*---------------------------------------------------------------------**
*---------------------------------------------------------------------**
* Includes
**---------------------------------------------------------------------*
*----------------------------------------------------------------------*
* Type-pools
*----------------------------------------------------------------------*
TYPE-POOLS :
slis.
**---------------------------------------------------------------------*
* Tables
**---------------------------------------------------------------------*
TABLES: ekko, "PURCHASING DOC. HEADER
ekpo, "PURCHASING DOC. ITEM
mara, "MATERIAL MASTER
makt, "MATERIAL DISCRIPTION
lfa1, "VENDOR MASTER
rseg, "DOC. ITEM - INCOMING INVOICE
rbkp, "DOC. HEADER - INVOICE RECEIPT
konv. "CONDITION (TRANSECTION DATA - CLUSTER TABLE)
**---------------------------------------------------------------------*
* Types Begin with TY_
**---------------------------------------------------------------------*
TYPES: BEGIN OF ty_head ,
ebeln LIKE ekko-ebeln,
aedat LIKE ekko-aedat,
lifnr LIKE ekko-lifnr,
knumv LIKE ekko-knumv,
name1 LIKE lfa1-name1,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
maktx LIKE makt-maktx,
alifnr LIKE rseg-lifnr,
belnr LIKE rseg-belnr , "for RSEG-KSCHL= "ZOCM"
wrbtr LIKE rseg-wrbtr,
bldat LIKE rbkp-bldat,
cwrbtr LIKE rseg-wrbtr, " when RSEG-KSCHL="ZOCM"
bktxt LIKE rbkp-bktxt,
kschl like rseg-kschl,
XBLNR LIKE RBKP-XBLNR,
temp,
END OF ty_head.
TYPES : BEGIN OF ty_rseg,
belnr LIKE rseg-belnr,
wrbtr LIKE rseg-wrbtr,
lifnr LIKE rseg-lifnr,
ebeln LIKE rseg-ebeln,
ebelp LIKE rseg-ebelp,
kschl LIKE rseg-kschl,
END OF ty_rseg.
TYPES : BEGIN OF ty_rbkp,
belnr LIKE rseg-belnr,
bldat LIKE rbkp-bldat,
bktxt LIKE rbkp-bktxt,
END OF ty_rbkp.
TYPES : BEGIN OF ty_HEAD1,
LIFNR LIKE EKKO-LIFNR,
AEDAT LIKE EKKO-AEDAT,
END OF ty_HEAD1.
**---------------------------------------------------------------------*
* Constants Begin with C_
**---------------------------------------------------------------------*
CONSTANTS: st_formname_top_of_page TYPE slis_formname
VALUE 'TOP_OF_PAGE-ALV'.
**---------------------------------------------------------------------*
* Data Begin with W_
**---------------------------------------------------------------------*
* Declarations for ALV Grid.
DATA: it_st_list_top_of_page TYPE slis_t_listheader,
it_st_fieldcat TYPE slis_t_fieldcat_alv,
it_st_events TYPE slis_t_event,
st_layout TYPE slis_layout_alv,
s_status TYPE slis_formname VALUE 'STANDARD_ST01',
s_user_command TYPE slis_formname VALUE 'USER_COMMAND-ALV',
s_repid LIKE sy-repid,
s_save(1) TYPE c,
s_variant LIKE disvariant,
code LIKE disvariant-handle.
**---------------------------------------------------------------------*
* Internal tables Begin with IT_
**---------------------------------------------------------------------*
DATA : it_head TYPE STANDARD TABLE OF ty_head WITH HEADER LINE.
DATA : it_rseg TYPE STANDARD TABLE OF ty_rseg WITH HEADER LINE.
DATA : it_rbkp TYPE STANDARD TABLE OF ty_rbkp WITH HEADER LINE.
DATA : it_head1 TYPE STANDARD TABLE OF ty_head1 WITH HEADER LINE.
**---------------------------------------------------------------------*
* R A N G E S
**---------------------------------------------------------------------*
ranges: r_loekz for ekko-loekz. " Deletion Indicator
**---------------------------------------------------------------------*
* Select Options Begin with SO_
**---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 3.
SELECT-OPTIONS : so_ebeln FOR ekko-ebeln.
SELECT-OPTIONS : so_aedat FOR ekko-aedat OBLIGATORY.
SELECT-OPTIONS : so_lifnr FOR ekko-lifnr.
SELECT-OPTIONS : SO_kschl FOR rseg-kschl default 'ZOCM' obligatory.
SELECTION-SCREEN SKIP 2.
selection-screen: skip,
begin of line,
comment (15) text-034.
parameters: p_all radiobutton group del.
selection-screen comment 25(9) for field p_all.
parameters: p_del radiobutton group del.
selection-screen comment 45(12) for field p_del.
parameters: p_undel radiobutton group del default 'X'.
selection-screen comment 65(14) for field p_undel.
selection-screen end of line.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN END OF BLOCK MAIN.
**---------------------------------------------------------------------*
* Initialisation
**---------------------------------------------------------------------*
INITIALIZATION.
s_repid = sy-repid.
s_save = 'A'.
PERFORM eventtab_build USING it_st_events[].
PERFORM variant_init.
**---------------------------------------------------------------------*
* AT SELECTION SCREEN
**---------------------------------------------------------------------*
AT SELECTION-SCREEN.
*DATA : TEMP(1) TYPE C.
*
*TEMP = SO_KSCHL-LOW+0(1).
*
*IF TEMP NE 'Z'.
*
* MESSAGE E001(ZMSG_M01_OCTROI) with temp.
*
*ENDIF.
************************************************************************
* S T A R T O F S E L E C T I O N
************************************************************************
START-OF-SELECTION.
PERFORM initialize.
PERFORM get_data.
*---alv
PERFORM comment_build USING it_st_list_top_of_page[].
PERFORM fieldcat USING it_st_fieldcat[].
PERFORM layout_build USING st_layout.
PERFORM reuse_alv_list_display.
***********************************************************************
* E N D O F S E L E C T I O N
***********************************************************************
END-OF-SELECTION.
************************************************************************
* FORM : I N I T I A L I Z E
************************************************************************
form initialize.
clear: r_loekz.
refresh: r_loekz.
*----ALL TYPE
if p_all = 'X'.
r_loekz-sign = 'I'.
r_loekz-option = 'EQ'.
r_loekz-low = ' '.
r_loekz-high = 'L'.
append r_loekz.
endif.
*--- Deleted PO's only
if p_del = 'X'.
r_loekz-sign = 'I'.
r_loekz-option = 'EQ'.
r_loekz-low = 'L'.
r_loekz-high = 'L'.
append r_loekz.
endif.
*--- UnDeleted PO's only
if p_undel = 'X'.
r_loekz-sign = 'E'.
r_loekz-option = 'EQ'.
r_loekz-low = ' '.
r_loekz-high = ' '.
append r_loekz.
endif.
endform. "initialize
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
FORM get_data.
*--------- GET DATA FROM TABLE EKKO, EKPO, LFA1, MAKT, RSEG
*--------- BASE TABLE IS RSEG (PO NO)
SELECT
A~BELNR A~WRBTR A~EBELN A~EBELP A~MATNR A~KSCHL
B~AEDAT B~LIFNR B~EBELN
C~BLDAT C~BKTXT C~XBLNR
D~MAKTX
E~NAME1
f~loekz F~EBELN
INTO CORRESPONDING FIELDS OF TABLE IT_HEAD
FROM RSEG AS A INNER JOIN EKKO AS B
ON A~EBELN = B~EBELN
INNER JOIN RBKP AS C
ON A~BELNR = C~BELNR and a~GJAHR = c~GJAHR
INNER JOIN MAKT AS D
ON A~MATNR = D~MATNR
INNER JOIN LFA1 AS E
ON a~LIFNR = E~LIFNR
inner join ekpo as f
on A~ebeln = f~ebeln and a~ebelp = f~ebelp
WHERE
A~EBELN IN SO_EBELN
AND A~KSCHL IN SO_KSCHL
AND a~LIFNR IN SO_LIFNR
and B~AEDAT IN SO_AEDAT
AND f~LOEKZ between R_LOEKZ-low and R_LOEKZ-high.
IF SY-SUBRC <> 0.
MESSAGE 'Record Not Found.' Type 'I'.
ENDIF.
SELECT LIFNR WRBTR EBELN EBELP
INTO CORRESPONDING FIELDS OF TABLE IT_RSEG
FROM RSEG
FOR ALL ENTRIES IN IT_HEAD
WHERE EBELN = IT_HEAD-EBELN
AND EBELP = IT_HEAD-EBELP
AND KSCHL = IT_HEAD-KSCHL.
LOOP AT it_head.
shift it_head-MATNR left deleting leading '0'.
modify it_HEAD.
shift it_head-lifnr left deleting leading '0'.
modify it_HEAD.
it_head-temp = sy-tabix.
MODIFY it_head TRANSPORTING temp.
READ TABLE it_rseg WITH KEY ebeln = it_head-ebeln.
shift it_RSEG-LIFNR left deleting leading '0'.
modify it_head.
IF sy-subrc = 0.
it_head-alifnr = it_rseg-lifnr.
it_head-CWRBTR = it_rseg-WRBTR.
MODIFY it_head TRANSPORTING alifnr CWRBTR.
ENDIF.
ENDLOOP.
ENDFORM. "GET_DATA
*&---------------------------------------------------------------------*
*& Form COMMENT_BUILD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM comment_build USING p_it_st_list_top_of_page TYPE slis_t_listheader .. DATA: ls_line TYPE slis_listheader. data : lw_head(60) type c value 'Payment Details To Vendors'. data : mix_ebeln(40) type c, mixebeln(40) type c, mix_aedat(40) type c, mixaedat(50) type c, mixaedat1(40) type c, mixaedat2(40) type c, mix_lifnr(40) type c, mixlifnr(40) type c, mixkschl(40) type c. REFRESH p_it_st_list_top_of_page. CLEAR ls_line. ls_line-typ = 'H'. ls_line-info = lw_head. APPEND ls_line TO p_it_st_list_top_of_page. *----- Display Document No. concatenate so_ebeln-low ' - ' so_ebeln-high into mix_ebeln SEPARATED BY SPACE. concatenate 'Document. No. :' ' ' mix_ebeln into mixebeln SEPARATED BY SPACE . ls_line-typ = 'S'. ls_line-info = mixebeln. APPEND ls_line TO p_it_st_list_top_of_page. data : m1_low(10) type c, m1_high(10) type c. . *----- Display Document Date concatenate so_aedat-low ' - ' so_aedat-high into mix_aedat. *SEPARATED BY SPACE. split mix_aedat at '-' into m1_low m1_high. concatenate m1_low+6(2) '.' m1_low+4(2) '.' m1_low+0(4) into mixaedat1 . concatenate m1_high+6(2) '.' m1_high+4(2) '.' m1_high+0(4) into mixaedat2 . concatenate 'Document. Date :' ' ' mixaedat1 '-' mixaedat2 into mixaedat SEPARATED BY SPACE. * ls_line-typ = 'S'. ls_line-info = mixaedat. APPEND ls_line TO p_it_st_list_top_of_page. *mix_aedat = so_aedat-low edit mask '--/--/--'. *----- Display Vendor concatenate so_lifnr-low ' - ' so_lifnr-high into mix_lifnr SEPARATED BY SPACE. concatenate 'Vendor :' ' ' mix_lifnr into mixlifnr SEPARATED BY SPACE. ls_line-typ = 'S'. ls_line-info = mixlifnr. APPEND ls_line TO p_it_st_list_top_of_page. *----- Display Vendor concatenate 'Condition Type :' ' ' SO_kschl-low '-' so_kschl-high into mixkschl SEPARATED BY SPACE. ls_line-typ = 'S'. ls_line-info = mixkschl. APPEND ls_line TO p_it_st_list_top_of_page. ENDFORM. " COMMENT_BUILD *&--------------------------------------------------------------------* *& Form TOP_OF_PAGE-ALV *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* FORM top_of_page-alv. * CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = it_st_list_top_of_page. ENDFORM. "TOP_OF_PAGE-ALV *&---------------------------------------------------------------------* *& Form FIELDCAT *&---------------------------------------------------------------------* * -->P_IT_ST_FIELDCAT[] text
*----------------------------------------------------------------------*
FORM fieldcat USING p_it_st_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'TEMP'.
ls_fieldcat-datatype = 'sy-tabix'.
ls_fieldcat-outputlen = 5.
ls_fieldcat-seltext_m = 'S.No'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'EBELN'.
* ls_fieldcat-rollname = 'PO NO'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 10.
ls_fieldcat-seltext_m = 'Purchase Order No'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'EBELP'.
ls_fieldcat-rollname = 'EBELP'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 5.
ls_fieldcat-seltext_m = 'PO LINE ITEM'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'AEDAT'.
* ls_fieldcat-rollname = 'AEDAT'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 8.
ls_fieldcat-seltext_m = TEXT-002.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'LIFNR'.
ls_fieldcat-rollname = 'LIFNR'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 10.
ls_fieldcat-seltext_m = 'VENDOR NO'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'NAME1'.
* ls_fieldcat-rollname = 'NAME1'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 35.
ls_fieldcat-seltext_m = 'Vendor Name'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-rollname = 'MATNR'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 18.
ls_fieldcat-seltext_m = 'MATERIAL NO'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MAKTX'.
ls_fieldcat-rollname = 'MAKTX'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 40.
ls_fieldcat-seltext_m = 'MATERIAL DISC.'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'ALIFNR'.
ls_fieldcat-rollname = 'ALIFNR'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 10.
ls_fieldcat-seltext_m = 'Agent No.'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'BELNR'.
ls_fieldcat-rollname = 'BELNR'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 10.
ls_fieldcat-seltext_m = 'Invoice No.'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'BLDAT'.
* ls_fieldcat-rollname = 'BLDAT'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 8.
ls_fieldcat-seltext_m = 'Inv. Date'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'WRBTR'.
* ls_fieldcat-rollname = 'WRBTR'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 13.
ls_fieldcat-seltext_m = 'Amount Paid'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'XBLNR'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 16.
ls_fieldcat-seltext_m = 'Ref Document No'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'BKTXT'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 25.
ls_fieldcat-seltext_m = 'Remarks'.
APPEND ls_fieldcat TO p_it_st_fieldcat.
ENDFORM. " FIELDCAT
*&---------------------------------------------------------------------*
*& Form LAYOUT_BUILD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_ST_LAYOUT text
*----------------------------------------------------------------------*
FORM layout_build USING p_st_layout TYPE slis_layout_alv.
p_st_layout-box_fieldname = 'SELK'. " Checkbox
p_st_layout-get_selinfos = 'X'.
p_st_layout-f2code = 'PICK' . " Doppelklickfunktion
p_st_layout-confirmation_prompt = 'X'. "Sicherheitsabfrage
p_st_layout-key_hotspot = 'X'. "Schlüssel als Hotspot
p_st_layout-info_fieldname = 'COL'. "Zeilenfarbe
ENDFORM. " LAYOUT_BUILD
*&---------------------------------------------------------------------*
*& Form REUSE_ALV_LIST_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM reuse_alv_list_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
i_callback_program = s_repid
* I_CALLBACK_PF_STATUS_SET = S_STATUS
* I_CALLBACK_USER_COMMAND = S_USER_COMMAND
* I_STRUCTURE_NAME = ''
* IS_LAYOUT = ST_LAYOUT
it_fieldcat = it_st_fieldcat[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS = ST_SP_GROUP
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
I_SAVE = 'U'
* IS_VARIANT = S_VARIANT
IT_EVENTS = IT_ST_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
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_head.
ENDFORM. " REUSE_ALV_LIST_DISPLAY
*&---------------------------------------------------------------------*
*& Form EVENTTAB_BUILD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_IT_ST_EVENTS[] text
*----------------------------------------------------------------------*
FORM eventtab_build USING p_st_events TYPE slis_t_event .
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = p_st_events.
READ TABLE p_st_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE st_formname_top_of_page TO ls_event-form.
APPEND ls_event TO p_st_events.
ENDIF.
* READ TABLE p_st_events WITH KEY name = slis_ev_user_command
* INTO ls_event.
* IF sy-subrc = 0.
* MOVE s_user_command TO ls_event-form.
* APPEND ls_event TO p_st_events.
* ENDIF.
* READ TABLE p_st_events WITH KEY name = slis_ev_pf_status_set
* INTO ls_event.
*
* IF sy-subrc = 0.
* MOVE s_status TO ls_event-form.
* APPEND ls_event TO p_st_events.
* ENDIF.
ENDFORM. " EVENTTAB_BUILD
*&---------------------------------------------------------------------*
*& Form VARIANT_INIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM variant_init . CLEAR s_variant. s_variant-report = s_repid. s_variant-handle = code. ENDFORM. "variant_init ***********************---------------------**************************** * E N D O F A B A P ***********************---------------------****************************
No comments:
Post a Comment