Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Creation of Extended IDOC

$
0
0

Purpose:

The extension IDOC concept comes into action when the standard IDOCs provided by SAP do not meet the customers’ requirement. IDOC is the acronym of Intermediate Document; IDOCs are nothing but a Data Format provided by SAP to transfer data in and out of an SAP system. Data are grouped under this (IDOC) data format for each application in order to maintain consistency while transferring data from one system to another system. Hence each application like order, delivery, invoice etc will have a standard IDOC available along with standard processing programs for the same. When standard IDOC does not meet customer’s requirement, custom extension IDOC are developed to meet the requirement and the corresponding processing program will be enhanced using existing customer exits.

The purpose of the document is to provide the step by step procedure for creating an extension IDOC.

 

Scenario:

In this document, we will discuss the extension of basic IDOC type “DELVRY03‟, this IDOC type is used to group delivery detail. The mentioned IDOC type does not have fields VBUK-KOSTK (Overall picking) and VBUK-KOQUK (Status of pick confirmation in its standard format. But customers business needs demand these fields to be added to delivery details. Hence the basic IDOC type “DELVRY03‟ will be extended as “ZDELVRY03‟ with the two new fields and relevant processing program will be identified and processing logic for the new fields will be included in the relevant customer exits.


Steps To Be Followed:


1) Create a Custom segmentTCODE WE31


It begins with creating a custom segment; type your custom segment name as ZELDP1 and click on the create button as shown below.

ZELDP1.png


When the create button is clicked, the below shown screen will be displayed. Enter a short description for the custom segment and add the required field name and the corresponding data element. Once the required fields are added, click on the save button.


Capture.PNG

After clicking on save button, click on back button, you will see the below show screen. Now click on the segment definition you have created and do Set Release from EDIT menu.


1.png


Here we can see that the release check box is checked.


Without releasing your segment definition you cannot use the segment in any IDOC type.


With this, custom segment creation is completed.


2) Create an Extension IDOC- TCODE WE30


With the above created custom segment, enter a name “ZDELVRY03‟ for the extension IDOC and select on the Extension radio button and click create button.

Click on the icon to create extension IDOC.


2.png


The following popup screen will be displayed. Click on the “Create New‟ radio button to create an extension with the help of a Basic IDOC type. Enter the standard basic type name “delvry03‟ in the “Linked Basic type‟ field and enter a short description and continue.


3.PNG

Note: Use the options –


  • Create New: Create the extension without a reference.
  • Create copy-here the extension can later be changed if necessary
  • Create as successor: Note that only one successor is allowed per release for each extension.

 

The following screen will be displayed with all the standard segment of basic type “delvry03‟. Now we need to add our custom segment to the required segment, in our example we will take segment E1EDL22. We will have to add the custom segment ZELDP1 to segment ELEDL22.


4.png


Click on the segment E1EDL22 to select it.


Select the segment E1EDL22 and click on the create button, an information message will pop up and say Extension segment type(s) will be in child segment type(s) of E1EDL22‟ as shown below. Click on continue.

5.png


Another pop up will be prompted for entering the custom segment name and attributes. Enter the name of the segment ZELDP1, minimum and maximum occurs as shown below.


6.png

The attributes entered here are chosen as per the requirement, when a custom segment is assigned at item level the minimum and maximum number is chosen considering the frequency the segment can occur in the idoc.


Newly added segment is seen as below.


7.png

Save the extension IDOC and click on the back button and go to utilities -> Enhancement -> Assign basic type.


The below pop up will be prompted with the basic type name, which we have used to create our extension type.in our case it is “delvry03” .Click on the continue button.

8.png

Now click on the Set Release menu item in EDIT menu to release the extension IDOC.

A pop up will be prompted as shown below and click Yes to release the Extension IDOC.


9.png

We have successfully created the extension IDOC.


3) Create a logical Message Type – TCODE WE81

By default the screen will be in display mode, go to change mode to enter a new entry. Give some name to the logical message type and a short description. Save the entry.


11.png

4) Assign Logical Message Type to Extension IDOC Type –TCODE WE82

Assign the created extension IDOC type with the above created logical message type. Here you will assign the message type with the extension IDOC type along with the basic type and release version combination as shown below.

Save the entry. Now the message type “ZDELVRY‟ will have the same structure as extension IDOC “ZDELVRY03‟ in runtime.

12.png


5) Create a Partner Profile and Assign Message Type – TCODE WE20

Create a partner profile and assign our message type to it. Also provide details like output types in the tabs.

Click on the Create Outbound Parameter button (An icon with green plus symbol). Following screen will be displayed. Enter the following information.


13.png

Transfer IDOC immediately option is selected to send the IDOC immediately when a delivery document is saved (i.e. each time the delivery document is saved successfully the IDOC will get created and transferred to the port.


6) Finding the Customer Exit and Write the Logic to Populate the Custom Segment


Find the function module. In this case it is the idoc_output_delvry.

Next step is to find the customer exit in the function module to populate the custom segment in the extension IDOC. Check for the PERFORM that fill the Data records internal table and proceed to find the relevant customer exit or directly you can search customer exit for Data record. Usually the customer exits for Data records will be “customer-function “002”.

7.png

7.png

This is the internal table idoc_data that need to be populated to add the new segment‟ZELDP1‟ and the corresponding fields.

Now check the attributes tab to see the package details of this function module

14.png

Go to transaction SMOD and press F4 on enhancement option.

In the pop up select the information system and enter the package name found above in the package option.


15.png

Now a pop up appears that lists the exit names here we will select the exit name whose short text matches our requirement.

7.png

Here we will select the exit name V55K0002 as it matches our requirement.

Now select the radio button Components and press enter.

16.png

On selection, we get the pop up that shows the function module exits. Double click on the exit.

17.png

Upon double clicking the module, we get the necessary include where we will write the code.

18.png

Double click on include name, it is this include which has the custom code for the Data Records.

The below code has the logic for adding the custom segment “ZELDP1‟ as child of “E1EDL22‟ in the data record internal table “IDOC_DATA‟ and what data needs to be populated in the fields of the custom segment.

19.png

Save and activate include ZXTRKU04.

Note: The code written above will be executed only if this enhancement components Project is activated in SMOD.


20.png

7.png

Here we can see that the implementation is checked. If the project is in the deactivate mode then the code will not work.

With this the Extension IDOC is successfully created. 


 

1)


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>