Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Extend the Standard SAP IDOC ?

Former Member
0 Kudos

Hi experts,

I am trying to Extend the SAP Basic Type OILSHI01 this is a Shipment IDOC for Is-oil. Can anybody tell me what all are the steps to do the extension & how to Identify the User-exit to populate the fields which i have defined in the Custom segement.

Pl. provide me the detailed steps.....

Be sure for Points if i get proper answer.

Regards,

Umesh

8 REPLIES 8

former_member404244
Active Contributor
0 Kudos

former_member588853
Active Contributor
0 Kudos

hi,

creating an extention IDOC for basic type.

first you need to create segment in WE31, gving the segment name and adding fields to it.save it and then EDIT-->set release..

Now go to WE30...

enter your extension IDOC name. click radio button extension and create..

now create new link basic type and give basic type name and enter..

now you need to add the segment which you created as per your requirement as chich segment..

rewards if useful

regards,

nazeer

Former Member
0 Kudos

Hi,

Extending a Basic Type

Prerequisites

You must have completed the required steps in Extending an IDoc Type .

It can occur that you want to fill table fields which already have an equivalent in the basic type but which are not supplied in the standard system. You therefore do not need to extend the basic type, but rather only the function module that supplies the application fields. In this case, skip the procedure.

Procedure

...

1. Choose SAP menu ® Tools ® IDoc Interface/ALE ® Development ® IDoc ® Generate ALE Interface ® IDoc Types (WE30). The IDoc type editor is displayed.

2. If you have not already done so, create a transport request for your development objects (extension segments, extension, function exit and so on). You can access the Workbench Organizer from the editor by selecting Requests (Organizer). From there, select Request ® Create and reply to the questions which appear on screen. By selecting you can return to the IDoc type editor.

3. Name your extension in accordance with the customer namespace and choose Extension as the development object. Choose .

The name of your extension should be no more than 8 characters if you wish to use the extension to communicate with partners who are using SAP Releases prior to 4.0. You can only use extension names with more than 8 characters from Release 4.0 onwards.

4. Choose one of the following options:

Create New: Create the extension without a reference.

· Create copy,which you can then change if necessary

· Create as successor: Note that only one successor is allowed per release for each extension.

5. Select the basic type which is to be combined with your extension. Confirm your entries.

The basic type is displayed as a tree structure. See the color legend (Utilities ® Color legend).

6. Position the cursor on the segment where you wish to append the extension segments (the reference segment). Choose . You must now assign attributes for these child segments:

· Mandatory segment (indicator): Must data be written to this segment in the IDoc?

· Maximum and minimum frequency of use: How often may/must a segment occur in the IDoc?

7. You can add further children or “grandchildren” to this or any other reference segment in the basic type.

8. When the new extension is complete, you can save your entry.

You should keep the following factors in mind when dealing with extensions:

· Segments must not explicitly occur more than once in the IDoc type - this means that the extension cannot have any segments which already exist in the basic type. This also means that a successor must not have any segments which already exist in the predecessor.

· Parent segments of predecessors must remain parent segments in the case of successors.

· Extension segments cannot be created from reference segments using the Cut and Paste functions and vice versa.

In the example call your extension Z1ORDERS. Append Z1TEST1 child segment to E1EDP19reference segment in ORDERS01 basic type. The child segment can be used only once.

Regards,

Priyanka.

0 Kudos

Hi Everybody,

thanx for your reply. but can anybody tell me after extending this IDOC how to populate a data in this segemnt? How to find out for a User exit of a particular IDOC. Can anybody take the example of OILSH IDOC type.

If there is no user exit then how do i go abt it. Any Sample code ?

In case if i have to go for new (ZIDOC Types ) How do i do it. ?

P.S. -


I have never done any IDOC configuration. Therefore i request you to kindly give me step by step how to go abt. it.

Regards,

Umesh

0 Kudos

HI Umesh,

Following are the steps which help you populate the data in the segment after extending the standard idoc ( i presume you understood the method of extending the standard idoc).

Go to we30, write the idoc (basic type) name. Go to Edit -> Object Directory entry. From here you will find the package of the idoc.

Then goto smod. press Ctrl+F. This will give you a detailed search option. There, enter the package name you found from we30. and execute. It will give you all the relavant exits for that package. If you go through the description of each enhancement, you will be able to find the relavant exit.

After finding the exit, go to the Z include, which will already be written in the exit. Double click on the include, and then say enter. You will now be able to write code for populating the data in the segment.

Following is the sample code of an exit implemented for populating data for idoc type cremas04.

data: ls_data_a type E1LFA1A,

ls_data_m type E1LFA1M,

ls_idoc_data type edidd,

lv_index type sy-tabix.

----


  • Declaration for segment ZVAT_INFO ---AMITA *

----


data : ls_data_vat type ZVAT_INFO,

ls_idoc_data_vat type edidd.

----


if segment_name = 'E1LFA1A'.

read table idoc_data into ls_idoc_data with key segnam = 'E1LFA1M'.

ls_data_m = ls_idoc_data-sdata.

clear ls_idoc_data.

read table idoc_data into ls_idoc_data with key segnam = segment_name.

ls_data_a = ls_idoc_data-sdata.

lv_index = sy-tabix.

select single smtp_addr from adr6 into ls_data_a-lfurl

where addrnumber = ls_data_m-ADRNR

and flgdefault = 'X'.

ls_idoc_data-sdata = ls_data_a.

modify idoc_data from ls_idoc_data index lv_index.

endif.

----


  • Assigning data to segment ZVAT_INFO ---AMITA *

----


IF segment_name = 'ZVAT_INFO'.

ls_data_vat-STCEG = 'abc'.

ls_idoc_data_vat-sdata = ls_data_vat.

modify idoc_data from ls_idoc_data_vat index lv_index.

endif.

KIndly give me your mail id and i will send you the list of all the exits associated with standard idoc enhancements.

Hope this helps.

Pls Reward points if useful.

Karan

0 Kudos

Hi Karan,

My Email Id is : umeshsonawane@hotmail.com

waiting for your mai.

Regards,

Umesh

0 Kudos

Hi Priyanka,

Thanx for you reply. But can you pl. give the steps in detailed. You have talked only abt trnasaction WE30. what abt. 31 & any other.

Secondly how to populate the code into the Custom IDOC fileds.

& what if there is no user exit to do so. This i am saying becasue i could not able to locate the User exit for Shipment IDOC of IS-Oil which (OILSHI01).

can u pl. take this as a example & explain me the steps.

Regards,

Umesh

0 Kudos

1. Extend the IDOC in we30.Enter the Name of IDOC you want to create then click 2nd button ie extend the IDOC.

then 3 options will appear in next screen. choose first option ie extend from basic type by entering the name of basic type.

2. Create a custom segment in we31 for the fields you want to add in that custom segment starting with z.

3. Add this custom segment in extended IDOC created at first step. like in MATMAS ADD below parent segment.

4. Link basic IDOC type and EXtended IDOC type and Message type in we82.

5. Find the user exit for this IDOC where you can write code to populate fields for custom IDOC.

User exit you can search on SAP market place. or check IDOC documentation.

In mostly cases User Exit exits but if in some case USER Exit is not there then copy standard function module to z_function module and write code to trigger the code for custom segment.

Hope this helps you in extending an standard IDOC