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: 

Add Field to IDOC Segment

Former Member
0 Kudos
22,382

Hi,

I am relatively new when it comes to IDOCs. I have identified an IDOC type but its missing some fields I need to output.

How do I add a certain field to a segment and ensure that it contains the correct value when I output the IDOC?

Please help.

Thanks.

Kenny

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
3,486

Hi

You can use IDoc extension

Here is steps

/nWE31

Here will create the segments for extend our idocs.

Example: 'ZDUMMY'

-> Write a short description and field name.

-> Data element = CHAR1 (will create a new field in the idoc with 1 character extension)

-> Save (developer permissions needed)

2)

/nWE30

-> At development object select 'extension'

-> Write a name for object name (8 char extension). For MATMAS IDOC extension i create ZMATEX01. Click on 'create' button.

-> Now we will select the IDOC link. Select 'create new', and link to a basic type (MATMAS05 in our example). Don't forget to write a description (will be usefull in the future for identificate correspondances).

-> Select IDOC substructure where wich will be extended. Click on header and 'create segment' (you can paste from clipboard with 'insert' button).

-> Select ZDUMMY segment created before.

-> Save and fill package and transport order for this modification.

-> Release segment from toolbar (Utilities)

/nWE82

Add Message Type (MATMAS), Basic Type (MATMAS05), Extension (ZMATEX01) and Release.

Finish

All it's done! So now you can use your new IDOC. For SAP XI, must import again to your integration scenario. Check ZDUMMY field at the segment you have selected.

aRs

12 REPLIES 12

former_member194669
Active Contributor
3,487

Hi

You can use IDoc extension

Here is steps

/nWE31

Here will create the segments for extend our idocs.

Example: 'ZDUMMY'

-> Write a short description and field name.

-> Data element = CHAR1 (will create a new field in the idoc with 1 character extension)

-> Save (developer permissions needed)

2)

/nWE30

-> At development object select 'extension'

-> Write a name for object name (8 char extension). For MATMAS IDOC extension i create ZMATEX01. Click on 'create' button.

-> Now we will select the IDOC link. Select 'create new', and link to a basic type (MATMAS05 in our example). Don't forget to write a description (will be usefull in the future for identificate correspondances).

-> Select IDOC substructure where wich will be extended. Click on header and 'create segment' (you can paste from clipboard with 'insert' button).

-> Select ZDUMMY segment created before.

-> Save and fill package and transport order for this modification.

-> Release segment from toolbar (Utilities)

/nWE82

Add Message Type (MATMAS), Basic Type (MATMAS05), Extension (ZMATEX01) and Release.

Finish

All it's done! So now you can use your new IDOC. For SAP XI, must import again to your integration scenario. Check ZDUMMY field at the segment you have selected.

aRs

0 Kudos
3,486

Thanks.

But how do I make sure that ZDUMMY contains the right value?

Thanks again.

Kenny

Former Member
3,486

Hi,

Go to Transaction SE31 and enter segment. press change

first from menu EDIT-> cancel Release

then enter the fields in that segment with the data element entering.

Save. then again you have to put RELEASE from menu.

You have to search for the correct Exit(Program) for population of these custom fields which we added in this segment and write the code.

then only it works.

reward if useful.

regards,

anji

former_member194669
Active Contributor
0 Kudos
3,486

Check your output function module , ex. for MATMAS --> MASTERIDOC_CREATE_MATMAS whether any custom exit available , if available then populate the ZDUMMY segment within that customer exist.

Thanks

aRs

former_member194669
Active Contributor
0 Kudos
3,486

Hi,

and also check the transaction code WE57.

aRs

Former Member
0 Kudos
3,486

Hi,

To get custom fields on IDOC you need to add custom segment on IDOC and for that you have to create a extension IDOC with reference to Basic IDOC.

You can do that as explain below.

Here for example you have basic idoc ORDERS05 and you want to add additional segments at header level - ZE1EDK01 and line item level ZE1EDP01

1. <b>TCode - WE31</b> : Create custom segments ZE1EDK01 and ZE1EDP01 with the fields you want and release these segments.

2. <b>TCode - WE30</b> : Create extension IDOC

