SAP MB51 Item Voucher list Program Enhancements add four fields

Source: Internet
Author: User

Functional requirements are:

Enhanced four fields on the basis of system standard function MB51 material voucher query

1, supplier Description: According to the supplier LIFNR in table Mseg to Gohead-vendorname value

2, the material group: According to mseg in the material code MATNR to table Mara take MATKL

3, the material group description: According to the material group MARA-MATKL to fetch T023t-wgbez

4, cost center description: According to MSEG-KOSTL to fetch Cskt-ltext

The enhanced four fields are placed in "change format" and can be removed when needed

First go to the standard program of MB51, click the Enhanced button, then click on the enhanced selection in the menu to show all the implicit enhancement of the program,

Then add the following code in the following places:

1. The inner table within the include rm07docs_generated defines the fields required for itab enhancement

Data:begin of ITAB occurs 0.
Data:anln1 TYPE mseg-anln1.
DATA:ANLN2 TYPE MSEG-ANLN2.
Data:aplzl TYPE Mseg-aplzl.
Data:aufnr TYPE Mseg-aufnr.
DATA:AUFPL TYPE MSEG-AUFPL.
Data:bktxt TYPE Mkpf-bktxt.
Data:bldat TYPE Mkpf-bldat.
Data:bpmng TYPE mseg-bpmng.
Data:bprme TYPE Mseg-bprme.
Data:bstme TYPE Mseg-bstme.
DATA:BSTMG TYPE MSEG-BSTMG.
Data:budat TYPE Mkpf-budat.
Data:bukrs TYPE Mseg-bukrs.
Data:bwart TYPE Mseg-bwart.
Data:bwtar TYPE Mseg-bwtar.
Data:charg TYPE Mseg-charg.
Data:cpudt TYPE Mkpf-cpudt.
Data:cputm TYPE Mkpf-cputm.
DATA:DMBTR TYPE MSEG-DMBTR.
Data:ebeln TYPE Mseg-ebeln.
Data:ebelp TYPE Mseg-ebelp.
Data:erfme TYPE Mseg-erfme.
DATA:ERFMG TYPE MSEG-ERFMG.
DATA:EXBWR TYPE MSEG-EXBWR.
DATA:EXVKW TYPE mseg-exvkw.
Data:grund TYPE Mseg-grund.
Data:kdauf TYPE Mseg-kdauf.
Data:kdein TYPE Mseg-kdein.
Data:kdpos TYPE Mseg-kdpos.
Data:kostl TYPE Mseg-kostl.
Data:kunnr TYPE Mseg-kunnr.
Data:kzbew TYPE Mseg-kzbew.
DATA:KZVBR TYPE MSEG-KZVBR.
Data:kzzug TYPE Mseg-kzzug.
Data:lgort TYPE Mseg-lgort.
Data:lifnr TYPE Mseg-lifnr.
Data:matnr TYPE Mseg-matnr.
Data:mat_kdauf TYPE Mseg-mat_kdauf.
Data:mat_kdpos TYPE Mseg-mat_kdpos.
Data:mblnr TYPE Mkpf-mblnr.
Data:meins TYPE Mseg-meins.
Data:menge TYPE Mseg-menge.
Data:mjahr TYPE Mkpf-mjahr.
Data:nplnr TYPE Mseg-nplnr.
DATA:PS_PSP_PNR TYPE MSEG-PS_PSP_PNR.
Data:rsnum TYPE Mseg-rsnum.
Data:rspos TYPE Mseg-rspos.
Data:shkzg TYPE Mseg-shkzg.
Data:sobkz TYPE Mseg-sobkz.
Data:usnam TYPE Mkpf-usnam.
Data:vgart TYPE Mkpf-vgart.
Data:vkwrt TYPE mseg-vkwrt.
Data:waers TYPE mseg-waers.
Data:werks TYPE Mseg-werks.
Data:xabln TYPE mkpf-xabln.
Data:xauto TYPE Mseg-xauto.
Data:xblnr TYPE Mkpf-xblnr.
Data:zeile TYPE Mseg-zeile.
Enhanced vendor Description, item group and item group description and cost center four fields
Data:name TYPE lfa1-name1.
DATA:MATKL TYPE MARA-MATKL.
Data:wgbez TYPE T023t-wgbez.
Data:ltext TYPE Cskt-ltext.
Enhanced vendor Description, item group and item group description and cost center four fields

Data:end of ITAB.

2. Add the following code to the tail of form data_selection Data_selection_via_matnr Data_selection_via_budat:

LOOP at ITAB.
IF Itab-lifnr is not INITIAL.
SELECT single NAME1 to Itab-name from LFA1 WHERE lifnr EQ itab-lifnr.
ENDIF.
IF Itab-matnr is not INITIAL.
SELECT single MATKL to ITAB-MATKL from MARA WHERE matnr EQ Itab-matnr.
ENDIF.
IF ITAB-MATKL is not INITIAL.
SELECT single Wgbez to Itab-wgbez from t023t WHERE matkl EQ itab-matkl.
ENDIF.
IF Itab-kostl is not INITIAL.
SELECT single ltext to Itab-ltext from Cskt WHERE kostl EQ itab-kostl.
ENDIF.
MODIFY ITAB.
Endloop.

3. Add the following code to the tail of the form build_runtimetable

Enhanced vendor Description, item group and item group description and cost center four fields
RX1 ' zmb51′ ' NAME ' 00′ ' 00′.
RX1 ' zmb51′ ' matkl ' 00′ ' 00′.
RX1 ' zmb51′ ' Wgbez ' 00′ ' 00′.
RX1 ' zmb51′ ' ltext ' 00′ ' 00′.
Enhanced vendor Description, item group and item group description and cost center four fields

5.DEFINE RX1.
Cs-tabname = &1.
Cs-fieldname = &2.
Cs-selection_position = &3.
Cs-output_position = &4.
APPEND CS to RTT.
End-of-definition.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.