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: 

Urgent !!! Not able to send Idoc through report

former_member217000
Active Participant
0 Kudos

Hi Experts,

I have created one Z report which fills data into Z idoc and send it to receiver system. It is running fine but one shortcoming of prog is when I executes the Z report idoc gets filled properly but to send it to receiver I have to user transaction WE19, then only it get transmitted properly.

How to do this through reports?

I am sending prog also. Please go through it.

&----


*& Report ZSAM_TEST_IDOC

*&

&----


*&

*&

&----


REPORT ZSAM_TEST_IDOC.

DATA: it_edidc TYPE STANDARD TABLE OF edidc,

it_edidd TYPE STANDARD TABLE OF edidd,

wa_edidc LIKE edidc,

wa_edidd LIKE edidd,

wa_seg like E1PLOGI.

    • Data for idoc

MOVE: '01' TO wa_seg-PLVAR,

'O' TO wa_seg-OTYPE,

'8888888' TO wa_seg-OBJID.

    • Master idoc data

wa_edidd-segnam = 'E1PLOGI'.

wa_edidd-sdata = wa_seg.

APPEND wa_edidd TO it_edidd.

***Idoc control data

wa_edidc-idoctp = 'HRMD_A06'.

wa_edidc-mestyp = 'HRMD_A'.

wa_edidc-RCVPRN = 'S47CLNT800'.

wa_edidc-RCVPRT = 'LS'.

wa_edidc-RCVPOR = 'A000000168'.

*wa_edidc-RCVPOR = 'A000000015'.

      • for disrtibuting idoc

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

master_idoc_control = wa_edidc

  • OBJ_TYPE = ''

  • CHNUM = ''

tables

communication_idoc_control = it_edidc

master_idoc_data = it_edidd

EXCEPTIONS

ERROR_IN_IDOC_CONTROL = 1

ERROR_WRITING_IDOC_STATUS = 2

ERROR_IN_IDOC_DATA = 3

SENDING_LOGICAL_SYSTEM_UNKNOWN = 4

OTHERS = 5

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

First thing would be to ensure is that you have a commit work after the call transaction e.g.

IF sy-subrc is initial.
  commit work.
else.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Jonathan

2 REPLIES 2

Former Member
0 Kudos

First thing would be to ensure is that you have a commit work after the call transaction e.g.

IF sy-subrc is initial.
  commit work.
else.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Jonathan

former_member187255
Active Contributor
0 Kudos

Sameer,

Check the Partner Profile(WE20), Output Type for the IDoc should be <b>Transfer IDoc Immed</b> not Collect IDocs.

Chandra.