‎2008 Jul 24 9:11 AM
Hi All,
Currently i'm working on custom IDOC and i've done with creation of custon idoc, segment and message type. Now i'm developing the outbound program for Custom IDOC and need to add status code into the program. can anyone send me sample code to add the status record. I checked some standard progarms like BD10 but unable to get code for status record......and wht are status codes are required in Outbound program...
Your help will b highly appreciated
Rgds
Faisal
‎2008 Jul 24 9:22 AM
Hi Faisal,
I think just pass the value to the master idoc standard idoc status code will be handled or are you looking to add from your side.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = wa_idoc_control
OBJ_TYPE = ''
CHNUM = ''
TABLES
communication_idoc_control = tb_master_control_data
master_idoc_data = tb_data_record
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
RAISING idoc_creation_not_successful.
ENDIF.
Check this link..
http://publib.boulder.ibm.com/tividd/td/ITMAN/SC23-4812-00/en_US/HTML/sa51mst256.htm
http://theobald-software.com/wiki/Send_a_simple_STATUS_IDoc
this link explains the connectivity and a simple idoc status.
Mohinder
Edited by: Mohinder Singh Chauhan on Jul 24, 2008 10:25 AM
‎2008 Jul 24 9:44 AM
Hi,
Thnx for quick response....i thought tht we need to write the logic for status record. Anyway i executed the outbound program and got the status code 29. how to resolve it and i have one more doubt....while creating inbound program we need to write the logic for status code 51 and 53....i thought in outbound program we need to write the logic in same way i.e., for status code (01, 30 and 03) .....so i guess no need to write the logic in outbound program for the above status codes.
Rgds
Faisal
‎2008 Jul 24 9:51 AM
Hi Faisal,
Check for Error / Success
IF NOT wf_exit_flag IS INITIAL .
idoc_contrl-status = co_51. "IDOC in Error
ELSE .
idoc_contrl-status = co_53. "IDOC in Posted Status
ENDIF.
set IDOC status.
PERFORM set_idoc_status.
Check this perfom and its corresponding form.
&----
*
*& Form set_idoc_status
&----
text
----
FORM set_idoc_status.
fill error / success message with corresponding
*status
CLEAR: wa_error, wa_success.
LOOP AT tb_error INTO wa_error.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = co_51.
idoc_status-msgid = wa_error-msgid.
idoc_status-msgno = wa_error-msgno.
idoc_status-msgv1 = wa_error-msgv1.
idoc_status-msgv2 = wa_error-msgv2.
idoc_status-msgv3 = wa_error-msgv3.
idoc_status-msgv4 = wa_error-msgv4.
APPEND idoc_status.
CLEAR wa_error.
ENDLOOP.
LOOP AT tb_success INTO wa_success.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = co_53.
idoc_status-msgid = wa_success-msgid.
idoc_status-msgno = wa_success-msgno.
idoc_status-msgv1 = wa_success-msgv1.
idoc_status-msgv2 = wa_success-msgv2.
idoc_status-msgv3 = wa_success-msgv3.
idoc_status-msgv4 = wa_success-msgv4.
APPEND idoc_status.
CLEAR wa_success.
ENDLOOP.
ENDFORM.
&----
*& Form execute_action
&----
text
Mohinder
‎2008 Jul 24 10:01 AM
Hi,
The code which you have send is for Inbound program and i knw abt this.....i wan't to know regarding the status code for outbound program...........please send the logic for outbound.
Rgds
Faisal