IDOC: Incorrect function module problem

Hi,
I am working on inbound IDOC processing. I created an extension for an IDOC. I created custom segment & included it in the extension that I created. The Message type was also custom. (I merely copied an existing standard Message Type for some other purpose). I also assigned Function Module to Message Type & IDOC type. I have other necessary settings configured as required. The problem that I am encountering is as follows:
Incorrect function module IDOC_INPUT_SHPCPR called up
Message no. B1044
Diagnosis
The function module IDOC_INPUT_SHPCPR, which was called for the application input, was not able to process the IDoc. A possible cause is that the IDoc has wrong message type or IDoc type.
Procedure
Please check the message type assignment for the application function module in the ALE customizing.
Now to troubleshoot the above error, I made sure that I have an entry with FM. IDOC_INPUT_SHPCPR,  IDOC Basic Type ,custom  IDOC extension & custom Message Type. But even then I see the above error. This error appears as Status 51 for the test IDOC that I processed.
Can anyone please tell me how to solve this? Thanks in advance.

On line 49 of the function module :
* Loop through the IDocs' control records
  LOOP AT idoc_contrl.
*   Check the IDOCs message type
    current_mestyp = idoc_contrl-mestyp.
    PERFORM idoc_message_type_check
                 TABLES   idoc_status
                 USING    idoc_contrl
                          mestyp-shpcpr
                 CHANGING subrc.
Perform looks like this ( in Include LV56IF0C...)
FORM idoc_message_type_check
          TABLES   t_idoc_status  STRUCTURE bdidocstat
          USING    f_idoc_contrl  STRUCTURE edidc
                   default_mestyp LIKE edidc-mestyp
          CHANGING subrc          LIKE sy-subrc.
  IF current_mestyp <> default_mestyp.   " Here the variable default_mestyp has the value SHPCPR
    MESSAGE ID      msg-id             "Global variable
            TYPE    'E'
            NUMBER  msg-nr_wrong_function    "Global variable
            WITH    current_mestyp     "message type
                    'IDOC_INPUT_SHIPPL'"Your function module
                    f_idoc_contrl-sndprt     "Sender partner type
                    f_idoc_contrl-sndprn     "Sender number
            RAISING wrong_function_called.
Again let me warn you that you will have to copy the entire function group V56I. Copying the function module alone will not help because there are many reusable subroutines in different includes of the function-pool.
regards,
Advait

