Application Development and Automation 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: 
Read only

ORDERS05 Idoc Type Extension

Former Member
0 Likes
5,304

Hello,

I am extending the segment E2EDKA3 in ORDERS05. Please let me know any user exit or any other way to populate the values in the extended segments.

I am adding these fields: VBPA-KUNNR,VBPA-ADRNR,VBPA-XCPDK & VBPA-ADRNP .

Thanks in advance,

Suresh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,041

EXIT_SAPLEINM_002, include ZXM06U02, enhancement MM06E001.

4 REPLIES 4
Read only

Former Member
0 Likes
3,042

EXIT_SAPLEINM_002, include ZXM06U02, enhancement MM06E001.

Read only

Former Member
0 Likes
3,041

hi suresh,

i am extending the segment E2EDKA3 in ORDERS05. Please let me know any user exit or any other way to populate the values in the extended segments.

I am adding these fields: VBPA-KUNNR,VBPA-ADRNR,VBPA-XCPDK & VBPA-ADRNP .

i think u have solved ur problem.

can u pl help me out in clearing these questions?

1)wat's the purpose of adding extending an segment with extra fields(real-time scenario).

2) code for populating the extended segmant coded in the user-exit..

pl give reply...

thanking u...

ajay(ajay.techno4u@gmail.com)

Read only

0 Likes
3,041

Hi Ajay,

1)wat's the purpose of adding extending an segment with extra fields(real-time scenario).

If the user has any custom fields in one system and while migrating the data he wanted the custom fields data to be migrated. Then we have to go for IDoc extensions. In the extension we will ass the Custom fields. Then in order to populate data and retrive data we have to use EXITS in both the systems.

SAP provides exits for posting data as well as retriving data.

2) code for populating the extended segmant coded in the user-exit..

hope this solves ur query....

Read only

Former Member
0 Likes
3,041

Hi Suresh,

Go through this info ucan able to do.

Enhancement of IDoc Type

Usually enhancement takes place when the content in IDocs provided by SAP are not sufficient for the business process. IDoc extension can take place whenever dictionary table has a new structure appended required by the business process.

In brief IDoc extension takes place when extra fields are required for the business process.

Let us take a scenario and understand the process of IDoc extension.

In this scenario say visitor is different from the actual customer who has came to the sales office in behalf of the customer to obtain the quotation or inquiry etc. Or an authorized agent qualified by the actual customer to order for items. So a field by name NAMEVI (Visitor) is added to Customer master data. As there is no provision given by SAP to handle this, we need to extend an IDoc.

The standard message type and IDoc type provided by SAP are DEBMAS and DEBMAS05.

Consider the data in the table below for extending the IDoc. These details can be understood in different sections in the process of extending it.

Basic IDoc type DEBMAS05

Version 4.7

IDoc extension DEBMASEXT

Custom segment Z1KNA1

Fields in Custom Segment Visitor

Parent of Custom Segment E1KNA11

Outbound process

Step1. Customize kna1 table by appending a structure provided by SAP (ZAKNA1)

Component Component Type

VISITOR NAMEVI

Step2: Write a module pool program to update some existing customers to add data for Visitor.

Step3: Create a custom segment

Transaction Code: WE31

Segment type: Z1KNA11 Click (create). Provide short text

Field Name Data element

VISITOR NAMEVI

Save

Step4: Create IDoc extension

Transaction WE30

Object Name DEBMASEXT

Choose Extension

Click and it leads to next screen.

Linked basic type: DEBMAS05

Provide description and enter

Observe all the segments to be copied into your IDoc extension from linked basic

type.

Select E1KNA11 and click (create segment) to obtain a popup window

Provide the required values and observe child segment Z1KNA11 to be added to

parent segment E1KNA11.

Step5: Release segment and IDoc extension

Transaction: WE31

Segment type: Z1KNA11

Path: Edit à Set release

Step6: Assign Basic type to extension / messages

Transaction: WE82

Click , then

Select DEBMAS message type against DEBMAS06 basic type

Click provide the information

Message Type Basic Type Extension Version

DEBMAS DEBMAS06 DEBMASEXT 4.7

Delete the earlier one from which it was copied.

Save.

Observe the result as follows

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

*extended

*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

INBOUND PROCESS

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'.

LOOP AT IDOC_data.

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.

else.

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

IDOC_INPUT_DEBITOR DEBMAS06 DEBMAS DEBMASEXT

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

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

Rewards some points.

Rgds,

P.Nag