Inbound IDOC processing, error duplicate key

We want to retrieve certain order-idocs in our system, before they are processed, to change AND insert segment data.
Flow we use in our current program
- DOC_STATUS_WRITE_TO_DATABASE
to change the status of the idoc (ok) (status 69)
- EDI_DOCUMENT_OPEN_FOR_EDIT (ok)
- EDI_CHANGE_DATA_SEGMENTS (ok)
- EDI_DOCUMENT_CLOSE_EDIT => not ok
This program gives SAPSQL error
Via debugging, we see that a new idoc number is
called (save as backup idoc ?), but we want the
current IDOC to be processed.
The system wants to insert in EDID4 => dump :
"Use an ABAP/4 Open SQL array insert only if you
are sure that none of the records passed already
exists in the database."
( I prefer to use these standard functions, in stead of just deleting and inserting into "EDID4" )
regards,
answers will be rewarded.
code extract
INCLUDE ZBE01458_TOP.
INITIALIZATION.
V_EDIT_STATUS = '69'.
V_PROCESSED_STATUS = '32'.
start-of-selection.
clear t_edidc. refresh t_edidc.
SELECT * FROM EDIDC into table t_edidc
WHERE DOCNUM in S_docnum
and mestyp in S_mestyp
and idoctp in S_idoctp
and credat in S_credat
and rcvpor in S_rcvpor
and rcvprt in S_rcvprt
and rcvprn in S_rcvprn
and sndpor in S_sndpor
and sndprt in S_sndprt
and sndprn in S_sndprn
and status in S_status.
loop at t_edidc.
move t_edidc-docnum to v_docnum.
refresh v_status.
V_STATUS-docnum = V_DOCNUM.
V_STATUS-status = V_EDIT_STATUS.
clear EDIDS.
select single * from EDIDS where docnum = v_docnum.
if sy-subrc = 0.
MOVE EDIDS-STACOD to V_STATUS-STACOD.
endif .
APPEND V_STATUS.
PERFORM CHANGE_IDOC_STATUS tables V_STATUS USING V_DOCNUM.
changing part for DEDIDD "idoc data
PERFORM OPEN_IDOC_FOR_CHANGE.
PERFORM CHANGE_IDOC.
PERFORM CLOSE_IDOC_FOR_CHANGE.
refresh v_status.
V_STATUS-docnum = V_DOCNUM.
V_STATUS-status = V_PROCESSED_STATUS.
APPEND V_STATUS.
PERFORM CHANGE_IDOC_STATUS tables V_STATUS
USING V_DOCNUM.
endloop.
*& Form OPEN_IDOC_FOR_CHANGE
text
--> p1 text
<-- p2 text
FORM OPEN_IDOC_FOR_CHANGE.
CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'
EXPORTING
DOCUMENT_NUMBER = V_DOCNUM
ALREADY_OPEN = 'N'
IMPORTING
IDOC_CONTROL =
TABLES
IDOC_DATA = DEDIDD
EXCEPTIONS
DOCUMENT_FOREIGN_LOCK = 1
DOCUMENT_NOT_EXIST = 2
DOCUMENT_NOT_OPEN = 3
STATUS_IS_UNABLE_FOR_CHANGING = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " OPEN_IDOC_FOR_CHANGE
*& Form CHANGE_IDOC
text
--> p1 text
<-- p2 text
FORM CHANGE_IDOC.
CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENTS'
TABLES
IDOC_CHANGED_DATA_RANGE = DEDIDD
EXCEPTIONS
IDOC_NOT_OPEN = 1
DATA_RECORD_NOT_EXIST = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " CHANGE_IDOC
*& Form CLOSE_IDOC_FOR_CHANGE
text
--> p1 text
<-- p2 text
FORM CLOSE_IDOC_FOR_CHANGE.
CLEAR t_EDI_DS40.
t_edi_ds40-docnum = v_docnum.
t_edi_ds40-status = '51'.
t_edi_ds40-repid = sy-repid.
t_edi_ds40-tabnam = 'EDI_DS'.
t_edi_ds40-mandt = sy-mandt.
t_edi_ds40-stamqu = 'SAP'.
t_edi_ds40-stamid = 'B1'.
t_edi_ds40-stamno = '999'.
t_edi_ds40-stapa1 = 'Changes made to idoc ...'.
t_edi_ds40-stapa2 = t_new_kunnr.
t_edi_ds40-logdat = sy-datum.
t_edi_ds40-logtim = sy-uzeit.
APPEND t_edi_ds40.
CALL FUNCTION 'EDI_DOCUMENT_CLOSE_EDIT'
EXPORTING
DOCUMENT_NUMBER = V_DOCNUM
DO_COMMIT = 'X'
DO_UPDATE = 'X'
WRITE_ALL_STATUS = 'X'
TABLES
STATUS_RECORDS = t_EDI_DS40
EXCEPTIONS
IDOC_NOT_OPEN = 1
DB_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " CLOSE_IDOC_FOR_CHANGE
*& Form CHANGE_IDOC_STATUS
text
--> p1 text
<-- p2 text
FORM CHANGE_IDOC_STATUS tables P_IDOC_STATUS structure V_IDOC_STATUS
USING P_DOCNUM.
CALL FUNCTION 'IDOC_STATUS_WRITE_TO_DATABASE'
EXPORTING
IDOC_NUMBER = p_docnum
IDOC_OPENED_FLAG = ' '
NO_DEQUEUE_FLAG = 'X'
IMPORTING
IDOC_CONTROL =
TABLES
IDOC_STATUS = P_IDOC_STATUS
EXCEPTIONS
IDOC_FOREIGN_LOCK = 1
IDOC_NOT_FOUND = 2
IDOC_STATUS_RECORDS_EMPTY = 3
IDOC_STATUS_INVALID = 4
DB_ERROR = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
commit work.
ENDIF.
ENDFORM. " CHANGE_IDOC_STATUS