Similar Messages

  • Idoc - Error Status 51: Incorrect function module called up

    Hi,
    In the receiver system for the custom message type, I got this error.
    Incorrect function module called up
    Can any one pls help me to solve this one.
    Regards,
    Bala Raja

    Hi Bala,
         Check the inbound function module attached to process code in receiving system. Generally in every inbound function module first check is coded for checking message type or for checking funciton module like below.In the receiving system go to WE20 and then select the partner and select inbound message type. in that double click on assigned process code.then you have to double click on displayed FM. In that fm check first few lines. You will find this error message.
    LOOP AT IDOC_CONTRL.
        IF IDOC_CONTRL-IDOCTP(6) <> 'DESADV'.
          MESSAGE ID 'E0' TYPE 'E' NUMBER '029'
          WITH IDOC_CONTRL-IDOCTP ' ' 'IDOC_INPUT_DESADV'
          RAISING WF_ERROR_PROCESS.
        ENDIF.
      ENDLOOP.
    Thanks & Regards,
    Kalyan.

  • Status : 51- Incorrect function module IDOC_INPUT_MATMAS01 called up

    Hello,
    File - IDOC
    in MONI, checkered flag is shown up and when I go the R3 server, WE05, I get error message
    Status : 51
    Incorrect function module IDOC_INPUT_MATMAS01 called up
    I am using MATMAS04 without extension and updated the same in WE57. also checked in WE42 (MATM)
    now, how do I proceed furthur related the above error message?
    Regards,
    Nikhil.

    can very much
    check your partner profiles PROPERLY. If u have the same IDoc type in 2 different partner profiles, check the 2nd one for it's process code. Isn't it the one, which is called after your Idoc is received? Processing code in partner profile is not based only on Idoc Type, but also on Message Type, Message Code and Extension. If the 2nd profile contains the process code, which is called, then check your incoming idoc for header values. May be this is causing your problem.
    Peter

  • Need help for IDOC inbound function module !

    Hi guys please help me to create a IDOC inbound function module.
    What are the parameters and tables.
    How to write the code.
    What it does.
    Please send me one inbound func module code if possuble
                                                                                  Thanks

    Hi,
    You need to create an inbound function module. Then define the process code in transaction we42 and attach the function module to this process code.
    In the function module you create you need to define tables of types EDIDC (Control record (IDoc)), EDIDD (Data record (IDoc)) and BDIDOCSTAT (ALE IDoc status (subset of all IDoc status fields)).
    Regards,
    Soumya.

  • Inbound IDoc Posting Function Module

    Give me an example of   how to write "Inbound IDoc Posting Function Module".
    In my IDOC i have 10 segments each containing 1 field.
    How do i create the Inbound IDoc Posting Function Module ??
    Is the following code correct ??
    FUNCTION ZIDOC_INBOUND.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD
    *"     VALUE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC
    *"  EXPORTING
    *"     VALUE(WORKFLOW_RESULT) LIKE  BDWFAP_PAR-RESULT
    *"     VALUE(APPLICATION_VARIABLE) LIKE  BDWFAP_PAR-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
    *DATABASE TABLES
    TABLES:LIKPUK.
    *DATA DECLARATIONS
        DATA: SALES_ORDER_NUM             LIKE Z1VBELN.
        DATA: DEL_TYPE                    LIKE Z1LFART.
        DATA: ACTUAL_GOODS_MOVEMENT_DATE  LIKE Z1WADAT_IST.
        DATA: SHIPPING_POINT              LIKE Z1VSTEL.
        DATA: LOADING_POINT               LIKE Z1LSTEL.
        DATA: ROUTE_PGI                   LIKE Z1ROUTE.
        DATA: PICK_DATA                   LIKE Z1KODAT.
        DATA: CUST_NO                     LIKE Z1KUNNR.
        DATA: LOCAL_DATE                  LIKE Z1STDAT.
        DATA: TOTAL_GOOD_MOV              LIKE Z1WBSTK.
    *INTERNAL TABLE DECLARATION
    DATA:
    IT_LIKP LIKE LIKPUK OCCURS 0 WITH HEADER LINE.
    INITIALIZE WORK FLOW
        WORK_RESULT = C_WF_RESULT_OK.
         LOOP AT IDOC_CONTRL.
    MAKE SURE WE HAVE CORRECT MESSAGE TYPE PASSED.
         IF IDOC_CONTRL-MESTYP NE 'Z_IDOC_PGI'.
         RAISE WRONG_FUNCTION_CALLED.
         ENDIF.
    CLEAR APPLICATION BUFFERS BEFORE READING NEW ENTRY
        CLEAR :IT_LIKP.
      REFRESH IT_LIKP.
    *PROCESS ALL THE DATA RECORDS IN AN IDOC AND TRANSFER THEM TO
    *APPLICATION BUFFERS
    INCLUDE MBDCONWF.
    LOOP AT IDOC_DATA WHERE DOCNUM EQ idoc_contrl-docnum.
    CASE IDOC_DATA-SEGNAM.
    WHEN'Z1VBELN'.
       SALES_ORDER_NUM  =    IDOC_DATA-SDATA.
       MOVE-CORRESPONDING SALES_ORDER_NUM TO IT_LIKP.
    WHEN 'Z1LFART'.
       DEL_TYPE    = IDOC_DATA-SDATA.
       MOVE-CORRESPONDING DEL_TYPE TO IT_LIKP.
    WHEN 'Z1WADAT_IST'.
       ACTUAL_GOODS_MOVEMENT_DATE    = IDOC_DATA-SDATA.
       MOVE-CORRESPONDING ACTUAL_GOODS_MOVEMENT_DATE TO IT_LIKP.
    WHEN 'Z1VSTEL'.
       SHIPPING_POINT    = IDOC_DATA-SDATA.
       MOVE-CORRESPONDING SHIPPING_POINT TO IT_LIKP.
    WHEN 'Z1LSTEL'.
       LOADING_POINT   = IDOC_DATA-SDATA.
       MOVE-CORRESPONDING LOADING_POINT TO IT_LIKP.
    WHEN 'Z1ROUTE'.
       ROUTE_PGI    = IDOC_DATA-SDATA.
       MOVE-CORRESPONDING ROUTE_PGI TO IT_LIKP.
    WHEN 'Z1KODAT'.
       PICK_DATA =   IDOC_DATA-SDATA.
       MOVE-CORRESPONDING PICK_DATA TO IT_LIKP.
    WHEN'Z1KUNNR'.
       CUST_NO  =   IDOC_DATA-SDATA.
       MOVE-CORRESPONDING CUST_NO TO IT_LIKP.
    WHEN'Z1STDAT'.
       LOCAL_DATE  =   IDOC_DATA-SDATA.
       MOVE-CORRESPONDING LOCAL_DATE TO IT_LIKP.
    WHEN'Z1WBSTK'.
       TOTAL_GOOD_MOV  =   IDOC_DATA-SDATA.
       MOVE-CORRESPONDING TOTAL_GOOD_MOV TO IT_LIKP.
    ENDCASE.
    ENDLOOP.
    selecting data from the database
    select * from likp into corresponding fields of table it_likp.
    add status record
        IF SY-SUBRC EQ 0.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '53'.
          IDOC_STATUS-MSGTY = 'I'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '004'.
          IDOC_STATUS-MSGV1 = it_likp-VBELN.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
        ELSE.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '51'.
          IDOC_STATUS-MSGTY = 'E'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '005'.
          IDOC_STATUS-MSGV1 = it_likp-VBELN.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
          RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          CLEAR RETURN_VARIABLES.
        ENDIF.
    IF SY-SUBRC EQ 0.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '53'.
          IDOC_STATUS-MSGTY = 'I'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '004'.
          IDOC_STATUS-MSGV1 = IT_LIKP-LFART.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
        ELSE.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '51'.
          IDOC_STATUS-MSGTY = 'E'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '005'.
          IDOC_STATUS-MSGV1 = IT_LIKP-LFART.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
          RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          CLEAR RETURN_VARIABLES.
        ENDIF.
    IF SY-SUBRC EQ 0.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '53'.
          IDOC_STATUS-MSGTY = 'I'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '004'.
          IDOC_STATUS-MSGV1 = IT_LIKP-WADAT_IST.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
        ELSE.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '51'.
          IDOC_STATUS-MSGTY = 'E'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '005'.
          IDOC_STATUS-MSGV1 = IT_LIKP-WADAT_IST.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
          RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          CLEAR RETURN_VARIABLES.
        ENDIF.
        IF SY-SUBRC EQ 0.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '53'.
          IDOC_STATUS-MSGTY = 'I'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '004'.
          IDOC_STATUS-MSGV1 = IT_LIKP-VSTEL.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
        ELSE.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '51'.
          IDOC_STATUS-MSGTY = 'E'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '005'.
          IDOC_STATUS-MSGV1 = IT_LIKP-VSTEL.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
          RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          CLEAR RETURN_VARIABLES.
        ENDIF.
        IF SY-SUBRC EQ 0.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '53'.
          IDOC_STATUS-MSGTY = 'I'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '004'.
          IDOC_STATUS-MSGV1 = IT_LIKP-LSTEL.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
        ELSE.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '51'.
          IDOC_STATUS-MSGTY = 'E'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '005'.
          IDOC_STATUS-MSGV1 = IT_LIKP-LSTEL.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
          RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          CLEAR RETURN_VARIABLES.
        ENDIF.
        IF SY-SUBRC EQ 0.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '53'.
          IDOC_STATUS-MSGTY = 'I'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '004'.
          IDOC_STATUS-MSGV1 = IT_LIKP-ROUTE.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
        ELSE.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '51'.
          IDOC_STATUS-MSGTY = 'E'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '005'.
          IDOC_STATUS-MSGV1 = IT_LIKP-ROUTE.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
          RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          CLEAR RETURN_VARIABLES.
        ENDIF.
        IF SY-SUBRC EQ 0.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '53'.
          IDOC_STATUS-MSGTY = 'I'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '004'.
          IDOC_STATUS-MSGV1 = IT_LIKP-KODAT.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
        ELSE.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '51'.
          IDOC_STATUS-MSGTY = 'E'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '005'.
          IDOC_STATUS-MSGV1 = IT_LIKP-KODAT.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
          RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          CLEAR RETURN_VARIABLES.
        ENDIF.
        IF SY-SUBRC EQ 0.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '53'.
          IDOC_STATUS-MSGTY = 'I'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '004'.
          IDOC_STATUS-MSGV1 = IT_LIKP-KUNNR.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
        ELSE.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '51'.
          IDOC_STATUS-MSGTY = 'E'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '005'.
          IDOC_STATUS-MSGV1 = IT_LIKP-KUNNR.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
          RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          CLEAR RETURN_VARIABLES.
        ENDIF.
        IF SY-SUBRC EQ 0.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '53'.
          IDOC_STATUS-MSGTY = 'I'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '004'.
          IDOC_STATUS-MSGV1 = SY-DATLO.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
        ELSE.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '51'.
          IDOC_STATUS-MSGTY = 'E'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '005'.
          IDOC_STATUS-MSGV1 = SY-DATLO.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
          RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          CLEAR RETURN_VARIABLES.
        ENDIF.
        IF SY-SUBRC EQ 0.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '53'.
          IDOC_STATUS-MSGTY = 'I'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '004'.
          IDOC_STATUS-MSGV1 = IT_LIKP-WBSTK.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
        ELSE.
          IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
          IDOC_STATUS-STATUS = '51'.
          IDOC_STATUS-MSGTY = 'E'.
          IDOC_STATUS-MSGID = 'YM'.
          IDOC_STATUS-MSGNO = '005'.
          IDOC_STATUS-MSGV1 = IT_LIKP-WBSTK.
          APPEND IDOC_STATUS.
          CLEAR IDOC_STATUS.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
          RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          CLEAR RETURN_VARIABLES.
        ENDIF.
    endloop.
    endfunction.

    Hi,
    First goto WE20-> click on the logical system , now select the receiver LS which you are using as your partner. Now in the inbound parameters cehck what is the process code is attached.
    once you get the process code then go to WE42 tcode.. there you give the process code and then double click you will get the function module IDOC_INPUT_FIDCMT.
    Hopw you got my point.
    Regards,
    Nagaraj

  • Creating a custom IDoc inbound function module

    I have created a custom idoc.I wanted to create a custom IDoc inbound function module, this Function module will provide to launch a BAPI .Tell me how to "create" inbound function module for the custom idoc ?

    Goto any standard for the Paramtetres
    *"  IMPORTING
    *"     REFERENCE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD
    *"     REFERENCE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC
    *"  EXPORTING
    *"     REFERENCE(WORKFLOW_RESULT) LIKE  BDWFAP_PAR-RESULT
    *"     REFERENCE(APPLICATION_VARIABLE) LIKE  BDWFAP_PAR-APPL_VAR
    *"     REFERENCE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK
    *"     REFERENCE(CALL_TRANSACTION_DONE) LIKE  BDWFAP_PAR-CALLTRANS
    *"     REFERENCE(DOCUMENT_NUMBER) LIKE  VBAK-VBELN
    *"  TABLES
    *"      IDOC_CONTRL STRUCTURE  EDIDC
    *"      IDOC_DATA STRUCTURE  EDIDD
    *"      IDOC_STATUS STRUCTURE  BDIDOCSTAT
    *"      RETURN_VARIABLES STRUCTURE  BDWFRETVAR
    *"      SERIALIZATION_INFO STRUCTURE  BDI_SER
    *"      EDI_TEXT STRUCTURE  EDIORDTXT1 OPTIONAL
    *"      EDI_TEXT_LINES STRUCTURE  EDIORDTXT2 OPTIONAL
    Do the below configs.
    1.Recognise the funcmod as Inbound -BD51
    2.Register the Function  module in WE57 .
    3.we42 Process code .
    4. WE20 -PARTNER Profile
    I hope it resolves ur Query.
    Rgds
    Sree M

  • IDOC inbound function module!

    Has anybody worked on IDOC inbound function module !
    What is the meaning of the following steps !
    IDOC_STATUS-DOCNUM = IDOC_CONTROL-DOCNUM.
    IDOC_STATUS-STATUS = '51'.
    IDOC_STATUS-MSGTY = 'E'
    IDOC_STATUS-MSGID = ' ZE'
    IDOC_STATUS-MSGNO = '007'
    IDOC_STATUS-MSGV1 =  IT_LIKP-vbeln.
    APPEND IDOC_STATUS.
    What are possible values for MSGTY,MSGID, MSGNO.....
    What do they mean !
    Edited by: Alvaro Tejada Galindo on Mar 10, 2008 7:18 PM

    "here nothing complicated ...
    "status 51 means 'Application document not posted'
    "in WE02 you can see this message
    IDoc: 0000000000001254 Status: Application document not posted
    IDOC_STATUS-DOCNUM = IDOC_CONTROL-DOCNUM. "IDoc number
    IDOC_STATUS-STATUS = '51'.                                      "stauts code
    IDOC_STATUS-MSGTY = 'E'                                         "error type
    IDOC_STATUS-MSGID = ' ZE'                                       "message class ID
    IDOC_STATUS-MSGNO = '007'                                     "message number in ZE
    IDOC_STATUS-MSGV1 =  IT_LIKP-vbeln.                      "document number or order number
    APPEND IDOC_STATUS.

  • Problem with IDOC inbound function module

    hi
       While excecuting the inbound function module in WE19
    I am getting error (short dump) 
    Incorrect parameter with Call transaction.

    Creating a Function Module (Direct Inbound Processing)
    This step describes how to create a function module which is identified by the IDoc Interface using a new process code and called from ALE (field TBD52-FUNCNAME). Direct inbound processing using a function module (not using a workflow) always includes the ALE layer. This setting (processing with function module and ALE layer) is identified by the value 6 in the field TEDE2-EDIVRS, which is read by the function module IDOC_START_INBOUND. IDOC_START_INBOUND then calls ALE.
    Prerequisites
    You must have completed the required steps in Defining and Using a Basic Type .
    Procedure
    Choose Tools ® ABAP Workbench ® Development ® Function Builder, and create a new function module.
    Create the segments as global data in your function group. The function module should copy the application data from the segments into the corresponding application tables and modify the IDoc status accordingly. If an error occurs, the function module must set the corresponding workflow parameters for exception handling.
    Activate the function module: From the initial screen of the Function Builder select .
    In the example, create the function module IDOC_INPUT_TESTER with a global interface. The function module is called when an IDoc of type TESTER01 is received for inbound processing. You will assign an application object ("standard order") to this IDoc type and therefore maintain tables from SD. To do this, call transaction VA01 using the command CALL TRANSACTION. Please note that the intention here is not to simulate a realistic standard order, but only to illustrate how data reaches application tables from an IDoc table via segment structures (form routine READ_IDOC_TESTER) and how the function module triggers an event for exception handling (by returning suitable return variables to the ALE layer in the FORM routine RETURN_VARIABLES_FILL).
    A comprehensive example of the code for an inbound function module is provided in the ALE documentation in the SAP Library under  Example Program to Generate an IDoc. This function module, for example, also checks whether the logical message is correct and calls a (fictitious) second function module which first writes the application data and then returns the number of the generated document. In addition, status 53 is only set if the application document was posted correctly.
    Administration parameters for IDOC_INPUT_TESTER
    Application abbreviation
    V (Sales and Distribution)
    Processing type
    Normal, start immediately
    Interface for IDOC_INPUT_TESTER (global interface)
    Formal parameters
    Reference structure
    Explanation
    Import parameters
    INPUT_METHOD
    BDWFAP_PAR-INPUTMETHD
    Describes how the function module is to be processed (example: in the background)
    MASS_PROCESSING
    BDWFAP_PAR-MASS_PROC
    Mass inbound processing? (indicator)
    Export parameters
    WORKFLOW_RESULT
    BDWFAP_PAR-RESULT
    Set to 99999 if an event is to be triggered for error handling.
    APPLICATION_VARIABLE
    BDWFAP_PAR-APPL_VAR
    Variable freely available from application for workflow
    IN_UPDATE_TASK
    BDWFAP_PAR-UPDATETASK
    Asynchronous update? (indicator is not set in example)
    CALL_TRANSACTION_DONE
    BDWFAP_PAR-CALLTRANS
    Transaction called? (indicator is not set in example)
    Table
    IDOC_CONTRL
    EDIDC
    IDoc control record
    IDOC_DATA
    EDIDD
    IDoc data records
    IDOC_STATUS
    BDIDOCSTAT
    IDoc status records for ALE
    RETURN_VARIABLES
    BDWFRETVAR
    IDoc assigned to Object type method parameters.
    SERIALIZATION_INFO
    BDI_SER
    If several IDocs are to be processed in a certain sequence: this structure contains the necessary information
    Example
    FUNCTION IDOC_INPUT_TESTER.
    ""Globale Schnittstelle:
    *"       IMPORTING
    *"             VALUE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD
    *"             VALUE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC
    *"       EXPORTING
    *"             VALUE(WORKFLOW_RESULT) LIKE  BDWFAP_PAR-RESULT
    *"             VALUE(APPLICATION_VARIABLE) LIKE  BDWFAP_PAR-APPL_VAR
    *"             VALUE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK
    *"             VALUE(CALL_TRANSACTION_DONE) LIKE  BDWFAP_PAR-CALLTRANS
    *"       TABLES
    *"              IDOC_CONTRL STRUCTURE  EDIDC OPTIONAL
    *"              IDOC_DATA STRUCTURE  EDIDD
    *"              IDOC_STATUS STRUCTURE  BDIDOCSTAT
    *"              RETURN_VARIABLES STRUCTURE  BDWFRETVAR
    *"              SERIALIZATION_INFO STRUCTURE  BDI_SER
    initialize SET/GET Parameter and internal tables
      PERFORM INITIALIZE_ORGANIZATIONAL_DATA.
    Move IDOC to internal tables of application
      PERFORM READ_IDOC_TESTER.
    call transaction Order Entry VA01
      PERFORM CALL_VA01_IDOC_ORDERS USING ERRORCODE.
    set status value
      perform write_status_record using errorcode.
    return values of function module
      PERFORM RETURN_VARIABLES_FILL USING ERRORCODE.
    ENDFUNCTION.
    FORM INITIALIZE_ORGANIZATIONAL_DATA.
    initialize SET/GET parameters
       SET PARAMETER ID 'VKO' FIELD SPACE.
       SET PARAMETER ID 'VTW' FIELD SPACE.
       SET PARAMETER ID 'SPA' FIELD SPACE.
       SET PARAMETER ID 'VKB' FIELD SPACE.
       SET PARAMETER ID 'VKG' FIELD SPACE.
    initialize internal tables
       REFRESH BDCDATA.
       CLEAR BDCDATA.
       CLEAR BELEGNUMMER.
       CLEAR ERRTAB.
       REFRESH ERRTAB.
       REFRESH XBDCMSGCOLL.
       CLEAR XBDCMSGCOLL.
    ENDFORM.                    " INITIALIZE_ORGANIZATIONAL_DATA
    FORM READ_IDOC_TESTER.
      PERFORM INITIALIZE_IDOC.
    LOOP AT IDOC_DATA
       WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
        CASE IDOC_DATA-SEGNAM.
    header data
          WHEN 'E1HEAD'.
            MOVE IDOC_DATA-SDATA TO E1HEAD.
            PERFORM PROCESS_SEGMENT_E1HEAD.
    position data
          WHEN 'E1ITEM'.
            MOVE IDOC_DATA-SDATA TO E1ITEM.
            PERFORM PROCESS_SEGMENT_E1ITEM.
        ENDCASE.
    ENDLOOP.
    only when there were one or more items
      CHECK FIRST NE 'X'.
      APPEND XVBAP.                        "last one
    ENDFORM.                    " READ_IDOC_TESTER
    FORM INITIALIZE_IDOC.
      CLEAR XVBAK.
      REFRESH XVBAP.
      CLEAR XVBAP.
      POSNR = 0.
      FIRST = 'X'.
    ENDFORM.                    " INITIALIZE_IDOC
    FORM PROCESS_SEGMENT_E1HEAD.
    requested date of delivery
      WLDAT = E1HEAD-WLDAT.
    delivery date
      XVBAK-BSTDK = E1HEAD-BSTDK.
    customer number
      XVBAK-KUNNR = E1HEAD-AUGEB.
    order number
      XVBAK-BSTNK = E1HEAD-BELNR.
    division
      XVBAK-SPART = E1HEAD-SPART.
    distribution channel
      XVBAK-VTWEG = E1HEAD-VTWEG.
    sales organization
      XVBAK-VKORG = E1HEAD-VKORG.
    order type
      XVBAK-AUART = E1HEAD-AUART.
    do not fill incoterms (inco1, inco2)
    customer function
      CALL CUSTOMER-FUNCTION '001'
           EXPORTING
                PI_VBAK621           = XVBAK
           IMPORTING
                PE_VBAK621           = XVBAK
           TABLES
                PT_IDOC_DATA_RECORDS = IDOC_DATA.
    ENDFORM.                    " PROCESS_SEGMENT_E1HEAD
    FORM PROCESS_SEGMENT_E1ITEM.
    position number
      XVBAP-POSNR = XVBAP-POSNR + 1.
    amount
      XVBAP-WMENG = E1ITEM-MENGE.
    unit
      CALL FUNCTION 'ISO_TO_SAP_MEASURE_UNIT_CODE'
           EXPORTING
                ISO_CODE  = E1ITEM-BMEINH
           IMPORTING
                SAP_CODE  = XVBAP-VRKME
           EXCEPTIONS
                OTHERS    = 0.
    material number
      XVBAP-MATNR = E1ITEM-LMATNR.
    CALL CUSTOMER-FUNCTION '002'
           EXPORTING
                PI_VBAP621           = XVBAP
           IMPORTING
                PE_VBAP621           = XVBAP
           TABLES
                PT_IDOC_DATA_RECORDS = IDOC_DATA.
    APPEND XVBAP.
    ENDFORM.                    " PROCESS_SEGMENT_E1ITEM
    FORM CALL_VA01_IDOC_ORDERS USING ERRORCODE.
    call transaction first dynpro
      PERFORM DYNPRO_START.
    call transaction double-line entry
      PERFORM DYNPRO_DETAIL2.
    incoterms
      PERFORM DYNPRO_HEAD_300.
    call transaction item datas
      PERFORM DYNPRO_POSITION.
      PERFORM DYNPRO_SET USING 'BDC_OKCODE' 'SICH'.
    determine input method
      IF INPUT_METHOD IS INITIAL.
        INPUT_METHOD = 'N'.
      ENDIF.
    call transaction VA01
    CALL TRANSACTION 'VA01' USING    BDCDATA
                             MODE     INPUT_METHOD
                             UPDATE   'S'
                             MESSAGES INTO XBDCMSGCOLL.
    errorcode = SY-SUBRC.       " remember returncode for status update
    ENDFORM.                    " CALL_VA01_IDOC_ORDERS
    form write_status_record using errorcode.
    FILL IDOC_STATUS
    IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
    IF ERRORCODE = 0.
    IDOC_STATUS-STATUS = BELEG_GEBUCHT. "value 53
       GET PARAMETER ID 'AUN' FIELD BELEGNUMMER.
       IDOC_STATUS-MSGID = 'V1'.
       IDOC_STATUS-MSGNO = '311'.
       IDOC_STATUS-MSGV1 = 'Terminauftrag'.
       IDOC_STATUS-MSGV2 = BELEGNUMMER.
    ELSE.
        IDOC_STATUS-STATUS = BELEG_NICHT_GEBUCHT. "value 51
        IDOC_STATUS-MSGID = SY-MSwGID.
        IDOC_STATUS-MSGNO = SY-MSGNO.
        IDOC_STATUS-MSGV1 = SY-MSGV1.
        IDOC_STATUS-MSGV2 = SY-MSGV2.
        IDOC_STATUS-MSGV3 = SY-MSGV3.
        IDOC_STATUS-MSGV4 = SY-MSGV4.
      ENDIF.
      APPEND IDOC_STATUS.
    ENDFORM.
    FORM DYNPRO_START.
      PERFORM DYNPRO_NEW USING PROGRAMM_AUFTRAG
                               DYNPRO-EINSTIEG
                      CHANGING LAST_DYNPRO.
    ordertype
      PERFORM DYNPRO_SET USING 'VBAK-AUART' XVBAK-AUART.
    sales organization
      PERFORM DYNPRO_SET USING 'VBAK-VKORG' XVBAK-VKORG.
    Distribution channel
      PERFORM DYNPRO_SET USING 'VBAK-VTWEG' XVBAK-VTWEG.
    Division
      PERFORM DYNPRO_SET USING 'VBAK-SPART' XVBAK-SPART.
    Sales office
      PERFORM DYNPRO_SET USING 'VBAK-VKBUR' XVBAK-VKBUR.
    Sales group
      PERFORM DYNPRO_SET USING 'VBAK-VKGRP' XVBAK-VKGRP.
    ENDFORM.                    " DYNPRO_START
    FORM DYNPRO_NEW USING    PROGNAME
                             DYNPRONR
                    CHANGING LAST_DYNPRO.
    CLEAR BDCDATA.
    BDCDATA-PROGRAM = PROGNAME.
    BDCDATA-DYNPRO  = DYNPRONR.
    BDCDATA-DYNBEGIN   = 'X'.
    APPEND BDCDATA.
    LAST_DYNPRO = DYNPRONR.
    ENDFORM.                    " DYNPRO_NEW
    FORM DYNPRO_SET USING    FELDNAME
                             FELDINHALT.
      CLEAR BDCDATA.
      CHECK FELDINHALT NE SPACE.
    dynpro field name
      BDCDATA-FNAM = FELDNAME.
    contents
      BDCDATA-FVAL = FELDINHALT.
      APPEND  BDCDATA.
    ENDFORM.                    " DYNPRO_SET
    FORM DYNPRO_DETAIL2.
    okcode
    PERFORM DYNPRO_SET USING 'BDC_OKCODE' PANEL-UER2.
    fix dynpro number 4001
      PERFORM DYNPRO_NEW  USING    PROGRAMM_AUFTRAG
                                   '4001'
                          CHANGING LAST_DYNPRO.
    order party
      PERFORM DYNPRO_SET      USING 'KUAGV-KUNNR'  XVBAK-KUNNR.
    purchase order number
      PERFORM DYNPRO_SET      USING 'VBKD-BSTKD'   XVBAK-BSTNK.
    requested delivery date
      PERFORM DYNPRO_DATE_SET USING 'VBKD-BSTDK'   XVBAK-BSTDK.
    purchase order date
      PERFORM DYNPRO_DATE_SET USING 'RV45A-KETDAT' WLDAT.
    ENDFORM.                    " DYNPRO_DETAIL2
    FORM DYNPRO_DATE_SET USING    FELDNAME
                                  FELDINHALT.
      DATA: DATE TYPE D.
      CLEAR BDCDATA.
      CHECK FELDINHALT NE SPACE.
      BDCDATA-FNAM = FELDNAME.
      WRITE FELDINHALT  TO DATE.
      BDCDATA-FVAL = DATE.
      APPEND  BDCDATA.
    ENDFORM.                    " DYNPRO_DATE_SET
    FORM DYNPRO_HEAD_300.
      PERFORM DYNPRO_SET USING 'BDC_OKCODE' PANEL-KKAU.
    incoterms part 1
      IF NOT XVBAK-INCO1 IS INITIAL.
       PERFORM DYNPRO_SET USING 'VBKD-INCO1' XVBAK-INCO1.
      ENDIF.
    incoterms part 2
      IF NOT XVBAK-INCO2 IS INITIAL.
       PERFORM DYNPRO_SET USING 'VBKD-INCO2' XVBAK-INCO2.
      ENDIF.
    PERFORM DYNPRO_SET USING 'BDC_OKCODE' 'BACK'.
    ENDFORM.                    " DYNPRO_HEAD_300
    FORM DYNPRO_POSITION.
      LOOP AT XVBAP.
    dynpro item double line entry
      PERFORM DYNPRO_SET USING 'BDC_OKCODE' 'UER2'.
        IF XVBAP-POSNR = 1.
    material number
          PERFORM DYNPRO_SET      USING 'VBAP-MATNR(01)'   XVBAP-MATNR.
    order quantity
          PERFORM DYNPRO_SET      USING 'RV45A-KWMENG(01)' XVBAP-WMENG.
    desired delivery date
          PERFORM DYNPRO_DATE_SET USING 'RV45A-ETDAT(1)'  WLDAT.
    sales unit
          PERFORM DYNPRO_SET      USING 'VBAP-VRKME(1)'   XVBAP-VRKME.
        ELSE.
         PERFORM DYNPRO_SET      USING 'BDC_OKCODE'      'POAN'.
    material number
          PERFORM DYNPRO_SET      USING 'VBAP-MATNR(02)'    XVBAP-MATNR.
    order quantity
          PERFORM DYNPRO_SET      USING 'RV45A-KWMENG(02)'  XVBAP-WMENG.
    desired delivery date
          PERFORM DYNPRO_DATE_SET USING 'RV45A-ETDAT(02)'   WLDAT.
    sales unit
          PERFORM DYNPRO_SET      USING 'VBAP-VRKME(02)'    XVBAP-VRKME.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " DYNPRO_POSITION
    FORM RETURN_VARIABLES_FILL USING ERRORCODE.
    allocate IDOC numbers to Workflow output parameters
      IF MASS_PROCESSING <> SPACE.
        IF ERRORCODE = 0.
          RETURN_VARIABLES-WF_PARAM = PID.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          RETURN_VARIABLES-WF_PARAM = APO.
          RETURN_VARIABLES-DOC_NUMBER = BELEGNUMMER.
          APPEND RETURN_VARIABLES.
          WORKFLOW_RESULT = C_WF_RESULT_OK.
        ELSE.
          RETURN_VARIABLES-WF_PARAM = EID.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          APPEND RETURN_VARIABLES.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
        ENDIF.
      ELSE.
        IF ERRORCODE = 0.
          RETURN_VARIABLES-WF_PARAM = APE.
          RETURN_VARIABLES-DOC_NUMBER = BELEGNUMMER.
          APPEND RETURN_VARIABLES.
          WORKFLOW_RESULT = C_WF_RESULT_OK.
        ELSE.
          WORKFLOW_RESULT = C_WF_RESULT_ERROR.
        ENDIF.
      ENDIF.
    ENDFORM.                    " RETURN_VARIABLES_FILL
    Globale Daten von IDOC_INPUT_TESTER
    TABLES: E1HEAD, E1ITEM.
    DATA: BEGIN OF BDCDATA OCCURS 500.
            INCLUDE STRUCTURE BDCDATA.
    DATA: END OF BDCDATA.
    DATA: BEGIN OF XVBAK.                 "Kopfdaten
         INCLUDE STRUCTURE VBAK621.
    DATA: END OF XVBAK.
    DATA: BEGIN OF XVBAP OCCURS 50.        "Position
           INCLUDE STRUCTURE VBAP.
    DATA:  WMENG(18) TYPE C.
    DATA:  LFDAT LIKE VBAP-ABDAT.
    DATA:  KSCHL LIKE KOMV-KSCHL.
    DATA:  KBTRG(16) TYPE C.
    DATA:  KSCHL_NETWR LIKE KOMV-KSCHL.
    DATA:  KBTRG_NETWR(16) TYPE C.
    DATA:  INCO1 LIKE VBKD-INCO1.
    DATA:  INCO2 LIKE VBKD-INCO2.
    DATA:  YANTLF(1) TYPE C.
    DATA:  PRSDT LIKE VBKD-PRSDT.
    DATA:  HPRSFD LIKE TVAP-PRSFD.
    DATA: END OF XVBAP.
    DATA: BEGIN OF DYNPRO,
          EINSTIEG          LIKE T185V-DYNNR VALUE 101,
          KKAU              LIKE T185V-DYNNR,
          UER2              LIKE T185V-DYNNR,
          KBES              LIKE T185V-DYNNR,
          ERF1              LIKE T185V-DYNNR,
          PBES              LIKE T185V-DYNNR,
          PKAU              LIKE T185V-DYNNR,
          PEIN              LIKE T185V-DYNNR,
          EID1              LIKE T185V-DYNNR,
          POPO              LIKE T185V-DYNNR,
          EIPO              LIKE T185V-DYNNR,
          KPAR              LIKE T185V-DYNNR,
          PSDE              LIKE T185V-DYNNR,
          PPAR              LIKE T185V-DYNNR,
          KDE1              LIKE T185V-DYNNR,
          KDE2              LIKE T185V-DYNNR,
          PDE1              LIKE T185V-DYNNR,
          PDE2              LIKE T185V-DYNNR,
          PKON              LIKE T185V-DYNNR,
          END OF DYNPRO.
    DATA: BEGIN OF PANEL,
          KKAU              LIKE T185V-PANEL VALUE 'KKAU',
          UER2              LIKE T185V-PANEL VALUE 'UER2',
          KBES              LIKE T185V-PANEL VALUE 'KBES',
          ERF1              LIKE T185V-PANEL VALUE 'ERF1',
          PBES              LIKE T185V-PANEL VALUE 'PBES',
          PKAU              LIKE T185V-PANEL VALUE 'PKAU',
          PEIN              LIKE T185V-PANEL VALUE 'PEIN',
          EID1              LIKE T185V-PANEL VALUE 'EID1',
          EIAN              LIKE T185V-PANEL VALUE 'EIAN',
          POPO              LIKE T185V-PANEL VALUE 'POPO',
          EIPO              LIKE T185V-PANEL VALUE 'EIPO',
          KPAR              LIKE T185V-PANEL VALUE 'KPAR',
          PSDE              LIKE T185V-PANEL VALUE 'PSDE',
          POAN              LIKE T185V-PANEL VALUE 'POAN',
          PPAR              LIKE T185V-PANEL VALUE 'PPAR',
          KDE1              LIKE T185V-PANEL VALUE 'KDE1',
          KDE2              LIKE T185V-PANEL VALUE 'KDE2',
          PDE1              LIKE T185V-PANEL VALUE 'PDE1',
          PDE2              LIKE T185V-PANEL VALUE 'PDE2',
          PKON              LIKE T185V-PANEL VALUE 'PKON',
          KOAN              LIKE T185V-PANEL VALUE 'KOAN',
          END OF PANEL.
    DATA: BEGIN OF ERRTAB OCCURS 20,
           TRANS  LIKE TSTC-TCODE,
           ARBGB  LIKE T100-ARBGB,
           CLASS(1) TYPE C,
           MSGNR LIKE T100-MSGNR,
         TEXT LIKE T100-TEXT,
           TEXT(123) TYPE C,
           MSGV1 LIKE SY-MSGV1,
           MSGV2 LIKE SY-MSGV2,
           MSGV3 LIKE SY-MSGV3,
           MSGV4 LIKE SY-MSGV4,
          END OF ERRTAB.
    *---- Hilfsfelder     -
    DATA: PROGRAMM_AUFTRAG LIKE T185V-AGIDV VALUE 'SAPMV45A'.
    DATA: LAST_DYNPRO      LIKE T185V-DYNNR,
          WLDAT            LIKE VBAK-BSTDK,
          POSNR            LIKE VBAP-POSNR,
          FIRST(1)         TYPE C VALUE 'X'.
    DATA: BEGIN OF XBDCMSGCOLL OCCURS 10.
            INCLUDE STRUCTURE BDCMSGCOLL.
    DATA: END OF XBDCMSGCOLL.
    Terminauftrag  ( Auftragsart wird fest gesetzt !)
    DATA:   BELEGNUMMER LIKE VBAK-VBELN.
    DATA:   ERRORCODE LIKE SY-SUBRC.
    Statuswerte fuer IDOC-Status
    DATA:   BELEG_NICHT_GEBUCHT LIKE TEDS1-STATUS VALUE '51'.
    DATA:   BELEG_GEBUCHT       LIKE TEDS1-STATUS VALUE '53'.
    *- Direktwerte für Return_variables -
    data:
        eid like bdwfretvar-wf_param value 'Error_IDOCs',
        pid like bdwfretvar-wf_param value 'Processed_IDOCs',
        apo like bdwfretvar-wf_param value 'Appl_Objects',
        ape like bdwfretvar-wf_param value 'Appl_Object'.
    *- Direktwerte für Workflow_Result -
    DATA: C_WF_RESULT_ERROR LIKE BDWFAP_PAR-RESULT VALUE '99999'.
    DATA: C_WF_RESULT_OK    LIKE BDWFAP_PAR-RESULT VALUE '0'.

  • Idoc function module problem

    Hi all,
    I have a idoc. In this Idoc i need to populate a segment which is not populated previously if it satisfies the selection criteria.
    For this i have to write a function module and this function module should check theselction and populate this field in Idoc.
    Can anyone help me in doing this.
    <REMOVED BY MODERATOR>
    Regards,
    Saroja.
    Edited by: Alvaro Tejada Galindo on Jan 31, 2008 11:28 AM

    You can hook into a user exit in the IDOC and directly populate the segments at the time the IDOC is created or processed.
    The process and user exit to use depends on:
    - what IDOC are you using
    - is it inbound or outbound
    - what are the criteria for the population of the segment
    Hope that helps,
    Michael

  • Idocs - Inbound function module

    Hi All,
    I'm facing a prolem while testing the inbound function module thru transaction WE19.
    The steps i'm following.
    1) i'll give the message type & will proceed further
    2) when i select the idoc & click on the push button "inbound function module " , My Z FM will displayed afterwards when i press enter a error message will be displayed.as"Interface for the Z function module is Incorrect"
    i have created Z funtion module, Z message type,Z IDOC type,Z segment type. Z process Code
    All the configuration like WE57,WE20,WE42 has been done.
    Please help.
    Points will be rewarded
    Thanks,
    Sureshkumar

    Suresh , please check if ure function module interface is as per the template below:
    IMPORTING     
         INPUT_METHOD LIKE  BDWFAP_PAR-INPUTMETHD
         MASS_PROCESSING  LIKE  BDWFAP_PAR-MASS_PROC
    EXPORT     
         WORKFLOW_RESULT  LIKE  BDWFAP_PAR-RESULT
         APPLICATION_VARIABLE  LIKE  BDWFAP_PAR-APPL_VAR
         IN_UPDATE_TASK  LIKE  BDWFAP_PAR-UPDATETASK
         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
    This is the general required format for IDoc inblund processing using FM.
    Message was edited by:
            Ayan Banerjee

  • How to create IDOC from Function module or RFC

    Hi all,
            I have tested one inbound IDOC for Time Upload to CAT2 using basic type "CATS_INSERT01"  in WE19 through function module BAPI_IDOC_INPUT1 .It works well.
    Now i need to create this IDOC once the sale order gets created thru BAPI.
    For creation of Sale order i wrote one RFC in which i will call the Standard Sale Order Bapi.My question is once the Sale order gets created in that RFC How do i trigger the IDOC for CATS upload.

    Hi,
    Which SAP product of wich release of which SP are you using ?
    The procedure is documented in help.sap.com and in blogs and SDN forum messages.
    It means that the use of the SEARCH button should give plenty of answers...
    >When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign >namespaces"
    As usual, begin your choosen name with an "Z".
    Regards,
    Olivier

  • Remote Function Module problem

    Hi Experts,
    I have written a Se38 progarm to execute a remote function module, so as to send some data out of the system. The receiving system is an XI system. Pls see below the code and the load at the XI end, I donno why and what mistake am I doing in the se38 program part, as a result of which, only part of the data is getting send to XI.
    REPORT ZRFC_ADAPTER.
    Data: it_final1 type standard table of zrfc_str with header line .
    it_final1-NAME = 'ARNAB'.
    it_final1-ADDRESS = 'ADDRESS'.
    it_final1-EMAIL = 'EMAIL'.
    it_final1-ID = 'ID'.
    CALL FUNCTION 'ZRFC_XI'
    IN BACKGROUND TASK DESTINATION
    'R32XIRFC'
    EXPORTING
    username = sy-uname
    tables
    it_final = it_final1 .
    break-point.
    COMMIT WORK.
    Clear it_final1.
    I have seen in debugging mode, after removing the "
    IN BACKGROUND TASK DESTINATION
    'R32XIRFC'", that the internal table " it_final1 " is working fine......
    The structure used in remote Function Module is
    IT_FINAL LIKE ZRFC_STR -- in tables parameter. and the structure of ZRFC_STR is as follows!
    NAME ZNAME CHAR 14
    ADDRESS ZADDRESS CHAR 40
    TELEPHONE ZTEL CHAR 20
    EMAIL ZEMAIL CHAR 40
    ID ZID CHAR 10
    Note that , apart from a COMMIT WORK statement, there is no other coding done in the SOURCE CODE part of the remote Function Module.
    The load in XI is showing as
    <?xml version="1.0" encoding="UTF-8" ?>
    <rfc:ZRFC_XI xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    <USERNAME>RETAILDEV</USERNAME>
    <IT_FINAL>
    <item>
    <NAME>ARNAB</NAME>
    <ADDRESS>EMAIL</ADDRESS>
    <EMAIL />
    <ID />
    </item>
    </IT_FINAL>
    </rfc:ZRFC_XI>
    Note that EMAIL is actually a content of field EMAIL and not ADDRESS. But I donno why, it is behaving like this,,
    Pls note, this RFC has been imported completely in integration repository of XI, so we dont have to worry about any settings change or activities, left pending in XI.
    I am very sure, something is missing in the se38 code, pls suggest!!
    Regards,
    Arnab .

    Hi Arnab,
    I am having really doubt that there is problem in field mapping.
    COuld you please check the following.
    In the FM structure contains 5 fields as follows,
    NAME ZNAME CHAR 14
    ADDRESS ZADDRESS CHAR 40
    TELEPHONE ZTEL CHAR 20
    EMAIL ZEMAIL CHAR 40
    ID ZID CHAR 10
    In the Internal Table it has got 4 fields. Check the Mapping properly
    and data on each field.
    t_final1-NAME = 'ARNAB'.
    it_final1-ADDRESS = 'ADDRESS'.
    it_final1-EMAIL = 'EMAIL'.
    it_final1-ID = 'ID'.
    Thanks & Regards,
    Nagaraj Kalbavi

  • RE: Idoc types , Function modules

    HI All
    What are the generic <b>Idoc types</b> and <b>function modules</b> used for the following objects for SAP R/3 4.7
    Invoice Release (inbound)
    Payments (outbound)
    Purchase Orders (outbound)
    Goods Receipts (outbound)
    Cost Centers (outbound)
    GL Codes (outbound)
    Internal Orders (outbound)
    WBS (outbound)
    Materials (outbound)
    Invoices (inbound)
    Invoices Blocked (outbbound)
    Any help will be very much appreciated
    And How do i judge which IDOC types and function module fit my requirement( I mean what are the things i have to keep in mind while choosing idoc types and function modules)
    Thnk you
    Steve

    I have an idea.
    Build an idoc from scratch with all the fileds or use the idoc invoic01 and extend it. Comming to function module write a function module that will extract the data from the idoc and will pass the data to bapi BAPI_INCOMINGINVOICE_CREATE( MIRO SCREEN). Please comment on this!!!

  • How to get structure from Idoc using function module?

    Hi all,
    I am looking for a function module in order to get the structure of a message type used for iDoc. The aim is to get the data element from the different fields in order to check authority if the data element is BUKRS.
    Thanks for your help!
    David

    Hi David,
    You can use the FM "IDOC_TYPE_COMPLETE_READ" which will get you the complete details of the IDOC type along with data elements referred for each fields in the segments.
    The aim is to get the data element from the different fields in order to check authority if the data element is BUKRS.
    Not sure if i understood the above requirement, if you could provide more info on the requirement, i guess you might get better a better solution from the forum. As there are other data elements with different names for company code (just look up *BUKRS* in SE11 under Data Elements to see what i mean), not sure if you can cover it all.
    Regards,
    Chen

  • IDOC Error - Function module not allowed: IDOC_INPUT_HRMD

    Hello Gurus,
    I have an issue with the IDOC Transfer. I am using the program RSEINB00 to read the file and convert the data into IDOCs with status 64.
    But all my Idocs are getting created with status 51 and the error is getting populated as " Function module not allowed: IDOC_INPUT_HRMD ".
    Please do let me know whats needs to be done for this to be rectified.
    Thanks,
    Naveen.

    You are not using the right process code.
    In partner profile - in message type
    u will see the process code to which a function module is attached,
    for ur message type, this is not the right function module.
    Regards
    Manu

Maybe you are looking for