How to control IDOC processing in XI

hi
I have scenario where File --> XI --> IDOC
Source structure
Header           1...1
    Detail         0..unbounded
Trailer             1..1
For every detail i need to generate 1 doc
My requirement is that i dont want to send all the IDOCs at one shot from XI.
trfc connection should be open just once for all the IDOCs and not single IDOCs are posted.
Is there any transaction from where i can control my IDOC processing.
Need urgent help.
Thanks ,
Loveena

Hi Loveena,
in a scenario, for instance, where you send IDOCs of type LS (logical system):
1. In the sender system, call transaction WE05 to display the outbound IDoc. The IDoc partner type of both receiver and sender is LS.
2. On the Integration Server, call transaction SXMB_MONI (Integration Engine Monitoring Monitor for Processed XML Messages) to display the message.
3. In the receiver system, call transaction WE05 to display the inbound IDoc.
if it helpful reward points are appreciated

Similar Messages

  • How to control the processing of the request?

    I have something like this:
    <h:inputText value="#{sessionController.currentRowData.settlementId}"/>
    <h:inputText value="#{sessionController.currentRowData.remark}"/>
    <h:inputText value="#{sessionController.currentRowData.fromDate}">
         <f:convertDateTime pattern="yyyy-MM-dd"/>
    </h:inputText>
    The currentRowData object is the currently selected row of a data model.
    Problem is, the model is updated with the value of the components whenever the form is submitted,
    and regardless of whether the value of the components has changed or not.
    (Actually, the behaviour depends on the type of the property, as ie. Date is treated differently from String or int.)
    This causes unwanted changes to the model, and, if a new row is selected, it will at once
    be updated with the values of the previous row (from the current state of the components).
    I want the above components to update the model only if the user wants to, ie. only if a
    specific command button is pressed.
    How to control this?
    Let a PhaseListener check the request, and do renderResponse on the FacesContext if
    the "selectRow" request is found in the request parameter map?
    This is not very elegant, and it does not seem to work either. If setting PhaseId to APPLY_REQUEST_VALUES, the action itself (selecting row)
    will not be executed, and if using UPDATE_MODEL_VALUES, the value of the components is set from the request (even if unchanged), and not updated according the the new data in the model (the rendered values does not reflect the values of the properties of the object the components are bound to)
    Another solution might be to let the "disabled"-attribute of the inputText tags be dependent on whether
    a specific "edit"-button has been pressed (disabled inputText tags are rendered correctly after a row change).
    But a better solution would to have the ability to control the behaviour, something like
    "for these components, no updating of state should be done unless the condition c is true"
    (I'm not sure what condition this could be, though).
    Whatever solution I may end up with, the real problem seems to be that the state (and hence the model)
    is updated from the request also in the case where the value in the request is the same as the current value of the component.
    Or maybe there is something I have missed here?
    erik

    This one is a tricky problem - a side-effect of JSF doing a lot of things automatically is that sometimes it does too much.
    I don't have a great solution, but here's a couple of ideas:
    (1) Try using multiple <h:form>s on your page (not nested one inside the other, but separate). Data will only get updated in the form that contains the button that got pressed.
    (2) Use an intermediate model layer, and discard updates as appropriate.
    Neither of these are beautiful solutions - the second is way ugly - but they might help. Long-range, I'd love to see something like "subforms" supported in JSF that can provide finer grained control over what gets processed (validations, model pushes, etc.) and what doesn't without resorting to the blunt hammer of multiple HTML forms.
    I'm a little confused about "the model is updated with the value of the components whenever the form is submitted, and regardless of whether the value of the components has changed or not.", because JSF is checking the old value and using ".equals()" to see if its changed. Note, however, that it's not caching the old value across the request, but simply going back to the model on the subsequent request, which may (or may not) explain the behavior you're seeing.
    -- Adam Winer (EG member)

  • Controlling IDOC processing at the adapter level

    Hi,
    Scenario :File --> XI --> IDOC
    My source file has multiple line items and for every line item an IDOC is generated.
    My requiremnt is that, these multiple IDOCs generated should reach R/3 with one trfc connection open , i.e if i have 1000 IDOCs generated , these 1000 IDOCs should be sent to R/3 from the IDOC adapter at one shot with one trfc port connection open for all 1000 iDOCs.
    Is this practically feasible?
    If yes, kindly give the step by step procedure for achieving this requirement.
    Thanks,
    Loveena.

    Check this:
    /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change
    Regards
    Stefan

  • How to control the process?

    Hi, I have a question here. I use try{ } catch{}, and hope the program will go back to continuously execute the for loop after the catch block. But I don't know how could I do that. Anybody know?
    Thanks a lot!
    try {
    for(i=0;i<tokenArray.length;i++) {
    tokenArray=tokens.nextToken();
    // System.out.println("Element #"+i+"="+Integer.parseInt(tokenArray[i]));
    numOperands[size++]=Integer.parseInt(tokenArray[i]);
    System.out.println("Element #"+i+"="+numOperands[size-1]);
    }catch (Exception e) {
    strOperands[strSize++]=tokenArray[i];
    System.out.println("Element #"+i+"="+strOperands[strSize-1]);

    try this
    try {
    yoman: //add yoman: before for() , u can use anything here with:
    }/end try
    catch(){}//catch complete
    continue yonam: //
    i think this will work cos i never tried this
    add some blocks to get results
    but the loop will continue for ever in your case

  • Restrict IDOC processing through output control

    Hi,
    We want to send one idoc (ORDERS) only to a particular logical system while creating purchase order through output control
    Can anybody explain how we can restrict sending idoc to only one logical system?
    Thanks in advance

    You can control output processing for shipments(VT01n docs) based on overall status by maintaining Activity profiles for shipment types.
    SPRO: Logistics execution->Transportation->Shipments->Define and assign activity profiles.
    Type a variant name in the status field you want to process edi for the shipment type and click on maintain.
    Select shipment checkbox in the 'Print after save' box and enter the EDI output type.
    Regards
    Sridhar

  • How to edit Idoc data in inbound processing

    Moved to correct forum by moderator
    Hi All,
    How to edit idoc data in inbound processing ? We have a custom FM in inbound scenario and requirement is to update a value in idoc, this value comes after certain processing in custom FM.
    I tried editing it through
    EDI_DOCUMENT_OPEN_FOR_EDIT
    EDI_CHANGE_DATA_SEGMENTS
    EDI_DOCUMENT_CLOSE_EDIT
    but there is problem in this approach. By this procedure two idocs are created in system, one with original data and one with modified data. We want only one with modified data.
    We do not want any direct database table updates.
    Please provide appropriate solution.
    Note : We are not changing status record. Please do not post replies related to status change
    Edited by: Matt on Nov 19, 2008 2:24 PM

    Hi,
    You can edit the idoc by doing the following steps:-
    1. Goto WE02 transaction and give the IDOC number and execute
    2. Once the required IDOC gets retrieved then double on the text pad icon beside the segment which you wanted to change.
    3. Select the Data Record at the top and click Display <-> Change option, which will enable you to change the data in that segment.
    4. After doing the step 3 then click the save button to save your changes.
    5. Then system will generate a new idoc number to store the actual data and your current idoc will hold the new data and the idoc will be in 69 status.
    6. Execute the Program RC1_IDOC_SET_STATUS by giving your idoc number and status as 69 and new status 64 and remove the test flag
    7. Then the IDOC will be in 64 status and you can reprocess the idoc with the help of the program RBDAPP01 by giving the idoc number.
    The above is the entire process for editing the error idoc and reprocessing it again.
    I hope I am clear and you understood the entire flow of editing and reprocessing an idoc.
    Thanks,
    Mahesh.

  • How to stop the duplicate idoc processing ? whar need to done SAP R/3

    Hi All
    If the Same Idoc is processed to SAP R/3 then what to do for not processing
    the duplicate IDOC ?
    Or some thing like this...
    If by mistake same idoc processed then how to avoid to process the idoc?
    what i need to in SAP R/3 side?
    Regards
    Kiran lvs

    Hi
    some thing like this:Using T.code: we19 ...Idoc processed a day ago
                                           today by using the same t.code we19 ..processed the
                                           same  idoc, what  i sent a day ago.
                                           Here how to stop this duplicate processing ?
    I hope this is clear...else pl put a note
    regards
    Kiran lvs

  • How to update the HTML file so that we can Control our process in real time

    After installing following three steps as per the lookout 4 online help I am unable to Monitor and control the Process in HTML format, which was exported manually in lookout server.
    1) Creating a Web Client Page in Lookout
    2) Download a Lookout Web Client
    3) Setting Up Own Web Server
    My browser shows only the instance, which I have uploaded manually without any update
    Problem: How to automatically update/refresh the HTML file so that we can Monitor/Control our process in real time/bi-directional mode.

    Hi,
    It seems like your process is not updating. When you create a Web Client, it uses ActiveX which lets you control the Lookout process fully. Make sure that you run the process. You can do this by pressing CTRL+Spacebar which puts it in Run-mode. Perhaps then you may see your graphs, etc updating.
    Also, please refer to page 11-1 of the Users Manual linked below:
    http://www.ni.com/pdf/manuals/322390a.pdf
    What kind of Web Server are you using? Make sure all the settings in it are done properly. If you have LabVIEW, you can use the LabVIEW Web Server.
    Hope this information is helpful. Please let us know if you have any further questions.
    Regards,
    A Saha
    Applications Engineer
    National Instruments
    Anu Saha
    Academic Product Marketing Engineer
    National Instruments

  • How can u creat LSMW port in Idoc Processing

    how can u creat LSMW port in Idoc Processing
    actullay i'm using Lsmw with bapi

    Hello Ronei
                 *After giving the project ,sub project ,object & short description
                      *go to menu bar click on settings  in that select idoc inbound processing ,
                      *in that screen click on maintain port push button
                      *port creation screen will be displayed in that left menu expand the file
                      *after that select file_port
                      *click on copy button
                      *provide your port name
                      *provide the short description
                      *after that deselect the uni code check box
          --->*this is the main step
                     *in the directory you will provide the path of your flat file other wise your
                      project will be terminated after 13 th step .
    thanks .
    prasad gandepalli     

  • How to control sequence of Function Modules processed in update task?

    Hello,
    I've some questions regarding following process that needs to be extended: a Function Module (FM) 'Save' calls several other FM e.g. 'X1' and 'X2' in update task. Those update modules are independent from each other and write data to the database that finalize the save process.
    Now a third FM 'X3' needs to be called in update task. This one is also independent from 'X1' and 'X2' but it calls a further FM 'X4' in background task as separate unit which starts a job. This job  requires the data from FM 'X1' and 'X2' already persistent on the database. By the way: the FM 'X3' triggers the Access Control Engine (ACE) notification that calculates the authorization data in the mentioned job. Therefore this process needs to be the last FM call in update task in the queue of calls in FM 'Save'.
    Questions:
    (1) Is it possible to control the process sequence of the FM 'in update task' simply by the sequence they are called in FM 'Save'.
    (2) Presumed that all FM beside 'X3' have processing type "Update with immediate start" or "Immediate start, no restart" (in short  V1) would it be another solution to specify FM 'X3' with type 'Delayed' to control the process sequence? When a delayed FM will be processed?
    (3) Is it uncritical to call in FM 'X3' (already running in update task) the FM 'X4' with addition in background task as separate unit  that furthermore starts a job by an event? I'm afraid that this nesting could lead to unexpected errors.
    Thank you in advance for your help!
    Best regards,
    Oliver

    ya it will this be in  the same sequence only...........
    Regards
    Anbu

  • How to know whether we are in Inbound Idoc processing ?

    Hi,
    Can we know from any system variables that whether we are in Inbound Idoc processing?
    Rgds,
    Antony

    Hi Antony,
    Inbound or Outbound is clssified based on Direction Filed.
    If we have IDOC Number chk in EDIDC its direction
    If Direct = 1(Outbound) or =2 (Inbound) i think
    Regards,
    Poornima

  • Basic doubts in ALE/IDOC processing

    Hi All,
    1.How are IDOC Type and Message Type related? Many to one or One to Many?
    2. what is the prominence of msg code and msg function in ALE outbound processing?
    3. During outbound processing what is the startegy followed by the ALE service layer to pick up the customer model?
       It would be great if any one can answer these questions in plain words rather than referring links. Reward guaranteed.

    Hi Ravi,
    1.Can'te we assign more than one IDOC to the same msg type if the IDOC's are of different versions?
    Yes we can. Doesn't SAP do that? For example, ORDERS01, ORDERS02 ... ORDERS05 are having the same message type ORDERS. You can also create your own IDoc type or extend the standard IDoc type.
    3. When we run a stand alone program to trigger IDOC processing the only mandatory field will be the message type, so how can the sending system identify the receiving system?
    You need to setup partner profile (t/code WE20) and distribution model (t/code BD64). Once this configuration are done, The system will populate automatically the IDoc Control Record for sender and recepient system information when the IDoc generated based partner profile setup.
    Hope this will help.
    Regards,
    Ferry Lianto
    Please reward points if helpful.

  • How to trigger Idoc?

    Hi,
       I did all design and configuration steps and ALE configuration steps for Idoc to file scenario. Can any one tell me how to put idoc that this scenario should work??

    Hi Pavani,
    WE19 -> u can enter either basic type or message type.
    click on create
    go to menu object->edit control record
    there give the receiver system paramters and source system parameters
    after that double click on idoc segments, window opens with all the fields, give data and click on Test Idoc outbound processing.
    check the status in we02.
    Regards,
    Ravi.

  • Please  send one exicuted program example of inbound idoc process

    Dear Friends,
            I am facing one problem to process inbound idoc process.Please example send anybody ?
           I have faced problem in standalone process to do inbound idoc process.
            iam waiting for your valuble response.
      Definitly best answer will get best reward.
    Regards.
    Sridhar Menda.

    Hi Sridhar,
    Here is a example of program for inbound idoc process.
    Example Program to Process an IDoc  
    The Example Program to Process an IDoc shows how the fictitious message type XAMPLE, communicated with IDocs of type XAMPLE01, is processed using the inbound function module Idoc_Input_Xample. The IDoc type has a header segment, E1xhead, and any number of item segments E1xitem. The data from the IDoc is written to two database tables, XHEAD and XITEM respectively. XHEAD and XITEM contain the same field names as E1xhead and E1xitem respectively. The fields names and data types are shown in the following two tables:
    Field Name in XHEAD
    Docmnt_no
    Date
    Currency
    Country
    Description
    Document number
    Date
    Currency
    Country
    Type in e1xhead
    CHAR
    CHAR
    CHAR
    CHAR
    Type in XHEAD
    NUMC
    DATS
    CUKY
    CHAR
    Field Name in XITEM
    Item_no
    Materialid
    Descript
    Unit
    Quantity
    Value
    Ship_Inst
    Description
    Item number
    Material number
    Material description
    Unit of measure
    Quantity
    Value
    Shipping instructions
    Type in e1xitem
    CHAR
    CHAR
    CHAR
    CHAR
    CHAR
    CHAR
    CHAR
    Type in xitem
    NUMC
    CHAR
    CHAR
    UNIT
    QUAN
    CURR
    UNIT
    The data on the database is assigned a new document number (field DOCMNT_NO) using number assignment. The field DOCMNT_NO is not stored in the newly created table XHEAD.
    FUNCTION·IDOC_INPUT_XAMPLE.
    *"Local·interface:
    *"·······IMPORTING
    *"·············VALUE(INPUT_METHOD)·LIKE··BDWFAP_PAR-INPUTMETHD
    *"·············VALUE(MASS_PROCESSING)·LIKE··BDWFAP_PAR-MASS_PROC
    *"·······EXPORTING
    *"·············VALUE(WORKFLOW_RESULT)·LIKE··BDWF_PARAM-RESULT
    *"·············VALUE(APPLICATION_VARIABLE)·LIKE··BDWF_PARAM-APPL_VAR
    *"·············VALUE(IN_UPDATE_TASK)·LIKE··BDWFAP_PAR-UPDATETASK
    *"·············VALUE(CALL_TRANSACTION_DONE)·LIKE··BDWFAP_PAR-CALLTRANS
    *"·······TABLES
    *"··············IDOC_CONTRL·STRUCTURE··EDIDC
    *"··············IDOC_DATA·STRUCTURE··EDIDD
    *"··············IDOC_STATUS·STRUCTURE··BDIDOCSTAT
    *"··············RETURN_VARIABLES·STRUCTURE··BDWFRETVAR
    *"··············SERIALIZATION_INFO·STRUCTURE··BDI_SER
    *"·······EXCEPTIONS
    *"··············WRONG_FUNCTION_CALLED
    ·05·July·1996·----
    *·Example·function·module·for·processing·inbound·IDocs·for·ALE·or·EDI.
    *·This·example·applies·for·processing
    *···with····-··one·IDoc·at·a·time
    *···without·-··serialization
    *···········-··customer-exits
    *···········-··calling·an·ALE-enabled·transaction
    *···········-··mass·processing·(more·than·one·IDoc·at·a·time)
    ·Naming·conventions·----
    *·Internal·tables·start·with·'t_'
    *·Internal·field·strings·start·with·'f_'
    *·>>·The·following·line·must·appear·in·the·global·part·of·your
    *·>>·function·group:
    *····include·mbdconwf.············"Report·containing·the·ALE·constants.
    *·The·ALE·constants·start·with·'c_'.
    ··DATA:·SUBRC·LIKE·SY-SUBRC,
    ········OBJECT_NUMBER·LIKE·XHEAD-DOCMNT_NO.
    *·Initialize·variables
    ··SUBRC·=·0.
    *·Read·the·IDoc's·control·record
    ··READ·TABLE·IDOC_CONTRL·INDEX·1.
    *·Process·the·IDoc·and·post·the·data·to·the·database
    ··PERFORM·IDOC_PROCESS_XAMPLE·TABLES···IDOC_DATA
    ·······································IDOC_STATUS
    ······························USING····IDOC_CONTRL
    ······························CHANGING·OBJECT_NUMBER
    ·······································SUBRC.
    *·Fill·the·ALE·export·parameters
    ··CLEAR·IN_UPDATE_TASK.
    ··CLEAR·CALL_TRANSACTION_DONE.·········"Call·Transaction·is·not·used.
    ··IF·SUBRC·<>·0.·······················"Error·occurred
    ····WORKFLOW_RESULT·=·C_WF_RESULT_ERROR.
    ····RETURN_VARIABLES-WF_PARAM·=·C_WF_PAR_ERROR_IDOCS.
    ····RETURN_VARIABLES-DOC_NUMBER·=·IDOC_CONTRL-DOCNUM.
    ····APPEND·RETURN_VARIABLES.
    ··ELSE.································"IDoc·processed·successfully
    ····WORKFLOW_RESULT·=·C_WF_RESULT_OK.
    ····RETURN_VARIABLES-WF_PARAM·=·C_WF_PAR_PROCESSED_IDOCS.
    ····RETURN_VARIABLES-DOC_NUMBER·=·IDOC_CONTRL-DOCNUM.
    ····APPEND·RETURN_VARIABLES.
    ····RETURN_VARIABLES-WF_PARAM·=·C_WF_PAR_APPL_OBJECTS.
    ····RETURN_VARIABLES-DOC_NUMBER·=·OBJECT_NUMBER.
    ····APPEND·RETURN_VARIABLES.
    ··ELSE.
    ENDFUNCTION.
    ·······FORM·IDOC_PROCESS_XAMPLE······································
    ··This·routine·creates·an·application·document·based·on·the·IDoc's···
    ··contents.·Object_Number·contains·the·new·document's·number.··········If·an·error·occurs,·subrc·is·non-zero,·t_idoc_status·is·filled.·······Note:·if·more·than·one·error·is·detected,·t_idoc_status·contains···
    ········more·than·one·status·record.·································
    ··-->··F_IDOC_CONTRL····IDoc·control·record··························
    ··-->··T_IDOC_DATA······IDoc·data·records····························
    ··<--··T_IDOC_STATUS····IDoc·status·records··························
    ··<--··OBJECT_NUMBER····Created·document's·number····················
    ··<--··SUBRC············Return·code··································
    FORM·IDOC_PROCESS_XAMPLE
    ·······TABLES···T_IDOC_DATA····STRUCTURE·EDIDD
    ················T_IDOC_STATUS··STRUCTURE·BDIDOCSTAT
    ·······USING····F_IDOC_CONTRL··STRUCTURE·EDIDC
    ·······CHANGING·OBJECT_NUMBER··LIKE·XHEAD-DOCMNT_NO
    ················SUBRC··········LIKE·SY-SUBRC.
    *·Internal·field·string·for·the·document·header.
    ··DATA:·F_XHEAD·LIKE·XHEAD.
    *·Internal·table·for·the·document·items.
    ··DATA:·T_XITEM·LIKE·XITEM·OCCURS·0·WITH·HEADER·LINE.
    *·Number·given·to·the·created·document·DOCUMENT_NUMBER·LIKE·F_XHEAD-DOCMNT_NO.
    *·Move·the·data·in·the·IDoc·to·the·internal·structures/tables
    *·f_xhead·and·t_xitem.
    ··PERFORM·IDOC_INTERPRET·TABLES···T_IDOC_DATA
    ··································T_XITEM
    ··································T_IDOC_STATUS
    ·························USING····F_IDOC_CONTRL
    ·························CHANGING·F_XHEAD
    ··································SUBRC.
    *·Create·the·application·object·if·no·error·occurred·so·far.
    ··IF·SUBRC·=·0.
    *···This·fictitious·function·module·creates·a·new·object·based·on·the
    *···data·that·was·read·from·the·IDoc.·The·new·object's·ID·is·returned
    *···in·the·parameter·'document_number'.
    *···The·function·module·checks·that·the·data·is·correct,·and·raises
    *···an·exception·if·an·error·is·detected.
    ····CALL·FUNCTION·'XAMPLE_OBJECT_CREATE'
    ·········EXPORTING
    ··············XHEAD···········=·F_XHEAD
    ·········IMPORTING
    ··············DOCUMENT_NUMBER·=·DOCUMENT_NUMBER
    ·········TABLES
    ··············XITEM···········=·T_XITEM
    ·········EXCEPTIONS
    ··············OTHERS··········=·1.
    ····IF·SY-SUBRC·<>·0.
    ······SUBRC·=·1.
    *·····Put·the·error·message·into·'t_idoc_status'
    ······PERFORM·STATUS_FILL_SY_ERROR
    ················TABLES···T_IDOC_STATUS
    ················USING····T_IDOC_DATA
    ·························SY
    ·························''············"Field·name
    ·························'idoc_process_xample'.·········"Form·routine
    ····ELSE.
    *·····Fill·the·remaining·export·parameters
    ······OBJECT_NUMBER·=·DOCUMENT_NUMBER.··········"New·document's·number
    ······t_idoc_status-docnum·=·f_idoc_contrl-docnum.
    ······t_idoc_status-status·=·c_idoc_status_ok.
    ······t_idoc_status-msgty··=·'S'.
    ······t_idoc_status-msgid··=·your_msgid.·"Global·variable.
    ······t_idoc_status-msgno··=·msgno_success."Global·variable.
    ······t_idoc_status-msgv1··=·object_number.
    ······APPEND·T_IDOC_STATUS.
    ····ENDIF.·····························"if·sy-subrc·<>·0.
    ··ENDIF.·····························"if·subrc·=·0.
    ENDFORM.
    ·······FORM·IDOC_INTERPRET···········································
    ··This·routine·checks·that·the·correct·message·type·is·being·used,···
    ··and·then·converts·and·moves·the·data·from·the·IDoc·segments·to·the·
    ··internal·structure·f_xhead·and·internal·table·t_xitem.·············
    ··If·an·error·occurs,·t_idoc_status·is·filled·an·subrc·<>·0.·········
    ··-->··T_IDOC_STATUS·················································
    ··-->··T_XITEM·······················································
    ··-->··F_IDOC_DATA···················································
    ··-->··F_XHEAD·······················································
    ··-->··SUBRC·························································
    FORM·IDOC_INTERPRET·TABLES···T_IDOC_DATA····STRUCTURE·EDIDD
    ·····························T_XITEM········STRUCTURE·XITEM
    ·····························T_IDOC_STATUS··STRUCTURE·BDIDOCSTAT
    ····················USING····F_IDOC_CONTRL··STRUCTURE·EDIDC
    ····················CHANGING·F_XHEAD········STRUCTURE·XHEAD
    ·····························SUBRC··········LIKE·SY-SUBRC.
    *·Check·that·the·IDoc·contains·the·correct·message·type.
    *··Note:·if·your·message·type·is·reducible,·check·field·'idoctp'
    *·······(IDoc·type)·instead·of·'mestyp'.
    ··IF·F_IDOC_CONTRL-MESTYP·<>·'XAMPLE'.
    ····MESSAGE·ID······YOUR_MSGID···············"Global·variable
    ············TYPE····'E'
    ············NUMBER··MSGNO_WRONG_FUNCTION·····"Global·variable
    ············WITH····F_IDOC_CONTRL-MESTYP·····"message·type
    ····················'IDOC_INPUT_XAMPLE'······"Your·function·module.
    ····················F_IDOC_CONTRL-SNDPRT·····"Sender·partner·type
    ····················F_IDOC_CONTRL-SNDPRN·····"Sender·number.
    ············RAISING·WRONG_FUNCTION_CALLED.
    ··ENDIF.
    *·Loop·through·the·IDoc's·segments·and·convert·the·data·from·the·IDoc
    *·format·to·the·internal·format.
    ··LOOP·AT·T_IDOC_DATA·WHERE·DOCNUM·=·F_IDOC_CONTRL-DOCNUM.
    ····CASE·T_IDOC_DATA-SEGNAM.
    ······WHEN·'E1XHEAD'.
    ········PERFORM·E1XHEAD_PROCESS·TABLES···T_IDOC_STATUS
    ································USING····T_IDOC_DATA
    ································CHANGING·F_XHEAD
    ·········································SUBRC.
    ······WHEN·'E1XITEM'.
    ········PERFORM·E1XITEM_PROCESS·TABLES···T_XITEM
    ·········································T_IDOC_STATUS
    ································USING····F_XHEAD-CURRENCY
    ·········································T_IDOC_DATA
    ································CHANGING·SUBRC.
    ····ENDCASE.
    ··ENDLOOP.
    ENDFORM.
    ·······FORM·E1XHEAD_PROCESS··········································
    ··This·routine·fills·'f_xhead'·out·of·segment·e1xhead.·················If·an·error·occurs,·subrc·is·non-zero,·t_idoc_status·is·filled.····*
    ··-->··F_IDOC_DATA·······IDoc·segment·containing·e1xhead·fields······
    ··<--··F_XHEAD···········Internal·structure·containing·doc.·header···
    ··<--··T_IDOC_STATUS·····Status·fields·for·error·handling············
    ··<--··SUBRC·············Return·code:·non-zero·if·an·error·occurred··
    FORM·E1XHEAD_PROCESS·TABLES···T_IDOC_STATUS··STRUCTURE·BDIDOCSTAT
    ·····················USING····F_IDOC_DATA····STRUCTURE·EDIDD
    ·····················CHANGING·F_XHEAD········STRUCTURE·XHEAD
    ······························SUBRC··········LIKE·SY-SUBRC.
    ··DATA:·F_E1XHEAD·LIKE·E1XHEAD.
    ··F_E1XHEAD·=·F_IDOC_DATA-SDATA.
    *·Process·fields·that·need·conversion·from·ISO-codes·to·SAP-codes
    ··PERFORM·E1XHEAD_CODES_ISO_TO_SAP
    ·········TABLES···T_IDOC_STATUS
    ·········USING····F_E1XHEAD
    ··················F_IDOC_DATA
    ·········CHANGING·F_XHEAD
    ··················SUBRC.
    *·Process·fields·containing·dates·or·times
    ··PERFORM·E1XHEAD_DATE_TIME·USING····F_E1XHEAD
    ····························CHANGING·F_XHEAD.
    ENDFORM.·······························"e1xhead_process
    ·······FORM·E1XITEM_PROCESS··········································
    ··This·routine·converts·the·data·in·the·segment·'e1xitem'·for········
    ··to·the·format·of·table·'t_xitem'·and·appends·it·to·the·table.········If·an·error·occurs,·subrc·is·non-zero,·t_idoc_status·is·filled.····*
    ··-->··F_IDOC_DATA······IDoc·segment·································
    ··<--··T_XITEM··········Document·items·to·be·updated·to·database·····
    ··<--··T_IDOC_STATUS····Status·fields·filled·if·an·error·occurred····
    ··<--··SUBRC············Return·code:·0·if·all·OK·····················
    FORM·E1XITEM_PROCESS·TABLES···T_XITEM·······STRUCTURE·XITEM
    ······························T_IDOC_STATUS·STRUCTURE·BDIDOCSTAT
    ·····················USING····CURRENCY······LIKE·XHEAD-CURRENCY
    ······························F_IDOC_DATA···STRUCTURE·EDIDD
    ·····················CHANGING·SUBRC·········LIKE·SY-SUBRC.
    ··DATA:·F_E1XITEM·LIKE·E1XITEM.
    ··F_E1XITEM·=·F_IDOC_DATA-SDATA.
    *·Fields·of·type·CHAR,·NUMC,·QUAN·need·no·conversion.
    ··T_XITEM-ITEM_NO····=·F_E1XITEM-ITEM_NO.
    ··T_XITEM-MATERIALID·=·F_E1XITEM-MATERIALID.
    ··T_XITEM-DESCRIPT···=·F_E1XITEM-DESCRIPT.
    ··T_XITEM-QUANTITY···=·F_E1XITEM-QUANTITY.
    *·Process·fields·that·need·conversion·from·ISO-codes·to·SAP-codes
    ··PERFORM·E1XHEAD_CODES_ISO_TO_SAP
    ·········TABLES···T_IDOC_STATUS
    ·········USING····F_E1XHEAD
    ··················F_IDOC_DATA
    ·········CHANGING·F_XHEAD
    ··················SUBRC.
    *·Process·fields·that·contain·monetary·values
    ··PERFORM·E1XITEM_VALUE_IDOC_TO_SAP·TABLES···T_IDOC_STATUS
    ····································USING····F_E1XITEM
    ·············································CURRENCY
    ·············································F_IDOC_DATA
    ····································CHANGING·T_XITEM
    ·············································SUBRC.
    ··APPEND·T_XITEM.
    ENDFORM.
    ·······FORM·E1XHEAD_CODES_ISO_TO_SAP·································
    ··Converts·ISO-Codes·in·f_e1xhead·to·SAP-codes·in·f_xhead.·············f_idoc_data,·t_idoc_status·and·subrc·are·used·for·error·handling.··*
    FORM·E1XHEAD_CODES_ISO_TO_SAP
    ·······TABLES···T_IDOC_STATUS·STRUCTURE·BDIDOCSTAT
    ·······USING····F_E1XHEAD·····STRUCTURE·E1XHEAD
    ················F_IDOC_DATA···STRUCTURE·EDIDD
    ·······CHANGING·F_XHEAD·······STRUCTURE·XHEAD
    ················SUBRC.
    *·f_xhead-currency···Type·CUKY·=>·convert·ISO-Code·to·SAP-Code.
    ··PERFORM·CURRENCY_CODE_ISO_TO_SAP
    ·········TABLES···T_IDOC_STATUS
    ·········USING····F_E1XHEAD-CURRENCY
    ··················F_IDOC_DATA
    ··················'CURRENCY'
    ·········CHANGING·F_XHEAD-CURRENCY
    ··················SUBRC.
    ··CHECK·SUBRC·=·0.
    *·f_xhead-country···Contains·a·country·=>·convert·from·ISO·to·SAP·code.
    ··PERFORM·COUNTRY_CODE_ISO_TO_SAP
    ·········TABLES···T_IDOC_STATUS
    ·········USING····F_E1XHEAD-COUNTRY
    ··················F_IDOC_DATA
    ··················'COUNTRY'
    ·········CHANGING·F_XHEAD-COUNTRY
    ··················SUBRC.
    ENDFORM.
    ·······FORM·E1XITEM_CODES_ISO_TO_SAP·································
    ··Converts·ISO-Codes·in·f_e1xitem·to·SAP-codes·in·f_xitem············
    ··f_idoc_data,·t_idoc_status·and·subrc·are·used·for·error·handling.··
    FORM·E1XITEM_CODES_ISO_TO_SAP
    ·······TABLES···T_IDOC_STATUS·STRUCTURE·BDIDOCSTAT
    ·······USING····F_E1XITEM·····STRUCTURE·E1XITEM
    ················F_IDOC_DATA···STRUCTURE·EDIDD
    ·······CHANGING·F_XITEM·······STRUCTURE·XITEM
    ················SUBRC·········LIKE·SY-SUBRC.
    *·f_xitem-unit·······Type·UNIT·=>·convert·ISO-Code·to·SAP-Code.
    ··PERFORM·UNIT_OF_MEASURE_ISO_TO_SAP
    ·········TABLES···T_IDOC_STATUS
    ·········USING····F_E1XITEM-UNIT
    ··················F_IDOC_DATA
    ··················'unit'
    ·········CHANGING·F_XITEM-UNIT
    ··················SUBRC.
    *·f_xitem-ship_inst··Contains·shipping·instructions·=>·ISO·to·SAP·code.
    ··PERFORM·SHIPPING_INSTRUCT_ISO_TO_SAP
    ·········TABLES···T_IDOC_STATUS
    ·········USING····F_E1XITEM-SHIP_INST
    ··················F_IDOC_DATA
    ··················'ship_inst'
    ·········CHANGING·F_XITEM-SHIP_INST
    ··················SUBRC.
    ENDFORM.
    ·······FORM·E1XITEM_VALUE_IDOC_TO_SAP································
    ··Converts·fields·containing·monetary·values·in·f_e1xitem·to·········
    ··the·internal·representation·in·f_xitem.······························f_idoc_data,·t_idoc_status·and·subrc·are·used·for·error·handling.··*
    FORM·E1XITEM_VALUE_IDOC_TO_SAP
    ·······TABLES···T_IDOC_STATUS·STRUCTURE·BDIDOCSTAT
    ·······USING····F_E1XITEM·····STRUCTURE·E1XITEM
    ················CURRENCY······LIKE·XHEAD-CURRENCY
    ················F_IDOC_DATA···STRUCTURE·EDIDD
    ·······CHANGING·F_XITEM·······STRUCTURE·XITEM
    ················SUBRC·········LIKE·SY-SUBRC.
    *·f_xitem-value····Type·CURR·=>·convert·IDoc·amount·to·internal·amount.
    *·N.B.·the·currency·code·used·here·must·be·the·SAP-internal·one,·not
    *······the·one·contained·in·the·IDoc!
    ··CALL·FUNCTION·'CURRENCY_AMOUNT_IDOC_TO_SAP'
    ·······EXPORTING
    ············CURRENCY····=·CURRENCY
    ············IDOC_AMOUNT·=·F_E1XITEM-VALUE
    ·······IMPORTING
    ············SAP_AMOUNT··=·F_XITEM-VALUE
    ·······EXCEPTIONS
    ············OTHERS······=·1.
    ··IF·SY-SUBRC·<>·0.
    ····SUBRC·=·1.
    *···Put·the·error·message·into·'t_idoc_status'
    ····PERFORM·STATUS_FILL_SY_ERROR
    ··············TABLES···T_IDOC_STATUS
    ··············USING····F_IDOC_DATA
    ·······················SY
    ·······················'value'·········"Field·name
    ·······················'e1xitem_value_idoc_to_sap'.······"Form·routine
    ··ENDIF.·······························"if·sy-subrc·<>·0.
    ENDFORM.
    ·······FORM·E1XHEAD_DATE_TIME········································
    ··Moves·date·and·time·fields·in·f_e1xhead·to·the·fields·in·f_xhead.··
    FORM·E1XHEAD_DATE_TIME·USING····F_E1XHEAD·STRUCTURE·E1XHEAD
    ·······················CHANGING·F_XHEAD·STRUCTURE·XHEAD.
    *·f_xhead-date····Type·DATS·=>·initial·value·is·not·'blank'.
    ··IF·E1XHEAD-DATE·IS·INITIAL.
    ····CLEAR·F_XHEAD-DATE.
    ····F_XHEAD-DATE·=·F_E1XHEAD-DATE.
    ··ENDIF.
    ENDFORM.
    ·······FORM·CURRENCY_CODE_ISO_TO_SAP·································
    ··Converts·ISO·currency·code·'iso_currency_code'·to·SAP·code·in······
    ··'sap_currency_code'················································
    ··f_idoc_data,·field_name,·t_idoc_status·and·subrc·are·used·for······
    ··for·error·handling.················································
    FORM·CURRENCY_CODE_ISO_TO_SAP
    ·······TABLES···T_IDOC_STATUS·····STRUCTURE·BDIDOCSTAT
    ·······USING····ISO_CURRENCY_CODE·LIKE·TCURC-ISOCD
    ················F_IDOC_DATA·······STRUCTURE·EDIDD
    ················FIELD_NAME········LIKE·BDIDOCSTAT-SEGFLD
    ·······CHANGING·SAP_CURRENCY_CODE·LIKE·TCURC-WAERS
    ················SUBRC·············LIKE·SY-SUBRC.
    ··IF·ISO_CURRENCY_CODE·IS·INITIAL.
    ····CLEAR·SAP_CURRENCY_CODE.
    ··ELSE.
    ····CALL·FUNCTION·'CURRENCY_CODE_ISO_TO_SAP'
    ·········EXPORTING
    ··············ISO_CODE·=·ISO_CURRENCY_CODE
    ·········IMPORTING
    ··············SAP_CODE·=·SAP_CURRENCY_CODE
    ·········EXCEPTIONS
    ··············OTHERS···=·1.
    ····IF·SY-SUBRC·<>·0.
    ······SUBRC·=·1.
    *·····Put·the·error·message·into·'t_idoc_status'
    ······PERFORM·STATUS_FILL_SY_ERROR
    ················TABLES···T_IDOC_STATUS
    ················USING····F_IDOC_DATA
    ·························SY
    ·························FIELD_NAME
    ·························'currency_code_iso_to_sap'.·····"Form·routine
    ··ENDIF.·····························"if·sy-subrc·<>·0.
    ··ENDIF.·······························"if·iso_currency_code·is·initial.
    ENDFORM.
    ·······FORM·CURRENCY_CODE_ISO_TO_SAP·································
    ··Converts·ISO·currency·code·'iso_currency_code'·to·SAP·code·in······
    ··'sap_currency_code'················································
    ··f_idoc_data,·field_name,·t_idoc_status·and·subrc·are·used·for······
    ··for·error·handling.················································
    FORM·COUNTRY_CODE_ISO_TO_SAP
    ·······TABLES···T_IDOC_STATUS····STRUCTURE·BDIDOCSTAT
    ·······USING····ISO_COUNTRY_CODE·LIKE·T005-INTCA
    ················F_IDOC_DATA······STRUCTURE·EDIDD
    ················FIELD_NAME·······LIKE·BDIDOCSTAT-SEGFLD
    ·······CHANGING·SAP_COUNTRY_CODE·LIKE·T005-LAND1
    ················SUBRC············LIKE·SY-SUBRC.
    *·Only·convert·if·the·field·is·not·initial.
    ··IF·ISO_COUNTRY_CODE·IS·INITIAL.
    ····CLEAR·SAP_COUNTRY_CODE.
    ··ELSE.
    ····CALL·FUNCTION·'COUNTRY_CODE_ISO_TO_SAP'
    ·········EXPORTING
    ··············ISO_CODE·=·ISO_COUNTRY_CODE
    ·········IMPORTING
    ··············SAP_CODE·=·SAP_COUNTRY_CODE
    ·········EXCEPTIONS
    ··············OTHERS···=·1.
    ····IF·SY-SUBRC·<>·0.
    ······SUBRC·=·1.
    *·····Put·the·error·message·into·'t_idoc_status'
    ······PERFORM·STATUS_FILL_SY_ERROR
    ················TABLES···T_IDOC_STATUS
    ················USING····F_IDOC_DATA
    ·························SY
    ·························FIELD_NAME
    ·························'country_code_iso_to_sap'.······"Form·routine
    ··ENDIF.·····························"if·sy-subrc·<>·0.
    ··ENDIF.·······························"if·iso_country_code·is·initial.
    ENDFORM.
    ·······FORM·UNIT_OF_MEASURE_ISO_TO_SAP·······························
    ··Converts·ISO·unit·of·measure·code·'iso_unit_of_measure'·to·SAP·····
    ··code·in·'sap_unit_of_measure'.·····································
    ··f_idoc_data,·field_name,·t_idoc_status·and·subrc·are·used·for······
    ··for·error·handling.················································
    FORM·UNIT_OF_MEASURE_ISO_TO_SAP
    ·······TABLES···T_IDOC_STATUS·······STRUCTURE·BDIDOCSTAT
    ·······USING····ISO_UNIT_OF_MEASURE·LIKE·T006-ISOCODE
    ················F_IDOC_DATA·········STRUCTURE·EDIDD
    ················FIELD_NAME··········LIKE·BDIDOCSTAT-SEGFLD
    ·······CHANGING·SAP_UNIT_OF_MEASURE·LIKE·T006-MSEHI
    ················SUBRC···············LIKE·SY-SUBRC.
    *·Only·convert·the·field·if·it·is·not·empty.
    ··IF·ISO_UNIT_OF_MEASURE·IS·INITIAL.
    ····CLEAR·SAP_UNIT_OF_MEASURE.
    ··ELSE.
    ····CALL·FUNCTION·'UNIT_OF_MEASURE_ISO_TO_SAP'
    ·········EXPORTING
    ··············ISO_CODE·=·ISO_UNIT_OF_MEASURE
    ·········IMPORTING
    ··············SAP_CODE·=·SAP_UNIT_OF_MEASURE
    ·········EXCEPTIONS
    ··············OTHERS···=·1.
    ····IF·SY-SUBRC·<>·0.
    ······SUBRC·=·1.
    *·····Put·the·error·message·into·'t_idoc_status'
    ······PERFORM·STATUS_FILL_SY_ERROR
    ················TABLES···T_IDOC_STATUS
    ················USING····F_IDOC_DATA
    ·························SY
    ·························FIELD_NAME
    ·························'unit_of_measure_iso_to_sap'.··"Form·routine
    ··ENDIF.·····························"if·sy-subrc·<>·0.
    ··ENDIF.··················"if·iso_unit_of_measure_code·is·initial.
    ENDFORM.
    ·······FORM·SHIPPING_INSTRUCT_ISO_TO_SAP·····························
    ··Converts·ISO·package·code·'iso_package_type'·to·SAP·code·for·······
    ··purchasing·shipping·instructions·in·'sap_shipping_instructions'.···
    ··f_idoc_data,·field_name,·t_idoc_status·and·subrc·are·used·for······
    ··for·error·handling.················································
    FORM·SHIPPING_INSTRUCT_ISO_TO_SAP
    ·······TABLES···T_IDOC_STATUS·············STRUCTURE·BDIDOCSTAT
    ·······USING····ISO_PACKAGE_TYPE··········LIKE·T027A-IVERS
    ················F_IDOC_DATA···············STRUCTURE·EDIDD
    ················FIELD_NAME················LIKE·BDIDOCSTAT-SEGFLD
    ·······CHANGING·SAP_SHIPPING_INSTRUCTIONS·LIKE·T027A-EVERS
    ················SUBRC·····················LIKE·SY-SUBRC.
    *·Only·convert·the·field·if·it·is·not·empty.
    ··IF·ISO_PACKAGE_TYPE·IS·INITIAL.
    ····CLEAR·SAP_SHIPPING_INSTRUCTIONS.
    ··ELSE.
    ····CALL·FUNCTION·'ISO_TO_SAP_PACKAGE_TYPE_CODE'
    ·········EXPORTING
    ··············ISO_CODE·=·ISO_PACKAGE_TYPE
    ·········IMPORTING
    ··············SAP_CODE·=·SAP_SHIPPING_INSTRUCTIONS
    ·········EXCEPTIONS
    ··············OTHERS···=·1.
    ····IF·SY-SUBRC·<>·0.
    ······SUBRC·=·1.
    *·····Put·the·error·message·into·'t_idoc_status'
    ······PERFORM·STATUS_FILL_SY_ERROR
    ················TABLES···T_IDOC_STATUS
    ················USING····F_IDOC_DATA
    ·························SY
    ·························FIELD_NAME
    ·························'shipping_instruct_iso_to_sap'.·"Form·rout.
    ··ENDIF.·····························"if·sy-subrc·<>·0.
    ··ENDIF.··················"if·iso_unit_of_measure_code·is·initial.
    ENDFORM.
    ·······FORM·STATUS_FILL_SY_ERROR·····································
    ··Fills·the·structure·t_idoc_status·with·the·import·parameters·······
    ··plus·the·relevant·sy·fields.·······································
    ··-->··IDOC_NUMBER···········IDoc·number·····························
    ··-->··SEGNUM················Segment·number··························
    ··-->··SEGFLD················Field·in·segment························
    ··-->··ROUTID················Name·of·routine·························
    ··<--··T_IDOC_STATUS·········Status·fields···························
    FORM·STATUS_FILL_SY_ERROR·TABLES···T_IDOC_STATUS·STRUCTURE·BDIDOCSTAT
    ··························USING····F_IDOC_DATA···STRUCTURE·EDIDD
    ···································VALUE(F_SY)···STRUCTURE·SY
    ···································SEGFLD········LIKE·BDIDOCSTAT-SEGFLD
    ···································ROUTID········LIKE·BDIDOCSTAT-ROUTID.
    ··t_idoc_status-docnum·=·f_idoc_data-docnum.
    ··t_idoc_status-status·=·c_idoc_status_error.
    ··t_idoc_status-msgty··=·f_sy-msgty.
    ··t_idoc_status-msgid··=·f_sy-msgid.
    ··T_IDOC_STATUS-MSGNO··=·F_SY-MSGNO.
    ··t_idoc_status-msgv1··=·f_sy-msgv1.
    ··t_idoc_status-msgv2··=·f_sy-msgv2.
    ··t_idoc_status-msgv3··=·f_sy-msgv3.
    ··t_idoc_status-msgv4··=·f_sy-msgv4.
    ··t_idoc_status-segnum·=·f_idoc_data-segnum.
    ··t_idoc_status-segfld·=·segfld.
    ··t_idoc_status-repid··=·f_sy-repid.
    ··t_idoc_status-routid·=·routid.
    ··APPEND·T_IDOC_STATUS.
    ENDFORM.
    Also Check out these docs.
    http://help.sap.com/saphelp_nw04/helpdata/en/dc/6b7ee143d711d1893e0000e8323c4f/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/1a/178ad32d3011d3bc3500105a6588b2/frameset.htm
    Dont forget to reward pts, if it helps ;>)
    Regards,
    Rakesh.

  • File to PI to IDOCs - Processing Order

    Hi experts,
    my problem is as follow :
    I have a file that contains serveral lines. Each lines represent the creation of an Idoc on ECC side.
    The problem is that we have some idocs that go to status 51 (dont get recorded). The reason is that each Idoc has to be processed in the exact order that it has arrived. In our case, it looks like it is not the case in consequence some of the idocs dont get integrated.
    I tried to add a timestamp + a counter in the SERIAL field of the control records, but it did not work.
    Do you guys have any input ?
    Kind regards,
    Jamal

    To add more..
    /people/community.user/blog/2006/11/04/how-to-serialize-idoc-xml-messages-fed-into-xi
    http://help.sap.com/saphelp_nw04s/helpdata/en/bd/277264c3ddd44ea429af5e7d2c6e69/frameset.htm
    Edited by: Kumar on Mar 5, 2009 1:10 PM

Maybe you are looking for