Enhancement of IDoc Type

By Suraj Kumar Pabbathi


Step 7: Check and Transport IDoc extension

Transaction: WE30

Object name: DEBMASEXT

Path: Development object -> Check

Ensure that there are no errors or warnings

Now transport

Path: Development -> Transport 

Step8: Find suitable user exit for writing code to support IDoc extension

Transaction: SE84.

Click Enhancements

In short text provide *customer*

Find suitable enhancement to be VSV00001 

                                                      Alternative way

Transaction: SMOD

Click F4 help for Enhancement

Path: F4help -> SAP Applications -> Logistics general -> Logistics Basic Data ->

Business partners -> Vendor Master.

Find the enhancement as VSV00002, which is an approximate user exit.

Now search for different extensions like VSV00001. Then see for its components.

Identify the appropriate user exit to be ‘EXIT_SAPLVV01_001’ (Create Export of

Additional Customer Master Segments). This user exit can be used in outbound ALE

process, meant for filling the data into custom segments. 

You have to identify here another user exit as ‘EXIT_SAPLVV02_001’, which is

helpful for inbound ALE process. This user exit can be used to read the segments

 and post it to Application repository. 

Step9: Develop a project to encapsulate enhancements and components.

Transaction: CMOD.

Enhancement: custex and click Create to provide attributes.

Click Enhancement Assignments.

Provide VSV00001, short text and save.

From the initial screen of the transaction, select components and click change.

Find 4 components to be added.

Activate them.

Select user exit EXIT_SAPLVV01_001 for outbound process and double click it. It leads to function builder.

Double click on provided include program ZXVSVU01 and press enter.

Now, write supporting code for IDoc extension, i.e., populating custom segments in IDoc.

Check the code and activate.  

Code in ZXVSVU01


*& Include           ZXVSVU01                                         *


*In this scenario, the E1KNA11 has been extended to accommodate

*User-defined fields in the customer table kna1. The name of the


*segment is z1kna11. There is one custom field: visitor


*Data declarations

DATA: kna1m like e1kna1m,

      kna11 like e1kna11,

      z1kna11 like z1kna11,

      w_kna1 like kna1. 

*  make sure you are processing correct message type

check message_type eq 'DEBMAS'.

* make sure data is added after the correct segment

check segment_name eq 'E1KNA1M'.

* since customer number is not passed in this user exit, you need to go

* through the data records to find the customer number

loop at idoc_data.

  case idoc_data-segnam.

     when 'E1KNA1M'.

       move idoc_data-sdata to kna1m.

     when 'E1KNA11'.

       move idoc_data-sdata to kna11.

  endcase.                             " case idoc_data-segname.

endloop.                               " loop at idoc_data. 

* select data from the user-defined fields in kna11.

select single *

  from kna1                            " Customer master table

  into w_kna1

 where kunnr = kna1m-kunnr.

if sy-subrc eq 0.

*  set the idoc extension name for control record

  idoc_cimtype = 'DEBMASEX'.

*  clear custom fields from kna1 to extended segment

  clear z1kna11.

*  copy custom fields from kna1 to extended segment 

move-corresponding w_kna1 to z1kna11. " field name must be same

*  condense all fields of extended segment

  condense: z1kna11-visitor.

*  populate segment name in the data record, copy data contents into it 

*  and append the data record to existing data records in

  move 'Z1KNA11' TO IDOC_data-segnam.    " administrative section

  move z1kna11 to idoc_data-sdata.       " data section 

  append idoc_data.

endif.                                 " if sy-subrc eq 0.


Step 10: 

Define Logical System

Assign client to Logical System

Maintain RFC Destination

Maintain Customer Distribution Model

Generate Partner Profiles

Distribute Customer Distribution Model


Step 11: Append the custom structure to the table KNA1 similar to the process done

        in outbound process.

Step 12.

Define Logical System

Assign client to Logical System

Generate Partner Profiles


Step 13. Execute the transaction to ‘Send Customers’ from Outbound system.


Step 14. Now in the Inbound system, create the project in the similar way as done at

        outbound side.

In the user exit EXIT_SAPLVV02_001, find include ‘ZXVSVU02’. Write the code to

 support IDoc extension.

Code in ZXVSVU02


*&  Include           ZXVSVU02                                         *


data: kna1m like e1kna1m,

      kna11 like e1kna11,

      z1kna11 like z1kna11.

data fs_kna1 type kna1.


message i000(0) with 'INBOUND PROCESS CALLED'.


  case idoc_data-segnam.

    when 'E1KNA1M'.

      kna1m = idoc_data-sdata.

    when 'E1KNA11'.

      kna11 = idoc_data-sdata.

    when 'Z1KNA11'.

      z1kna11 = idoc_data-sdata.

      select single *

        from kna1

        into fs_kna1

       where kunnr = kna1m-kunnr.

      if sy-subrc eq 0.

        update kna1

           set visitor = z1kna11-visitor

         where kunnr = kna1m-kunnr.


        idoc_status-docnum = idoc_control-docnum.

        idoc_status-status = '51'.

        idoc_status-msgty = 'E'.

        idoc_status-msgid = 'ZE'.

        idoc_status-msgno = '005'.

        idoc_status-msgv1 = kna1m-kunnr.

     append idoc_status.

      endif.                           " if sy-subrc eq 0.

  endcase.                             " case idoc_data-segnam.

endloop.                               " LOOP AT IDOC_data.


Step 15. Assign FM to extension/Message type

Transaction:          WE57

Path: Change à New Entries

Select ‘IDOC_INPUT_DEBITOR’ against DEBMAS06 basic type, to fill extra

information as shown below.

Function Module                Basic Type      Message Type                        Extension



Step 16. Execute the transaction to ‘Get Customers’.

And observe that records with extra data are saved in database.




Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image