Idoc Segment - Context Handling.

Hi All,
Can anyone suggest me a solution as  how to handle the below idoc context problem.. its a file to idoc scenario
I have an Debmas idoc, in which It is possible for a customer to have more than one E1KNBKM segment, so we only want to map the first segment for that customer and then also we only want the information from the /GLB/XGT_EXTRA_17 segments that are child segments of E1KNBKM.
-Anu

What Ravi suggested was:
SourceNode --> Index -->
                            --> equalS --> ifWithoutElse (Then SourceNode) --> TargetNode
Constant(1) -->
Index is similar to Count function (just that it is more reliabel when counting multiple node occurences)...the above will check if the occurence of SourceNode isthe first or not.
Regards,
Abhishek.

Similar Messages

  • Context handling in message mapping  for an IDoc to File Scenario

    Hi,
    Can somebody help me with this issue. I have an Idoc to file scenario. heres my idoc structure. Its a custom Idoc
    Header (1..1)
    Detail (0..Unbounded)
             DependentDetail (0...Unbounded)              Note: This dependentdetail is a subelement of Detail
    Trailer(1...1)
    I  created my target structrure the same way as the Idoc structure.
    My output is a simple text file. I need the output in this format
    Header
    Detail1
       Dependentdetail1
       DependentDetail2
       DependentDetail3
    Detail2
       DependentDetail1
       Dependentdetail2
    Detail3
    Detail4
    Trailer
    Since the Detail and Dependent Detail records are unbounded .
    But right now i m getting my output like this:
    Header
    Detail1
    Detail2
    Detail3
    Detail4
    Trailer
    But the DependentDetail record in not showing up in the output file. I didnot do any context change in my mapping. So do I need to do any context handling??...If so can somebody explain me with this.
    Thanks,
    Adam
    Edited by: hymanroth on Apr 29, 2011 11:11 PM

    Thanks Kenneth foryour quick reply,
    Yes, I see the payload for Dependent detail in SXMB_MONI. So as you said earlier there's a problem with my content conversion.
    my content conversion is as follows:
    Header.fieldNames                             
    Header.fieldFixedLengths                
    Header.endSeparator                        
    Detail.fieldNames                               
    Detail.fieldFixedLengths                    
    Detail.endSeparator
    DependentDetail.fieldNames
    DependentDetail.fieldFixedLengths                   
    DependentDetail.endSeparator
    Trailer.fieldNames                             
    Trailer.fieldFixedLengths                
    Trailer.endSeparator  
    So As I told  earlier. With the above content conversion. I am not able to get the Dependent detail record in my output file. So If there is a change in my content conversion can u check it and tell me where I went wrong.
    Thanks,
    Harsh
    Edited by: hymanroth on May 2, 2011 7:03 PM

  • How SAP handles Child Idoc segment data insertion automatically

    Hello,
    We have some Infotypes with extra segments and IDocs are getting created with Parent and child segments.
    To fill the data into the parent/child segments, we are currently using User-Exits.
    Is there any settings/config in table level(e.g. T777D etc), or any other way, so that SAP handles the data filling into parent/child segments automatically.
    Thanks.

    No I dont want to change the value in WE19.... In runtime I am changing the value of schedule Line quantity and the same is getting update in SDSA also but when a new idoc is getting created that value is not getting reflected in that Idoc segment field.
    Kindly suggest.

  • Context handling during message mapping

    Hi,
    I'm working on a mapping and it almost works. There is just 1 thing to solve. I use the fixvalues funtion with as input a field A in a segment of my Idoc. This function is used to map a field B in another segment. However as this segment has multiple occurences, I have problems with the context handling: the first timle works ok but then it fails (as the filed A is in another segment/context). How could I fix this?  I would like to avoid UDF as I don't know much java.
    Kind regards,
    Ulrich

    Hi Ulrich,
    <b>Mapping A_source-Fixvalue-B_target</b>
    In the above case What are the elements exist in A_Source same thing will be transfered to B_target . If it is not find any value in Fixvalue table then it will pass the default value. So provde the default value.
    If there is not element in context then it won't create b_target not at all for that context. So use the Mapwithdefault() nodefunction before passing the value B_target. so in that case it will generate the empty value instead of none.
    Warm Regards,
    Vijay

  • How to create additional Line in file based on condition available as part of ZINVOIC02 Idoc segment

    Scenario Details:
    Receiving Zinvoic02 Idoc in PI. Idoc to file translation creates comma separated file with .csv extn
    The logic was kept in such a way that how many E1EDP01 (items) are available in IDoc that many no of records will be created in csv file.
    The file logic for some the fields is as below:
    No of records
    InvNumber
    InvDate
    CusNumber
    LineitemDesc
    Tax1Type
    Tax1%
    for 1st E1EDP01
    E1EDK01-BELNR
    E1EDK03-DATUM
    E1EDK01-PARTN
    Populate when E1EDP04/MSKWZ=O2 or O4 with E1EDP19/KTEXT
    Hardcode when E1EDP04/MSKWZ=O2 or O4
    Sum all E1EDP04 /MSATZ when E1EDP04/MSKWZ=O2 or O4
    for 2nd E1EDP01
    E1EDK01-BELNR
    E1EDK01-DATUM
    E1EDK01-PARTN
    same as above
    same as above
    same as above
    for 3rd E1EDP01
    E1EDK01-BELNR
    E1EDK03-DATUM
    E1EDK01-PARTN
    same as above
    same as above
    same as above
    Additional Line to be created when one or more of E1EDP01 is having E1EDP04/MSKWZ = O3
    same as above
    same as above
    same as above
    Hardcode "REIM for USE TAX"
    Hardcode ""
    Hardcode ""
    Now we have got addition requirement to add a new lineitem when tax code is equal to O3 for any of the E1EDP01.
    Is it possible to create additional lineitem based on condition. If yes, please share what should be the approach.
    How we can create the additional lineitem?
    Currently we are using E1EDP01 to do context handling.
    The target structure is :
    MT_FILE
         INVOICE     0..unbounded
              InvNumber     0..1
              InvDate          0..1
              CusNumber     0..1
              LineitemDesc     0..1
              Tax1Type          0..1
              Tax1%               0..1

    Hello,
    Please add one extra field in the data structure of the target mapping and let its occurrence be 0..unbounded under the root node 'MT_ADP_Invoice'.
    Apply the condition, if tax code MSKWZ (with its context changed to E1EDP01) equalsS to '03', then map it to the newly created target field whose occurrence is 0..unbounded.
    This will then create an additional field which is your requirement.
    The above is one way.
    But if you want to have the same target field name as ADP_File appended for tax field being '03'.
    Then in that case you can you two message mapping for one common operational mapping / interface.
    In the first message mapping you need to have one target data structure created with the source data structure remaining the same as the one shown by you in scrn shot. Now this target data structure will be similar to the source, except that you need to add one more field at the end(name different from other fields) in target (whose occurrence should be 0..unbounded), and it needs to be mapped to E1EDP01 provided the tax code field MSKWZ(its context changed to E1EDP01) equalsS to constant '03'.
    In the second message mapping you need to map the target structure of previous message mapping to the actual required structure. The newly added field should be mapped to ADP_File of your final target structure.
    This will then create the same structure as required.
    Note : Please change the occurence of ADP_File to 0..unbounded.
    Regards,
    Souvik

  • 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,
    Navin

    Hi 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

  • IDoc segment issue

    Hi,
    I have file to Idoc scenario, where my input file structure like below and need to create Idoc segments in SAP.
    Input Structure:
    Record (1--Unbounded)
    Header (1-1)
    Item_Details (1- Unbounded)
    Child_ItemsInfo (1 -Unbounded)
    Item_1 (1--1)
    abc
    def
    Item_2 (1--1)
    abc
    def
    Item_3 (1--1)
    abc
    def
    Now..I need to generate an Idoc segment "Z1ABCD", as many as child Item segments(Item_1,Item_2,Item_3) occurs in my input structure. I have used duplicate subtree on Idoc segment "Z1ABCD" and copied 2 more times.Now I have 3 "Z1ABCD" segments in my IDoc.
    Lets say, if my input structure have 2 Child_ItemsInfo, then I need to generate 6 "Z1ABCD" segments in Idoc. I'm able generate these segments.
    My code generating all the Item_1 segments then Item_2 segments like that...But I'm expecting a "Z1ABCD" segment at Item_details node level...like Item1,2,3 and then Item1,2,3....Please help me out!
    Note: My mapping looks like this;
    Item_1 ->remove context>Split by value(each) ->CollapseContext->Z1ABCD
    Item_2 ->remove context>Split by value(each) ->CollapseContext->Z1ABCD
    Item_3 ->remove context>Split by value(each) ->CollapseContext->Z1ABCD
    the target structure which I'm lookin for like below...(for 2 Child_ItemsInfo from my input structure)
    1.Z1ABCD (Item_1 info)
    2.Z1ABCD (Item_2 info)
    3.Z1ABCD (Item_3 info)
    4.Z1ABCD (Item_1 info)
    5.Z1ABCD (Item_2 info)
    6.Z1ABCD (Item_3 info)
    But my code generating the segments like below;
    1.Z1ABCD (Item_1 info)
    2.Z1ABCD (Item_1 info)
    3.Z1ABCD (Item_2 info)
    4.Z1ABCD (Item_2 info)
    5.Z1ABCD (Item_3 info)
    6.Z1ABCD (Item_3 info)
    Esha
    Edited by: esha nadh on Mar 9, 2011 9:14 PM

    I am bit confused .
    Why are you using this ...
    remove context-->Split by value(each) --->CollapseContext
    Do Direct assignment like below
    even the context should not change . it shoule be default .,
    Item_1 - > Z1ABCD
    Item_2 - > Z1ABCD
    Item_3 - > Z1ABCD
    isnt it working fine ??????
    actually it should ..
    In your case .
    IZ1ABCD for Item_1 coming together because . you Used removeContext So Both  Item_1 comest together .. and then you doing transformation .. so the result are coming together...
    Try Like Direct assignment . I hoping it should work fine
    regds
    PS

  • XI Mapping to Idoc - Multiple Identical Idoc Segments

    I am debuuging XI mapping. I see the same idoc segments in the mapping multiple times. However, the way the fields are mapped in each one is different.
    Why? Is this to handle different scenarios?
    Thanks.

    in IDOCs each segment could occur multiple times. Lets say if its a address segment, u could see it multiple times for billing, shipping etc etc. so, depending on business logic the mapping will change. Some fields you'll map to one segment and some fields to some other segment.
    --Archana

  • Mapping Items in XML string to multiple IDOC segments

    I would like to map an XML tag  <Text>Line1Line2Line3Line4</Text>
    to an IDOC segment E1ED1TEXT . Defined as occurring 0 to 999999.
    I would like to map each item separated by a tilde into a separate occurence of the IDOC text segment. Is ther anyway to repeat the mapping without duplicating the subtree.
    E1ED1TEXT
    Text_Id - "ZTXT"
    Text_Line = Line1
    E1ED1TEXT
    Text_Id - "ZTXT"
    Text_Line = Line2
    E1ED1TEXT
    Text_Id - "ZTXT"
    Text_Line = Line3

    Hello,
    This is only possible using UDF
    mapping is like this:
    Text -> UDF -> splitByValue:eachValue -> Text_Id
    UDF is of context type
    argument is input
    String temp[] = input[0].split("~");
    for(int a=0;a<temp.length;a++){
    result.addValue(temp[a]);
    Hope this helps,
    Mark

  • Generate multiple Idoc segments

    Hi all,
    I have a Flat file to Idoc Scenario.
    I need to generate no. of multiple Idoc Segments based on the source field value.
    For Eg: if Field1 starts with 5 or 6 then E1 segment should be created 5 times,
    similarly if Field1 starts with 4 then E1 segment is created 6 times
    And as many times E1 is created that many times the corresponding other E2,E3 segments are created
    i.e E2 E3 has 1-1 relationship with E1
    Can this be done graphically ?
    Working on PI 7.0 Environment
    I would appreciate your Inputs.
    Regards,
    Varun
    Edited by: Varun Reddy on Oct 5, 2010 8:21 AM

    Im pretty sure that if you duplicate the target segment the max number of times (6) but you only map to 4 of them, only 4 will be created in the target structure. Let the Mapping/Data drive how many segments actually get created in your target structure.
    I could be wrong but Im pretty sure thats how Ive handled repeating segments before.

  • Context Handling problem

    Hi all,
    I have a problem with a context handling requirement. I think UDF is needed in this case but I don't know where to start. Please see below for the scenario:
    I have an input structure like this:
    segment1
         field1
    segment2
         field2
    segment3
         field3
    node2
         field2
    node3
         field3
    node3
         field3
    the fields will corelate the segment and the node. so for this structure, segment2 and node2 are corelated. Actually, node2 is under segment2.
    here's my desired output to make things clearer:
    segment1
         field1
    segment2
         field2
         node2
              field2
    segment3
         field3
         node3
              field3
         node3
              field3
    field1 sample value. ex. 0000000001
    all field2 have the same value. Value from both segment2 and node2 of field2 is the same. ex. 0000000002
    all field3 have the same value. Value from both segment3 and the 2 node3s of field3 is the same. ex. 0000000003
    In my current mapping, I'm getting this erroneous output:
    segment1
         field1
         node2
              field2
    segment2
         field2
         node3
              field3
    segment3
         field3
         node3
              field3
    The nodes are not in their correct segments. node2 is one level higher because there was no node1.
    Occurrence of segments are 1..unbounded. nodes are 0..unbounded.
    Thanks all.
    Regards,
    SAPenthusiast

    Hello,
    You need to use UDF for this:
    UDF type is Context
    Arguments:
    input1
    input2
    HashMap map = new HashMap();
    for(int a=0;a<input2.length;a++){
         if(!map.containsKey(input2[a])){
              map.put(input2[a],"");
    for(int a=0;a<input1.length;a++){
         if(map.containsKey(input1[a])){
              result.addValue("true");
         else{
              result.addValue("false");
    mapping is something like this:
    input1 -> removeContext -> UDF -> target
    input2 -> removeContext -> /
    Hope this helps,
    Mark

  • How to insert the standard idoc segment in the idoc

    Hi Experts!
    We  are using  SRM 7.0.Wo got a requirement as below:
    In our organiation there will be both regular employees and the non-employees.For non-employees address will not be maintained in Tcode PA20 in backend ECC HR  system.Where as for employees address will be maintained.
    As the HR replication will be done by scheduled jobs, in case of non employees replication is not happening due to the missing address in PA20.In order to avoid this we are building some logic and as part of it we need to add the standard IDOC segment  'E1P0006' in the main idoc as this particular segment is for address and it is missing due to the missing address in PA20 for non-employees where as this idoc segment will be there for employees.
    As am very much new to idoc concept can some one help me how to handle this if any one of you came across this kind of scenario.
    Please find the attached document for the idoc seq we have.
    Thanks in advance.
    Regards,
    Kalyani

    1. Open the form
    2. Choose Tools--> Diagnostics
    3. In the block field choose $DESCRIPTIVE_FLEXFIELD$
    4. Field will show the list of all the DFF's enabled for that form.
    5. Choosing one will display the name of the DFF in the value field.
    Thanks
    Nagamohan

  • Replaced value is not getting relected in IDOC segment field

    Hi,
    Need your help for the below issue.
    I am replacing the PO # with Delivery Doc # . But the replaced value is not getting reflected in the IDOC segment field(e1bp2017_gm_item_create-po_number.).
    Function Module  which I am using is IDOC_INPUT_MBGMCR as a copy.
    Here is my code given below:
    SELECT
                SINGLE vbeln
                  INTO lx_vbeln
                  FROM lips
                 WHERE vgbel EQ e1bp2017_gm_item_create-po_number.
    Move lx_vbeln TO e1bp2017_gm_item_create-po_number.
    MOVE-CORRESPONDING e1bp2017_gm_item_create
                   TO goodsmvt_item.
    Then this is passed as  TABLE in "BAPI_GOODSMVT_CREATE".
    Please do the needful.

    Hi Dheepa,
    Check it in debug whether the filed is empty or having po#, when ur code is executed for the replacement. if it is empty, po# is populated after ur code. in this case you need to write the code in suitable place.
    Reddy

  • Unable to change the length of field in idoc segment

    Dear all,
    My requirement is to change the length of a field(Z field) in a segment (Z Segment). I tried the following but in vain
    1)Tried to  Cancel the release and then change the length of the domain. Unfortunately it is givin an error saying "Error while resetting release of segment ZC9DEMARA01".
    I also tried cancelling hte release of extension and then cancelled the release of segment
    2) Created a new version, but in new version the earlier fields are diabled. So I am unable to edit.
    I have gone through some of the links available in SDN but I could not solve as I am unable to cancel the release in the first step.
    [Idoc segment field length changes]
    Could you please help me.
    Thanks in advance!
    regards,
    Aravind

    Hello Aravind,
    I Have created one Segment type with some fields, changed the field length also its working.
    just try to cancel the release and change the length of the filed and do it set release again.
    Try it .
    Thanks,
    santhosh

  • Idoc Segment Cancel release error

    Hi all,
       I have problem in cancelling the release of an Idoc Segment. I have a requirement to add new fields to the segment. When I try to do Edit->Cancel Release it is throwing below error.
    "Error while resetting release of segment Z1PXXXX
    Message no. EA259"
    Could anyone tell me how to overcome this error or the root cause of this error?
    Many Thanks,
    Sri
    Edited by: Arunsri on Nov 10, 2009 8:37 AM

    Hello,
    The reason that you are getting these errors is that you cannot cancel
    the release of an extension made in previous version e.g. 4.6C. Instead you have to
    create a new extension.
    It is not possible to change a segment definition which is released in a
    lower release. This is a basic concept of our release strategy to
    guarantee compatibility between different releases.
    You must create a new segment definition for the new release e.g. 620 with a new segment
    field with the appropriate length. In transaction WE20, outbound parameters, you can specify
    the "segment release in IDoc type" for the communication. Please read the F1 help of this field for further
    information.
    For your own segments you can define a new version of the segment via
    transaction WE31 -> Add Version (Shift+F5).
    Please review your online help for more information on this and related topics.
    Hope this information helps.
    Regards,
    David

Maybe you are looking for

  • Iphoto and iphone synching Photos in the wrong order

    Just downloaded 4.2 and now my iphone shows my photos in ascending order even though it is set on iphoto to descending order. No matter what I do I cannot get the photos to show in descending order....Any ideas? Message was edited by: Mikey_w

  • Internal error occured...Reader XI

    I've been getting the message "an internal error occurred" the last few times I've tried using Reader XI on my Windows 8.1 laptop.   I've even gone as far as using Revo Uninstaller AND the tool at http://labs.adobe.com/downloads/acrobatcleaner.html w

  • Bind Variable ORA-01006 ??

    How do i set a Bind Variable ?? Because when i excute this i get an error like this appears : java.sql.SQLException: ORA-01006: bind variable does not exist at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168) at oracle.jdbc.ttc7.TTIoe

  • Standard SAP t-code to get the log of deliveries that has been deleted

    Hi All, I need a help on the below issue. Is there any standard SAP t code which gives the log of the deliveries which has been deleted ? If Yes; Could you please share the same ? Thanks, Babu Kilari

  • Is there any Enterprise Manager Utility that can help update the Hostname

    I have installed An Oracle Database 12c and further planning to install Enterprise Manager 12c CC on top of this, Since occassionally my system IP changes due to dhcp configuration, hence i prefer using hostnames instead of IP address and further upd