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: 

No of idocs created

Former Member
0 Kudos

Hi,

Im creating idocs using this function module. MASTER_IDOC_DISTRIBUTE. Can anyone tel me how to display the no of idocs created in the output?

-Anbu.

7 REPLIES 7

Former Member
0 Kudos

There is table parameter MASTER_IDOC_DATA of FM MASTER_IDOC_DISTRIBUTE. Suppoase you are passing internal table ITAB to this parameter. Use DESCRIBE TABLE ITAB LINES lv-Lines. Lv_lines give number of idocs generated.

0 Kudos

Hi Ashwin,

As you told the itab which is passed for the MASTER_IDOC_DATA, in my case it contains 3 segments so it's just showing Describe lines as '3'. But the itab passed to COMMUNICATION_IDOC_CONTROL actually contains the idoc number.

0 Kudos

Hello,

The FM: MASTER_IDOC_DISTRIBUTE will always send only one idoc (with single or multiple segments).

So i think you are looping & calling the FM.

You can try something like this:

DATA: V_IDOC TYPE I.

LOOP AT ITAB.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
...
TABLES
...
EXCEPTIONS
...

IF SY-SUBRC = 0.
  V_IDOC = V_IDOC + 1.
ENDIF.

ENDLOOP.

V_IDOC gives the count of IDocs generated. Hope i am clear.

BR,

Suhas

0 Kudos

solved!!...thank u.

Former Member
0 Kudos

Hi Anbu,

As the FM MASTER_IDOC_DISTRIBUTE creates a single IDoc, you can count on the number of times it has been executed with SY-SUBRC = 0, so that, you can capture the number of success IDocs that has been gerentated.

Rgds,

Sripal

andrea_olivieri
Contributor
0 Kudos

Hi,

you can get the idoc number from the table parameter COMMUNICATION_IDOC_CONTROL because always only one line is returned.

(...)
          CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
            EXPORTING
              master_idoc_control            = ls_idoc_header_item
            TABLES
              communication_idoc_control     = lt_idoc_comm_control
              master_idoc_data               = lt_idoc_data_items
            EXCEPTIONS
              error_in_idoc_control          = 01
              error_writing_idoc_status      = 02
              error_in_idoc_data             = 03
              sending_logical_system_unknown = 04.
          IF sy-subrc = 0.
*           Get IDoc number
            CLEAR ls_idoc_comm_control.
             "               ls_idoc_comm_control-docnum is the idoc number
            READ TABLE lt_idoc_comm_control INDEX 1 INTO ls_idoc_comm_control.
          endif.
(...)

Regards,

Andrea

andrea_olivieri
Contributor
0 Kudos

Sorry if I misunderstood the question. If you have to count the number of idoc created during the processing, you just increment a variable in your program after every call of Master_idoc_distribute if SY-SUBRC = 0.

Regards,

Andrea