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

Similar Messages

  • Need help in INBOUND idoc generation function module!

    Can anyone send me the inbound idoc function module !
    i have the outbound code but i need the inbound code

    Might be a constant C_WF_RESULT_OK is assigned to
    variable WORK_RESULT .
    Please check if they are declared in the function module ..

  • Processes in Inbound IDoc posting

    Hi guys,
    I'm new with IDocs, and I have an object which requires Inbound IDoc posting..
    Can you give me the possible steps/processes including the tcodes on how can I solve this object?
    Please also include FMs that I might possibly used during my development.
    I highly appreciate all your swift responses. Thanks!

    Hi Mel,
    You can use FM IDOC_INBOUND_WRITE_TO_DB to create an inbound IDoc.
    CALL FUNCTION 'IDOC_INBOUND_WRITE_TO_DB'
        EXPORTING
          PI_STATUS_MESSAGE       = I_EDIDS
        IMPORTING
          PE_IDOC_NUMBER          = DOCNUM
          PE_STATE_OF_PROCESSING  = STPROC
          PE_INBOUND_PROCESS_DATA = I_TEDE2
        TABLES
          T_DATA_RECORDS          = I_EDIDD
        CHANGING
          PC_CONTROL_RECORD       = I_EDIDC
        EXCEPTIONS
          IDOC_NOT_SAVED          = 1
          OTHERS                  = 2.
    Regards,
    Chandra Sekhar

  • ALE-IDOC Error -Function module not allowed: ZIDOC_INPUT_MATCLASS

    Hello all,
    I am having a requirement to enhace bd10  to suit for material master.For that i have written a Z-function module to at inbound side.
    Function module has coading for extended segments and z processing code is created for the same.
    The issue is that i am getting error-Function module not allowed: ZIDOC_INPUT_MATCLASS.Please help to resolve the issue.
    Thank you.

    I have checked as per your suggestion in detail the error reported as-
    Function module not allowed: ZIDOC_INPUT_MATCLASS
    Message no. B1252
    Diagnosis
    The function module ZIDOC_INPUT_MATCLASS and the application object type which were determined are not valid for this IDoc.
    Procedure
    1. Please check that the process code in the inbound partner profile is correct.
    2. If this is the case, you should check the ALE inbound methods ALE inbound methods for the process code and see whether the specified function module and application object type are correct.
    3. If this is also the case, then the function module and the application object type are not permitted for the logical message type, message variant, message function and basis type that are contained in the IDoc control record. You should check whether the correct values have been assigned to these fields in the control record. If they do have the correct values, then the assignment to the function module and the application object type needs to be maintained.
    I am done with all the procedure.
    I am currently using-BUS1001006.I really dont know if this is the one for extended idocs and z function module for material master.Please guide me if this is the issue. And i f so please guide right buziness object.
    Thanks.
    Edited by: sanjivrd on Sep 22, 2009 1:27 PM

  • Delay in the Inbound Idoc Posting Process

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

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

  • LOIPGR01 Inbound posting function Module

    I need to post LOIPGR01 idoc into ECC. Is there any function module or BAPI to post this IDOC to application?
    Thanks.

    I config inbound process using INBOUND_IDOC_PROCESS FM to handle LOIPGR idoc. But when I test the inbound LOIPGR idoc and it threw CX_SY_DYN_CALL_PARAM_MISSING exception and saying
    When calling the function module "INBOUND_IDOC_PROCESS", one of the parameters
    needed according to the interface description was not specified.
    This parameter was "IDOC_CONTROL".
    But I can saw IDOC_CONTROL parameter contains values in debugger.

  • How to change field values AFTER Inbound IDOC Posted successfully

    Hi SAP Experts,
    In my project I receive the inbound IDOC PORDCR05 from PI and posted as an Purchase Order in ECC.
    I create the Z process code and Z function module (which is a copy version of IDOC_INPUT_PORDCR) and complete all the necessary configuration steps. It works perfectly.
    My problem is: I have to  collect some inbound idocs (that satisfied some criteria) and change the value of field EKPO-TXJCD and EKKN-KOSTL of the PO AFTER  it posted successfully (means the purchase order is created and save in database).
    How can I do this? I've try to put the logic code in Z function module, but it does not work, since at that time, the Inbound IDOC is not updated to the database yet.
    Aprreciate your advise.
    Regards,
    Elaine.

    Hi Elaine ,
    as per your cretiria pick the idocs and take created PO# from status 53 & use the BAPI (BAPI_PO_CHANGE) to change the neccessary values in the PO. We can't reprocess those idocs again.
    Reddy

  • Inbound IDOC Posting

    I am developing a function module in ECC that will be used to post inbound IDOC for customer creation DEBMAS07
    The logic is as follows -
    The function receives an IDOC structure
    It then invokes function module 'IDOC_INPUT_DEBITOR'
    IDOC_INPUT_DEBITOR takes care of creating a new customer in table KNA1. But I was expecting IDOC_INPUT_DEBITOR to also handle the IDOC posting. This way I can go to WE02 and see a new IDOC record. What am I missing? Is there some more code I need to write after the function module call?
    Thank you.
    * IDOC structures for using ALE
         data       lc_no_display         type bdwfap_par-inputmethd value ' '.
         data       lt_idoc_control       type standard table of edidc.
         data       ls_idoc_control       type edidc.
         data       lt_idoc_data          type standard table of edidd.
         data       lt_idoc_data_knvi     type standard table of edidd.
         data       lt_idoc_status        type standard table of bdidocstat.
         data       ls_idoc_status        type bdidocstat.
         data       lt_return_variables   type standard table of bdwfretvar.
         data       lt_serialization_info type standard table of bdi_ser.
         data       lv_workflow_result    type bdwf_param-result.
         data       pi_idoctyp            type edi_iapi00-idoctyp.
         data       pt_segments           type standard table of edi_iapi11.
         data       lw_segments           type edi_iapi11.
         data       ls_idoc_data          type edidd.
         data       ls_e1kna1m            type  zdebmas07_e1kna1m.
         data       e1kna1m               type e1kna1m.
    *** CONTROL DATA
         ls_idoc_control-mandt  = input-idoc-edi_dc40-mandt.
         ls_idoc_control-status = input-idoc-edi_dc40-status.
         ls_idoc_control-doctyp = input-idoc-edi_dc40-idoctyp.
         ls_idoc_control-direct = input-idoc-edi_dc40-outmod.
         ls_idoc_control-rcvprt = input-idoc-edi_dc40-rcvprt.
         ls_idoc_control-rcvprn = input-idoc-edi_dc40-rcvprn.
         ls_idoc_control-stdmes = input-idoc-edi_dc40-stdmes.
         ls_idoc_control-outmod = input-idoc-edi_dc40-outmod.
         ls_idoc_control-sndpor = input-idoc-edi_dc40-sndpor.
         ls_idoc_control-sndprt = input-idoc-edi_dc40-sndprt.
         ls_idoc_control-sndprn = input-idoc-edi_dc40-sndprn.
         ls_idoc_control-mestyp = input-idoc-edi_dc40-mestyp.
         ls_idoc_control-idoctp = input-idoc-edi_dc40-idoctyp.
         append ls_idoc_control to lt_idoc_control.
    *** READ SEGMENTS
         pi_idoctyp = ls_idoc_control-idoctp.
         call function 'IDOCTYPE_READ_COMPLETE'
           exporting
             pi_idoctyp         = pi_idoctyp
           tables
             pt_segments        = pt_segments
           exceptions
             object_unknown     = 1
             segment_unknown    = 2
             relation_not_found = 3
             others             = 4.
         loop at pt_segments into lw_segments.
           case lw_segments-segmenttyp.
             when 'E1KNA1M'.
               ls_idoc_data-segnam = 'E1KNA1M'.
               ls_idoc_data-mandt  = sy-mandt.
               ls_idoc_data-segnum = lw_segments-nr.
               ls_idoc_data-psgnum = lw_segments-parpno.
               ls_e1kna1m          = input-idoc-e1kna1m.
               move-corresponding ls_e1kna1m to e1kna1m.
               move e1kna1m to ls_idoc_data-sdata.
               append ls_idoc_data to lt_idoc_data.
               exit.
           endcase.
         endloop.
    *** IDOC INPUT CALL FUNCTION
         data: response type zsi_create_customer_is_res_tab.
         data: response_lwa type zsi_create_customer_is_respons.
         data: lwa_error_message type string.
         call function 'IDOC_INPUT_DEBITOR'
           exporting
             input_method          = lc_no_display
             mass_processing       = space
           importing
             workflow_result       = lv_workflow_result
           tables
             idoc_contrl           = lt_idoc_control
             idoc_data             = lt_idoc_data
             idoc_status           = lt_idoc_status
             return_variables      = lt_return_variables
             serialization_info    = lt_serialization_info
           exceptions
             wrong_function_called = 1
    others                = 2.

    Hello Megan,
    Check with the function modules
    EDI_DATA_INCOMING
    IDOC_WRITE_AND_START_INBOUND
    Program:
    RBDAPP01
    I guess this would answer your query.
    Regards,
    TP

  • 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

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

  • 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

  • Idocs and function modules

    HI All
    Can anyone suggest <b> function modules</b> used for the following objects or idoc types (If not atleast provide me a link where i can find them ??We are on SAP R/3 4.7.
    Purchase Orders (outbound)             <b>orders05</b>
    Goods Receipts (outbound)              <b>acc_goods_movement02</b>
    Cost Centers (outbound)          <b> cosmas01</b>
    GL Codes (outbound)                           <b>glmast01</b>
    Internal Orders (outbound)              <b>  INTERNAL_ORDER01</b>
    WBS (outbound)                           <b>HRCC1DNWBSEL01</b>
    Materials (outbound)                           <b>matmas05</b>
    Invoices (inbound)                   <b>invoic02</b>
    Invoices Blocked (outbbound)   <b>ACC_INVOICE_PYMNTBLK01</b>
    Any help will be very much appreciated
    Thank you
    Steve

    Hi steve,
    If you are searching for Outbound FM for those idoc types, 1st you have to get the <b>Process code</b> linked with the Message type of the Idoc types.
    So go to <b>WE41(Outbound process code)</b>, then search for the message types, you will get the process codes, then double click on the process codes, you will get the appropriate FM.
    e.g.Purchase order- process code:-ME10
                                  FM:- <b>IDOC_OUTPUT_ORDERS</b>
         Invoice- process code:- SD09
                     FM:- <b>IDOC_OUTPUT_INVOIC</b>
    when <b>Inbound process code</b> you can go for <b>WE42</b> and do the similar process to find out the FM.
    e.g. Material master- process code:-MATM
                          FM:- <b>IDOC_INPUT_MATMAS01</b>
          GL master- process code:- GLMA
                           FM:- <b>IDOC_INPUT_GLMAST</b>
    In this fashoin you can find out.
    Reward points if helpful,
    Best Regards,
    Bhawani
    Message was edited by:
            BHAWANI SHANKAR MOHANTY

  • 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

  • Inbound idoc posting directly even with 'Trigger by background' option

    We have inbound idocs coming into ECC from Siebel via PI. The partner profile is setup for "Trigger by background program' .So that we can run the job RBDAPP01 to sweep these status 64 idocs. But we don't get a chance as the idocs are getting posted directly(its already in status 51 or 53) as if we used the 'Trigger Immediately' option. Where could the problem lie ? Is there a possibility of some RFC call from PI overriding the Partner Profile config ? Any advice or useful tip is welcome!
    thanks,
    S

    Hi,
    I guess you can still check in the control record for EDIDC-EXPRSS - Overriding in inbound processing, the documentation of the Data Element EDI_EXPRSS is as below
    Short Text
    Overriding in inbound processing
    General
    This field determines for ALE whether a time schedule is to be deactivated for inbound processing and replaced by immediate processing.
    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