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

Regarding Idoc

Former Member
0 Likes
683

How can i give my custom idoc status after processing an idoc

You can assign the status in the processing function module of the IDoc. This is determined by the process code. The internal table is probably named IDOC_STATUS.

5 REPLIES 5
Read only

Former Member
0 Likes
660

hi siva

go and see we05 give the message

Read only

0 Likes
660

No

I need to give out some error status of my own if the processing is stopped

for example

status : Z1

the error messsage will be (idoc processing stopped due to some reasons)

Read only

0 Likes
660

hi

by using tcode WE47 u can give as u desired

<b><REMOVED BY MODERATOR></b>

regards

Nagesh.Paruchuri

Message was edited by:

Alvaro Tejada Galindo

Read only

0 Likes
660

You can assign the status in the processing function module of the IDoc. This is determined by the process code. The internal table is probably named IDOC_STATUS.

Read only

former_member404244
Active Contributor
0 Likes
660

Hi,

look at the below code to get some idea

    • Work areas for the idoc tables.

DATA: wa_data TYPE edidd.

status = '53'. "initial

  • Read the control data information of idoc.

READ TABLE idoc_contrl INTO gwa_control WITH KEY mestyp = 'ZORDRPLY'.

IF sy-subrc EQ 0.

  • Extract the data from the segments.

LOOP AT idoc_data INTO wa_data "LOOP AT idoc_data

WHERE docnum = idoc_contrl-docnum.

CASE wa_data-segnam. " CASE gwa_data-segnam

WHEN 'Z1SCSK'. "Header data

MOVE wa_data-sdata TO gwa_z1scsk.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = gwa_z1scsk

IMPORTING

output = gv_vbeln.

WHEN 'Z1SCSP'. "Item data

MOVE wa_data-sdata TO gwa_z1scsp.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = gwa_z1scsp-posnr

IMPORTING

output = gv_posnr.

gwa_z1scsp-posnr = gv_posnr.

APPEND gwa_z1scsp TO i_z1scsp.

ENDCASE. " CASE gwa_data-segnam

ENDLOOP. "LOOP AT idoc_data

  • Update the sales order

PERFORM order_change.

ELSE.

  • Begin of Mod-001

status = '51'.

bapi_retn_info-type = 'E'.

bapi_retn_info-id = 'ZSDM'.

bapi_retn_info-number = '028'.

bapi_retn_info-message_v1 = 'Wrong'.

bapi_retn_info-message_v2 = 'Message'.

bapi_retn_info-message_v3 = 'Type'.

  • RAISE wrong_function_called.

ENDIF. " IF sy-subrc EQ 0

***********************************************************************

*Start wf

*----


PERFORM wf_start

USING

idoc_contrl-docnum

gv_vbeln

CHANGING

bapi_retn_info.

*----


*end of starting of wf

***********************************************************************

*set status

*----


IF status = '53'.

bapi_retn_info-type = 'S'.

bapi_retn_info-id = 'ZSDM'.

bapi_retn_info-number = '028'.

bapi_retn_info-message_v1 = gv_vbeln.

bapi_retn_info-message_v2 = 'Changed.'.

bapi_retn_info-message_v3 = 'Succcessfully'.

ENDIF.

PERFORM idoc_status_ord_change

TABLES idoc_data

idoc_status

return_variables

USING idoc_contrl

bapi_retn_info

status

workflow_result.

  • End of Mod-001

ENDFUNCTION.

************************************************************************

*Fill in idoc status --

***********************************************************************

FORM idoc_status_ord_change

TABLES idoc_data STRUCTURE edidd

idoc_status STRUCTURE bdidocstat

r_variables STRUCTURE bdwfretvar

USING idoc_contrl LIKE edidc

value(retn_info) LIKE bapiret2

status LIKE bdidocstat-status

wf_result LIKE bdwf_param-result.

CLEAR idoc_status.

idoc_status-docnum = idoc_contrl-docnum.

idoc_status-msgty = retn_info-type.

idoc_status-msgid = retn_info-id.

idoc_status-msgno = retn_info-number.

idoc_status-appl_log = retn_info-log_no.

idoc_status-msgv1 = retn_info-message_v1.

idoc_status-msgv2 = retn_info-message_v2.

idoc_status-msgv3 = retn_info-message_v3.

idoc_status-msgv4 = retn_info-message_v4.

idoc_status-repid = sy-repid.

idoc_status-status = status.

APPEND idoc_status.

IF idoc_status-status = '51'.

wf_result = '99999'.

r_variables-wf_param = 'Error_IDOCs'.

r_variables-doc_number = idoc_contrl-docnum.

READ TABLE r_variables FROM r_variables.

IF sy-subrc <> 0.

APPEND r_variables.

ENDIF.

ELSEIF idoc_status-status = '53'.

CLEAR wf_result.

r_variables-wf_param = 'Processed_IDOCs'.

r_variables-doc_number = idoc_contrl-docnum.

READ TABLE r_variables FROM r_variables.

IF sy-subrc <> 0.

APPEND r_variables.

ENDIF.

ENDIF.

Regards,

Nagaraj