Application Development and Automation 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: 
Read only

Processing IDoc from status-30 to status-03 using BDC recording.

Former Member
0 Kudos
926

Hi

I've written an ABAP code to generate IDocs using 'MASTER_IDOC_DISTRIBUTE. Though now am facing a problem that IDoc generated remain in status 30 and goes to status 0 only after manually processing it on transaction BD87 and that too it is not a sureity that it would go onto status 03 even after processing. I've used BDC recording for the very purpose but it is also not giving favourable result. Please Help with this problem.

Regards

Arun

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
845

First check the flag "Transfer IDoc Immed." in WE20. If u get the same status 30 then write the below code after the FM

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

  • EXPORTING

  • master_idoc_control = control_record_out

  • TABLES

  • communication_idoc_control = li_edidc[]

  • master_idoc_data = int_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.

    • ELSE.

    • COMMIT WORK AND WAIT.

    • CALL FUNCTION 'DEQUEUE_ALL'

    • EXPORTING

    • _synchron = 'E'.

  • ENDIF.

*READ TABLE li_edidc[] INTO lwa_edidc INDEX 1.

*IF sy-subrc = 0.

  • lc_doc = lwa_edidc-docnum .

  • SUBMIT rseout00

  • WITH docnum = lc_doc

  • WITH p_outmod = lc_outmode

  • AND RETURN.

*ENDIF.

"SUBMIT rseout00" is used to bring the to idoc satus 3 from the status 30.

Edited by: Shilpa_gunjan on Sep 22, 2011 8:38 AM

Edited by: Shilpa_gunjan on Sep 22, 2011 8:39 AM

9 REPLIES 9
Read only

Former Member
0 Kudos
845

Hi,

do a COMMIT WORK after calling 'MASTER_IDOC_DISTRIBUTE'.

Best regards,

Oliver

Read only

0 Kudos
845

Hi Oliver

This is the sample code I've used;

&----


*& Report ZTEST_CALLIDOC

*&

&----


*&

*&

&----


REPORT ztest_callidoc.

TABLES: ztest_idoc.

PARAMETER : sel_psno TYPE i.

DATA: header_segment_name LIKE edidd-segnam VALUE 'ZTEST_SEG',

item_segment_name LIKE edidd-segnam VALUE 'ZTEST_SEG',

idoc_name LIKE edidc-idoctp VALUE 'ZTEST_IDOC'.

DATA: header_segment_data LIKE ztest_seg,

item_segment_data LIKE ztest_seg.

DATA: control_record LIKE edidc.

DATA: messagetyp LIKE edmsg-msgtyp VALUE 'ZTEST_MESSG'.

DATA: i_communication LIKE edidc OCCURS 0 WITH HEADER LINE,

i_data LIKE edidd OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF itab OCCURS 0,

name TYPE ztest_idoc-name,

psno TYPE ztest_idoc-psno,

END OF itab.

DATA: wa LIKE LINE OF itab.

START-OF-SELECTION.

SELECT name psno FROM ztest_idoc

INTO TABLE itab WHERE psno EQ sel_psno.

control_record-mestyp = messagetyp.

control_record-rcvpor = 'A000000017'.

control_record-rcvprt = 'LS'.

control_record-idoctp = idoc_name.

control_record-rcvprn = 'PICCLNT300'.

LOOP AT itab.

header_segment_data-psno = itab-psno.

header_segment_data-name = itab-name.

i_data-segnam = header_segment_name.

i_data-sdata = header_segment_data.

APPEND i_data.

ENDLOOP.

CLEAR itab.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

master_idoc_control = control_record

  • OBJ_TYPE = ''

  • CHNUM = ''

TABLES

communication_idoc_control = i_communication

master_idoc_data = i_data

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.

ELSE.

LOOP AT i_communication.

WRITE: 'IDOC GENERATED', i_communication-docnum.

ENDLOOP.

COMMIT WORK.

ENDIF.

Read only

0 Kudos
845

Hi,

this looks good to me. I have a very similar szenario where this works. The only difference there is that I fill i_data-segnum, too. But I don't know if this makes a difference.

So and your IDoc get's stuck in status 30? What is the message that comes with the status?

Best regards,

Oliver

Read only

0 Kudos
845

Hi Oliver

This is the message I get when I try to process the IDoc in BD87.

IDoc ready for dispatch (ALE service) Receiver exists , No filters , No conversion , No version change.

Thanks.

Read only

0 Kudos
845

Did you tried calling the function module DEQUEUE_ALL after MASTER_IDOC_DISTRIBUTE call?

Regards, Vinod

Read only

0 Kudos
845

Hi,

okay, and did you set the flag "Transfer IDoc Immed." in WE20?

And is the port (WE21) and connection (SM59) maintained properly?

Best regards,

Oliver

Read only

Former Member
0 Kudos
846

First check the flag "Transfer IDoc Immed." in WE20. If u get the same status 30 then write the below code after the FM

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

  • EXPORTING

  • master_idoc_control = control_record_out

  • TABLES

  • communication_idoc_control = li_edidc[]

  • master_idoc_data = int_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.

    • ELSE.

    • COMMIT WORK AND WAIT.

    • CALL FUNCTION 'DEQUEUE_ALL'

    • EXPORTING

    • _synchron = 'E'.

  • ENDIF.

*READ TABLE li_edidc[] INTO lwa_edidc INDEX 1.

*IF sy-subrc = 0.

  • lc_doc = lwa_edidc-docnum .

  • SUBMIT rseout00

  • WITH docnum = lc_doc

  • WITH p_outmod = lc_outmode

  • AND RETURN.

*ENDIF.

"SUBMIT rseout00" is used to bring the to idoc satus 3 from the status 30.

Edited by: Shilpa_gunjan on Sep 22, 2011 8:38 AM

Edited by: Shilpa_gunjan on Sep 22, 2011 8:39 AM

Read only

0 Kudos
845

Hi,

This generally happens when the receiver system is down or there is a long queue for transferring IDOC's.

You can always execute the report RSEOUT00 or submit it inside your program after the idoc's have been created.

Thanks,

Manish

Read only

Former Member
0 Kudos
845

thanx a lot for your suggestions.