*--------------------------------------------
*SELECTION
*--------------------------------------------
*BLOCK 0
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH
FRAME TITLE text-001.
SELECT-OPTIONS s_lifnr FOR ekko-lifnr NO INTERVALS.
SELECT-OPTIONS s_matnr FOR ekpo-matnr NO INTERVALS.
SELECT-OPTIONS s_matkl FOR ekpo-matkl NO INTERVALS.
SELECT-OPTIONS s_ekgrp FOR ekko-ekgrp NO INTERVALS.
SELECT-OPTIONS s_bedat FOR ekko-bedat.
SELECT-OPTIONS s_purdoc FOR ekko-ebeln.
PARAMETER s_wbs LIKE ekkn-ps_psp_pnr .
*SELECT-OPTIONS S_WBS for EKKN-PS_PSP_PNR NO INTERVALS.
SELECTION-SCREEN END OF BLOCK 0.
*BLOCK 2
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH
FRAME TITLE text-010.
PARAMETERS: p_vari LIKE disvariant-variant. " ALV Variant
*SELECTION-SCREEN SKIP.
*SELECTION-SCREEN PUSHBUTTON /10(20) SUMMA USER-COMMAND ABCD.
SELECTION-SCREEN END OF BLOCK 2.
*--------------------------------------------
*DATA
*--------------------------------------------
*ALV DATA
TYPE-POOLS: slis.
DATA: gt_list_top_of_page TYPE slis_t_listheader,
gt_events TYPE slis_t_event,
gs_layout TYPE slis_layout_alv,
gt_sort TYPE slis_t_sortinfo_alv,
gt_fieldcat TYPE slis_t_fieldcat_alv,
fieldcat_ln LIKE LINE OF gt_fieldcat,
repname LIKE sy-repid,
g_save(1) TYPE c,
g_exit(1) TYPE c,
g_variant LIKE disvariant,
gx_variant LIKE disvariant.
*USER DATA
DATA vwcase(3) TYPE n.
DATA sdat LIKE eket-eindt.
*--------------------------------------------
*INTERNAL TABLE
*--------------------------------------------
*ITAB
DATA: BEGIN OF itab OCCURS 0,
belnr LIKE ekbe-belnr, "Start insert by suchon CH01
lifnr LIKE ekko-lifnr,
bedat LIKE ekko-bedat,
waers LIKE ekko-waers,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
txz01 LIKE ekpo-txz01,
menge LIKE ekpo-menge,
meins LIKE ekpo-meins,
netpr LIKE ekpo-netpr,
elikz LIKE ekpo-elikz,
eindt LIKE eket-eindt,
budat LIKE ekbe-budat,
menge2 LIKE ekbe-menge,
delp TYPE i,
cmt(15) TYPE c,
*BELNR LIKE EKBE-BELNR, "Start insert by suchon CH01
buzei LIKE ekbe-buzei,
dmbtr LIKE ekbe-dmbtr,
ps_psp_pnr LIKE ekkn-ps_psp_pnr,"End insert by suchon CH01
dmbtr1 LIKE ekbe-dmbtr,
dmbtr2 LIKE ekbe-dmbtr,
dmbtr3 LIKE ekbe-dmbtr,
dmbtr4 LIKE ekbe-dmbtr,
dmbtr5 LIKE ekbe-dmbtr,
dmbtr6 LIKE ekbe-dmbtr,
dmbtr7 LIKE ekbe-dmbtr,
dmbtr8 LIKE ekbe-dmbtr,
dmbtr9 LIKE ekbe-dmbtr,
dmbtr10 LIKE ekbe-dmbtr,
dmbtr11 LIKE ekbe-dmbtr,
dmbtr12 LIKE ekbe-dmbtr,
*BRTWR1 LIKE EKPO-BRTWR,
brtwr1(13) TYPE c,
brtwr2(13) TYPE c,
brtwr3(13) TYPE c,
brtwr4(13) TYPE c,
brtwr5(13) TYPE c,
brtwr6(13) TYPE c,
brtwr7(13) TYPE c,
brtwr8(13) TYPE c,
brtwr9(13) TYPE c,
brtwr10(13) TYPE c,
brtwr11(13) TYPE c,
brtwr12(13) TYPE c,
sum_brtwr LIKE ekpo-brtwr,
post1 LIKE prps-post1,
h_note LIKE tline-tdline,
sum_out LIKE ekpo-brtwr,
sum_act LIKE ekbe-dmbtr,
END OF itab.
*ITAB1
DATA: BEGIN OF itab1 OCCURS 0,
lifnr LIKE ekko-lifnr,
bedat LIKE ekko-bedat,
waers LIKE ekko-waers,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
txz01 LIKE ekpo-txz01,
menge LIKE ekpo-menge,
meins LIKE ekpo-meins,
netpr LIKE ekpo-netpr,
elikz LIKE ekpo-elikz,
eindt LIKE eket-eindt,
budat LIKE ekbe-budat,
menge2 LIKE ekbe-menge,
delp TYPE i,
cmt(15) TYPE c,
belnr LIKE ekbe-belnr, "Start insert by suchon CH01
buzei LIKE ekbe-buzei,
dmbtr LIKE ekbe-dmbtr,
ps_psp_pnr LIKE ekkn-ps_psp_pnr, "End insert by suchon CH01
dmbtr1 LIKE ekbe-dmbtr,
dmbtr2 LIKE ekbe-dmbtr,
dmbtr3 LIKE ekbe-dmbtr,
dmbtr4 LIKE ekbe-dmbtr,
dmbtr5 LIKE ekbe-dmbtr,
dmbtr6 LIKE ekbe-dmbtr,
dmbtr7 LIKE ekbe-dmbtr,
dmbtr8 LIKE ekbe-dmbtr,
dmbtr9 LIKE ekbe-dmbtr,
dmbtr10 LIKE ekbe-dmbtr,
dmbtr11 LIKE ekbe-dmbtr,
dmbtr12 LIKE ekbe-dmbtr,
*BRTWR1 LIKE EKPO-BRTWR,
brtwr1(13) TYPE c,
brtwr2(13) TYPE c,
brtwr3(13) TYPE c,
brtwr4(13) TYPE c,
brtwr5(13) TYPE c,
brtwr6(13) TYPE c,
brtwr7(13) TYPE c,
brtwr8(13) TYPE c,
brtwr9(13) TYPE c,
brtwr10(13) TYPE c,
brtwr11(13) TYPE c,
brtwr12(13) TYPE c,
sum_brtwr LIKE ekpo-brtwr,
post1 LIKE prps-post1,
h_note LIKE tline-tdline,
sum_out LIKE ekpo-brtwr,
sum_act LIKE ekbe-dmbtr,
END OF itab1.
*MTEXT
DATA: BEGIN OF mtext OCCURS 50.
INCLUDE STRUCTURE tline.
DATA: END OF mtext.
*Temp data
DATA temp1 LIKE itab1.
*EKKOTAB
DATA: BEGIN OF ekkotab OCCURS 0,
ebeln LIKE ekko-ebeln,
lifnr LIKE ekko-lifnr,
bedat LIKE ekko-bedat,
waers LIKE ekko-waers,
END OF ekkotab.
*EKPOTAB
DATA: BEGIN OF ekpotab OCCURS 0,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
lifnr LIKE ekko-lifnr,
bedat LIKE ekko-bedat,
waers LIKE ekko-waers,
matnr LIKE ekpo-matnr,
txz01 LIKE ekpo-txz01,
menge LIKE ekpo-menge,
meins LIKE ekpo-meins,
netpr LIKE ekpo-netpr,
elikz LIKE ekpo-elikz,
eindt LIKE eket-eindt,
brtwr LIKE ekpo-brtwr,
END OF ekpotab.
*--------------------------------------------
AT SELECTION-SCREEN.
*--------------------------------------------
IF s_bedat IS INITIAL.
MESSAGE e000
WITH 'Please enter a date in Main Selection Criteria'.
ENDIF.
* IF P_01 = 'X' AND P_D01 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Delivered Before Plan Delivery'.
* ENDIF.
*
* IF P_02 = 'X' AND P_D02 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Delivered After Plan Delivery'.
* ENDIF.
*
* IF P_04 = 'X' AND P_D04 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Un-delivered Before Plan Delivery'.
* ENDIF.
*
* IF P_05 = 'X' AND P_D05 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Un-delivered After Plan Delivery'.
* ENDIF.
PERFORM pai_of_selection_screen.
*--------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
*--------------------------------------------
PERFORM f4_for_variant.
*--------------------------------------------
FORM start.
*--------------------------------------------
PERFORM get_ekkotab.
PERFORM get_ekpotab.
PERFORM get_itab1.
PERFORM move_itab1_to_itab.
* START INSERT BY SUCHON CH01
IF NOT s_wbs IS INITIAL.
DELETE itab WHERE ps_psp_pnr <> s_wbs.
ENDIF.
ENDFORM. "START
* END INSERT BY SUCHON CH01
*--------------------------------------------
FORM get_ekkotab.
*--------------------------------------------
REFRESH ekkotab. CLEAR ekkotab.
SELECT ebeln lifnr bedat waers
INTO (ekko-ebeln, ekko-lifnr, ekko-bedat, ekko-waers)
FROM ekko WHERE
lifnr IN s_lifnr AND
ekgrp IN s_ekgrp AND
bedat IN s_bedat
AND ebeln IN s_purdoc. " INSERT BY SUCHON , CH01
MOVE ekko-ebeln TO ekkotab-ebeln.
MOVE ekko-lifnr TO ekkotab-lifnr.
MOVE ekko-bedat TO ekkotab-bedat.
MOVE ekko-waers TO ekkotab-waers.
APPEND ekkotab. CLEAR ekkotab.
ENDSELECT.
ENDFORM. "GET_EKKOTAB
*--------------------------------------------
FORM get_ekpotab.
*--------------------------------------------
REFRESH ekpotab. CLEAR ekpotab.
LOOP AT ekkotab.
SELECT ebeln ebelp matnr txz01 menge meins netpr elikz brtwr
INTO (ekpo-ebeln, ekpo-ebelp, ekpo-matnr, ekpo-txz01,
ekpo-menge, ekpo-meins, ekpo-netpr, ekpo-elikz,
ekpo-brtwr)
FROM ekpo WHERE
ebeln = ekkotab-ebeln AND
matnr IN s_matnr AND
matkl IN s_matkl.
SELECT SINGLE eindt INTO eket-eindt
FROM eket WHERE
ebeln = ekpo-ebeln AND ebelp = ekpo-ebelp.
MOVE ekkotab-lifnr TO ekpotab-lifnr.
MOVE ekkotab-bedat TO ekpotab-bedat.
MOVE ekkotab-waers TO ekpotab-waers.
MOVE ekpo-ebeln TO ekpotab-ebeln.
MOVE ekpo-ebelp TO ekpotab-ebelp.
MOVE ekpo-matnr TO ekpotab-matnr.
MOVE ekpo-txz01 TO ekpotab-txz01.
MOVE ekpo-menge TO ekpotab-menge.
MOVE ekpo-meins TO ekpotab-meins.
MOVE ekpo-netpr TO ekpotab-netpr.
MOVE ekpo-elikz TO ekpotab-elikz.
MOVE eket-eindt TO ekpotab-eindt.
MOVE ekpo-brtwr TO ekpotab-brtwr.
APPEND ekpotab. CLEAR ekpotab.
ENDSELECT.
ENDLOOP.
ENDFORM. "GET_EKPOTAB
*--------------------------------------------
FORM get_itab1.
*--------------------------------------------
DATA dvplan TYPE i.
DATA commt(15) TYPE c.
DATA tname LIKE thead-tdname.
REFRESH itab1. CLEAR itab1.
LOOP AT ekpotab.
SELECT SINGLE ps_psp_pnr
INTO (itab1-ps_psp_pnr)
FROM ekkn WHERE ebeln = ekpotab-ebeln
AND ebelp = ekpotab-ebelp.
SELECT SINGLE post1
INTO (itab1-post1)
FROM prps
WHERE pspnr = itab1-ps_psp_pnr.
MOVE ekpotab-ebeln TO tname.
***************CALL HEADER NOTES*******************
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F02'
language = 'E'
name = tname
object = 'EKKO'
TABLES
lines = mtext
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
****************************************************
IF sy-subrc = 0.
READ TABLE mtext INDEX 1 ."INTO itab1-h_note.
MOVE mtext-tdline TO itab1-h_note.
ENDIF.
*Deliver - Select All
WHEN '003'.
IF itab1-budat <> space.
MOVE-CORRESPONDING itab1 TO itab.
APPEND itab. CLEAR itab.
ENDIF.
*UnDeliver - Select All
WHEN '006'.
IF itab1-budat IS INITIAL OR itab1-budat = ''.
MOVE-CORRESPONDING itab1 TO itab.
APPEND itab. CLEAR itab.
ENDIF.
*Select All
WHEN '007'.
MOVE-CORRESPONDING itab1 TO itab.
APPEND itab. CLEAR itab.
ENDCASE. "VWCASE
ENDLOOP. "ITAB1
ENDFORM. "MOVE_ITAB1_TO_ITAB
*--------------------------------------------
FORM get_filter_case.
*--------------------------------------------
CLEAR vwcase.
MOVE '007' TO vwcase.
ENDFORM. "GET_FILTER_CASE
*--------------------------------------------
FORM f4_for_variant.
*--------------------------------------------
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save = g_save
IMPORTING
e_exit = g_exit
es_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF g_exit = space.
p_vari = gx_variant-variant.
ENDIF.
ENDIF.
ENDFORM. " F4_FOR_VARIANT
*--------------------------------------------
FORM pai_of_selection_screen.
*--------------------------------------------
IF NOT p_vari IS INITIAL.
MOVE g_variant TO gx_variant.
MOVE p_vari TO gx_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant.
g_variant = gx_variant.
ELSE.
PERFORM initialize_variant.
ENDIF.
ENDFORM. " PAI_OF_SELECTION_SCREEN
*--------------------------------------------
FORM comment_build CHANGING gt_top_of_page TYPE slis_t_listheader.
*--------------------------------------------
DATA: gs_line TYPE slis_listheader.
CLEAR gs_line.
gs_line-typ = 'S'.
gs_line-info = 'Purchase Order Performance Report'.
APPEND gs_line TO gt_top_of_page.
ENDFORM. "COMMENT_BUILD
*--------------------------------------------
FORM eventtab_build CHANGING lt_events TYPE slis_t_event.
*--------------------------------------------
CONSTANTS:
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: ls_event TYPE slis_alv_event.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_top_of_page TO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
ENDFORM. "EVENTTAB_BUILD
*--------------------------------------------
FORM top_of_page.
*--------------------------------------------
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
ENDFORM. "TOP_OF_PAGE
*--------------------------------------------
FORM build.
*--------------------------------------------
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.