Urmila,
I tried this sequence : code extract follows...
I got the duplicate key errors again.
what about delete first and then insert again in EDID4 table ?
source code extract:
INCLUDE ZBE01458_TOP.
INITIALIZATION.
  V_EDIT_STATUS = '69'.
  V_PROCESSED_STATUS = '32'.
  V_SAPCODE = 'SAPE0184'.
start-of-selection.
  clear t_edidc. refresh t_edidc.
  SELECT  * FROM  EDIDC into table t_edidc
         WHERE  DOCNUM  in S_docnum
           and  mestyp  in S_mestyp
           and  idoctp  in S_idoctp
           and  credat  in S_credat
           and  rcvpor  in S_rcvpor
           and  rcvprt  in S_rcvprt
           and  rcvprn  in S_rcvprn
           and  sndpor  in S_sndpor
           and  sndprt  in S_sndprt
           and  sndprn  in S_sndprn
           and  status  in S_status.
  loop at t_edidc.
    move t_edidc-docnum to v_docnum.
    move-corresponding T_EDIDC to WA_EDIDC.
    V_STA-docnum      = v_docnum.
    V_STA-status      = '51'.
    V_STA-repid       = sy-repid.
    V_STA-tabnam      = 'EDI_DS'.
    V_STA-mandt       = sy-mandt.
    V_STA-stamqu      = 'SAP'.
    V_STA-stamid      = 'B1'.
    V_STA-stamno      = '999'.
    V_STA-stapa1      = 'Changes made to idoc ...'.
t_edi_ds40-stapa2      = t_new_kunnr.
    V_STA-logdat      = sy-datum.
    V_STA-logtim      = sy-uzeit.
    V_STA-STACOD       =  V_SAPCODE.
    PERFORM OPEN_FOR_PROCESS.
    PERFORM SET_IDOC_STATUS USING V_DOCNUM V_STA.
    PERFORM CLOSE_IDOC_FOR_PROCESS.
    PERFORM OPEN_IDOC_FOR_CHANGE.
    PERFORM PROCESS_IDOC_STRUCTURE.
    PERFORM CHANGE_IDOC.
    PERFORM CLOSE_IDOC_FOR_CHANGE.
   refresh v_status.
   V_STATUS-docnum = V_DOCNUM.
   V_STATUS-status = V_EDIT_STATUS.
   V_STATUS-STACOD = V_SAPCODE.
   clear EDIDS.
   select single * from EDIDS where docnum = v_docnum.
   if sy-subrc = 0.
    MOVE EDIDS-STACOD to V_STATUS-STACOD.
   endif .
   APPEND V_STATUS.
   PERFORM CHANGE_IDOC_STATUS tables V_STATUS USING  V_DOCNUM.
  endloop.
*&      Form  OPEN_IDOC_FOR_CHANGE
      text
-->  p1        text
<--  p2        text
FORM OPEN_IDOC_FOR_CHANGE.
  CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'
   EXPORTING
     DOCUMENT_NUMBER                     = V_DOCNUM
  ALREADY_OPEN                        = 'N'
IMPORTING
   IDOC_CONTROL                        = WA_EDIDC
   TABLES
     IDOC_DATA                           = DEDIDD
  EXCEPTIONS
    DOCUMENT_FOREIGN_LOCK               = 1
    DOCUMENT_NOT_EXIST                  = 2
    DOCUMENT_NOT_OPEN                   = 3
    STATUS_IS_UNABLE_FOR_CHANGING       = 4
    OTHERS                              = 5
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " OPEN_IDOC_FOR_CHANGE
*&      Form  CHANGE_IDOC
      text
-->  p1        text
<--  p2        text
FORM CHANGE_IDOC.
  CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENTS'
       TABLES
            IDOC_CHANGED_DATA_RANGE = DEDIDD
       EXCEPTIONS
            IDOC_NOT_OPEN           = 1
            DATA_RECORD_NOT_EXIST   = 2
            OTHERS                  = 3.
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " CHANGE_IDOC
*&      Form  CLOSE_IDOC_FOR_CHANGE
      text
-->  p1        text
<--  p2        text
FORM CLOSE_IDOC_FOR_CHANGE.
  CLEAR t_EDI_DS40.
  t_edi_ds40-docnum      = v_docnum.
  t_edi_ds40-status      = '69'.
  t_edi_ds40-repid       = sy-repid.
  t_edi_ds40-tabnam      = 'EDI_DS'.
  t_edi_ds40-mandt       = sy-mandt.
  t_edi_ds40-stamqu      = 'SAP'.
  t_edi_ds40-stamid      = 'B1'.
  t_edi_ds40-stamno      = '999'.
  t_edi_ds40-stapa1      = 'Changes made to idoc ...'.
