Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Batch input IDoc generation vs standard SAP transaction

konstantinos_vassiliadis
Active Participant
0 Kudos

Hello experts,

I am facing the following situation:

  1. I developed a batch input program calling transaction WPUK and using an Excel file as the source of values. In particular the batch input calls Aggregated Sales option. When the transaction is called and values are filled, on Save button press no message for IDoc generation appears. No IDoc is displayed in WE02.
  2. If I call directly transaction WPUK with the same data entered and press Save a message for the generated IDoc is displayed. Indeed the generated IDoc is displayed in WE02.
  3. In table EDIDC there is a gap in the number range and this gap is caused by the "missed" IDoc which was not generated in case 1 (batch input).

Can somebody help?

Thanks in advance,

Konstantinos

1 ACCEPTED SOLUTION

konstantinos_vassiliadis
Active Participant
0 Kudos

Actually the problem is in the standard program (SAPMWPUK) underlying WPUK. There is the following code:

call function 'IDOC_INBOUND_WRITE_TO_DB'

       exporting

         pi_do_handle_error      = ' '

       importing

         pe_state_of_processing  = l_state_of_processing

         pe_inbound_process_data = l_inbound_process_data

       tables

         t_data_records          = g_t_edidd

       changing

         pc_control_record       = g_t_edidc

       exceptions

         idoc_not_saved          = 1

         others                  = 2.

     if sy-subrc = 0 and sy-binpt <> 'X'.

       commit work.

     endif.

     if l_state_of_processing = 0 and sy-subrc = 0.

       append g_t_edidc to l_t_edidc.

       call function 'IDOC_START_INBOUND'

         exporting

           pi_inbound_process_data = l_inbound_process_data

           pi_called_online        = 'X'

           pi_do_commit            = 'X'

         tables

           t_control_records       = l_t_edidc

         exceptions

           others                  = 8.

The status variable sy-binpt is 'X' and thus there is no commit and then when IDOC_START_INBOUND FM is called it raises exception because although IDoc number is reserved it cannot be found in the database - due to no commit.

As an alternative, is there a BAPI or something else other than batch input to call WPUK??

Thanks in advance,

Konstantinos

2 REPLIES 2

konstantinos_vassiliadis
Active Participant
0 Kudos

Actually the problem is in the standard program (SAPMWPUK) underlying WPUK. There is the following code:

call function 'IDOC_INBOUND_WRITE_TO_DB'

       exporting

         pi_do_handle_error      = ' '

       importing

         pe_state_of_processing  = l_state_of_processing

         pe_inbound_process_data = l_inbound_process_data

       tables

         t_data_records          = g_t_edidd

       changing

         pc_control_record       = g_t_edidc

       exceptions

         idoc_not_saved          = 1

         others                  = 2.

     if sy-subrc = 0 and sy-binpt <> 'X'.

       commit work.

     endif.

     if l_state_of_processing = 0 and sy-subrc = 0.

       append g_t_edidc to l_t_edidc.

       call function 'IDOC_START_INBOUND'

         exporting

           pi_inbound_process_data = l_inbound_process_data

           pi_called_online        = 'X'

           pi_do_commit            = 'X'

         tables

           t_control_records       = l_t_edidc

         exceptions

           others                  = 8.

The status variable sy-binpt is 'X' and thus there is no commit and then when IDOC_START_INBOUND FM is called it raises exception because although IDoc number is reserved it cannot be found in the database - due to no commit.

As an alternative, is there a BAPI or something else other than batch input to call WPUK??

Thanks in advance,

Konstantinos

0 Kudos

Actually I found the solution...when using CALL TRANSACTION ....OPTIONS FROM opt

I set opt--NOBINPT = 'X' and then in called program sy-binpt is SPACE and the IDoc is commited!