sitemap
Sample IDOC shell program

Note: ABAP/4 is the proprietary programming language of SAP™

REPORT ZWMMBXY1.
*
************************************************************************
*** This is an IDOC shell program to create WMMBID01 IDocs for       ***
*** the Goods Movement interface between an external warehouse       ***
*** management system and SAP R/3's Inventory Management module.     ***
************************************************************************

TABLES :
E2MBXYH,                " WMMBID01 IDoc type's header segment
E2MBXYI.                " WMMBID01 IDoc type's detail segment
*      idoc control record
DATA:  BEGIN OF IDOC_CONTROL.
 INCLUDE STRUCTURE EDI_DC.
DATA:  END OF IDOC_CONTROL.

*      idoc data record
DATA: BEGIN OF INT_EDIDD.
INCLUDE STRUCTURE EDI_DD.
DATA: END OF INT_EDIDD.
*
PARAMETERS:
*  SAP IM Inbound Test file of IDocs
OUTFILE(40)  TYPE C  LOWER CASE     " output filename
                DEFAULT '/home/rajcast/invadj50.tst'.
*
START-OF-SELECTION.
*
***** Open the output file
*
OPEN DATASET OUTFILE FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC NE 0.
WRITE: / 'Error opening outfile!', SY-SUBRC.
EXIT.
ENDIF.
*******
CLEAR:  IDOC_CONTROL, INT_EDIDD.
************************************************************************
*     SET CONTROL VARIABLES AND WRITE CONTROL RECORD
************************************************************************
*
IDOC_CONTROL-TABNAM     = 'EDI_DC'.          "Table name
IDOC_CONTROL-MANDT      = SY-MANDT.          "Client
IDOC_CONTROL-DOCREL     = SY-SAPRL.          "SAP release
* IDOC_CONTROL-DOCNUM     =                    "edi docnumber
IDOC_CONTROL-DOCTYP     = 'WMMBID01'.        "IDOC type
IDOC_CONTROL-DIRECT     = '2'.               "Direction
IDOC_CONTROL-RCVPOR     = 'SAPBK1'.      "Receiver Port
IDOC_CONTROL-RCVPRT     = 'LS'.              "Receiver Partner Type
IDOC_CONTROL-RCVPRN     = 'BK1CLNT010'.      "Receiver Partner
IDOC_CONTROL-SNDPOR     = 'SAPBK1'.          " Sender port
IDOC_CONTROL-SNDPRT     = 'LS'.              "Partner Type for sender
IDOC_CONTROL-SNDPRN     = 'GOODSMVT01'.      "Sender Partner
IDOC_CONTROL-SNDPFC     = SPACE.             "Sender Partner, function
IDOC_CONTROL-MESTYP     = 'WMMBXY'.          "Message type
IDOC_CONTROL-IDOCTYP    = 'WMMBID01'.        "IDOC type
* IDOC_CONTROL-CIMTYP     =                    "Extension type
* IDOC_CONTROL-SERIAL     =                    "Serial number for serlzn
*
TRANSFER IDOC_CONTROL TO OUTFILE.            "write control record
IF SY-SUBRC NE 0.
WRITE: / 'ERROR EDIDC 1'.
ENDIF.