t_edi_ds40-stapa2      = t_new_kunnr.
  t_edi_ds40-logdat      = sy-datum.
  t_edi_ds40-logtim      = sy-uzeit.
  APPEND t_edi_ds40.
  CALL FUNCTION 'EDI_DOCUMENT_CLOSE_EDIT'
       EXPORTING
            DOCUMENT_NUMBER  = V_DOCNUM
            DO_COMMIT        = 'X'
            DO_UPDATE        = 'X'
            WRITE_ALL_STATUS = 'X'
       TABLES
            STATUS_RECORDS   = t_EDI_DS40
       EXCEPTIONS
            IDOC_NOT_OPEN    = 1
            DB_ERROR         = 2
            OTHERS           = 3.
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " CLOSE_IDOC_FOR_CHANGE
*&      Form  CHANGE_IDOC_STATUS
      text
-->  p1        text
<--  p2        text
FORM CHANGE_IDOC_STATUS tables P_IDOC_STATUS structure V_IDOC_STATUS
USING P_DOCNUM.
  CALL FUNCTION 'IDOC_STATUS_WRITE_TO_DATABASE'
EXPORTING
  IDOC_NUMBER                     = p_docnum
        IDOC_OPENED_FLAG                = ' '
        NO_DEQUEUE_FLAG                 = 'X'
      IMPORTING
        IDOC_CONTROL                    =
TABLES
  IDOC_STATUS                     = P_IDOC_STATUS
      EXCEPTIONS
        IDOC_FOREIGN_LOCK               = 1
        IDOC_NOT_FOUND                  = 2
        IDOC_STATUS_RECORDS_EMPTY       = 3
        IDOC_STATUS_INVALID             = 4
        DB_ERROR                        = 5
        OTHERS                          = 6
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  else.
    commit work.
  ENDIF.
ENDFORM.                    " CHANGE_IDOC_STATUS
*&      Form  OPEN_FOR_PROCESS
      text
-->  p1        text
<--  p2        text
FORM OPEN_FOR_PROCESS.
  CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_PROCESS'
    EXPORTING
  DB_READ_OPTION                 = DB_READ
      DOCUMENT_NUMBER                = V_DOCNUM
  ENQUEUE_OPTION                 = SYNCHRONOUS
IMPORTING
   IDOC_CONTROL                   = WA_EDIDC
EXCEPTIONS
  DOCUMENT_FOREIGN_LOCK          = 1
  DOCUMENT_NOT_EXIST             = 2
  DOCUMENT_NUMBER_INVALID        = 3
  DOCUMENT_IS_ALREADY_OPEN       = 4
  OTHERS                         = 5
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " OPEN_FOR_PROCESS
*&      Form  SET_IDOC_STATUS
      text
-->  p1        text
<--  p2        text
FORM SET_IDOC_STATUS USING P_DOCNUM P_STA.
  CALL FUNCTION 'EDI_DOCUMENT_STATUS_SET'
    EXPORTING
      DOCUMENT_NUMBER               = P_DOCNUM
      IDOC_STATUS                   = P_STA
IMPORTING
   IDOC_CONTROL                  = WA_EDIDC
EXCEPTIONS
  DOCUMENT_NUMBER_INVALID       = 1
  OTHER_FIELDS_INVALID          = 2
  STATUS_INVALID                = 3
  OTHERS                        = 4
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " SET_IDOC_STATUS
*&      Form  CLOSE_IDOC_FOR_PROCESS
      text
-->  p1        text
<--  p2        text
FORM CLOSE_IDOC_FOR_PROCESS.
  CALL FUNCTION 'EDI_DOCUMENT_CLOSE_PROCESS'
    EXPORTING
      DOCUMENT_NUMBER           = V_DOCNUM
  BACKGROUND                = NO_BACKGROUND
  NO_DEQUEUE                = ' '
IMPORTING
   IDOC_CONTROL              = WA_EDIDC
EXCEPTIONS
  DOCUMENT_NOT_OPEN         = 1
  FAILURE_IN_DB_WRITE       = 2
  PARAMETER_ERROR           = 3
  STATUS_SET_MISSING        = 4
  OTHERS                    = 5
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " CLOSE_IDOC_FOR_PROCESS

