I would like to share a nice report that can be used to display those MRP Elements by Exception Messages.
The goal of this report is that you can make more sustainable the Planning by Exception methodology.
This is the selection screen:
This is the Output:
This is the code:
*=======================================================================
*-----------------------------------------------------------------------
* Consulting2b
*-----------------------------------------------------------------------
* Program: Z_MD07_EXCEPTION
* Type: Report
*-----------------------------------------------------------------------
* Created By: Mariano Cabalen
* Created On: 15/01/2008
*-----------------------------------------------------------------------
* Description
* This Program will execute MD07 and list MRP Elements based on mess.
*-----------------------------------------------------------------------
* INPUT : Internal Table MDMWX has to be filled with
* material / plant / MRP area combination of
* selected materials
*-----------------------------------------------------------------------
* OUTPUT: MD07 overview of these materials to be processed
* like in MD07
*-----------------------------------------------------------------------
*=======================================================================
REPORT Z_MD07_RMMD07DB MESSAGE-ID ZMD.
************************************************************************
* VARIABLES DEFINITIONS *
************************************************************************
*--> Type-Pools
TYPE-POOLS: m61x.
TYPE-POOLS: slis.
*--> DB-Table
TABLES: marc, mara, mdma, eord, pgmi, mkal,
t000md, mdlv, t458a, t458b, t458c, t458d.
*--> Data definitions
CONSTANTS: memo_id_md07(10) TYPE c VALUE 'START_MD07'.
*--> Structures and Data
DATA: rm61r LIKE rm61r.
DATA: l_bertx LIKE rm61r-bertx.
*--> Table of selected materials
DATA: BEGIN OF mdmwx OCCURS 0.
INCLUDE STRUCTURE mdmw. "material / plant / MRP area
DATA: END OF mdmwx.
*--> Table of selected materials
TYPES: BEGIN OF it_md07,
MATNR LIKE MDMW-MATNR,
WERKS LIKE MDMW-WERKS,
BERID LIKE MDMW-BERID,
BERTX LIKE MDMW-BERTX,
END OF it_md07.
Types: tb_md07_h type standard table of it_md07.
data: tb_md07 type tb_md07_h WITH HEADER LINE,
tb1_md07 type tb_md07_h WITH HEADER LINE,
tb2_md07 type tb_md07_h WITH HEADER LINE,
tb3_md07 type tb_md07_h WITH HEADER LINE.
DATA it_mdezx TYPE STANDARD TABLE OF MDEZ WITH HEADER LINE.
DATA it_MT61D TYPE STANDARD TABLE OF MT61D WITH HEADER LINE.
TYPES: BEGIN OF it_disp,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
BERID LIKE MDMW-BERID,
BERTX LIKE MDMW-BERTX,
MAKTX LIKE MAKT-MAKTX,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
MEINS LIKE MARA-MEINS,
DISMM LIKE MARC-DISMM,
BESKZ LIKE MARC-BESKZ,
SOBSL LIKE MARC-SOBSL,
DISPO LIKE MARC-DISPO,
EKGRP LIKE MARC-EKGRP,
DAT00 LIKE IT_MDEZX-DAT00,
DELB0 LIKE IT_MDEZX-DELB0,
EXTRA LIKE IT_MDEZX-EXTRA,
AUSKT LIKE IT_MDEZX-AUSKT,
UMDAT LIKE IT_MDEZX-UMDAT,
MNG01 LIKE IT_MDEZX-MNG01,
END OF it_disp.
Types: tb_disph type standard table of it_disp.
data: tb_disp1 type tb_disph WITH HEADER LINE.
types: begin of tp_T458,
auskt like T458A-auskt,
AUSLT like T458B-AUSLT,
selgp like T458A-selgp,
text40 like T458D-text40,
aussl like T458A-aussl,
end of tp_T458.
types: begin of tp_T458F,
auskt like T458A-auskt,
end of tp_T458F.
Types: tp_tbl_T458 type standard table of tp_T458.
Types: tp_tbF_T458 type standard table of tp_T458F.
DATA: t_T458 TYPE tp_tbl_T458 WITH HEADER LINE.
DATA: t_T458F TYPE tp_tbF_T458 WITH HEADER LINE.
DATA: BEGIN OF I_FIELDS OCCURS 10.
INCLUDE STRUCTURE HELP_VALUE.
DATA: END OF I_FIELDS.
DATA: BEGIN OF I_VALUES OCCURS 10,
LINE(80),
END OF I_VALUES.
CLEAR I_FIELDS. REFRESH I_FIELDS.
CLEAR I_VALUES. REFRESH I_VALUES.
************************************************************************
* CONSTANTS *
************************************************************************
CONSTANTS:
c_x(1) VALUE 'X',
c_status(8) VALUE 'TRSTATUS',
c_1 TYPE c VALUE '1',
c_marca(5) TYPE c VALUE 'MARCA',
c_pfs(6) TYPE c VALUE 'STATUS',
c_usc(12) TYPE c VALUE 'USER_COMMAND',
c_bot(4) TYPE c VALUE '&DEL',
c_w TYPE c VALUE 'W'.
* Data for the alv - PO Final Display
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
wa_layout TYPE slis_layout_alv,
v_repid LIKE sy-repid,
t_events TYPE slis_t_event.
************************************************************************
* INTERNAL TABLES *
************************************************************************
* Vendor Truck - Unit Conversion
DATA: E_SUBRC LIKE SY-SUBRC.
DATA:
*Variables for screen 1001
p_ucomm TYPE sy-ucomm,
pw_selfield TYPE slis_selfield.
************************************************************************
* SELECT-OPTIONS *
************************************************************************
START-OF-SELECTION.
SELECTION-SCREEN: BEGIN OF BLOCK a0 WITH FRAME TITLE text-000.
SELECT-OPTIONS:
s_AUSKT FOR t458a-AUSKT, "Exception Message
s_SELGP FOR t458c-SELGP. "Exception Group
SELECTION-SCREEN: END OF BLOCK a0.
SELECTION-SCREEN: BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_werks FOR rm61r-werks OBLIGATORY, "Plant
s_berid FOR rm61r-berid. "MRP area
SELECTION-SCREEN: END OF BLOCK a1.
SELECTION-SCREEN: BEGIN OF BLOCK a2 WITH FRAME TITLE text-002.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: chk_mat RADIOBUTTON GROUP rad1.
SELECTION-SCREEN COMMENT 3(27) TEXT-R01.
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS:
s_matnr FOR rm61r-matnr. "Material
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: chk_ven RADIOBUTTON GROUP rad1.
SELECTION-SCREEN COMMENT 3(39) TEXT-R02.
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS:
s_lifnr FOR eord-lifnr. "Vendor
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: chk_pro RADIOBUTTON GROUP rad1.
SELECTION-SCREEN COMMENT 3(32) TEXT-R03.
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS:
s_prgrp FOR pgmi-prgrp. "Product Group
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: chk_lin RADIOBUTTON GROUP rad1.
SELECTION-SCREEN COMMENT 3(60) TEXT-R04.
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS:
s_mdv01 FOR mkal-mdv01. "Production Line
SELECTION-SCREEN: END OF BLOCK a2.
SELECTION-SCREEN: BEGIN OF BLOCK a3 WITH FRAME TITLE text-003.
SELECT-OPTIONS:
s_matkl FOR mara-matkl, "Material group
s_dispo FOR rm61r-dispo, "MRP controller
s_ekgrp FOR marc-ekgrp, "Purchasing Group
s_beskz FOR rm61r-beskz, "Procurement Type
s_sobsl FOR rm61r-sobsl, "Special procurement type
s_dismm FOR rm61r-dismm, "MRP Type
s_mmsta FOR rm61r-mmsta, "Plant-Specific Material Status
s_maabc FOR rm61r-maabc. "ABC indicator
SELECTION-SCREEN: END OF BLOCK a3.
************************************************************************
* PERFORMANCE CHECKS *
************************************************************************
*--> MRP-Area active ?
PERFORM read_t000md.
IF NOT s_berid IS INITIAL.
IF t000md-disfg IS INITIAL.
MESSAGE I001(ZMD).
EXIT.
ENDIF.
ENDIF.
*--> Performance Check for Material Selection by Source List
IF chk_ven = 'X'.
IF s_lifnr IS INITIAL.
MESSAGE I000 WITH TEXT-T00.
EXIT.
ENDIF.
ENDIF.
*--> Performance Check for Material Selection by Product Group
IF chk_pro = 'X'.
IF s_prgrp IS INITIAL.
MESSAGE I000 WITH TEXT-T01.
EXIT.
ENDIF.
ENDIF.
*--> Performance Check for Material Selection by Production Version
IF chk_lin = 'X'.
IF s_mdv01 IS INITIAL.
MESSAGE I000 WITH TEXT-T02.
EXIT.
ENDIF.
ENDIF.
*--> Performance Check for Material Selection by Production Version
IF s_AUSKT IS INITIAL AND s_SELGP IS INITIAL.
MESSAGE I000 WITH TEXT-T03.
EXIT.
ENDIF.
END-OF-SELECTION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_AUSKT-low.
PERFORM exc_matchcode USING s_AUSKT-low.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_AUSKT-high.
PERFORM exc_matchcode USING s_AUSKT-low.
************************************************************************
* START OF MAIN PROGRAM *
************************************************************************
start-of-selection.
*--> Select all materials by source list
IF chk_ven = 'X'.
IF s_berid IS INITIAL.
SELECT a~matnr
b~werks
INTO TABLE tb_md07
FROM eord AS a
INNER JOIN marc AS b ON a~matnr = b~matnr
AND a~werks = b~werks
INNER JOIN mara AS c ON a~matnr = c~matnr
WHERE b~werks IN s_werks AND a~lifnr IN s_lifnr
AND a~vdatu <= sy-datum AND a~BDATU >= sy-datum
AND b~dispo IN s_dispo AND b~beskz IN s_beskz
AND b~sobsl IN s_sobsl AND b~dismm IN s_dismm
AND b~mmsta IN s_mmsta AND b~maabc IN s_maabc
AND b~ekgrp IN s_ekgrp AND c~matkl IN s_matkl.
ELSE.
*--> Select all materials in MRP Areas other than plant MRP Area
IF NOT s_berid IS INITIAL.
SELECT a~matnr
b~werks
c~berid
INTO TABLE tb_md07
FROM eord AS a
INNER JOIN marc AS b ON a~matnr = b~matnr
AND a~werks = b~werks
INNER JOIN mdma AS c ON a~matnr = c~matnr
AND a~werks = c~werks
INNER JOIN mara AS d ON a~matnr = d~matnr
WHERE b~werks IN s_werks AND a~lifnr IN s_lifnr
AND a~vdatu <= sy-datum AND a~BDATU >= sy-datum
AND b~dispo IN s_dispo AND b~beskz IN s_beskz
AND b~sobsl IN s_sobsl AND b~dismm IN s_dismm
AND b~mmsta IN s_mmsta AND b~maabc IN s_maabc
AND b~ekgrp IN s_ekgrp AND d~matkl IN s_matkl
AND c~berid IN s_berid.
ENDIF.
ENDIF.
ENDIF.
*--> Select all materials by material
IF chk_mat = 'X'.
IF s_berid IS INITIAL.
SELECT a~matnr
a~werks
INTO TABLE tb_md07
FROM marc AS a
INNER JOIN mara AS b ON a~matnr = b~matnr
WHERE a~werks IN s_werks AND a~dispo IN s_dispo
AND a~beskz IN s_beskz AND a~sobsl IN s_sobsl
AND a~dismm IN s_dismm AND a~mmsta IN s_mmsta
AND a~maabc IN s_maabc AND a~matnr IN s_matnr
AND a~ekgrp IN s_ekgrp AND b~matkl IN s_matkl.
ELSE.
*--> Select all materials in MRP Areas other than plant MRP Area
IF NOT s_berid IS INITIAL.
SELECT a~matnr
a~werks
b~berid
INTO TABLE tb_md07
FROM marc AS a
INNER JOIN mdma AS b ON a~matnr = b~matnr
AND a~werks = b~werks
INNER JOIN mara AS c ON a~matnr = c~matnr
WHERE a~werks IN s_werks AND a~dispo IN s_dispo
AND a~beskz IN s_beskz AND a~sobsl IN s_sobsl
AND a~dismm IN s_dismm AND a~mmsta IN s_mmsta
AND a~maabc IN s_maabc AND b~berid IN s_berid
AND a~matnr IN s_matnr
AND a~ekgrp IN s_ekgrp AND c~matkl IN s_matkl.
ENDIF.
ENDIF.
ENDIF.
*--> Select all materials by product group
IF chk_pro = 'X'.
IF s_berid IS INITIAL.
SELECT a~nrmit
a~wemit
INTO TABLE tb1_md07
FROM pgmi AS a
WHERE a~werks IN s_werks AND a~prgrp IN s_prgrp.
SORT tb1_md07 by werks matnr.
LOOP AT TB1_MD07.
SELECT SINGLE matnr werks
FROM MARC INTO (tb2_md07-matnr, tb2_md07-werks)
WHERE matnr = tb1_md07-matnr AND werks = tb1_md07-werks
AND dispo IN s_dispo AND beskz IN s_beskz
AND sobsl IN s_sobsl AND dismm IN s_dismm
AND mmsta IN s_mmsta AND maabc IN s_maabc
AND ekgrp IN s_ekgrp.
IF SY-SUBRC = 0.
APPEND tb2_md07.
ENDIF.
ENDLOOP.
SORT tb2_md07 by werks matnr.
LOOP AT TB2_MD07.
SELECT SINGLE matnr
FROM MARA INTO (tb_md07-matnr)
WHERE matnr = tb2_md07-matnr
AND matkl IN s_matkl.
tb_md07-werks = tb2_md07-werks.
IF SY-SUBRC = 0.
APPEND tb_md07.
ENDIF.
ENDLOOP.
ELSE.
*--> Select all materials in MRP Areas other than plant MRP Area
IF NOT s_berid IS INITIAL.
SELECT a~nrmit
a~wemit
INTO TABLE tb1_md07
FROM pgmi AS a
WHERE a~werks IN s_werks AND a~prgrp IN s_prgrp.
LOOP AT TB1_MD07.
SELECT SINGLE matnr werks
FROM MARC INTO (tb2_md07-matnr, tb2_md07-werks)
WHERE matnr = tb1_md07-matnr AND werks = tb1_md07-werks
AND dispo IN s_dispo AND beskz IN s_beskz
AND sobsl IN s_sobsl AND dismm IN s_dismm
AND mmsta IN s_mmsta AND maabc IN s_maabc
AND ekgrp IN s_ekgrp.
IF SY-SUBRC = 0.
APPEND tb2_md07.
ENDIF.
ENDLOOP.
SORT tb2_md07 by werks matnr.
LOOP AT TB2_MD07.
SELECT SINGLE matnr
FROM MARA INTO (tb_md07-matnr)
WHERE matnr = tb2_md07-matnr
AND matkl IN s_matkl.
tb_md07-werks = tb2_md07-werks.
IF SY-SUBRC = 0.
APPEND tb_md07.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
*--> Select all materials by production line
IF chk_lin = 'X'.
IF s_berid IS INITIAL.
SELECT a~matnr
b~werks
INTO TABLE tb_md07
FROM mkal AS a
INNER JOIN marc AS b ON a~matnr = b~matnr
AND a~werks = b~werks
INNER JOIN mara AS c ON a~matnr = c~matnr
WHERE b~werks IN s_werks AND a~mdv01 IN s_mdv01
AND a~adatu <= sy-datum AND a~BDATU >= sy-datum
AND b~dispo IN s_dispo AND b~beskz IN s_beskz
AND b~sobsl IN s_sobsl AND b~dismm IN s_dismm
AND b~mmsta IN s_mmsta AND b~maabc IN s_maabc
AND b~ekgrp IN s_ekgrp AND c~matkl IN s_matkl.
ELSE.
*--> Select all materials in MRP Areas other than plant MRP Area
IF NOT s_berid IS INITIAL.
SELECT a~matnr
b~werks
c~berid
INTO TABLE tb_md07
FROM mkal AS a
INNER JOIN marc AS b ON a~matnr = b~matnr
AND a~werks = b~werks
INNER JOIN mdma AS c ON a~matnr = c~matnr
AND a~werks = c~werks
INNER JOIN mara AS d ON a~matnr = d~matnr
WHERE b~werks IN s_werks AND a~mdv01 IN s_mdv01
AND a~adatu <= sy-datum AND a~BDATU >= sy-datum
AND b~dispo IN s_dispo AND b~beskz IN s_beskz
AND b~sobsl IN s_sobsl AND b~dismm IN s_dismm
AND b~mmsta IN s_mmsta AND b~maabc IN s_maabc
AND c~berid IN s_berid
AND b~ekgrp IN s_ekgrp AND d~matkl IN s_matkl.
ENDIF.
ENDIF.
ENDIF.
* Exception Groups
SELECT AUSKT
INTO CORRESPONDING FIELDS OF TABLE t_t458F
FROM T458A
where auskt IN s_auskt and selgp IN s_selgp.
*--> Check: Selektion nichtleer
IF tb_md07[] IS INITIAL.
MESSAGE e085(61).
ENDIF.
END-OF-SELECTION.
LOOP AT tb_md07.
IF NOT tb_md07-matnr IS INITIAL AND NOT tb_md07-werks IS INITIAL.
REFRESH it_mdezx.
REFRESH it_MT61D.
CALL FUNCTION 'MD_STOCK_REQUIREMENTS_LIST_API'
EXPORTING
matnr = tb_md07-matnr
werks = tb_md07-werks
IMPORTING
E_MT61D = it_MT61D
TABLES
mdezx = it_mdezx
EXCEPTIONS
material_plant_not_found = 1
plant_not_found = 2
OTHERS = 3.
IF sy-subrc = 0.
IF NOT it_mdezx[] IS INITIAL.
LOOP AT T_T458F.
LOOP AT it_mdezx where AUSKT = t_t458F-auskt.
tb_disp1-MATNR = tb_md07-MATNR.
tb_disp1-WERKS = tb_md07-WERKS.
tb_disp1-BERID = tb_md07-BERID.
tb_disp1-BERTX = tb_md07-BERTX.
tb_disp1-MAKTX = it_mt61d-MAKTX.
tb_disp1-MTART = it_mt61d-MTART.
tb_disp1-MATKL = it_mt61d-MATKL.
tb_disp1-MEINS = it_mt61d-MEINS.
tb_disp1-DISMM = it_mt61d-DISMM.
tb_disp1-BESKZ = it_mt61d-BESKZ.
tb_disp1-SOBSL = it_mt61d-SOBSL.
tb_disp1-DISPO = it_mt61d-DISPO.
tb_disp1-EKGRP = it_mt61d-EKGRP.
tb_disp1-DAT00 = it_mdezx-DAT00.
tb_disp1-DELB0 = it_mdezx-DELB0.
tb_disp1-EXTRA = it_mdezx-EXTRA.
tb_disp1-AUSKT = it_mdezx-AUSKT.
tb_disp1-UMDAT = it_mdezx-UMDAT.
tb_disp1-MNG01 = it_mdezx-MNG01.
APPEND TB_DISP1.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDIF.
CLEAR TB_DISP1.
CLEAR it_MT61D.
CLEAR it_mdezx.
REFRESH it_mdezx.
REFRESH it_MT61D.
ENDIF.
ENDLOOP.
******ADD DATO TO IT2******
*--> Check: Selektion nichtleer
IF TB_DISP1[] IS INITIAL.
MESSAGE e085(61).
ELSE.
PERFORM alv.
ENDIF.
************************************************************************
* END OF MAIN PROGRAM *
************************************************************************
*&---------------------------------------------------------------------*
*& Form read_t000md
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* Has to be called at the beginning of the transaction
* T000md-disfg : flag MRP area functionality is active
*----------------------------------------------------------------------*
FORM read_t000md.
STATICS:
done_flag,
l_t000md LIKE t000md. "Puffer
IF done_flag IS INITIAL.
* check done_flag is initial.
SELECT SINGLE * FROM t000md.
IF sy-subrc <> 0.
CLEAR t000md.
ENDIF.
done_flag = 'X'.
l_t000md = t000md.
ELSE.
t000md = l_t000md.
ENDIF.
ENDFORM. " read_t000md
*&---------------------------------------------------------------------*
*& Form alv
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM alv.
PERFORM xinit_fieldcat.
PERFORM xinit_layout.
PERFORM xlist.
ENDFORM. " alv
*&---------------------------------------------------------------------*
*& Form xinit_layout
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM xinit_layout.
wa_layout-zebra = c_x.
wa_layout-colwidth_optimize = c_x.
wa_layout-box_fieldname = ' '.
wa_layout-expand_fieldname = c_x.
ENDFORM. " init_layout
*&---------------------------------------------------------------------*
*& Form xinit_fieldcat
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM xinit_fieldcat.
DATA: wa_fieldcat TYPE slis_fieldcat_alv,
sum TYPE i .
REFRESH gt_fieldcat.
CLEAR: wa_fieldcat.
sum = c_1.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'MATNR'.
wa_fieldcat-ref_tabname = 'MARC'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'MAKTX'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'MAKTX'.
wa_fieldcat-ref_tabname = 'MAKT'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'WERKS'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'WERKS'.
wa_fieldcat-ref_tabname = 'MARC'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'DAT00'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'DAT00'.
wa_fieldcat-ref_tabname = 'MDEZ'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'DELB0'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'DELB0'.
wa_fieldcat-ref_tabname = 'MDEZ'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'EXTRA'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'EXTRA'.
wa_fieldcat-ref_tabname = 'MDEZ'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'AUSKT'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'AUSKT'.
wa_fieldcat-ref_tabname = 'MDEZ'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'UMDAT'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'UMDAT'.
wa_fieldcat-ref_tabname = 'MDEZ'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'MNG01'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'MNG01'.
wa_fieldcat-ref_tabname = 'MDEZ'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'MTART'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'MTART'.
wa_fieldcat-ref_tabname = 'MARA'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'MATKL'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'MATKL'.
wa_fieldcat-ref_tabname = 'MARA'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'MEINS'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'MEINS'.
wa_fieldcat-ref_tabname = 'MARA'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'DISMM'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'DISMM'.
wa_fieldcat-ref_tabname = 'MARC'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'BESKZ'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'BESKZ'.
wa_fieldcat-ref_tabname = 'MARC'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'SOBSL'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'SOBSL'.
wa_fieldcat-ref_tabname = 'MARC'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'DISPO'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'DISPO'.
wa_fieldcat-ref_tabname = 'MARC'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
wa_fieldcat-fieldname = 'EKGRP'.
wa_fieldcat-tabname = 'TB_DISP1'.
wa_fieldcat-ref_fieldname = 'EKGRP'.
wa_fieldcat-ref_tabname = 'MARC'.
wa_fieldcat-col_pos = sum.
APPEND wa_fieldcat TO gt_fieldcat .
CLEAR: wa_fieldcat.
sum = sum + c_1.
ENDFORM. " init_fieldcat
*&---------------------------------------------------------------------*
*& Form xlist
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM xlist.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_program = v_repid
* i_callback_user_command = 'USER_COMMAND'
is_layout = wa_layout
it_fieldcat = gt_fieldcat
* it_events = t_events[]
TABLES
t_outtab = TB_DISP1
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE I000 WITH TEXT-T14.
ENDIF.
ENDFORM. " list
************************************************************************
* Start of ALV and FORMs for Generated PO and error log *
************************************************************************
FORM exc_matchcode USING ys_AUSKT.
FREE: I_FIELDS, I_VALUES.
CLEAR I_FIELDS.
I_FIELDS-TABNAME = 'T458A'.
I_FIELDS-FIELDNAME = 'AUSKT'.
I_FIELDS-SELECTFLAG = 'X'.
APPEND I_FIELDS.
CLEAR I_FIELDS.
I_FIELDS-TABNAME = 'T458B'.
I_FIELDS-FIELDNAME = 'AUSLT'.
APPEND I_FIELDS.
CLEAR I_FIELDS.
I_FIELDS-TABNAME = 'T458A'.
I_FIELDS-FIELDNAME = 'SELGP'.
APPEND I_FIELDS.
CLEAR I_FIELDS.
I_FIELDS-TABNAME = 'T458D'.
I_FIELDS-FIELDNAME = 'TEXT40'.
APPEND I_FIELDS.
CLEAR I_FIELDS.
SELECT a~AUSKT
c~AUSLT
a~selgp
b~text40
INTO CORRESPONDING FIELDS OF TABLE t_t458
FROM T458A as a inner join T458D as b
on a~selgp = b~selgp
inner join T458B as c
on a~aussl = c~aussl
where c~spras = sy-langu and b~spras = sy-langu.
SORT t_T458 ASCENDING BY auskt.
DELETE ADJACENT DUPLICATES FROM t_t458 COMPARING AUSKT.
LOOP AT t_T458.
I_VALUES-LINE = t_T458-auskt.
APPEND I_VALUES.
I_VALUES-LINE = t_T458-auslt.
APPEND I_VALUES.
I_VALUES-LINE = t_T458-SELGP.
APPEND I_VALUES.
I_VALUES-LINE = t_T458-TEXT40.
APPEND I_VALUES.
ENDLOOP.
CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
EXPORTING
TITLE_IN_VALUES_LIST = text-L00
TITEL = text-L00
IMPORTING
SELECT_VALUE = ys_AUSKT
TABLES
FIELDS = I_FIELDS
VALUETAB = I_VALUES
EXCEPTIONS
FIELD_NOT_IN_DDIC = 01
MORE_THEN_ONE_SELECTFIELD = 02
NO_SELECTFIELD = 03.
ENDFORM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
4 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 |