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: 

IDoc receiver system

Former Member
0 Kudos

Hi all!

I have a custom program, which is used for creating IDocs, during the program FM MASTER_IDOC_DISTRIBUTE is called and receiving system (chosen on the selection screen) is passed to FM with communication_idoc_control. During the FM, it gets receiving systems, based on BD64 (distribution model) and doesn't take into account receiving systems passed from the selection screen.

For example, in BD64 for message type 'a' I have 2 receiving systems, and in custom program selection screen I choose one of the receiving systems, but IDocs always get created for both receiving systems.

Does anyone have a solution or ideas how to fix this problem?

Thank you!

Roberts

1 ACCEPTED SOLUTION

vadimklimov
Active Contributor
0 Kudos

Hello Roberts,

The esiest way would be to submit receiver partner number (that is derived from the value of the receiver system which has been chosen on the selection screen) when calling the function module MASTER_IDOC_DISTRIBUTE. The logic of MASTER_IDOC_DISTRIBUTE checks if receiver partner is specified (namely, if fields RCVPRT or RCVPRN if the import structure MASTER_IDOC_CONTROL are filled):

  • If receiver partner is specified, the communication IDoc will be generated for the specified partner;
  • If receiver partner is not specified, communication IDoc(s) will be generated for all receiver partners based on configuration of the distribution model.

A more advanced technique would be to implement BAdI IDOC_CREATION_CHECK (precisely, method IDOC_DATA_CHECK of it) that is called from MASTER_IDOC_DISTRIBUTE, and decide if the communication IDoc should be generated for each found receiver partner from there by setting corresponding value of the export parameter CREATE_IDOC: by default, this flag is assigned the value 'true' (which means the communication IDoc will be generated), but based on needed verifications and conditions, this flag can be assigned the value 'false' (which means the corresponding communication IDoc will not be generated).

Regards,

Vadim

1 REPLY 1

vadimklimov
Active Contributor
0 Kudos

Hello Roberts,

The esiest way would be to submit receiver partner number (that is derived from the value of the receiver system which has been chosen on the selection screen) when calling the function module MASTER_IDOC_DISTRIBUTE. The logic of MASTER_IDOC_DISTRIBUTE checks if receiver partner is specified (namely, if fields RCVPRT or RCVPRN if the import structure MASTER_IDOC_CONTROL are filled):

  • If receiver partner is specified, the communication IDoc will be generated for the specified partner;
  • If receiver partner is not specified, communication IDoc(s) will be generated for all receiver partners based on configuration of the distribution model.

A more advanced technique would be to implement BAdI IDOC_CREATION_CHECK (precisely, method IDOC_DATA_CHECK of it) that is called from MASTER_IDOC_DISTRIBUTE, and decide if the communication IDoc should be generated for each found receiver partner from there by setting corresponding value of the export parameter CREATE_IDOC: by default, this flag is assigned the value 'true' (which means the communication IDoc will be generated), but based on needed verifications and conditions, this flag can be assigned the value 'false' (which means the corresponding communication IDoc will not be generated).

Regards,

Vadim