- In WE20 enter extension IDOC name - ZORDERS05, select "Extension" option and hit "create" button. When it gives pop-up, select "create new" and enterd linked basis type as "ORDERS05". Enter proper description and save.

3. On the next screen of WE30, select the segment under which you want to add your additional segment. Save everything.

4. <b>TCode - WE82</b>. Here you link extension idoc to basic idoc and message type.

- Go into change mode. Hit "New entries button" Enter Message type = "ORDERS", basic type = "ORDERS05" and extension type = "ZORDERS05".

You can populate this segment and fields you want using the user-exit available in that perticular IDOC processing.

Some common user-exits are:

1. Purchase Order IDOC: ORDERS05

Enhancement: <b>MM06E001</b> - User exits for EDI inbound and outbound purchasing documents

2. Quotation IDOC: ORDERS05

Enhancement: <b>VEDE0001</b> - SD EDI Outbound quotation (customer enhancement)

3. Invoice IDOC ( bill. doc): INVOIC02

Enhancement: <b>LVEDF001</b> - User exit for IDOC_OUTPUT_INVOICE

Let me know what message type, process code, idoc type you are using and i will tell you what user-exit you can use for your requirement.

Regards,

RS

0 Kudos
3,486

Hi,

Thanks for the clear instructions.

I have some questions though:

1) I extended idoc type ORDERS01 and made ZORDERS01 Extension. For output parameters in Partner Profile, do I still use the basic type ORDERS01 or use the extension name ZORDERS01?

2) Im modifying the FM IDOC_INPUT_ORDERS to supply data in the extension. I just have to modify the edidd table right?

3) How do I debug and make sure that it really goes through the exit?

Thanks so much.

Kenny

0 Kudos
3,486

Hi,

Here are the answers to your questions.

1. Yes, in partner profile you have to give both idoc name. Basic type = ORDERS01 and extension = ZORDERS01.

2. FM - IDOC_INPUT_ORDERS. It seems you are configuring OUTBOUND idoc then why are you talking about IDOC_INPUT_ORDERS. The FM you should be looking at is IDOC_OUTPUT_ORDERS. Also, to populate these custom segments and fields, you do not have to modify the FM. Just use the user-exit.

Check Enhancement <b>MM06E001</b> (User exits for EDI inbound and outbound purchasing documents). If you just want to populate extra segment in outbound IDOC then you should user-exit <b>EXIT_SAPLEINM_002</b> of enhancement MM06E001.

3. How to check the exit? - This exit will definitely trigger for ORDERS01 idoc. If you want to check in debug then what you can do is,

- Create a document.

- While saving the document, switch the debugging on with '/h' command.

- As soon as you are on debug screen, go to setting tab ( right-most tab). Here you will see the check-box called "update debugging" and save the settings.

- Now hit F8. A new session will open taking you to the update debugging.

- Here, you go to menu path "Breakpoint -> Breakpoint at -> Function Module" and put the FM EXIT_SAPLEINM_002 and hit save button.

- Now hit F8. The debugger will stop at the first line item of code in this user-exit.

Please note that the user-exit will only trigger if the IDOC is trigger and IDOC will only trigger if the correct message ( output type ) for EDI output ( medium = 6 )determines in the document.

Also, just put a one executable line of code in user-exit ( "break" statement is fine ) so the break-point sets there.

I hope this will help you.

Let me know if you need any information.

Regards,

RS

0 Kudos
3,486

Hi RS,

Thank you so much. I was able to do this but Im having problem with populating the segments in the exit. Please check my latest post regarding problem with IDOC extension.

I really appreciate everything.

Also, would you happen to have a sample outbound idoc program? Im developing an idoc type and want to output it.

Thanks in advance.

Best Regards,

Kenny

0 Kudos
3,486

Hi,

I have already reply to your question in my previus post. Let me know if i am missing anything.

Also if you can give me the information line, where have you added your extra segment ( under which standard segment) and the code you are using to populate the data, i can help you.

Let me know if you have any other issues.

Regards,

RS

Former Member
0 Kudos
3,486

Hi if you still want more info... tell me and give ur mail id. i will send a details step-by step documents 2 u

0 Kudos
3,486

Heres my email add:

kennie_m@yahoo.com

Thanks in advance.

Kenny