IDoc segment name prefix
Hi,
I'm trying to send the iDoc type 'MATMAS05' to a file port in the R/3 system. My problem is that the segments in the file start with 'E2', for example segment 'E2MAKTM'. In the iDoc type all the segments start with 'E1'.
I want to give the iDoc type definition (xsd file downloaded from WE60) to the legacy system people (so they can see the complete iDoc structure) and also to send them an example of the iDoc in a flat file form.
The segment names are different in the definition and in the example...
what can I do to solve it ? (I understand the difference between the E1,E2,E3)
Thanks, Nir.
Message was edited by: Nir Marcu
Hi Abraham,
Segment definition is changed whenever we add version , as you have upgraded to ECC6.0 segment definition might have change, observe the version number in we31 for segment definition and ask the other party to use that version for that segment.
Also see new release (600 for ECC6.0) is is linked with message type and basic type in we82
Regards
Vinod
Similar Messages
-
IDOC segment fields prefixing blank space with values
Hi Experts,
I am sending data through custom IDOC from SAP to XML which generates successfully but getting 2 problems in the data.
its having 3 level idoc segments:
SEGMENT1 with 1 field (field_name(20))
SEGMENT2 with 3 fields, (code_g(20), field_name(20), value(20))
SEGMENT3 with 4 fields, (code(20), field_name(20), Language(2) & text(20))
When i check the idoc in WE02,
1. i found that segment2-value field is prefixing some space along with the values.
Eg: if the output is "0111" whihc is plant, in the output (WE02) it is giving " 0111"
2. Segment3-language is no where in the output and text which should come as "011" is coming like " EN011" means it is concatinating language field value and displaying it with the text field value with prefixing space.
This is happening in PRD not in QA & DEV. I also checked the transport req and everything, Its same everywhere.
Can anyone please help me on this.
Regards,
NikHi,
This issue happnes when u are moving the data to iDOC segement with offset.
to aviod this improper move instead of using offset statement use below mentioned code.
decalare a structure as
Data SEG1 type SEGMENT1 ,
SEG2 type SEGMENT2,
SEG3 type SEGMENT3.
then while moving
SEG2-code_g = 'XXXX'
SEG2-field_name = 'YYYY'
SEG3-value = 'ZZZZ'
here u are moving the segment values to idoc data (SDATA) and then append it.
move seg3 to idoc-sdata.
then append it to idoc.
hope this helps -
How to assign idoc segment at runtime ??
Hi ,
I have a ztable which is maintained via sm30.
The field1 is a key field and other fields are idocsegment name , idoc field , field value .
Field1 = key field
idoc segment name (field2)
idoc field (field3)
field value(field4)
How do i update idoc segment and particular field with field4 at runtime .
segment name , field and value changes with the matching key field.
loop at it_edidd into wa_edidd
where segnam = wa_ztable-idoc_segment.
wa_seg = wa_edidd-sdata.
how to assign the field at runtime ?????????????????????????
how to change the value of field ?????????????????????????
update edid4 set sdata = wa_seg
where docnum = wa_edidd-docnum
and segnum = wa_edidd-segnum
and segnam = wa_edidd-segnam.
if sy-subrc <> 0 .
rollback work .
write: / wa_edidd-docnum .
else.
commit work.
endif.
endloop.
Please help me with the above code .
Regards,
RachelHello Rachel
You could do this the following way:
DATA: ls_edidd TYPE edidd,
ld_idx TYPE i.
FIELD-SYMBOLS:
<ls_segment> TYPE any,
<ld_field> TYPE any.
LOOP AT it_edidd INTO ls_eddid
WHERE ( segnam = wa_ztable-idoc_segment ).
ld_idx = syst-tabix.
ASSIGN ls_edidd-sdata TO <ls_segment> CASTING TYPE (ls_edidd-segnam). " <<<
ASSIGN COMPONENT wa_ztable-field3 OF STRUCTURE <ls_segment>
TO <ld_field>.
<ld_field> = wa_ztable-field4.
MODIFY it_edidd FROM ls_edidd INDEX ld_idx.
ENDLOOP.
However, be aware that your logic might fail in case of repetitive segments.
Regards
Uwe -
Change segment name for Idoc created through BDBG transaction
hi all,
I have created a BO thru SWO1 transaction and then have used BDBG. Now for one of the segments in the IDoC which got generated automatically,i would like to change the segment name.This object was completed long time back and hence was released. Now we have been asked to get the segment name changed. But, when i try to click on the change button it says "<b>the object has been generated and hence cannot be changed"</b> Is there an work around for this? Pls reply. Thanx
Regards,
VenkatHi,
I have the same error. Did you solve it?
Regards,
Lyda -
If i pass the SEGMENT NAME and its SDATA can i get the all IDOCs?
Hello
If i pass the SEGMENT NAME and its SDATA can i get the all IDOCs of these values(sdata) holding? is tehre any standard SAP function module?
Moderator message: please search for information and try yourself before asking.
Edited by: Thomas Zloch on Aug 23, 2011 2:44 PMHi Uwe,
Thanks very much for your reply, now I have another problem .
Only the authrotiy field in the authority object is not '*' shall I check for the authority, how can I realize this?
thanks very much for your help.
Lament -
Changing filed name description - idoc segment creation/change
HI,
is it possible to change the fieldname description in an IDoc Segment without changing the DataElement ?
Exampel:
I Used CHAR40 as dataelement for my own ZZFIELD. In the Idoc the fieldname description of the data element CHAR40 is shown.
Can i change this description ?
thx,
GordonNo, The IDOC always displays the texts based on the Data Element which is assigned to that field. If you want to display your own text you have two options:
1. Create an enhancement and change the text of the data element which is not recopmmended because it will be changed wherever that data element is used.
2. Instead just create an own data element where you can maintain any texts you need.
Hope that helps,
Michael -
Segment Name with extra information in WE02.
Hello SAPients!
I created an IDoc Extension for basic type WBBDLD04 and modified the corresponding BAdI. Everything works fine, the extra segment is correctly added and the information in the Segment is correct. The only problem I have is that in TCode WE02/WE05 the name of the segment appears with information of the first field.
Example: The segment is ZE1WBB1 but in the tree of the Tcode WE02 appears like <b>ZE1WBB1 1024.00</b> or sometimes like <b>ZE1WBB1 0.00</b>. That extra information corresponds to the first field of the custom segment that I created (<b>LABST</b> in this case)
If I look in the table EDID4 everything looks perfect. The segment name is what it should be and the SDATA field has the correct information.
What am I doing wrong?
Thanks!I found the problem, in WE31 I just had to remove the "Qualified Segment" Checkbox and Voila!
-
Hi Gurus,
i have a problem in Idoc, while creating output type for a Billing document that time one segment repeating lots of time with same data..how to avoid this?
MohanaMohana
Are you sure about the segment name E1EDK01 ?? Becoz.. Only one Segment of type E1EDK01 is allowed in one IDOC...
See below for details:
Segm.type E1EDK01
Minimum number 1
Maximum number 1
Parent segment
Hier.level 1
Thanks
Amol Lohade -
IDOC segment with multiple lines
Hi,
I have a requirement where I need to populate the multiple lines in one segment without getting created multiple segment.
I am generating material with multiple line data in the additional data using MATMAS05 IDOC for segment E1MTXHM but its generating multiple sub segments. I need to have multiple lines in one segment and not multiple segment.
Please let me know how to achieve multiple lines in one segment.
Thanks & Regards,
RayanHi Subas,
I haven written any code as I am triggering IDOC through BD10. This is a testing requirement and we need any IDOC irresepective of MATMAS, DEBMAS, CREMAS etc etc which can have multiple lines in a single segemnt.
Sample IDOC:
Z2XXXXD000 00002300002203CTDI-PA
90210 Testing Address
CA
Beverly Hills
United States
Z2XXXD000 00002400002203ON TESTING
303 308 5319
Z2XXXXC000 00002500000102Z004E
Actually every IDOC I am generating is getting multiple segment and each segment holding one line and my requirement is that all the lines should be get accomadated in a single segment like the above sample IDOC.
Actually each segment has segment name and IDOC no. followed by field values but my requirement is within one segment name and IDOC no. all the field values get accomadated. Hope you got the understanding of what my requirement is? Please guide me how to trigger multiple line in a segment.
Thanks & Regards,
Rayan -
Adding field in standard IDOC Segment E1EDL24
Hello Friends,
I have an urgent requirement that I have to extend IDOC segment E1EDL24 with two fields PABNR and LFSNR.
When I tries to change the segment in WE31, it shows an error message that you can only modify the segments of customer namespace and cannot modify Standard IDOC Segments.
Can we modify the standard IDOC segments, and if yes, how can we modify the standard IDOC segments. Please clarify.
Points will be rewarded generously.
Regards,
NavinHi Naveen,
We cannot Modify the Standard segments. But we have to Create a new Segment and Add these fields.
Then Create an Extended Idoc type
Implement User Exits in Outbound And Inbound ..
This is the Complete Steps and Info on this...with an Example...
Enhancing ALE
For example, if in an outbound interface you find that the IDOC type does not contain all the data you need to pass to the other system, you can extend the IDOC to accommodate the additional fields and enhance the ALE function modules to populate the fields. Similarly, if in an inbound interface, there is additional data that needs to be posted to the R/3 application, you can extend the IDOC type to have additional fields populated by the external system or translator or the other R/3 system and then enhance the inbound ALE function modules to post the additional data to the R/3 application.
let us use the SAP Customer Master application as an example. Specifically, letâs focus on the IDOC extension and ALE function module enhancement of IDOC type DEBMAS02 and message type DEBMAS (Customer Master) and the IDOC reduction of message type MATMAS.
IDOC EXTENSIONS
Letâs first look at the concept of IDOC extension. SAP delivers Basic IDOC types such as DEBMAS02, MATMAS02, ORDERS02, and WMMBID01. By extending the Basic IDOC type, you are actually creating a new IDOC type. You create a new segment with the additional fields. This new segment has to be associated with one of the existing Basic IDOC segments. Then you create a new extension type, which is associated with the Basic IDOC type. This results in a new IDOC type. In order for ALE function modules to relate to this new IDOC type, the IDOC type is linked to the corresponding message type.
Note that you should not add fields to existing segments but should create a new segment and associate it with an existing segment. This, in a nutshell, is the process of creating IDOC extensions.
In our example, the Basic IDOC type DEBMAS02 is used to communicate Customer Master data to the SAP Customer Master application. Even though the application has a screen to enter and store a contact personâs business address (see Figure 1), DEBMAS02 does not have a segment or fields that communicate the contact personâs business address. If your business requires that this business address be communicated to the other system through the ALE interface for Customer Master, then you have to extend the DEBMAS02 IDOC type, and enhance the corresponding ALE function module.
In DEBMAS02 the contact person fields are present in segment E1KNVKM and the business address of the contact person is stored on the SADR SAP table. You need to create a new segment, Z1SADRX, that is associated with E1KNVKM. This will be done in the process of creating an extension type ZDEBMASX. This extension type will then be associated with a new IDOC type, ZDEBMASZ. IDOC type ZDEBMASZ will be linked to message type DEBMAS for Customer Master. The final step in the IDOC extension process is to check the new objects. This check also verifies the structural integrity of the IDOC type. Letâs look at each of these steps in more detail.
1. Create an Extension Type and a New Segment.
Determine the fields on table SADR that you are going to provide for in the new segment Z1SADRX. You need fields for name, street, city, region, and country to give the business address of the contact person. You also need fields for the address number. ADRNR is a field in SAP tables such as SADR that uniquely identifies the address of an entity. This field is cross-referenced from other tables to the SADR table to obtain the full description of the address. Because this is an IDOC type for master data, the first field of the new segment will be MSGFN. The message function field informs the receiving system of the action to be taken for that particular segment. In the code that you write for populating the new segment, the value of the message function is the same as that of the parent segment E1KNVKM. In all, you will have 12 fields in segment Z1SADRX (see Table 1).
To create an extension type and new segment:
Use transaction WE30 or from WEDI go to Development -> IDOC types.
Enter ZDEBMASX for Object Name.
Choose Extension Type.
Click on Create.
You will see a pop-up screen. Choose Create New, and enter a description. For version 4.x, enter DEBMAS02 in the Linked Basic Type field. Enter.
You will see a screen with ZDEBMASX and its description in the first line. Click on this line, and press Create. For version 4.x, expand the tree of segments, and place the cursor on E1KNVKM.
You will see a pop-up screen. Enter E1KNVKM as the reference segment. Enter.
For 4.x, press Create after placing the cursor on segment E1KNVKM.
You will see a line appear with E1KNVKM hierarchically below ZDEBMASX, with a description "Customer Master contact person (KNVK)."
Click on this line and press Create. You will receive a message indicating that the new segment being created will be a child segment of E1KNVKM. Enter. A pop-up box appears for the new segment.
Enter Z1SADRX as the segment type, 1 for Minimum, 1 for Maximum. Leave Mandatory segment unchecked. These entries imply that there is only one Z1SADRX segment for every occurrence of the E1KNVKM segment, and also that this segment is not mandatory. Note that if the parent segment is not mandatory, then the child segment should not be mandatory, because this could result in a syntax error during the creation or processing of the IDOC.
For 4.x, you must first create the IDOC segment Z1SADRX (Iâll explain why in a moment) from the menu path WEDI -> IDOC -> Development -> IDOC Segment.
Click on Segment Editor.
On the next screen, click on Create.
Enter a development class for the object. Enter.
This will take you to the screen for segment definition. Enter a description for the segment. Enter the field name, data element, and the data element documentation name. In most cases, all three fields may have the same values. If you are using a field in the segment that is not present in the ABAP/4 data dictionary, you must first create the domain, data element, field, and appropriate documentation before using it in the new segment.
Enter these three columns for all 12 fields. Save.
Click on Generate/Activate, F3 to step back.
From screen Maintain Segment, go to Segment Type -> Release. A checkbox now appears beside the segment definition Z1SADRX (see Figure 2). Check this box. Save.
Save again to store the descriptions of the segment, F3 to step back.
Save the extension type.
It is possible to have several new segments with relevant Basic IDOC type parent segments in a single extension type. However, you can form only one IDOC type based on a single extension type.
2. Create an IDOC Type.
The next step is to create an IDOC type by associating the extension type that you created with the Basic IDOC type. This is a simple process:
From transaction WE30 or WEDI go to Development -> IDOC Types.
Enter ZDEBMASZ for Object Name.
Click on IDOC Type.
Click on Create.
Enter DEBMAS02 for Basic IDOC type.
Enter ZDEBMASX for extension type.
Enter a description.
Enter.
You will see a display of the composite IDOC type with all segments, including Z1SADRX (see Figure 3).
It is possible to associate only one extension type with a Basic IDOC type for a given IDOC type. However, you can have multiple new segments in an extension type.
3. Link IDOC Type to Message Type.
The next step is to link the new IDOC type to its corresponding message type. This is important, because this relationship is referenced in the partner profile parameters where you specify the message type and IDOC type to be used for that particular representative system. To link the message type:
Use transaction WE82, or from WE30, go to Environment -> IDOC Type / Message Type, or from WEDI go to Development -> IDOC Type -> Environment Î IDOC Type / Message Type.
Click on Display <-> Change.
Click on New Entries.
Enter DEBMAS for message type.
Enter DEBMAS02 for Basic IDOC type.
Enter ZDEBMASX for extension type.
Enter your SAP R/3 release number for Release.
Save.
This data is stored on the EDIMSG table and is accessed by several ALE processes to relate the message type to the IDOC type.
4. Check the IDOC Type.
Before checking the IDOC type for consistency, it is important to perform another step that releases the extension type to the IDOC type:
From WEDI go to Development -> IDOC Types -> Extras -> Release Type, or from transaction WE30 go to Extras -> Release Type.
For the Object Name ZDEBMASX and radio button Extension Type, click Yes.
The extension type has now been "released."
You canât edit the extension type once itâs released. To cancel the release for further editing or deactivation, go to WE30 Î Extras Î Cancel release. The final step in the IDOC extension process is checking the validity of the IDOC type:
From transaction WE30 or WEDI go to Development -> IDOC types.
Enter ZDEBMASX for Object name.
Click on Extension Type.
From the Development Object menu select Check.
Repeat the operation for IDOC type ZDEBMASZ.
A check log will be generated for each run with details of correctness or errors (see Figure 4).
In some situations it is possible to receive errors during the check process, especially segment length errors. The incorrect IDOC segment can be repaired and corrected by executing program RSEREPSG. This program checks the formal consistency and repairs incorrect segments. In test mode it will generate a log of formal correctness for the specified segment only. For the program to repair segments in normal mode, the underlying IDOC structures (DDIC structures) must be active. This program rectifies the lengths of the DDIC structures and not the fields themselves. RSEREPSG can also be used to change the person responsible for the object and the release flag.
Menu paths may vary slightly depending on the release/version of SAP R/3, but the procedures and the principles are the same.
ALE FUNCTION MODULE ENHANCEMENTS
Having extended the IDOC type to contain additional fields for an inbound or outbound application, you now want to enhance ALE function modules for populating the additional segment on the outbound or applying the additional segment data on the inbound application.
The core working code for ALE processes for a given application area is always encapsulated in ABAP/4 function modules. These function modules are associated with such control information as message types and process codes. So the ALE process checks this control information and derives the name of the function module to invoke for that particular IDOC processing from certain database tables. These function modules contain objects known as customer functions, which can be considered SAP Enhanced user exits. A function module is called at a particular point during the processing of the main program or function module, and it can be used to influence data processing at that point by adding code to the customer function. The customer function behaves like a normal function module and has import and export parameters, tables (internal tables) statement, and exception processing. Unlike a conventional user exit, customer functions give you the ability to modify only data available to you by the function moduleâs parameters and internal tables. While most ALE/EDI function modules are supported by customer functions, there are ALE/EDI processes that still use conventional user exits. There are a few ways to determine which function module to enhance for a given message type/process code:
For master data distribution, from SALE go to Extensions -> Master data distribution -> Setup additional data for message types. Search for message type DEBMAS in this example. You see an entry for DEBMAS associated with function module MASTERIDOC_CREATE_SMD_DEBMAS. This data is stored on table TBDME. The function module names for all master data message types follow this pattern: MASTERIDOC_CREATE_SMD_messagetype. This function module calls another function module of name MASTERIDOC_CREATE_DEBMAS or MASTERIDOC_CREATE_messagetype. Search for the words customer function, and you find several hits that can be used to add code to the function module.
From WEDI got to Control -> Inbound process codes -> Inbound with ALE service -> Processing by function module (transaction WE42), or from WEDI go to Control -> Outbound process codes -> Outbound with ALE service -> With function module (transaction WE41). There will be function modules associated with the process codes. For inbound, the function modules usually follow this pattern: IDOC_INPUT_messagetype: for example, IDOC_INPUT_CHRMAS for inbound characteristics master.
Use transaction WE57 or from WEDI go to Development -> Message/Application Object. The entries list the function module, Business Object, message type, and IDOC type that are used for inbound ALE/EDI interfaces.
Customer functions are not specific only to ALE and EDI but also to all programs/modules in SAP R/3. Customer function is a SAP enhancement component; the other two types are menu and screen enhancements.
All customer function exits are maintained in SAP enhancements and are found by using transaction SMOD. After executing transaction SMOD, pull down (F4) on the enhancement name field, and execute again. This provides you with a list of all SAP enhancements available. SAP enhancements are grouped by development class pertaining to an application area. Choose Application development R/3 SD master data distribution for development class VSV to lead to a screen that lists VSV00001 as an enhancement (see Figure 5). Press Component +/- to display its function exit components. There are four possible components listed, all of which are function exits (and are function modules) that are called from the ALE function modules in the form Call Customer Function Î001â. This is a special occurrence of the ABAP statement Call. Go to item Exit_SAPLVV01_ 001, which you need to enhance for the Customer Master outbound example of an IDOC extension. In the ALE-function module MASTERIDOC_CREATE_DEBMAS, the statement CALL Customer Function 001 is translated in the background to call component EXIT_SAPLVV01_001. Although this function exit can be edited using transaction SE37, you will use a simpler approach.
When you use SAP enhancements and their components, you manage them with an SAP object known as a project, which is like an envelope containing the selected enhancements and their components. A project can be used to control the execution of components and to transport them to other clients and instances in SAP. Basically, the process involves creating a project, including enhancements and components that are to be enhanced, editing the components, and then activating the project. The following process creates a project for our example Customer Master IDOC extension:
Execute transaction CMOD.
Enter name of project, say CSTMAST1.
Click on Create.
Enter a description of the project.
Save.
Click on SAP Enhancements.
Enter VSV00001 for Enhancement.
Save.
Once youâve created the project, edit the function exit components and activate the project. Remember that the code in the function exit enhancement will execute only if the project is activated. In fact, this is a convenient SAP enhancements feature, whereby the work in progress (developing code in the customer function) will not affect users of that application. When the code is completed, the project can be activated so the enhanced functionality takes effect. It can also be deactivated for maintenance.
As mentioned earlier, customer functions (function exits) are embedded in ALE function modules and can be used to influence the creation and modification of IDOC data on an outbound application or to post additional or modified IDOC data to an inbound R/3 application. Function exits are similar to regular function modules, with import/export parameters, tables (internal tables), and exceptions.
The two important factors to consider while developing the customer function are:
1. The point in the ALE function module where the function exit occurs
2. The data made available by the customer function that can be modified or posted to the R/3 application, based on the direction.
Because some function modules have several customer functions, it is critical to choose the function exit best suited for that particular enhancement. Do not attempt to perform activities that the function exit is not designed for. The importance of this point is illustrated by the following description of enhancing function modules for outbound and inbound ALE interfaces.
Outbound interfaces. In an outbound ALE interface you use function exits (customer functions) to populate additional segments created by an IDOC extension or to modify the existing IDOC data segments as per business requirements. Previously, you identified that enhancement VSV00001 has a component EXIT_SAPLVV01_001 (function exit), which can be used for populating the additional data segment Z1SADRX that you created in the IDOC extension ZDEBMASX (IDOC type ZDEBMASZ, based on Basic IDOC type DEBMAS02). You also learned that the ALE function module that calls this function exit is MASTERIDOC_CREATE_DEBMAS, which has a statement Call Customer Function 001.
Browse the function module MASTERIDOC_CREATE_DEBMAS using transaction SE37. You will find that this customer function is invoked for every segment of IDOC type DEBMAS02. In fact, the function exit is called soon after the creation of an existing segment has been populated with data and appended to the IDOC data table (internal table). Also, the function exit is exporting the message type, IDOC type, and the segment name and is importing the IDOC extension type. It is also passing the IDOC data internal table. This indicates that the ALE function module is allowing you to populate additional segments for every existing segment and modify the existing segmentâs data.
Letâs write ABAP/4 code to accomplish the task of populating IDOC segment Z1SADRX with a contact personâs business address:
From SE37, display function module MASTERIDOC_CREATE_ DEBMAS.
Find Customer Function 001.
Double-click on 001.
The function EXIT_SAPLVV01_001 will be displayed.
Double-click on INCLUDE ZXVSVU01.
You will be asked to create a new include object. Proceed as desired.
Enter code (as in Listing 1).
Be sure to perform a main program check (Function Module -> Check -> main program) and extended program check (Function module -> Check -> Extended check).
Now that you have extended the IDOC and enhanced the ALE function module based on the requirements for the contact personâs business address on the Customer Master, letâs test the interface. You should create a logical system and define a port for this interface. You should also configure the Customer Distribution Model to indicate that message type DEBMAS is being distributed to this logical system. The only difference in configuration between a regular outbound ALE interface and an enhanced one is the partner profile definition. While maintaining the outbound parameters of the partner profile, make sure the IDOC type is ZDEBMASZ. The fields for Basic IDOC type and extension type are automatically populated with DEBMAS02 and ZDEBMASX, respectively.
To maintain the contact personâs business address of a customer:
Use transaction BD12 or from BALE go to Master Data ->Customer -> Send and send that Customer Master record by executing the transaction after filling in the relevant fields such as customer number, message type, and logical system.
Use transaction WE02 or WE05 to verify the IDOC created. You should see the new segment Z1SADRX populated with the correct data.
With SAP releases below 4.5B, you cannot capture changes to business address through change pointers because a change document object is not available for capturing business address changes, and also earlier releases have not been configured to write change documents for a contact personâs business address. If you would like this functionality, you can either create change document objects, generate function modules to create change documents, and perform ALE configuration to tie it in, or make a cosmetic change to the contact person screen data while changing the contact personâs business address so that it gets captured as a change to the Customer Master. Subsequently, the ALE enhancement that you performed captures the contact personâs business address.
Inbound interfaces. The process for enhancing inbound ALE interfaces is similar for outbound, with a few exceptions; specifically in the coding of customer functions (function exits) for the ALE/EDI function modules.
The first step is to create an IDOC extension for the specific Basic IDOC type by adding new segments at the appropriate hierarchy level: that is, associated to the relevant existing segment. Populate the data fields on the new segments with application data by the translator or external system/program before importing them into the R/3 System. Then, find the ALE function module that is invoked by the inbound processing. By browsing through the code or reading the documentation on the function exit enhancements using the SMOD transaction, identify the function exit in which you should place your code. The technique used in the code to post the additional or modified IDOC data to the application can vary based on the application rules and requirements, the data available at that point in processing, and the application function modules available to update the application tables. It is important to search first for application modules that process the data and see if they can be called within the function exit. If the additional data in the extended segments in specific to a custom table or resides in nonkey fields of a single or small set of tables, you may be able to update it directly by SQL statements in the function exit. This approach should be carefully evaluated and is certainly not highly recommended.
Another option is to use Call Transaction from within the function exit to process the additional data. For example, in the case of message type WMMBXY for inbound goods movements from a warehouse management system, the standard interface creates batches for materials, but does not update its characteristics. In such a case, you can use Call Transaction MSC1 to create the batch and assign characteristic values to it from within the function exit provided.
Error handling is a very important consideration when making enhancements to inbound ALE/EDI objects. In ALE and EDI inbound processing, workflow is used for handling errors at different levels such as technical and application. If workflow has been configured for the interface, the error messages and workflow items flow to the inbox of the named recipient(s).
It is also critical to enhance the workflow that handles notifications of the inbound ALE/EDI process. In most scenarios this is not a very difficult task because SAP lets you influence the workflow parameters and messages in function exits (customer functions). You typically do this using flags and message codes to trigger certain workflow actions. If you conform to the status codes and flags stipulated for workflow processing, the enhancement could be error-free and seamless. In the case of an inbound IDOC with an extension, you should populate the EDIDC fields IDOCTYP (new IDOC type) and CIMTYP (extension type) accordingly.
Reward if Helpful -
Hi,
Iam new to idocs and a functional consultant. I need to know whenever we receive the inbound idocs and if i see the segments of the inbound idoc, do the fields which i see in the segments are the sap fields.????/ for instance if the inbound idoc needs to create a sales order, then the fields of the segments of such an inbound idoc are the normal sap sales order fields ??
do i need to give functional specs to the abapers that whenever the inbound idocs is received the segments fields need to be mapped to sales order fields if such an idoc needs to create a sales order ??
regards
sachinHi Sachin,
Most of the IDoc segment fields are simmilar to SAP transaction fields e.g. most of the ORDERS IDoc segment fields will be simmilar to what you can see in VA01/VA02 screen fields.
Some fields may have different names.
In the case of few segments which may repeate in IDoc with different qualifiers (such as partner details, date segments), fields will be same but different qualifier value decides where these field values will be populated in the Order.
If you are using standard function module to create Order, it will take care of mapping IDoc segment fields to VA01/VA02 screen fields. But if it is a Z function module, then you need to specify the mapping.
Hope this information will help you.
Regards,
Mahesh Pakhale -
How to populate IDOC segments...
Hello Experts,
I was just tasked to add new fields in an IDOC segment. My question is, how do I populate
those newly created fields? The data will be coming from a purchase order.
Thank you guys and take care!Hi,
U cannot edit the existing segment u have to create a zsegment with the fields and then under the main segment u have to add this new segment..also u have create a extended idoc in ur case...then only u can add this new segment..also once u create a segment u have to release it...
u have to write the code in the userexit only...
check the sample code which i have done for my requirement for sales order..
*& Include ZXVEDU02
Program: Function Module:EXIT_SAPLVEDC_002 Creation Date: 12-04-2006 *
Program Type : Outbound IDOC Enhancement *
Program Description:OutBound IDOC Enhancement *
Modification ID:001 *
Date : 25-05-2006 *
Description : 1.The sales organization master data needs to be sent as supplier party
details.New segment ZZSALORG is created and attached to the parent
segment E1EDK01
2.Data required to be sent are:
1.NAME1- Sales organization name
2.STRAS- Address
3.TELFX- Fax number
4.TELF1- phone number.
3.ZZSALORG is filled with the above information.
Modification ID:002 *
Date : 09-06-2006 *
Description : A new field zstceg added to the segment zzdochdr and it was populated *
by selecting stceg field from Kna1 table *
Modification ID:001 *
Date : 15-06-2006 *
Description : 1.New segment ZZE1EDP01 is created and attached to the parent segment E1EDP01
2.Data required to be sent are:
1.POSEX- Item number
2.UEBTO- Overdelivery tolerance
3.UNTTO- Underdelivery tolerance
3.ZZE1EDP01 is filled with the above information.
*-- Data Declaration--
*-- Constant Declaration--
CONSTANTS: c_1(1) TYPE c VALUE '1',
c_langu LIKE t005t-spras VALUE 'E',
c_parvw LIKE vbpa-parvw VALUE 'RG',
c_e1edk01(7) TYPE c VALUE 'E1EDK01',
c_e1edk02(7) TYPE c VALUE 'E1EDK02',
c_e1edk17(7) TYPE c VALUE 'E1EDK17',
c_e1edka1(7) TYPE c VALUE 'E1EDKA1',
c_e1edk14(7) TYPE c VALUE 'E1EDK14',
c_004(3) TYPE c VALUE '004',
c_001(3) TYPE c VALUE '001',
c_002(3) TYPE c VALUE '002',
c_re(2) TYPE c VALUE 'RE',
c_we(2) TYPE c VALUE 'WE',
c_ag(2) TYPE c VALUE 'AG',
c_0010(4) TYPE c VALUE '0010',
c_zzdochdr(8) TYPE c VALUE 'ZZDOCHDR',
c_ze1edk02(8) TYPE c VALUE 'ZE1EDK02',
c_zze1edk17(9) TYPE c VALUE 'ZZE1EDK17',
c_zze1edka1(9) TYPE c VALUE 'ZZE1EDKA1',
c_pe(2) TYPE c VALUE 'PE',
c_y(1) TYPE c VALUE 'Y',
c_zze1email(9) TYPE c VALUE 'ZZE1EMAIL',
c_zzsalorg(8) TYPE c VALUE 'ZZSALORG',
c_zze1edp01(9) TYPE c VALUE 'ZZE1EDP01',
c_e1edp01(7) TYPE c VALUE 'E1EDP01'.
*-- Variables Declaration--
DATA: lv_vbeln LIKE vbak-vbeln,
lv_country LIKE t005t-landx,
lv_text1 LIKE t042z-text1,
lv_vzskz LIKE knb1-vzskz,
lv_inco LIKE tinct-bezei,
lv_cadnr LIKE akkp-cadnr,
lv_pernr LIKE pa0105-pernr,
lv_parvw LIKE tpar-parvw,
lv_adrnr LIKE tvko-adrnr,
lv_zinso LIKE t056z-zinso,
Begin of Mod-002
lv_stceg TYPE stceg.
End of Mod-002
Begin of MOD-003
lv_min_tol TYPE KWMENG,
lv_max_tol TYPE KWMENG.
End Of MOD-003
TYPES:BEGIN OF t_vbfa,
vbelv LIKE vbfa-vbeln,
erdat TYPE erdat,
END OF t_vbfa.
DATA: i_akkp TYPE akkp.
*-- WorkArea Declaration--
DATA : wa_zdochdr TYPE zzdochdr,
wa_ze1edk02 TYPE zze1edk02,
wa_ze1edk17 TYPE zze1edk17,
wa_zze1email TYPE zze1email,
wa_zzsalorg TYPE zzsalorg,
wa_zze1edp01 TYPE zze1edp01,
wa_e1edk02 TYPE e1edk02,
wa_e1edk17 TYPE e1edk17,
wa_e1edka1 TYPE e1edka1,
wa_e1edk01 TYPE e1edk01,
wa_e1edp01 TYPE e1edp01,
wa_adrc TYPE adrc,
wa_pa0105 TYPE pa0105,
wa_zze1edka1 TYPE zze1edka1,
wa_zzdochdr TYPE zzdochdr,
wa_vbfa TYPE t_vbfa,
wa_vbpa TYPE vbpa.
*-- Move data to ZZDOCHDR Segment--
CASE int_edidd-segnam.
WHEN c_e1edk01.
MOVE int_edidd-sdata TO wa_e1edk01.
*--Begin of MOD001+(Modification ID 001)--
*-- Filling of ZZSALORG segment--
SELECT SINGLE adrnr
FROM tvko
INTO lv_adrnr
WHERE vkorg EQ dxvbak-vkorg.
IF sy-subrc EQ 0.
SELECT SINGLE *
FROM adrc
INTO wa_adrc
WHERE addrnumber EQ lv_adrnr.
wa_zzsalorg-salorg = dxvbak-vkorg.
wa_zzsalorg-name1 = wa_adrc-name1.
wa_zzsalorg-name2 = wa_adrc-name2.
wa_zzsalorg-stras = wa_adrc-street.
wa_zzsalorg-telf1 = wa_adrc-tel_number.
wa_zzsalorg-telfx = wa_adrc-fax_number.
wa_zzsalorg-land1 = wa_adrc-country.
wa_zzsalorg-strs2 = wa_adrc-str_suppl1.
wa_zzsalorg-street2 = wa_adrc-str_suppl2.
wa_zzsalorg-street3 = wa_adrc-str_suppl3.
wa_zzsalorg-ort01 = wa_adrc-city1.
wa_zzsalorg-pstlz = wa_adrc-post_code1.
wa_zzsalorg-regio = wa_adrc-region.
int_edidd-segnam = c_zzsalorg.
CLEAR int_edidd-sdata.
MOVE wa_zzsalorg TO int_edidd-sdata.
APPEND int_edidd.
CLEAR: wa_adrc,
wa_zzsalorg.
ENDIF.
*--End of MOD001+(Modification ID 001)--
SELECT SINGLE text1
FROM t042z
INTO lv_text1
WHERE land1 EQ dxvbpa-land1
AND zlsch EQ dxvbkd-zlsch.
READ TABLE dxvbpa INTO wa_vbpa WITH KEY vbeln = dxvbpa-vbeln
parvw = c_parvw.
IF sy-subrc EQ 0.
Begin of Mod-002
SELECT SINGLE stceg
FROM kna1
INTO lv_stceg
WHERE kunnr = wa_vbpa-kunnr.
End of Mod-002
SELECT SINGLE vzskz
FROM knb1
INTO lv_vzskz
WHERE kunnr EQ wa_vbpa-kunnr
AND bukrs EQ dxvbak-bukrs_vf.
IF sy-subrc EQ 0.
SELECT SINGLE zinso
FROM t056z
INTO lv_zinso
WHERE vzskz EQ lv_vzskz
AND waers EQ wa_e1edk01-curcy.
wa_zzdochdr-zdoctitle = dobject-objky.
wa_zzdochdr-zdate = dobject-erdat.
wa_zzdochdr-zmestyp = dobject-kschl.
wa_zzdochdr-zmedium = dobject-nacha.
wa_zzdochdr-zlang = dobject-spras.
wa_zzdochdr-zttype = dxvbkd-kdkg1.
wa_zzdochdr-zpaymethod = dxvbkd-zlsch.
wa_zzdochdr-zpaytext = lv_text1.
wa_zzdochdr-zintonpymt = lv_zinso.
Begin of Mod-002
wa_zzdochdr-zstceg = lv_stceg.
End of Mod-002
int_edidd-segnam = c_zzdochdr.
CLEAR int_edidd-sdata.
MOVE wa_zzdochdr TO int_edidd-sdata.
APPEND int_edidd.
CLEAR : wa_zzdochdr.
ENDIF.
ENDIF.
*-- Move data to ZZE1EDK02 Segment--
WHEN c_e1edk02.
MOVE int_edidd-sdata TO wa_e1edk02.
IF wa_e1edk02-qualf EQ c_004.
SELECT SINGLE vbelv FROM vbfa INTO wa_vbfa
WHERE vbeln EQ lv_vbeln
AND vbtyp_v EQ 'B'.
IF sy-subrc EQ 0.
SELECT SINGLE erdat FROM vbak INTO wa_vbfa
WHERE vbeln EQ wa_vbfa-vbelv.
int_edidd-segnam = c_ze1edk02.
CLEAR int_edidd-sdata.
MOVE wa_vbfa TO int_edidd-sdata.
APPEND int_edidd.
CLEAR wa_vbfa.
ENDIF.
ENDIF. " IF ended for "IF wa_e1edk02-qualf = '004'" condition.
**-- Move data to ZZE1EDK17 Segment--
WHEN c_e1edk17.
MOVE int_edidd-sdata TO wa_e1edk17.
IF NOT dxvbkd-lcnum IS INITIAL.
SELECT SINGLE inco1
inco2
FROM akkp
INTO i_akkp
WHERE lcnum EQ dxvbkd-lcnum.
IF sy-subrc EQ 0.
IF wa_e1edk17-qualf EQ c_001.
wa_ze1edk17-lkond = i_akkp-inco1.
wa_ze1edk17-qualf = wa_e1edk17-qualf.
SELECT SINGLE bezei
FROM tinct
INTO lv_inco
WHERE spras EQ 'E'
AND inco1 EQ i_akkp-inco1.
IF sy-subrc EQ 0.
wa_ze1edk17-lktext = lv_inco.
ENDIF.
ELSEIF wa_e1edk17-qualf EQ c_002.
wa_ze1edk17-qualf = wa_e1edk17-qualf.
wa_ze1edk17-lktext = i_akkp-inco2.
ELSE.
ENDIF.
int_edidd-segnam = c_zze1edk17.
CLEAR int_edidd-sdata.
MOVE wa_ze1edk17 TO int_edidd-sdata.
APPEND int_edidd.
CLEAR wa_ze1edk17.
ENDIF.
ENDIF. " IF ended for not initial condition.
*--Move data to zze1edka1 Segment--
WHEN c_e1edka1.
MOVE int_edidd-sdata TO wa_e1edka1.
*--Checking the wa_e1edka1-parvw field for 'RE'--
IF wa_e1edka1-parvw EQ c_re.
IF NOT dxvbkd-lcnum IS INITIAL.
SELECT SINGLE cadnr
FROM akkp
INTO lv_cadnr
WHERE lcnum EQ dxvbkd-lcnum.
IF sy-subrc EQ 0.
SELECT SINGLE *
FROM adrc
INTO wa_adrc
WHERE addrnumber EQ lv_cadnr.
wa_zze1edka1-parvw = wa_e1edka1-parvw.
wa_zze1edka1-partn = wa_e1edka1-partn.
wa_zze1edka1-land1 = wa_adrc-country.
wa_zze1edka1-name1 = wa_adrc-name1.
wa_zze1edka1-name2 = wa_adrc-name2.
wa_zze1edka1-stras = wa_adrc-street.
wa_zze1edka1-strs2 = wa_adrc-str_suppl1.
wa_zze1edka1-ort01 = wa_adrc-city1.
wa_zze1edka1-pstlz = wa_adrc-post_code1.
wa_zze1edka1-regio = wa_adrc-region.
int_edidd-segnam = c_zze1edka1.
CLEAR int_edidd-sdata.
MOVE wa_zze1edka1 TO int_edidd-sdata.
APPEND int_edidd.
CLEAR: wa_adrc,
wa_zze1edka1.
ENDIF.
ENDIF.
ENDIF. " IF ended for "IF wa_e1edka1-parvw EQ 'RE'" condition.
*--Checking the wa_e1edka1-parvw field for 'WE'--
IF wa_e1edka1-parvw EQ c_we.
IF NOT dxvbkd-lcnum IS INITIAL.
SELECT SINGLE cadnr
FROM akkp
INTO lv_cadnr
WHERE lcnum EQ dxvbkd-lcnum.
IF sy-subrc EQ 0.
SELECT SINGLE *
FROM adrc
INTO wa_adrc
WHERE addrnumber EQ lv_cadnr.
wa_zze1edka1-parvw = wa_e1edka1-parvw.
wa_zze1edka1-partn = wa_e1edka1-partn.
wa_zze1edka1-land1 = wa_adrc-country.
wa_zze1edka1-name1 = wa_adrc-name1.
wa_zze1edka1-name2 = wa_adrc-name2.
wa_zze1edka1-stras = wa_adrc-street.
wa_zze1edka1-strs2 = wa_adrc-str_suppl1.
wa_zze1edka1-ort01 = wa_adrc-city1.
wa_zze1edka1-pstlz = wa_adrc-post_code1.
wa_zze1edka1-regio = wa_adrc-region.
int_edidd-segnam = c_zze1edka1.
CLEAR int_edidd-sdata.
MOVE wa_zze1edka1 TO int_edidd-sdata.
APPEND int_edidd.
CLEAR: wa_adrc,
wa_zze1edka1.
ENDIF.
ENDIF.
ENDIF. " IF ended for "IF wa_e1edka1-parvw EQ 'WE'" condition.
*--Checking the wa_e1edka1-parvw field for 'AG'--
IF wa_e1edka1-parvw EQ c_ag.
IF NOT dxvbkd-lcnum IS INITIAL.
SELECT SINGLE cadnr
FROM akkp
INTO lv_cadnr
WHERE lcnum EQ dxvbkd-lcnum.
IF sy-subrc EQ 0.
SELECT SINGLE *
FROM adrc
INTO wa_adrc
WHERE addrnumber EQ lv_cadnr.
wa_zze1edka1-parvw = wa_e1edka1-parvw.
wa_zze1edka1-partn = wa_e1edka1-partn.
wa_zze1edka1-land1 = wa_adrc-country.
wa_zze1edka1-name1 = wa_adrc-name1.
wa_zze1edka1-name2 = wa_adrc-name2.
wa_zze1edka1-stras = wa_adrc-street.
wa_zze1edka1-strs2 = wa_adrc-str_suppl1.
wa_zze1edka1-ort01 = wa_adrc-city1.
wa_zze1edka1-pstlz = wa_adrc-post_code1.
wa_zze1edka1-regio = wa_adrc-region.
int_edidd-segnam = c_zze1edka1.
CLEAR int_edidd-sdata.
MOVE wa_zze1edka1 TO int_edidd-sdata.
APPEND int_edidd.
CLEAR: wa_adrc,
wa_zze1edka1.
ENDIF.
ENDIF. " IF ended for "IF NOT dxvbkd-lcnum IS INITIAL" condition.
ENDIF. " IF ended for "IF wa_e1edka1-parvw EQ c_ag" condition.
*--Checking the wa_e1edka1-parvw field for 'Y'--
IF wa_e1edka1-parvw+0(1) EQ c_y.
SELECT SINGLE parvw
FROM tpar
INTO lv_parvw
WHERE parvw EQ wa_e1edka1-parvw
AND nrart EQ c_pe.
IF sy-subrc EQ 0.
SELECT SINGLE pernr
FROM vbpa
INTO lv_pernr
WHERE vbeln EQ dxvbpa-vbeln
AND parvw EQ lv_parvw.
IF sy-subrc EQ 0.
SELECT SINGLE usrid_long
FROM pa0105
INTO wa_pa0105-usrid_long
WHERE pernr EQ lv_pernr
AND usrty EQ c_0010. " communication type email
wa_zze1email-zparvw = wa_e1edka1-parvw.
wa_zze1email-zname = wa_e1edka1-name1.
wa_zze1email-zemail = wa_pa0105-usrid_long.
int_edidd-segnam = c_zze1email.
CLEAR int_edidd-sdata.
MOVE wa_zze1email TO int_edidd-sdata.
APPEND int_edidd.
CLEAR: wa_adrc,
wa_zze1email,
wa_pa0105.
ENDIF.
ENDIF.
ENDIF. " IF ended for "IF wa_e1edka1-parvw EQ 'Y'" condition.
*--Begin of MOD003 (Modification ID 003)--
*-- Move data to ZZE1EDP01 Segment--
WHEN c_e1edp01.
MOVE int_edidd-sdata TO wa_e1edp01.
wa_zze1edp01-posex = wa_e1edp01-posex.
wa_zze1edp01-uebto = dxvbap-kwmeng + ( dxvbap-kwmeng * dxvbap-uebto / 100 ).
wa_zze1edp01-untto = dxvbap-kwmeng - ( dxvbap-kwmeng * dxvbap-untto / 100 ).
wa_zze1edp01-uebto = dxvbap-uebto.
wa_zze1edp01-untto = dxvbap-untto.
int_edidd-segnam = c_zze1edp01.
CLEAR int_edidd-sdata.
MOVE wa_zze1edp01 TO int_edidd-sdata.
APPEND int_edidd.
CLEAR: wa_zze1edp01.
*--End of MOD003 (Modification ID 003)--
WHEN OTHERS.
ENDCASE.
Regards,
Nagaraj -
Can we have feilds from different tables in one segment ?
Or a segment must have the fields from one particular table only ?Hey thanks to co-operate.This is my code. ALL the BEZEI values are not comming,support type values are not comming,
Take your time and seld me back reply.
Thanks
REPORT Z_CREDITMEMO_OUTBOUND MESSAGE-ID ZJOY .
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1
NO INTERVALS.
PARAMETERS: S_VBELN LIKE LIKPUK-VBELN.
PARAMETERS: P_MESTYP LIKE EDMSG-MSGTYP OBLIGATORY.
PARAMETERS: P_LOGSYS LIKE TBDLST-LOGSYS.
*PERFORM ARE_YOU_SURE.
SELECTION-SCREEN END OF BLOCK BL1.
*INTERNAL TABLE FOR ITEM DATA
ranges: r_matkl for vbap-matkl.
r_matkl-sign = 'I'.
r_matkl-option = 'BT'.
r_matkl-low = '000000300'.
r_matkl-high = '000000399'.
append r_matkl.
DATA: BEGIN OF I_ITEM OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
MATNR LIKE VBAP-MATNR,
VKAUS LIKE VBAP-VKAUS,
SPART LIKE VBAP-SPART,
NETWR LIKE VBAP-NETWR,
WAERK LIKE VBAP-WAERK,
KWMENG LIKE VBAP-KWMENG,
KONDM LIKE VBAP-KONDM,
MVGR1 LIKE VBAP-MVGR1,
MVGR2 LIKE VBAP-MVGR2,
MVGR3 LIKE VBAP-MVGR3,
MVGR4 LIKE VBAP-MVGR4,
MVGR5 LIKE VBAP-MVGR5,
KONDA LIKE VBKD-KONDA,
BSTDK LIKE VBKD-BSTDK,
BSTDK_E LIKE VBKD-BSTDK_E,
KDKG2 LIKE VBKD-KDKG2,
BEZEI1 LIKE TVLVT-BEZEI,
BEZEI2 LIKE TVM1T-BEZEI,
BEZEI3 LIKE TVM2T-BEZEI,
BEZEI4 LIKE TVM3T-BEZEI,
BEZEI5 LIKE TVM4T-BEZEI,
BEZEI6 LIKE TVM5T-BEZEI,
VTEXT1 LIKE V_T178-VTEXT,
VTEXT2 LIKE V_T188-VTEXT,
VTEXT3 LIKE TVKGGT-VTEXT,
END OF I_ITEM.
*Declaring constants
DATA:
*SEGMENT NAMES
C_SALES_ORDER_NUMBER LIKE EDIDD-SEGNAM VALUE 'Z1SONUMBER',
C_MATERIAL_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MATERIAL',
C_PRODUCT_LINE LIKE EDIDD-SEGNAM VALUE 'Z1MVGR1',
C_PRODUCT_NAME LIKE EDIDD-SEGNAM VALUE 'Z1MVGR2',
C_PRODUCT_VERSION_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MVGR3',
C_PRODUCT_PLATFORM_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MVGR4',
C_PRODUCT_APPSERVER_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MVGR5',
C_COMPILER_CODE LIKE EDIDD-SEGNAM VALUE 'Z1KONDM',
C_LANGUAGE_CODE LIKE EDIDD-SEGNAM VALUE 'Z1KONDA',
C_RUNTIME_BANDCODE LIKE EDIDD-SEGNAM VALUE 'Z1VKAUS',
C_SUPPORT LIKE EDIDD-SEGNAM VALUE 'Z1SUPPORT',
C_AMOUNT LIKE EDIDD-SEGNAM VALUE 'Z1AMOUNT'.
DATA :
C_CREDIT_IDOITY LIKE EDIDC-IDOCTP VALUE 'ZIPGI_IDOC_TYPE'.
*data declaration
*idoc control record
data : control_record_out like edidc.
*other data declaration
DATA:W_SALES_ORDER LIKE Z1SONUMBER.
DATA:W_MATERIAL LIKE Z1MATERIAL.
DATA:W_MVGR1 LIKE Z1MVGR1.
DATA:W_MVGR2 LIKE Z1MVGR2.
DATA:W_MVGR3 LIKE Z1MVGR3.
DATA:W_MVGR4 LIKE Z1MVGR4.
DATA:W_MVGR5 LIKE Z1MVGR5.
DATA:W_KONDM LIKE Z1KONDM.
DATA:W_KONDA LIKE Z1KONDA.
DATA:W_VKAUS LIKE Z1VKAUS.
DATA:W_SUPPORT LIKE Z1SUPPORT.
DATA:W_AMOUNT LIKE Z1AMOUNT.
*DECLARE TABLES
TABLES : VBAP,VBKD,TVM1T,TVM2T,TVM3T,TVM4T,TVM5T,TVLVT,T178T,T188T,
TVKGGT.
*CREATING INTERNAL TABLES FOR THE DATABASE TABLES
DATA:
INT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE,
IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE,
IT_VBAP LIKE VBAP OCCURS 0 WITH HEADER LINE,
IT_VBKD LIKE VBKD OCCURS 0 WITH HEADER LINE,
IT_TVM1T LIKE TVM1T OCCURS 0 WITH HEADER LINE,
IT_TVM2T LIKE TVM2T OCCURS 0 WITH HEADER LINE,
IT_TVM3T LIKE TVM3T OCCURS 0 WITH HEADER LINE,
IT_TVM4T LIKE TVM4T OCCURS 0 WITH HEADER LINE,
IT_TVM5T LIKE TVM5T OCCURS 0 WITH HEADER LINE,
IT_TVLVT LIKE TVLVT OCCURS 0 WITH HEADER LINE,
IT_T178T LIKE T178T OCCURS 0 WITH HEADER LINE,
IT_TVKGGT LIKE TVKGGT OCCURS 0 WITH HEADER LINE,
IT_T188T LIKE T188T OCCURS 0 WITH HEADER LINE.
SELECT APPLICATION DATA
*POPULATING THE ITEM DATA
break-point.
SELECT
VBAP~VBELN
VBAP~POSNR
VBAP~MATNR
VBAP~VKAUS
VBAP~SPART
VBAP~NETWR
VBAP~WAERK
VBAP~KWMENG
VBAP~KONDM
VBAP~MVGR1
VBAP~MVGR2
VBAP~MVGR3
VBAP~MVGR4
VBAP~MVGR5
FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE I_ITEM
WHERE VBAP~VBELN EQ S_VBELN
and vbap~matkl NOT IN r_matkl.
LOOP AT I_ITEM.
data: ITEMWORKAREA like line of I_ITEM.
BREAK-POINT.
select single
KONDA
BSTDK
BSTDK_E
KDKG2
FROM VBKD INTO corresponding fields of ITEMWORKAREA
WHERE vbkd~vbeln eq I_item-vbeln
AND vbkd~posnr EQ '000'.
select single
KONDA
BSTDK
BSTDK_E
KDKG2
FROM VBKD INTO corresponding fields of ITEMWORKAREA
WHERE vbkd~vbeln eq I_item-vbeln
AND vbkd~posnr EQ I_item-posnr.
select single
bezei
FROM tvm1t
INTO ITEMWORKAREA-BEZEI2
WHERE spras EQ sy-langu
AND mvgr1 EQ I_ITEM-mvgr1.
select single
bezei
FROM tvm2t
INTO ITEMWORKAREA-BEZEI3
WHERE spras EQ sy-langu
AND mvgr2 EQ I_ITEM-mvgr2.
select single
bezei
FROM tvm3t
INTO ITEMWORKAREA-BEZEI4
WHERE spras EQ sy-langu
AND mvgr3 EQ I_ITEM-mvgr3.
select single
bezei
FROM tvm4t
INTO ITEMWORKAREA-BEZEI5
WHERE spras EQ sy-langu
AND mvgr4 EQ I_ITEM-mvgr4.
select single
bezei
FROM tvm5t
INTO ITEMWORKAREA-BEZEI6
WHERE spras EQ sy-langu
AND mvgr5 EQ I_ITEM-mvgr5.
SELECT SINGLE
VTEXT
FROM T178T
INTO ITEMWORKAREA-VTEXT1
WHERE SPRAS EQ SY-LANGU
AND KONDM EQ I_ITEM-KONDM.
SELECT SINGLE
VTEXT
FROM T188T
INTO ITEMWORKAREA-VTEXT2
WHERE SPRAS EQ SY-LANGU
AND KONDA EQ ITEMWORKAREA-KONDA.
SELECT SINGLE
bezei
FROM TVLVT
INTO ITEMWORKAREA-BEZEI1
WHERE ABRVW = I_ITEM-VKAUS.
SELECT SINGLE
vtext
FROM TVKGGT
INTO ITEMWORKAREA-VTEXT3
WHERE KDKGR = ITEMWORKAREA-kdkg2.
ITEMWORKAREA-VBELN = I_ITEM-VBELN.
ITEMWORKAREA-POSNR = I_ITEM-POSNR.
ITEMWORKAREA-MATNR = I_ITEM-MATNR.
ITEMWORKAREA-VKAUS = I_ITEM-VKAUS.
ITEMWORKAREA-SPART = I_ITEM-SPART.
ITEMWORKAREA-NETWR = I_ITEM-NETWR.
ITEMWORKAREA-WAERK = I_ITEM-WAERK.
ITEMWORKAREA-KWMENG = I_ITEM-KWMENG.
ITEMWORKAREA-KONDM = I_ITEM-KONDM.
ITEMWORKAREA-MVGR1 = I_ITEM-MVGR1.
ITEMWORKAREA-MVGR2 = I_ITEM-MVGR2.
ITEMWORKAREA-MVGR3 = I_ITEM-MVGR3.
ITEMWORKAREA-MVGR4 = I_ITEM-MVGR4.
ITEMWORKAREA-MVGR5 = I_ITEM-MVGR5.
modify I_ITEM from ITEMWORKAREA.
CLEAR ITEMWORKAREA.
ENDLOOP.
Fill the control record Information.
control_record_out-MESTYP = P_MESTYP.
control_record_out-IDOCTP = C_CREDIT_IDOITY.
control_record_out-RCVPRT = 'LS'.
control_record_out-RCVPRN = P_LOGSYS.
FILL THE DATA RECORD
W_SALES_ORDER-VBELN = I_ITEM-VBELN.
INT_EDIDD-SEGNAM = C_SALES_ORDER_NUMBER.
INT_EDIDD-SDATA = W_SALES_ORDER-VBELN.
APPEND INT_EDIDD.
W_MATERIAL-MATNR = I_ITEM-MATNR.
W_MATERIAL-SPART = I_ITEM-SPART.
INT_EDIDD-SEGNAM = C_MATERIAL_DETAILS.
INT_EDIDD-SDATA = W_MATERIAL.
APPEND INT_EDIDD.
W_MVGR1-MVGR1 = I_ITEM-MVGR1.
W_MVGR1-BEZEI = I_ITEM-BEZEI2.
INT_EDIDD-SEGNAM = C_PRODUCT_LINE.
INT_EDIDD-SDATA = W_MVGR1.
APPEND INT_EDIDD.
W_MVGR2-MVGR2 = I_ITEM-MVGR2.
W_MVGR2-BEZEI = I_ITEM-BEZEI3.
INT_EDIDD-SEGNAM = C_PRODUCT_NAME.
INT_EDIDD-SDATA = W_MVGR2.
APPEND INT_EDIDD.
W_MVGR3-MVGR3 = I_ITEM-MVGR3.
W_MVGR3-BEZEI = I_ITEM-BEZEI4.
INT_EDIDD-SEGNAM = C_PRODUCT_VERSION_DETAILS.
INT_EDIDD-SDATA = W_MVGR3-MVGR3.
APPEND INT_EDIDD.
W_MVGR4-MVGR4 = I_ITEM-MVGR4.
W_MVGR4-BEZEI = I_ITEM-BEZEI5.
INT_EDIDD-SEGNAM = C_PRODUCT_PLATFORM_DETAILS .
INT_EDIDD-SDATA = W_MVGR4.
APPEND INT_EDIDD.
W_MVGR5-MVGR5 = I_ITEM-MVGR5.
W_MVGR5-BEZEI = I_ITEM-BEZEI6.
INT_EDIDD-SEGNAM = C_PRODUCT_APPSERVER_DETAILS.
INT_EDIDD-SDATA = W_MVGR5.
APPEND INT_EDIDD.
W_KONDA-KONDA = I_ITEM-KONDA.
W_KONDA-VTEXT = I_ITEM-VTEXT1.
INT_EDIDD-SEGNAM = C_COMPILER_CODE.
INT_EDIDD-SDATA = W_KONDA.
APPEND INT_EDIDD.
W_KONDM-KONDM = I_ITEM-KONDM.
W_KONDM-VTEXT = I_ITEM-VTEXT2.
INT_EDIDD-SEGNAM = C_LANGUAGE_CODE.
INT_EDIDD-SDATA = W_KONDM.
APPEND INT_EDIDD.
W_VKAUS-VKAUS = I_ITEM-VKAUS.
W_VKAUS-BEZEI = I_ITEM-BEZEI1.
INT_EDIDD-SEGNAM = C_RUNTIME_BANDCODE .
INT_EDIDD-SDATA = W_VKAUS.
APPEND INT_EDIDD.
W_SUPPORT-BSTDK = I_ITEM-BSTDK.
W_SUPPORT-BSTDK_E = I_ITEM-BSTDK_E.
W_SUPPORT-KDKG2 = I_ITEM-KDKG2.
W_SUPPORT-VTEXT = I_ITEM-VTEXT3.
INT_EDIDD-SEGNAM = C_SUPPORT.
INT_EDIDD-SDATA = W_SUPPORT.
APPEND INT_EDIDD.
W_AMOUNT-NETWR = I_ITEM-NETWR.
W_AMOUNT-KWMENG = I_ITEM-KWMENG.
W_AMOUNT-WAERK = I_ITEM-WAERK.
INT_EDIDD-SEGNAM = C_AMOUNT.
INT_EDIDD-SDATA = W_AMOUNT.
APPEND INT_EDIDD.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = CONTROL_RECORD_OUT
OBJ_TYPE = ''
CHNUM = ''
TABLES
COMMUNICATION_IDOC_CONTROL = IT_COMM_IDOCS
MASTER_IDOC_DATA = INT_EDIDD
EXCEPTIONS
ERROR_IN_IDOC_CONTROL = 1
ERROR_WRITING_IDOC_STATUS = 2
ERROR_IN_IDOC_DATA = 3
SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE E002 WITH I_ITEM-vbeln.
ELSE.
LOOP AT it_comm_idocs.
WRITE: / 'IDOC GENERATED',IT_COMM_IDOCS-DOCNUM.
ENDLOOP.
COMMIT WORK.
ENDIF. -
IDOCS: Segment Definition and Segment Type
Hi Gurus,
We are working on IDOCs and trying to send a Location Master IDOCs to Third party system.
1. In the IDOC print preview we are in a position to see the IDOC segment type Ex: E1TPLOC but customer is asking for Segment definition E2TPLOC.
When we go through the documentation:
u2022 Segment Type consists of Segment definition with Version and Release.
u2022 Segment Definition will contain the Field names
u2022 E1TPLOC, E1TPDLH, E1KNVAM, E1TPTRM & E1TPSHH Segment types with concerned Segment definitions are
E2TPLOC,E2TPDLH, E2KNVAM
How to see the Segment definition types?Hi,
You can see the documentation in the transaction WE60 by giving the IDOC Basic type and extension if you have any.
E1 and E2 are the same, when you see the definition of the segment the naming convention will be E2 and when populating the data it will be E1.
I believe he is asking the segment definition alone, you go to WE60 transaction and give the inputs and click the parser button and that will give you the definition of the idoc and which you can share it with your partner.
Thanks,
Mahesh. -
Idoc segment field - maximum length ?
Hi,
what is the maximum of characters in a segment field of an idoc ?
regards,
HansMax length = 1000 characters
Check out
http://help.sap.com/saphelp_nw04/helpdata/en/1c/9fad3a05fdb92de10000000a114084/content.htm
FYI
ALE Interface
The following objects are generated from the application function module:
· Message, IDoc structure and segments: Mapping of the complex data type
· Outbound function module: Each IDoc always contains one application object only
· Inbound function module: IDocs are always transferred to the application individually or in packets of objects.
· Customizing objects required for the run
Assigning names to generated objects
· Default message (maximum 30 characters) proposed from the function module name.
· IDoc (maximum 30 characters) is derived from the message the last two characters are extended by 01 (message <= 28 characters) or are replaced by 01 (message > 28 characters).
· Generated function module name
Outbound (maximum 30 characters): ALE_function module name (default)
Inbound (maximum 30 characters): IDOC_INPUT_message (default)
· Segments
The default segment name begins with E1 for SAP and Z1 for customers, or namespace /.../. A meaningful and unique segment name is assigned as follows:
- In the application system (maximum 27 characters):
The segment name is derived from the structure name:
· If the structure name is shorter than 24 characters, the segment name is copied directly.
· If the structure name is longer than 23 characters, it is shortened to 23 and the less important characters at the front are cut off. The remaining characters are used to form a number that establishes the uniqueness of the shortened name. If numbers 01 to 99 are used, assignment continues with numbers 100 to 999 until the segment name becomes unique. This ensures that new segment names are created for the same structure, when this structure is used many times in a complex data type.
Hope thisll give you idea!!
P.S award the points.
Good luck
Thanks
Saquib Khan
"Some are wise and some are otherwise"
Maybe you are looking for
-
Explode LUMF material in scheduling agreement
Hi SAP experts, In short: Is it possible to have LUMF materials explode in a scheduling agreement? At our company we have a lot of projects. We are in the process of selecting an appropriate way to handle these in SAP. We came to the conclusion that
-
How can I import data from history including time of visit to site?
When I open my "History" tab I can then select from the left hand column, for example "last seven days" and then select "copy" from the "Organize" tab. But when I paste into an Excel worksheet, the only information that shows up is the website. Is th
-
Wich HDMI-cable I need for the iMac?
I allready have the adapter Thunderbolt to HDMI. I want to connect a beamer (Panasonic PT-AX200E). In the beamer-manual stands: "Required is a cable, wich is compatible for the HDMI 1.080p signal (RP-CDHG100: optional)". Yours faithfully
-
Using weblogic as ssl client?
Hi, I am trying to connect from en ejb to a remote rmi server using ssl, I imported the servers key into the weblogic keystore and I see that's in there when running in ssl debug but the server complains ExecuteThread: '12' for queue: 'weblogic.kerne
-
Automatic start of particular excel file at window start up
Hi, I created an excel file for reminders. That pop ups at system start up. It has a short cut in start up folder ( C:\Users\drsantoshsinghrathore\AppData\Roaming\Microsoft\Excel\XLSTART ). The problem is, that it starts up every time I start excel a