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

Function module for posting idoc

Former Member
0 Likes
1,270

Hi,

For Inbound Idoc

In function module for posting the Idoc what should be given as the return_variable.

1 ACCEPTED SOLUTION
Read only

former_member404244
Active Contributor
0 Likes
1,033

Hi,

it depends on application.i have written some piece of code for my requiremnt.chek it,may be it will help u.

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

8 REPLIES 8
Read only

Former Member
0 Likes
1,033

It would depend on the function module. You would expect all the IDoc related Function Modules to work in the same manner but they do not.

Read only

Former Member
0 Likes
1,033

Hi,

check Fm IDOC_INPUT_RESEND

IDOC_INPUT_CMSEND

IDOC_INPUT_ACC_SENDER_ACTIVITY

return idoc number

Regards

amole

Read only

Former Member
0 Likes
1,033

hi,

below is a piece of code to give u an ideas as to what to do with <b>RETURN_VARIABLES</b>

WORKFLOW_RESULT = C_WF_RESULT_OK.

RETURN_VARIABLES-WF_PARAM = C_WF_PAR_PROCESSED_IDOCS.

RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.

APPEND RETURN_VARIABLES.

RETURN_VARIABLES-WF_PARAM = C_WF_PAR_APPL_OBJ_TYPE.

RETURN_VARIABLES-DOC_NUMBER = 'LIKP'.

APPEND RETURN_VARIABLES.

RETURN_VARIABLES-WF_PARAM = C_WF_PAR_APPL_OBJECTS.

RETURN_VARIABLES-DOC_NUMBER = S_KOKO-VBELN_VL.

APPEND RETURN_VARIABLES.

hope it helps...

please reward if useful...

Read only

Former Member
0 Likes
1,033

Hi,

it depends on application.

and for sales order change in the FM IDOC_INPUT_ORDCHG

this is the code SAP uses...

      return_variables-wf_param = eid.
      return_variables-doc_number = idoc_contrl-docnum.
      APPEND return_variables.

Regards

vijay

Read only

messier31
Active Contributor
0 Likes
1,033

Hi,

In function module to post IDOC ...there is no return variable..

If posting if successful sy-subrc is 0 else <> 0.

Read only

former_member404244
Active Contributor
0 Likes
1,034

Hi,

it depends on application.i have written some piece of code for my requiremnt.chek it,may be it will help u.

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

Read only

0 Likes
1,033

Thanks a lot nagaraj,

why do we give '99999' to wf_result and 'error_idoc' to r_variables-wf_param .

What is the reason, Can you please tell me why it is so

Read only

former_member404244
Active Contributor
0 Likes
1,033

Hi,

why do we give '99999' to wf_result .Actually i was told to use like this ,i also don't know the exact reason.

for ur second query i actually copied it from standard function module IDOC_INPUT_ORDERS..

inside the function module u can find like this.

DATA: eid LIKE bdwfretvar-wf_param VALUE 'Error_IDOCs'.

return_variables-wf_param = eid.

return_variables-doc_number = idoc_contrl-docnum.

So i have applied it in my code ,the sample code which i have given....

Regards,

nagaraj