Similar Messages

  • Inbound IDOC process error

    Hi
    While an Inbound is being processed it is not behaving as per the design and if the same type of idoc is reprocessed through BD87 is it behaving as per the design.
    In detail, the idoc will create a purchase order based on reservation number in R/3 and the quantity needs to be checked against the availability. If the quantity is more in the idoc counting all line items of idoc segments it should not be posted giving that the quantity is not available. If it is automated it is not checking, but while testing on creation of an inbound idoc and reprocessed the validation is happenning.
    So, please help me in understanding as why the idoc is not getting validated when it is automated ans whne it is reprocessed through BD87 it is getting validated.
    Thanks
    Shankar

    Hi Shankar,
    how do you notice that your code is not executed.
    Usually I would say it should.
    Therefore I recommended to implement an infinite loop to make sure that it is really not executed.
    By the way...where did you implement your coding?
    Best regards,
    Oliver
    Edited by: Oliver Hütköper on Aug 12, 2011 8:45 AM

  • Where to put break point when debugging the inbound IDOC processing

    Hi, Dear Experts,
    If IDOC has error and want to debug, which program or function module  to put break point when debugging the inbound IDOC processing
    Thank you so much!
    Helen

    It depends on if you have the custom FM or standard FM...Is it MM invoice or FI invoice? ... You can find out your FM by going to partner profile (WE20) for your sender partner and partner function.. Drill down to your partner and the message type and find the inbound process code.. Double clicking on the process code will help you find the FM...
    If you don't have access to WE20, You can also put BP into any of the IDOC_INPUT_INVOIC* FM and see if it is getting triggered (assuming your IDOC is standard FM)...

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

  • Error receiving AS2 message from partner: B2B-50037:  B2B inbound message processing error

    B2B/SOA 11.1.1.6.0
    We are setting a new trading partner and when we started document transmissions we are getting errors on the inbound messages: B2B-50037:  B2B inbound message processing error.
    The attachment shows the relevant lines from the soa log and diagnostic log files.  Here is the error detail that shows:
    [URI: /b2b/httpreceiver] Error -:  B2B-50037:  B2B inbound message processing error[[
    Error -:  B2B-50037:  B2B inbound message processing error
            at oracle.tip.b2b.engine.Engine.processIncomingMessageImpl(Engine.java:3143)
            at oracle.tip.b2b.engine.Engine.processIncomingMessage(Engine.java:1650)
            at oracle.tip.b2b.transport.InterfaceListener.onMessageLocal(InterfaceListener.java:403)
            at oracle.tip.b2b.transport.InterfaceListener.onMessage(InterfaceListener.java:214)
            at oracle.tip.b2b.transport.basic.TransportServlet.doPost(TransportServlet.java:754)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
            at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
            at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
            at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
            at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
            at java.security.AccessController.doPrivileged(Native Method)
            at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
            at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
            at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
            at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
            at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
            at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
            at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
            at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
            at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    From the b2b_wire_message we get these Protocol_Transport_BINDINGS:
    ChannelName=TransportServlet
    Reverse-Via=LIN-ISA1
    AS2-To=accobra.....
    Date=Fri, 26 Sep 2014 05:46:17 +0000
    AS2-Version=1.2
    AS2-From=K.......
    Disposition-Notification-Options=signed-receipt-protocol=optional, pkcs7-signature; signed-receipt-micalg=optional, sha1
    Disposition-Notification-To=http://<ip&port>/as2in
    Message-ID=<[email protected]>
    MSG_RECEIVED_TIME=Fri Sep 26 00:46:17 CDT 2014
    ECID-Context=1.0050z5j^buc6yGn6wnZf6G0002f60007bt;kXjE1ZDLIPGIj2QCYV8QoKSSmLRO_PQT_IS
    Content-Type=application/pkcs7-mime; smime-type=enveloped-data; name=smime.p7m
    Proxy-Client-IP=172.17.25.101
    MIME-Version=1.0
    User-Agent=e-integration AS2 Server V 6.1.8
    X-Forwarded-For=172.17.25.101
    Content-Length=3602
    Host=nalinsoa05.abd.ad.acco.com
    x-weblogic-cluster-hash=QoZzGUzdcjBD5fGIE8Uos5abiHI
    EDIINT-Features=multiple-attachments, CEM
    Connection=Keep-Alive
    X-WebLogic-KeepAliveSecs=30
    X-WebLogic-Request-ClusterInfo=true
    The message creates a wire message, business message, and an application message.
    What doesn't happen is no MDN gets sent back to the partner.  It should be a synchronous MDN.
    We have double checked the certificates on both ends and they are OK.
    The document and Agreement get recognized OK:
    Refer To Message
    Refer To Message
    Sender Type
    AS2 Identifier
    Sender Value
    K. . .
    Receiver Type
    AS2 Identifier
    Receiver Value
    accobr. . .
    Sender
    K. . . l
    Receiver
    ACCO . . .
    Agreement Id
    K. . .l_EDI_X12_4010_856_856Def_Inbound
    Agreement
    K. . .l_EDI_X12_4010_856_856Def_Inbound
    Document Type
    856
    Document Protocol
    EDI_X12
    Document Version
    4010
    Message Type
    REQ
    Direction
    INBOUND
    State
    MSG_ERROR
    Acknowledgement Mode
    SYNC
    Response Mode
    ASYNC
    Send Time Stamp
    09/26/2014 12:46:17 AM
    Receive Time Stamp
    09/26/2014 12:46:17 AM
    The error is vague enough to provide little or no help in locating the root cause of the issue.
    Any assistance in providing information on how to get this working would be greatly appreciated.
    We do have dozens of other AS2 partners working in this instance just foe reference.  We are just having issues with this new partner setup.
    Thank you.
    Regards,
    Ken

    Ken,
    I am observing the Ack Mode is set as "SYNC" . This is selected by default. This option is available in the channel configuration section
    If the usecase is not SYNC, please change as ASYNC and test. It should work.

  • 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

  • B2B-50037: B2B inbound message processing error

    We are trying to implement B2B with Customer EDI X12 850 Inbound with SOA
    Application server Version     11.1.1.4.0 (weblogic)
    Hitting the following error in the logs
    MDS-00013: no metadata found for metadata object "/soa/b2b/EDI_X12/4010/850/New/8504010Viterra.ecs"
    Was successful in overcoming all the usual obstacles of finding the TP, Document Type, protocol etc...However hitting the above error. 8504010Viterra.ecs is a custom spec builder document we created and "8504010Viterra.ecs" was browsed from the windows PC into the Document Type B2B set up. I am willing to use a seeded ecs file but do not know how to find one for X12 850 4010 version....?
    Went through one SR that asks you upload a group ECS file but that did not help in our case....Following was the SR
    "B2B-50037 B2B INBOUND MESSAGE PROCESSING" Error with EDIX12 And DEF 830 VER 200\0 [ID 1357136.1]
    Please help
    Now at the agreement level, if we set the translate to No and Validate to No then B2B completes normally but we do want B2B to translate the file so that we can get it in XML form for us to transform and process it in BPEL
    Any help or hint is really appreciated!

    Anuj
    THANK YOU SO MUCH!!! I cannot thank you enough for this
    I was playing around so much with the document type, the protocol version etc. that i must have inadvertently messed up the repository. I took the export of the data as you suggested, purged the design repository and reimported the zip. I also had to restart the server since the ftp was not kicking in...& wholla! the message got translated into XML and went into the queue
    Thanks again
    Gopal Iyer
    Edited by: ghiyer on Nov 10, 2011 10:07 AM

  • B2B-50037: B2B inbound message processing error  java.lang.NullPointerException

    Can anyone help me with this problem.
    I'm new here.
    Oracle SOA Server version 11.1.1.6.0
    Got this error message after I put Ignore Correlation true.
    diagnostic.log:
    [2013-08-12T14:05:26.668+02:00] [MS_KETEN_SOA_01] [NOTIFICATION] [] [oracle.soa.b2b.engine] [tid: DaemonWorkThread: '17' of WorkManager: 'wm/SOAWorkManager'] [userId: <anonymous>] [ecid: 0000K1mQe8WAdL9_rdH7iY1I2CVn0000Lc,0] [APP: soa-infra] Engine: processIncomingMessageImpl: Message id = 0A253556140726AA60A000003E11ADD0-1 FromParty = JD0021_OTA Doctype = ScanDocumenten version = 1.0
    [2013-08-12T14:05:26.712+02:00] [MS_KETEN_SOA_01] [ERROR] [] [oracle.soa.b2b.engine] [tid: DaemonWorkThread: '17' of WorkManager: 'wm/SOAWorkManager'] [userId: <anonymous>] [ecid: 0000K1mQe8WAdL9_rdH7iY1I2CVn0000Lc,0] [APP: soa-infra]     [[
            at oracle.tip.b2b.msgproc.Acknowledgment.createAckMsg(Acknowledgment.java:659)
            at oracle.tip.b2b.msgproc.Acknowledgment.asyncOutgoingAck(Acknowledgment.java:290)
            at oracle.tip.b2b.msgproc.Request.handleAck(Request.java:652)
            at oracle.tip.b2b.engine.Engine.processIncomingMessageImpl(Engine.java:3019)
            at oracle.tip.b2b.engine.Engine.processIncomingMessage(Engine.java:1650)
            at oracle.tip.b2b.engine.Engine.incomingContinueProcess(Engine.java:4042)
            at oracle.tip.b2b.engine.Engine.handleMessageEvent(Engine.java:3718)
            at oracle.tip.b2b.engine.Engine.processEvents(Engine.java:3205)
            at oracle.tip.b2b.engine.ThreadWorkExecutor.processEvent(ThreadWorkExecutor.java:677)
            at oracle.tip.b2b.engine.ThreadWorkExecutor.run(ThreadWorkExecutor.java:211)
            at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)
            at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:184)
            at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)
    [2013-08-12T14:05:26.720+02:00] [MS_KETEN_SOA_01] [ERROR] [] [oracle.soa.b2b.engine] [tid: DaemonWorkThread: '17' of WorkManager: 'wm/SOAWorkManager'] [userId: <anonymous>] [ecid: 0000K1mQe8WAdL9_rdH7iY1I2CVn0000Lc,0] [APP: soa-infra] Error -:  B2B-50037:  B2B inbound message processing error[[
    Error -:  B2B-50037:  B2B inbound message processing error
            at oracle.tip.b2b.engine.Engine.processIncomingMessageImpl(Engine.java:3143)
            at oracle.tip.b2b.engine.Engine.processIncomingMessage(Engine.java:1650)
            at oracle.tip.b2b.engine.Engine.incomingContinueProcess(Engine.java:4042)
            at oracle.tip.b2b.engine.Engine.handleMessageEvent(Engine.java:3718)
            at oracle.tip.b2b.engine.Engine.processEvents(Engine.java:3205)
            at oracle.tip.b2b.engine.ThreadWorkExecutor.processEvent(ThreadWorkExecutor.java:677)
            at oracle.tip.b2b.engine.ThreadWorkExecutor.run(ThreadWorkExecutor.java:211)
            at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)
            at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:184)
            at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)

    It is a Defect 17324828 has been created. Details for this defect maybe viewed in Oracle Support Portal , we will update you the status as soon as we have more information.
    I found ,Bug 16713853 : BTMLR: IGNORE CORRELATION AS TRUE IN ADMIN COFIGURATION GIVES NULLPOINTER ERROR for this issue in 11G , As of now development team is still working to fix this , i will raise a New BUG and involve development team for this issue

  • EDIFACT D98A Inbound Message Processing Error

    Hi
    I have been setting up an EDI B2B G/W using 11g B2B PS3 (Host & Partner). I have created the ECS, XSD and XML files using the B2B Document Editor and have completed the partner setup for D98A Purchase Order.
    I had the issues when I posted the PO where the Host is unable to pick up the agreements and I was getting B2B-51507 Payload Validation Error and the message was failling at the B2B Host.
    Later I changed the payload in-line with the below thread and removed the Internal Properties
    https://forums.oracle.com/forums/thread.jspa?messageID=11039032#11039032
    upon which the messages was sent to RemoteTP but failed with B2B-50037: B2B inbound message processing error
    When I analyzed further I could see the InternalPropertes sent by the Host to the RemoteTP are with empty values.
    I would like to understand the point of removing the InternalProperties and why B2B Host is not sending it in the right format to the other B2B.
    I am pasting the file that is been received at the RemoteTP which failed with B2B-50037: B2B inbound message processing error
    <?xml version="1.0" encoding="UTF-8"?><Transaction-CONTRL xmlns="urn:oracle:integration:b2b:9FF110DDDB0C424F8B4C5A0F73EF6547" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" XDataVersion="1.0" Standard="EDIFACT" Version="D3" CreatedDate="2013-05-31T13:41:20" CreatedBy="XEngine_2133" GUID="{65236268-C9EF-11E2-BC04-E4115BAD2692}"><Internal-Properties><Data-Structure Name="Interchange"><Lookup Name="InterchangeControlVersion">1</Lookup><Lookup Name="InterchangeReceiverID"> </Lookup><Lookup Name="InterchangeReceiverQual"></Lookup><Lookup Name="InterchangeSenderID"> </Lookup><Lookup Name="InterchangeSenderQual"></Lookup><Lookup Name="Standard">EDIFACT</Lookup><Property Name="InterchangeSyntaxVersion">1</Property><Property Name="ReleaseCharacter">0x3f</Property><Data-Structure Name="Group"><Lookup Name="GroupID">CONTRL</Lookup><Lookup Name="GroupReceiverID"> </Lookup><Lookup Name="GroupReceiverQual"></Lookup><Lookup Name="GroupReleaseNumber">3</Lookup><Lookup Name="GroupSenderID"> </Lookup><Lookup Name="GroupSenderQual"></Lookup><Lookup Name="GroupVersion">D</Lookup><Property Name="GroupID">CONTRL</Property><Data-Structure Name="Transaction"><Lookup Name="TransactionID">CONTRL</Lookup><Lookup Name="TransactionMessageReleaseNumber">3</Lookup><Lookup Name="TransactionMessageVersionNumber">D</Lookup></Data-Structure></Data-Structure></Data-Structure></Internal-Properties><Segment-UNH><Element-0062>#ControlNumber(Transaction)#</Element-0062><Composite-S009><Element-0065>CONTRL</Element-0065><Element-0052>D</Element-0052><Element-0054>3</Element-0054><Element-0051>UN</Element-0051></Composite-S009></Segment-UNH><Segment-UCI><Element-0020>1051</Element-0020><Composite-S002><Element-0004> </Element-0004></Composite-S002><Composite-S003><Element-0010> </Element-0010></Composite-S003><Element-0083>4</Element-0083></Segment-UCI><Loop-Group_3><Segment-UCF><Element-0048>1051</Element-0048><Composite-S006><Element-0040> </Element-0040></Composite-S006><Composite-S007><Element-0044> </Element-0044></Composite-S007><Element-0083>4</Element-0083></Segment-UCF><Loop-Group_4><Segment-UCM><Element-0062>1</Element-0062><Composite-S009><Element-0065>ORDERS</Element-0065><Element-0052>D</Element-0052><Element-0054>98A</Element-0054><Element-0051>AA</Element-0051></Composite-S009><Element-0083>4</Element-0083><Element-0085>18</Element-0085></Segment-UCM></Loop-Group_4></Loop-Group_3><Segment-UNT><Element-0074>5</Element-0074><Element-0062>#ControlNumber(Transaction)#</Element-0062></Segment-UNT></Transaction-CONTRL>
    Has anyone encountered such issues? Is there any additional properties that are needed to be configured?
    Regards
    RD

    Hi Anuj
    this is the stack trace
    <02-Jun-2013 12:50:47 o'clock BST> <Error> <oracle.soa.b2b.engine> <BEA-000000> <Error -: B2B-50037: B2B inbound message processing error
    Error -: B2B-50037: B2B inbound message processing error
    at oracle.tip.b2b.engine.Engine.processIncomingMessageImpl(Engine.java:3283)
    at oracle.tip.b2b.engine.Engine.processIncomingMessage(Engine.java:1764)
    at oracle.tip.b2b.engine.Engine.incomingContinueProcess(Engine.java:4179)
    at oracle.tip.b2b.engine.Engine.handleMessageEvent(Engine.java:3855)
    at oracle.tip.b2b.engine.Engine.processEvents(Engine.java:3328)
    at oracle.tip.b2b.engine.ThreadWorkExecutor.processEvent(ThreadWorkExecutor.java:610)
    at oracle.tip.b2b.engine.ThreadWorkExecutor.run(ThreadWorkExecutor.java:192)
    at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)
    at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:183)
    at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)
    the xml i posted is the one that is logged by the remote TP in the trace logs before the error occurrence,
    Regards
    RD

  • 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

  • Optimize inbound idoc process

    Hi everybody.
    Im trying to improve perfomance at inbound idoc process:
    For instance I have scheduled the program RBDAPP01to process inbound ORDERS every 5 minutes. (The number of inbound orders to proces are 300 aprox.).
    I have some question to choose the best variant to this job:
    - What's better in transaction BD51 set the FM as mass process or single process? I think to choose mass process It´d be better because the FM would be call less times.
    - What packing size I have to choose. I hope SAP recommends between 20-100.
    - Should I choose parallelling process? It´d help me to improve the process???
    Thanks a lot.
    Regards

    INBOUND_IDOC_PROCESS is the function module to be used before release SAP R/3 4.0; since release 4.0 you should use IDOC_INBOUND_ASYNCHRONOUS instead.
    Similarly as indicated by the previous posting IDOC_INBOUND_SINGLE replaces function module IDOC_INBOUND_SYNCHRONOUS for posting a single IDoc.
    Best wishes, harald

  • WF-BATCH user locks up inbound IDoc processing

    Hi Experts!
    We have an issue with our inbound IDoc processing randomly being locked by the WF-BATCH user.  I have searched SAP Notes, and the only thing I could find was on Note 519420, it said to check the default settings for date format and decimal notation format in SU01.  All looked fine, except for the decimal notation which was 1.234,567.89, instead of 1,234,567.89.  If I changed this, would this fix the problem?  Any suggestions would be greatly appreciated.  Thank you in advance. 
    WC

    WF-BATCH - is an ID in SAP which processes batch workflow tasks.
    So if your IDOC posting triggers workflow task - it's going to be processed by WF-BATCH.

  • Inbound Idoc processing issues - Partner Profiles - error status 56

    Hello All,
    I'm having a little difficulty posting an idoc coming from MDM.  It's a CREMDM04 xml coming from an MDM system.  It is getting mapped through PI and is being split into ADRMAS02 and CREMAS04 Idocs.  The message is being passed through XI and being posted to the ECC system, but certain fields in the EDI_DC40 header table are not being populated correctly (i believe).  I'm using nothing but standard mapping/material from the SAP Business Content for XI.  After looking through the standard XSLTs i cannot find the field-to-field mapping where the fields below are being populated.
    The RCVPOR value (SAP[SID]) is correct when i view it in SOAP Header, but does not appear in the remote system under the receiver port for the inbound idoc.
    The RCVPRN value ([String Value]) is incorrect in the SOAP Header and does appear in the remote system under the receiver partner number for the inbound idoc.  How is the RCVPRN value being populated? 
    SOAP Header in IDocOutbound tag
      <SAP:RCVPOR>SAP[SID]</SAP:RCVPOR>
      <SAP:RCVPRN>[String Value]</SAP:RCVPRN>
      <SAP:RCVPRT>LS</SAP:RCVPRT>
    I've been trying to trace down the string value for the RCVPRN, but i cannot find it anywhere.  Perhaps i'm just overlooking it?
    When i set the proper values (port = SAP<SIDofECC> and partner number = <LSnameof ECC>) using WE19 in the remote system then the partner profile is found and i'm left with different error to please specify an address group.
    Any help is very much appreciated! :-D

    Hi Jason ,
    Just check out if you have done the following steps most of us make minor mistake here ....... I think this would solve your problem
    To Configure the IDOC SCENARIOS ,PROCEED AS FOLLOWS
    STEP 1:ALE SETTINGS TO POST IDOC INTO SAP R/3
    We need to do the following settings in XI
    1) Create an RFC Destination to the Receiving System in transaction code (SM59)
    a) Choose create
    b) Specify the name of the RFC destination
    c) Select connection type as 3 and save
    d) In the technical settings tab enter the details SAP SID/URL and system number#
    e) Enter the Gateway host as same details above SID/URL
    f) Gateway service is 3300+system number#
    g) In the Logon /Security tab, enter the client, user & Password details of Destination system
    h) Test the connection and remote logon.Both should be succesful
    2) Create Port Using Transaction Code IDX1
    a) Select Create New button
    b) Enter the port name as SAP+SID (The starting char should be SAP)
    c) Enter the destination client
    d) Enter the RFC Destination created in XI towards R/3
    e) Save
    3) Load Meta Data for IDOC Using transaction Using Transaction (IDX2)
    a) Create new
    b) IDOC Message Type
    c) Enter port created in IDX1
    SETTINGS IN SAP R/3
    We need to do the following settings in R/3
    Logon to Sap R/3 System
    1) Create an RFC Destination to XI in transaction code (SM59)
    a) Choose create
    b) Specify the name of the RFC destination
    c) Select connection type as 3 and save
    d) In the technical settings tab enter the details SAP SID/URL and system number#
    e) Enter the Gateway host as same details above SID/URL
    f) Gateway service is 3300+system number#
    g) In the Logon /Security tab, enter the client, user & Password details of Destination system
    h) Test the connection and remote logon.Both must be succesful
    2) Create communication Port for Idoc processing Using Transaction(We21)
    a) First Select Transactional RFC and then click create button
    b) Enter the destination port name as SAP+SID (The starting char should be SAP)
    d) Enter the RFC Destination created in SAP R/3 towards other system.
    e) Save
    3) Create Partner Profile with Inbound Parameters (WE20)
    a) Create New
    b) Create the Partner no. name as same the logical system name of the destination system
    c) Select Partner type LS
    d) Enter details for Type: US/USER, Agent, and Lang
    Then Save
    e) Select Partner no. and LS which were create above
    f) Now we have to give some Inbound Parameters.So click on ADD TO Create Inbound Parameter
    g) Select Message type
    h) Double click on Message Type and Then Enter the details for Message Type and Process Code.
    I) save
    4) In Transaction SALE, Create Logical System
    a). Go to Basic Settings-> First Define logical systems
    and then assign logical systems
    b) Double click on Define the logical systems
    c) Give data for your Logicaal System and Name
    d) Now click on Save.Here one window may appear just click on Continue.Now the Logical System name is ready
    e) Assign the logical system name to the client
    do let me know if it helped
    Edited by: Tom  Jose on Feb 21, 2008 9:04 AM

  • Send mail to a specific user group when an Inbound Idoc processing fails

    I am using standard Message type DEBMAS, but the process code is customed (say ZDEBM as the function module is customed). Can you tell me what configurations are required to activate the error notification message to a user when the inbound idoc fails?

    hi,
    i think u need to check tcode swu3 for automatic workflow customizing and check in we40 (error AND STATUS PROCESSING) whether the processing code is assigned to the workflow task.
    if it is assigned,the workflow will be automatically triggered and the mail will be sent to the user by itself.
    ALE error handling uses workflow. A standard task is provided for each message type. Task TS20000051 is used for all BAPIs.
    Workflow functions as follows:
    A task (work item) is generated for the error handling and stored as a message in the inboxes of the employees responsible.
    If one of these employees processes the work item, the standard task method for error handling is started. The user can, for example, restart IDoc processing.
    If the IDoc is processed successfully, the work item is deleted from the inboxes of all the employees involved.
    For this procedure to function, the employees responsible for a particular message type and partner (sender or receiver) must be defined as follows:
    1. A hierarchy of organizational units (for example, "sales office") and positions (for example, "customer officer for customer X") is created and employees are assigned to it.
    2. The standard tasks for error handling (for example, an error related to an inbound sales order) are assigned to the relevant organizational units or positions (for example, "sales office").
    3. The organizational unit, position or employee responsible for dealing with the error are specified for each partner and message type in the partner profiles.
    If an error occurs, the system determines:
    1. The employees responsible using the staffing schedule of the organizational unit or position linked to the standard task.
    2. The employees defined in the partner profiles (using position, user ID, or organizational unit).
    3. The employees appearing in both groups represent those who will receive a work item in their inboxes.
    regards,
    pankaj singh

  • Inbound idoc processing using custom FM to cancel sales orders

    hello all,
             I have a scenario where i need to create a customized function module which is assigned to custom message type. and this function module is triggered when inbound idoc comes, which will process idoc data for cancellation of sales orders. If an errror occurs than the error during cancellation has to be reflected back in the idoc status.
          can anyone tell me how exactly i can log the status and reflect it back, how exactly can i do this
         And what are all the objects i need to create to succusfully execute  this scenario, i have created message type, function module, i am using orders05 do i need to create process code also.
    Thanks,
    krishnam raju.

    Hi Krishna,
       Hope you are done with the Inbound function module creation. But, just creation of function module would not be enough, what u said that is like creation of Process code should also be done.
    WE42 is the transaction code for inbound process code.
    And while creation of the process code, we need to do few things like:
    We need to create an entry of the inbound function module in BD51 transaction or so. And coming to updating of the status, open any of the inbound function module, you will observe that there is a standard subroutine which will update the IDOC_STATUS record. You can implement the same logic whenever you want to update an error message.
    Thanks,
    Adithya K

Maybe you are looking for

  • A question about concurrency and static getter methods

    Hello I have a class with some static methods. they just return a reference and doesnt apply any changes. something like this: public class FieldMapper {         private static Map<Class,Map<String,String>> fieldMap = new HashMap<Class,Map<String,Str

  • How can I open a new window with the same website like the one I have open?

    In safari I can open a new window with the same website like the one I have open, that makes it easy continuing to navigate on a website and to go back to the original website

  • BP that has multiple "ship" to addresses

    For a BP that has multiple u201Cship tou201D addresses in their BP u201Cmaster datau201D, how do we select the correct address at the point of sales order entry?  The only way we can do it at present is to alter the u201Cset as defaultu201D address i

  • USB stick very slow

    Hello, I don't use my USB stick very often, so only today I've found that copying from/to USB is VERY slow (~10kb/s). I remember that some time ago the speed was fast enough. What is wrong, why USB is so slow now?

  • UpdateRow of EO is not calling while updating VO Attribute fields of table

    I have one seeded VO and EO which is attached with one seeded Region. When i change any display field in region updateRow of EO calls and update row in database. I have added one messageTextInout through personalization and used one attribute field a