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

Former Member
0 Kudos

hi all,

My scenario is like,

i had decleared workarea wa_idoc for EDIDC.Now I have to call the messagetype,idoc type,senport,recport and etc...

and this is wa is passed in fm "master_idoc_distribute".

my problem is that how can call the parameters that are present in the EDIDC into hte work area.

Regards,

Swathi.k

3 REPLIES 3

Former Member
0 Kudos

hi

You need to fill the work area with the control record for e.g

idoc_control-doctyp = str_edp13-idoctyp.

and then assign the work area to MASTER_IDOC*

EXPORTING

master_idoc_control = idoc_control

and clear the work area after the function call

cheers

chetanya

Former Member
0 Kudos

Hello,

If you are developing a Custom Program and the details are known apart from the IDoc Type and the Message Type, then you can go ahead and hard code them in your program.

See the below Code for your understanding.

REFRESH i_edidc.

CLEAR wa_edidc.

CLEAR wa_edidd1.

wa_edidc-doctyp = c_idoc1.

wa_edidc-mestyp = c_messtyp1.

wa_edidc-rcvprt = c_rcvprt.

wa_edidc-rcvpor = c_rcvpor.

wa_edidc-rcvprn = c_rcvprn.

APPEND wa_edidc TO i_edidc.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

master_idoc_control = wa_edidc

TABLES

communication_idoc_control = i_edidc

master_idoc_data = i_edidd1

EXCEPTIONS

error_in_idoc_control = 1

error_writing_idoc_status = 2

error_in_idoc_data = 3

sending_logical_system_unknown = 4

OTHERS = 5.

Hope it helps.

Thanks and Regards,

Venkat Phani Prasad Konduri

Former Member
0 Kudos

Do like this,

If you want to keep the sender and receiver of the message dynamic, create a distribution model ( t-code BD64 ) for the message type and code the filling of control record as follows :


FORM fill_control_record  TABLES  p_ctrl_rec STRUCTURE edidc.

  DATA : i_model_data LIKE bdi_model OCCURS 0 WITH HEADER LINE.
  DATA : mess_type TYPE bdmsgtyp-mestyp.

  mess_type = 'XXXXXXX'.  "Give your message type here
  

  CALL FUNCTION 'ALE_MODEL_INFO_GET'
    EXPORTING
      message_type                 = mess_type
*   RECEIVING_SYSTEM             = ' '
*   SENDING_SYSTEM               = ' '
*   VALIDDATE                    = SY-DATUM
   TABLES
     model_data                   = i_model_data
 EXCEPTIONS
   no_model_info_found          = 1
   own_system_not_defined       = 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.

  LOOP AT i_model_data.
*    -fill the control record
*-------------------------------------------------
    p_ctrl_rec-rcvprt ='LS'.
    p_ctrl_rec-mestyp = mess_type.
    p_ctrl_rec-idoctp = 'XXXXXXXXXX'.    "Give your IDoc type here
    p_ctrl_rec-rcvprn = i_model_data-rcvsystem.
    p_ctrl_rec-rcvpfc = 'LS'.
    APPEND p_ctrl_rec.
  ENDLOOP.

ENDFORM.                    " fill_control_record

Note : This avoid hard coding any values in the program.

regards,

Advait

Edited by: Advait Gode on Oct 1, 2008 2:35 PM