Inbound IDocs will only process immediately

Hello.  I have been having an issue with our inbound INVOIC02 IDocs coming from our EDI server.  We are processing a high number of invoices and I wanted to change the processing from immediate to collective.  The immediate processing is causing a strain on our EDI server.  I would like the IDocs to come into the SAP system, but stay in a status 64 until a background job runs to process them.  I changed the partner profile for the vendor from Trigger immediately to Trigger by background program.  For some reason, the IDocs are still processing immediately. 
Here are some of my settings:
EDI side Function Module:  IDOC_INBOUND_ASYNCHRONOUS
SAP side Function Module: IDOC_INPUT_INVOIC_MRM
Partner profile setup:
Partner no: (vendor #)
Partn. type: LI (vendor)
Message type: INVOIC
Process code:  INVL
Processing by function module: Trigger by background program.
Please let me know if you have any recommendations as to how I can get these IDocs to process from a background program instead of immediately.  Am I missing another setting for this?
Thanks,
Lisa

Hi Klaus,
form the mentioned options, I would give enqueue / dequeue a second try.
I would use customer (/sender) as key field for your locking object.
If you try to set the lock right in the beginning of your FM, whole customer should be locked for processing. Second test is of course, if already a sales order exists.
Maybe here the problem occurs: when you have some parts in update task, select for sales order is not successful for some (micro-)seconds.
Solution for this part: use synchronic booking / commit work and wait. Maybe make a test with a select for VBAK in the end of your FM to test existence -> if not successfull, you know you identified your problem.
If this is your problem, you should make a new enqueue after commit (because it will be deleted by commit) and wait until DB gives you new VBAK entry.
I would start with a test, why all this different locking options don't work (instead of looking for a different locking option): make a select after your sales order creation. If this is not successfull, then here is your starting point.
Regards,
Christian

Similar Messages

  • Inbound Idocs are not Processing

    Hi,
    Inbound IDOCS queue is not processing if any one IDOC is showing amber(error) . Please let me know the resolution to avoid this issue or let me know the BASIS setting to avoid it.
    Regards,
    PVK.

    Hello,
    Can you please explain your issue is with "Trigger by Background program" or "Trigger immediately"?
    For Trigger immediately, if there is no free dialog work process available than IDocs are posted with status 64.
    For Trigger by Background program, Background job RBDAPP01 will process IDocs depending on variant you define to select & process IDocs(i.e., IDoc Status = 64).
    It is always recommended to use "Trigger by Background program" for high volume interface which has large number of IDocs.
    Help on RBDAPP01
    Regards,
    Sameer

  • Inbound IDOC error while processing Invoice

    Hi All,
    I received the following error while processing an Invoice on an inbound IDOC:
    <b>Field BSEG-MEINS - does not exist in the screen SAPMF05A 0300</b>
    Message no. 00349
    <b>Diagnosis</b>
    The specified field does not exist on the screen
    <b>Procedure</b>
    Check your batch input data
    Any assistance will be greatly appreciated.
    Thanks, Inno

    Hi
    Please check which G/L Accounts were involved and verify that the Field BSEG-MEINS was set to 'optional' in Transaction OB14. The correct Field Status Variant
    for the Company Code can be viewed with Transaction OBY6 and the Field
    Status Group for G/L Account can be found with Transaction FS00 under
    the Create/bank/inter Tab. This should eliminate the Error 00 349.
    Regards
    Javier

  • How inbound delivery will get processed in receving plant in stock transfer

    Hi,
    We are doing a stock transport scenario with one step procedure. Can you please confirm whether following things are possible ?
    1.With one step procedure stock transfer we want good receipt to be posted in receving plant automatically after good issue from supplying plant.This is happening after you select indicator of one step.
    But will system post GR if inbound delivery is posted in receving plant when you set up one step indicator?
    2.We tried to create inbound delivery in receiving plant but we are getting error of " Vendor account number & vendor address indicator". If you go to see technical details it shows these entries are to be in VBPA table.We maintained all  entries in vendor master but still we could not create inbound delivery. We are creating inbound delivery to check whether system post GR with one step procedure.
    Please reply.
    Regards,
    Prashant

    You are abosolutely right if plants are near one step procedure is used. Here the case is same.
    But client  mentioned shipping notification relation ship between two plants.Do you think is it possible?
    I am able to create inbound delivery without vendor name in field in inbound delivery. When I PGI'd  delivery it has post GR in receiving plant but inbound delivery remained open.
    Please comment.
    Thanks for reply.
    Regards,
    Prashant.

  • Firefox will only start immediately after installation, but once that window is closed, it will not open again.

    Running Windows XP on Sony Vaio laptop, which seems to meet system requirements. There is no error message, nothing happens when trying to open application.

    Try to use "Firefox > Exit" (Windows: Firefox/File > Exit; Mac: Firefox > Quit Firefox; Linux: Firefox/File > Quit) to close Firefox if you are currently doing that by clicking the close X on the Firefox title bar.
    It is possible that Firefox fails to close properly and that there is a hanging Firefox or plugin-container process showing in the Windows Task Manager.
    *http://kb.mozillazine.org/Kill_application

  • Inbound idoc processing by workflow

    Hello,
    How can I find if an inbound IDoc has been processed via workflow ?
    following are details -
    1)status records 50 and 64 for the idoc show RFC user ID whereas 62 and 53 show WORKFLOW_020 user ID.
    2)manual re process in test system using WE19 has all four status records by login user ID.
    3)BD67 values for this process code was checked for the start events.
    4)I checked standard task 30200090 following oss note 325361
    5)The invoice document posted via this idoc has created by user ID as WORKFLOW_020 
    I do not have full knowledge of inbound idoc processing via workflow and I am in the process of learning the same. Kindly help.
    thank you very much in advance,
    Bhakti

    Hello,
    How can I find if an inbound IDoc has been processed via workflow ?
    following are details -
    1)status records 50 and 64 for the idoc show RFC user ID whereas 62 and 53 show WORKFLOW_020 user ID.
    2)manual re process in test system using WE19 has all four status records by login user ID.
    3)BD67 values for this process code was checked for the start events.
    4)I checked standard task 30200090 following oss note 325361
    5)The invoice document posted via this idoc has created by user ID as WORKFLOW_020 
    I do not have full knowledge of inbound idoc processing via workflow and I am in the process of learning the same. Kindly help.
    thank you very much in advance,
    Bhakti

  • How to read file from prsntn server in Inbound idoc FM.

    Hi Experts,
    I am new to idoc.
    I have requirment that i need to read a file from presentation and application server and put in inbound idoc FM.Idoc will be processed in batch.
    How can i put selection screen in FM and read the file?or how can i proceed  with the solution?
    Please help..
    Umesh

    Hi Umesh,
    My understanding on your requirement is to read a file from pres. server and pass the data to an IDoc function module. Am I correct?
    If this is the case then you can create a report which picks up the file from pres. server and then read data from the file and pass it to the parameters of the required function module.
    Hope this helps.
    Regards,
    -Sandeep

  • INBOUND IDOC Creation

    Hi ,
    Trying to create an INBOUND IDOC for material.
    Using the FM  MASTER_IDOC_DISTRIBUTE . But the problem is that this is creating an idoc as an outbound .although I have set the parmeter for direction as inbound.
    Could some please advise me which Fm should I use to create an IDOC as inbound ? 
    since I can see there are more FM like 'IDOC_WRITE_AND_START_INBOUND' and CCDL_MASTER_IDOC_CREATE  and more.
    Thanks and Regards,
    Ankur

    Hi,
    The FM that you have specified here are the one which are used for saving the data from IDOC to SAP.
    But in this scenarion I want to create an IDOC with inbound direction . to be more eleborative I will get incomplete information from External system in IDOC and based on this I neeed to create an Standard IDOC filling the more required information and then this Standard IDOC will be processed by Standard FM like the one you have specified here 'IDOC_INPUT_XXXX',
    What i need is the FM for Creating this Standard IDOC as inbound.
    hope this explain .
    Thanks and Regards,
    Ankur

  • Inbound Idoc function module  for Cycle count with msg type WVINVE

    Can any one tell me which is the standard function Module which processes Cycle count for message type WVINVE.
    My requirement is to setup Inbound Idoc for cycle processing with message type WVINVE.

    Hi Mukesh,
             Inbound FM is IDOC_INPUT_STORE_INVENTORY , and Process code is WVIN.
             Yoou can check this in Tcode WE42 for process code WVIN.
    Regards
    Srikanth M

  • Inbound Idoc port ???

    Hi All,
    I am working on proxy to IDoc_AAE scenario. Can anybody tell me from where inbound Idoc will take port?? I have imported inbound parameters in respective partner profile, but not sure from where this idoc is picking port value. Kindly suggest.
    Thanks & Regards,
    Rashmi Joshi

    Hello,
    If you already know the port no , you can do that by filling the EDIDC Segment of the Idoc .
    Else the Idoc will be sent via the RFC destination configured in the rcver idoc channel
    and  during  the TRFC call system will check for the existing partner profile (the entries set up in we21).
    hope this helps .
    rgds
    Kishore

  • Re: ME51n through Inbound Idoc

    Hi Expert,
      Below is the required set up.
      "A non-sap system will generate a textfile and the textfile will be push to SAP automatically to trigger automatic creation of PR."
    This is my suppose approach but am not sure if this is feasible and how...
    1. The text file  be output in a ftp server or in a unix directory.
        the text file contain all the info needed to create a purchase
        request.
    2. FTP or unix script will push this file to SAP by means of unix or ftp script..
       - any ftp script or unix script for this
    3.SAP will acknowledge the textfile
       3.1 trigger event that will generate inbound idoc
           - how to set up the IDOC
       3.2 the inbound idoc will be use to create the PR
           - a customize program running in a background mode which as
             a mode of trigger event
       3.3. the customize program is made of bapi_create_purchase
    Does anyone have this requirement before?, any other alternative or better approach to accomplish this? Thanks in advance..
    She

    Hi,
    Please use BAPI_REQUISITION_CREATE to accomplish this.. You'd have to make a remote call and pass the data from the 3rd  party system in to the BAPI's structure as a string and it is the nsorted out based on the fields in teh structure..

  • Delay in the Inbound Idoc Posting Process

    Dear Friends,
    We have an scenario in the Inbound Idoc Posting Process, when we process the Idocs through the standard Inbound Program - RBDAPP01, we face the delay of 3hrs to 12 hrs, approx.
    When we try to re-process the same through the manual process, we could successfully post the Idocs, immediately.
    When the same happens, through the background job - the delay is happening.
    As we see, there is no problem with the program - RBDAPP01, but can't able to trace the delay in the process.
    Any suggestions / advises are welcome.
    Thanks in advance.

    Hi Prasanna,
    The update will happen only if a value already exists with the same unit of measure in the system. If the quantity is left blank in the system and if you are trying to update, the update might not happen. Even if the value is Zero in the system, provide the same unit of measure as the data used in the BAPI.
    Regards,
    Yogesh

  • Inbound IDOC Mass processing - No status message

    Hi Friends,
    I am updating a database table using inbound IDOC. But in batch job when XI passes multiple IDOCS,
    for some IDOCs there is no status message even though i coded for status message.
    If i rerun IDOC in BD87 then it work fine.
    please help.
    regards,
    madan

    Hi Madan,
    Since you are loading multiple idoc to the system due to high load in the production system data is not commiting properly. So use external commit work statement in you code. this will reduce the performance but logic will work.
    COMMIT WORK [AND WAIT].
    Effect
    The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the current SAP LUW in the process. In this case, COMMIT WORK performs the following actions:
    It executes all subroutines registered using PERFORM ON COMMIT.
    The sequence is based on the order of registration or according to the priority specified using the LEVEL addition. Execution of the following statements is not permitted in a subroutine of this type:
    PERFORM ... ON COMMIT|ROLLBACK
    COMMIT WORK
    ROLLBACK WORK
    The statement CALL FUNCTION ... IN UPDATE TASK can be executed.
    Triggering an internal event for the Persistence Service of the Object Services.
    If event handlers are registered by the Persistence Service, these collect the changes to the objects managed by the Persistence Service and transfer them via CALL FUNCTION ... IN UPDATE TASK to a specific update function module that is registered as the last update module.
    This executes all high-priority (VB1) update function modules in the order of their registration and in a common database LUW. If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating), but instead is resumed immediately after COMMIT WORK. However, if the addition AND WAIT is specified, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).
    When all high-priority update function modules are completed successfully, the statement executes the low-priority (VB2) update function modules in the order of registration together in a common database LUW.
    After the execution of high-priority update function modules, the individual function modules registered using CALL FUNCTION ...IN BACKGROUND TASK|UNIT are executed in a separate database LUW for each destination.
    Within an update function module started using COMMIT WORK, the execution of statements that lead to a database commit is not permitted. In particular, the following are forbidden:
    Thanks,
    Raghav

  • Inbound IDOC not Triggering Immediately

    I am processing an inbound idoc using startrfc, EDI_DATA_INCOMING.  It posts the idoc, but stuck with status 64.  Partner profile set to Trigger immediately.  Why will it not process immediately?  I can execute the RBDAPP01 to handle, but prefer immediately.  Is there something on the EDI_DC that needs to be set?

    Oh, unfortunately not with startrfc. I overlooked the startrfc word in your post.
    You can check this SAP note 168276. It talks about The event receiver linkage not activated in Customizing. (t-code OYEB)
    regards,
    Advait

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

Maybe you are looking for