cancel
Showing results for 
Search instead for 
Did you mean: 

IDOC_START_INBOUND Not reading partner profile settings

Former Member
0 Kudos

Hi All

I have written below logic to create an inbound idoc but the idoc is getting processed directly without reading the partner profile settings. Eventhough the partner profile settings is 'Trigger by background Job', the idoc is processing directly in 53 status.

Please suggest.

DATA : lv_idocnum  TYPE edidc-docnum,

         lv_stproc   TYPE sy-subrc,

         lv_prdata   TYPE tede2,

         lt_idoc_control TYPE STANDARD TABLE OF edidc.

* Inbound IDoc with structure EDI_DD saved in database

  CALL FUNCTION 'IDOC_INBOUND_WRITE_TO_DB'

    IMPORTING

      pe_idoc_number          = lv_idocnum

      pe_state_of_processing  = lv_stproc

      pe_inbound_process_data = lv_prdata

    TABLES

      t_data_records          = lt_idoc_data

    CHANGING

      pc_control_record       = ls_idoc_control

    EXCEPTIONS

      idoc_not_saved          = 1

      OTHERS                  = 2.

  IF sy-subrc IS INITIAL.

    wa_idocstat-docnum   = lv_docnum.

    wa_idocstat-status   = c_53.

    wa_idocstat-msgty    = c_success.

    wa_idocstat-msgid    = c_messageclass.

    wa_idocstat-msgno    = c_593.

    wa_idocstat-msgv1    = ls_idoc_control-docnum.

    APPEND wa_idocstat TO i_status.

    APPEND  ls_idoc_control TO lt_idoc_control.

    CALL FUNCTION 'IDOC_START_INBOUND'

      EXPORTING

        pi_do_commit                  = 'X'

      TABLES

        t_control_records             = lt_idoc_control

        t_data_records                = lt_idoc_data

      EXCEPTIONS

        invalid_document_number       = 1

        error_before_call_application = 2

        inbound_process_not_possible  = 3

        old_wf_start_failed           = 4

        wf_task_error                 = 5

        serious_inbound_error         = 6

        OTHERS                        = 7.

*  Checking the SY-SUBRC value after the FM

    IF sy-subrc EQ 0.

     COMMIT WORK AND WAIT.

    ENDIF.

Accepted Solutions (1)

Accepted Solutions (1)

former_member585060
Active Contributor
0 Kudos

Hi Shilpa,

              The function module will directly process the IDoc, so before calling 'IDOC_START_INBOUND' function module, call function module 'IDOC_INBOUND_PROCESS_DATA_GET' and verify the PE_PARTNER_DATA-INMOD value, if it is 1 then only call the function module 'IDOC_START_INBOUND' as this will process the IDoc immediately. If the value is not 1 then do not process any thing, the IDoc will be in '64' status and can be processed by triggering background program.

Sample code.

   * Generate the Idoc number and get the Process code details
  CALL FUNCTION 'IDOC_INBOUND_WRITE_TO_DB'
    EXPORTING
      pi_status_message       = wa_edids
*     PI_DO_HANDLE_ERROR      = 'X'
*     PI_NO_DEQUEUE           = ' '
*     PI_RETURN_DATA_FLAG     = 'X'
*     PI_RFC_MULTI_CP         = '    '
    IMPORTING
      pe_idoc_number          = v_idocn
      pe_state_of_processing  = v_subrc
      pe_inbound_process_data = wa_tede2
    TABLES
      t_data_records          = i_edidd
*     T_LINKED_OBJECTS        =
    CHANGING
      pc_control_record       = wa_edidc
    EXCEPTIONS
      idoc_not_saved          = 1
      OTHERS                  = 2.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.


  APPEND wa_edidc TO i_edidc.


  CALL FUNCTION 'IDOC_INBOUND_PROCESS_DATA_GET'
    EXPORTING
      pi_control_record             = wa_edidc
   IMPORTING
     pe_partner_data                = wa_edp21
*   PE_INBOUND_PROCESS_DATA       =
*   PE_PROCESS_IDOC_LATER         =
   EXCEPTIONS
     partner_not_usuable           = 1
     event_code_missing            = 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.

* Partner profile is configured for Trigger immediately
  IF wa_edp21-inmod = 1.

* Process the Idoc
    CALL FUNCTION 'IDOC_START_INBOUND'
      EXPORTING
        pi_inbound_process_data       = wa_tede2
*     PI_CALLED_ONLINE              = ' '
        pi_do_commit                  = 'X'
*     PI_START_EVENT_ENABLED        = 'X'
*     PI_ORG_UNIT                   = ' '
*     SUCC_SHOW_FLAG                = ' '
      TABLES
        t_control_records             = i_edidc
        t_data_records                = i_edidd
      EXCEPTIONS
        invalid_document_number       = 1
        error_before_call_application = 2
        inbound_process_not_possible  = 3
        old_wf_start_failed           = 4
        wf_task_error                 = 5
        serious_inbound_error         = 6
        OTHERS                        = 7.
    IF sy-subrc <> 0.
* Implement suitable error handling here

    ENDIF.

  ENDIF.

Thanks & Regards

Bala Krishna

Answers (1)

Answers (1)

former_member197445
Contributor
0 Kudos

In BD87, can you confirm that is coming from the correct partner system?  Are there any message variants in the inbound parameter? 

Former Member
0 Kudos

Hi

I am creating this Idoc with SAP as a LUW idoc, yes we do have message variant.

former_member197445
Contributor
0 Kudos

You're probably plugging in the event code in the inbound process data parameter.  By filling that in, I think you're bypassing the partner profile.  If you leave the process code (EVCODE) blank, it will use the partner profile to get this information, thereby getting your triggering logic at the same time.