09-06-2009 6:42 PM
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.
09-07-2009 4:45 AM
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.
09-07-2009 2:31 PM
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.
09-07-2009 2:38 PM
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
09-08-2009 11:29 AM
09-07-2009 4:46 AM
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
09-07-2009 1:46 PM
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
09-07-2009 3:30 PM
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