************************************************************************
************************************************************************
CLEAR INT_EDIDD.
INT_EDIDD-TABNAM     = 'EDI_DD'.
INT_EDIDD-SEGNAM     = 'E2MBXYH'.
* INT_EDIDD-SEGNUM     =
* INT_EDIDD-PSGNUM     =
* INT_EDIDD-HLEVEL     =
*
CLEAR: E2MBXYH.
*
E2MBXYH-BLDAT = '19980825'. "         8   Document date in document
E2MBXYH-BUDAT = '19980825'. "         8   Posting data in document
E2MBXYH-XBLNR = 'testgood'.    "     16   Reference document number
E2MBXYH-BKTXT = 'testgdsrecp'. "     25   Document header text
*E2MBXYH-FRBNR            CHAR C     16   Number of bill of lading
*E2MBXYH-XABLN            CHAR C     10   Goods receipt/issue slip
E2MBXYH-TCODE = 'MB1C'. " CHAR C      4   Session: Current transaction
*
INT_EDIDD-SDATA = E2MBXYH.
*
TRANSFER INT_EDIDD TO OUTFILE.
IF SY-SUBRC NE 0.
WRITE: / 'Error writing EDIDD 1'.
ENDIF.
*
CLEAR INT_EDIDD.
INT_EDIDD-TABNAM     = 'EDI_DD'.
INT_EDIDD-SEGNAM     = 'E2MBXYI'.
* INT_EDIDD-SEGNUM     =
* INT_EDIDD-PSGNUM     =
* INT_EDIDD-HLEVEL     =
*
CLEAR E2MBXYI.
*
*2MBXYI-BEAKZ             CHAR C      1        Indicator: line already e
*2MBXYI-XSTOB             CHAR C      1        Flag: Reverse posting
E2MBXYI-MATNR = '000000TESTMATERIAL'. "rial number
E2MBXYI-WERKS = 'PLNT'. " CHAR C      4        Plant
E2MBXYI-LGORT = '0001'. "                      Storage Location
E2MBXYI-CHARG = 'TESTBTCH'. "                  Batch number
E2MBXYI-BWART = '561'.    "           3        Movement type (inventory
*2MBXYI-INSMK = 'S'.    " CHAR C      1       stock type
*2MBXYI-SOBKZ             CHAR C      1        Special stock indicator
*2MBXYI-KZVBR             CHAR C      1        Indicator: consumption po
*2MBXYI-LIFNR             CHAR C     10        Vendor (creditor) account
*2MBXYI-KUNNR             CHAR C     10        Customer number
*2MBXYI-KDAUF             CHAR C     10        Sales order number
*2MBXYI-KDPOS             CHAR C      6        Item number in customer o
*2MBXYI-KDEIN             CHAR C      4        Scheduling of customer or
*2MBXYI-SHKZG             CHAR C      1        Debit/credit indicator
*2MBXYI-WAERS             CHAR C      5        Currency key
*2MBXYI-DMBTR             CHAR C     15        Amount in local currency
*2MBXYI-BWTAR             CHAR C     10        Valuation type
E2MBXYI-ERFMG = '555.000'. "                   Quantity in unit of entry
E2MBXYI-ERFME = 'CS'. "   CHAR C      3        Unit of entry in char.for
*2MBXYI-BPMNG             CHAR C     15        Quantity in order price q
*2MBXYI-BPRME             CHAR C      3        Order price quantity unit
*2MBXYI-EBELN =                "     10        Purchasing docum
*2MBXYI-EBELP =                "      5        Item number of purchasing
*2MBXYI-ELIKZ = 'X'. "    CHAR C      1        "Delivery completed" indi
*2MBXYI-SGTXT             CHAR C     50        Line item text
*2MBXYI-WEMPF             CHAR C     12        Goods recipient
*2MBXYI-ABLAD             CHAR C     25        Unloading point
*2MBXYI-KOSTL             CHAR C     10        Cost center
*2MBXYI-AUFNR =                   "  12        Order Number
*2MBXYI-ANLN1             CHAR C     12        Asset main number
*2MBXYI-ANLN2             CHAR C      4        Asset sub-number
*2MBXYI-RSNUM             CHAR C     10        Number of reservation / d
*2MBXYI-RSPOS             CHAR C      4        Item number of reservatio
*2MBXYI-KZEAR             CHAR C      1        Indicator: final issue fo
*2MBXYI-UMMAT             CHAR C     18        Receiving/issuing materia
*2MBXYI-UMWRK =         " CHAR C      4        Receiving Plant/Issuing P
*2MBXYI-UMLGO = '  '. "        C      4        Receiving/Issuing Storage
*2MBXYI-UMCHA             CHAR C     10        Receiving/Issuing Batch
*2MBXYI-KZBEW =       "   CHAR C      1        Movement Indicator
*2MBXYI-WEUNB             CHAR C      1        Indicator: goods receipt
*2MBXYI-LGNUM             CHAR C      3        Warehouse number/complex
*2MBXYI-LGTYP             CHAR C      3        Storage type
*2MBXYI-LGPLA             CHAR C     10        Storage bin
*2MBXYI-GRUND =          "            4        Indicator:Reason for Good
*2MBXYI-EVERS             CHAR C      2        Shipping instructions
*2MBXYI-EVERE             CHAR C      2        Compliance with shipping
*2MBXYI-IMKEY             CHAR C      8        Internal key for real est
*2MBXYI-KSTRG             CHAR C     12        Cost object
*2MBXYI-PAOBJNR           CHAR C     10        Number for business segme
*2MBXYI-PRCTR             CHAR C     10        Profit center
*2MBXYI-PS_PSP_PNR        CHAR C      8        Project structure plan el
*2MBXYI-NPLNR             CHAR C     12        Network number for accoun
*2MBXYI-AUFPL             CHAR C     10        Planning number for trans
*2MBXYI-APLZL             CHAR C      8        Counter for distinguishin
*2MBXYI-AUFPS             CHAR C      4        Number of order item in C
*2MBXYI-VPTNR             CHAR C     10        Partner account number
*2MBXYI-FIPOS             CHAR C     14        Commitment item
*2MBXYI-GSBER             CHAR C      4        Business area
*2MBXYI-BSTMG             CHAR C     15        Goods receipt quantity in
*2MBXYI-BSTME             CHAR C      3        Order unit
*2MBXYI-EXBWR             CHAR C     15        Posting amount in local c
*2MBXYI-KONTO             CHAR C     10        G/L account number
*2MBXYI-RSHKZ             CHAR C      1        Debit/credit indicator
*2MBXYI-BDMNG             CHAR C     15        Requirement quantity in C
*2MBXYI-ENMNG             CHAR C     15        Issued quantity in char.f
*2MBXYI-QPLOS             CHAR C     12        Inspection lot number in
*2MBXYI-UMZST             CHAR C      1        Status of receiving batch
*2MBXYI-UMZUS             CHAR C      1        Status key of transfer ba
*2MBXYI-UMBAR             CHAR C     10        Valuation type of transfe
**MBXYI-UMSOK             CHAR C      1        Special stock indicator f
*2MBXYI-LFBJA             CHAR C      4        Fiscal year of a referenc
*2MBXYI-LFBNR             CHAR C     10        Document number of a refe
*2MBXYI-LFPOS             CHAR C      4        Item in a reference docum
*2MBXYI-SJAHR             CHAR C      4        Material document year in
*2MBXYI-SMBLN             CHAR C     10        Number of a material docu
*2MBXYI-SMBLP             CHAR C      4        Item in material document
*2MBXYI-EXVKW             CHAR C     15        Sales value specified ext
*2MBXYI-QM_ZUSTD          CHAR C      1        Batch status with status
*2MBXYI-POSNR             CHAR C      6        Delivery item for subsyst
*2MBXYI-VBELN             CHAR C     10        Delivery
*2MBXYI-QM_UMZST          CHAR C      1        Status of receiv. batch w
*2MBXYI-BWLVS             CHAR C      3        Movement type for Whse Mg
*2MBXYI-UMREZ = '   '. "  CHAR C      5        NUMERATOR FOR CONVERTING
*2MBXYI-UMREN = '   '. "  CHAR C      5        DENOMINATOR FOR CONVERSIO
*2MBXYI-VFDAT = '        '. "         8        EXPIRATION DATE OR BEST-B
*2MBXYI-DABRZ             DATS D      8        Reference date for accoun
*
******************************** write EDIDD record ********************
INT_EDIDD-SDATA = E2MBXYI.
TRANSFER INT_EDIDD TO OUTFILE.
IF SY-SUBRC NE 0.
WRITE: / 'ERROR EDIDD 2'.
ENDIF.
************************************************************************
*
All of the  product names here are trademarks of their respective companies.  The site
www.allsaplinks.com no way affiliated with SAP AG. We have made every effort for the content
integrity.  Information used on this site is at your own risk.
SapMaterial.com  
ABAP TECHNICAL

SAP Introduction

sap abap faq

sap Tables

SAP Transaction codes

Internal tables

data dictionary

performance tuning

transports & Requests

Sap scripts

Smartforms

lsmw

reports

sap Workflow

module pool/ dialog
programming

table control

user exits

sap memory

abap memory

alv reports

ABAP ADVANCED

IDOC

ALE

BAPI

BADI

RFC


FUNCTIONAL SIDE

Materials Management

FICO

Human Resources

BIW / BW / SEM


Free Documentation
Abap Material

Ale Material

BAPI Material

BC Material

IDOC Material

R/3 Database Management

SAP material

RFC

Transport

Sales & Distribution Material

Basic Data and Function
Material

Basis (BC) Material

Billing Material

CA Material

CATT : Computer Aided Test
Tool

Capacity Evaluation and
leveling Material

Capacity Planning Material

Cross Application Material

Countries

Customer Service Material

Enterpise  Material

Financial / Controlling (FICO)

Internet Time Sheet

Inspection Material

HR Material

Material Management
Material

Payments Material

Payroll Material

Pension Fund

Production Planning and
Control

Plant Maintenance

Quality Management Material

Real Estate Material

SAP material

Wage Types