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: 

IDOC Status 51

Former Member
0 Kudos

Hi,

Whenever i post an idoc from system A to B (MATMAS), the inbound idoc ends with a status 51 with message 'Function module not allowed'. Now the FM used is a Z FM. I have checked the following steps but found no error :-

1 WE20 , partner profile checked correctly

2 we42 , FM assigned correctly

3 WE57 , FM assigned to message type with correct business object and direction.

4 Table TBD51 , FM exists with correct entries.

Also , when i run the failed idoc in WE19 with the same FM , it posts correctly with status 53.

Please help me on this problem.

Kunal

9 REPLIES 9

Former Member
0 Kudos

The problem is not with your partner profile, but with your function module. I don't think the code written is not right. Look at the standard function and see where is the mistake.

Regards,

Ravi

0 Kudos

Hi Ravi,

As i mentioned , i have run the FM through WE19 , but got no error , the FM ran correctly and posted the IDOCs.

Kunal

Former Member
0 Kudos

Hi Kunal,

In WE42, (Inbound process code), Did you assign the processing type as "Processing by Function module" . It should be "Processing by function module" but not "processing by task" or "processing by process".

Hopew this works for you.

Regards,

Vicky

PS: Award points if helpful

0 Kudos

Hi vicky,

In we42 , it is "Processing by Function module" and not task or process.

Kunal

0 Kudos

Hi,

The status is set only the function module and I am sure that there is something wrong with the function. Can you post the code here, with the execptions of the function.

Regards,

Ravi

0 Kudos

This is the code for the FM , this FM is used for multiple types of inbound message types

FUNCTION z_ds_xx_call_inbound.

*"----


""Local interface:

*" IMPORTING

*" VALUE(INPUT_METHOD) TYPE INPUTMETHD

*" VALUE(MASS_PROCESSING) TYPE MASS_PROC

*" EXPORTING

*" VALUE(WORKFLOW_RESULT) TYPE WF_RESULT

*" VALUE(APPLICATION_VARIABLE) TYPE APPL_VAR

*" VALUE(IN_UPDATE_TASK) TYPE UPDATETASK

*" VALUE(CALL_TRANSACTION_DONE) TYPE CALLTRANS2

*" TABLES

*" IDOC_CONTRL STRUCTURE EDIDC

*" IDOC_DATA STRUCTURE EDIDD

*" IDOC_STATUS STRUCTURE BDIDOCSTAT

*" RETURN_VARIABLES STRUCTURE BDWFRETVAR

*" SERIALIZATION_INFO STRUCTURE BDI_SER

*"----


TYPES : BEGIN OF t_master,

mdtype TYPE zmdtype,

rcvprg TYPE zintrcvprg,

primseg TYPE edilsegtyp,

END OF t_master.

DATA : wa_edidc TYPE edidc,

wa_edidd TYPE edidd,

wa_master TYPE t_master,

  • wa_relhead TYPE zdsrelhead,

wa_primkey TYPE zsdsprimkey,

wa_sdata TYPE edi_sdata,

wa_segfld TYPE edsappl,

wa_segfld1 TYPE edsappl,

wa_pkeys TYPE zdssnddata,

wa_idoc_satus TYPE bdidocstat,

w_key_val TYPE string,

w_index1(4) TYPE n,

w_index2(4) TYPE n,

w_pos(4) TYPE n,

w_reqid LIKE zdsparentdata-reqid,

w_mdline LIKE zdsparentdata-mdline,

w_status LIKE zdsreqmaster-status,

w_return_log TYPE string,

wa_idoc_status TYPE bdidocstat,

w_msg(255).

DATA : i_primkey TYPE TABLE OF zsdsprimkey,

i_segfld TYPE TABLE OF edsappl,

i_pkeys TYPE TABLE OF zdssnddata,

i_primarykey TYPE TABLE OF zsdsprimkey,

wa_primarykey TYPE zsdsprimkey.

FIELD-SYMBOLS : <fs_segment> TYPE ANY,

<fs_prim1> TYPE ANY.

*--> Get the inbound function module name for the given master data

CLEAR: wa_edidc,

w_reqid,

w_mdline,

i_primarykey[].

READ TABLE idoc_contrl INTO wa_edidc INDEX 1.

CLEAR wa_master.

SELECT SINGLE mdtype

intrcvprg

primseg

INTO wa_master

FROM zdsmasterdata

WHERE mestyp = wa_edidc-mestyp

AND intmed = 1.

*--> Get the primary key

REFRESH i_primkey.

CALL FUNCTION 'Z_DS_XX_GET_PRIMKEY'

EXPORTING

mdtype = wa_master-mdtype

TABLES

i_output = i_primkey.

.

  • REFRESH : idoc_contrl,

  • idoc_data,

  • idoc_status,

  • return_variables,

  • serialization_info.

CALL FUNCTION wa_master-rcvprg

EXPORTING

input_method = input_method

mass_processing = mass_processing

  • IMPORTING

  • IN_UPDATE_TASK =

  • CALL_TRANSACTION_DONE =

  • WORKFLOW_RESULT =

  • APPLICATION_VARIABLE =

TABLES

idoc_contrl = idoc_contrl

idoc_data = idoc_data

idoc_status = idoc_status

return_variables = return_variables

serialization_info = serialization_info

EXCEPTIONS

wrong_function_called = 1

OTHERS = 2.

IF sy-subrc <> 0.

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

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

ENDIF.

  • Get the primary keys values from IDOC

CLEAR : wa_edidd,

wa_pkeys.

LOOP AT idoc_data INTO wa_edidd

WHERE segnam = wa_master-primseg.

wa_sdata = wa_edidd-sdata.

REFRESH i_segfld.

SELECT * INTO TABLE i_segfld FROM edsappl

WHERE segtyp = wa_master-primseg.

CLEAR: wa_primkey,

wa_primarykey.

LOOP AT i_primkey INTO wa_primkey.

CLEAR : wa_segfld,

w_index1,

w_index2,

w_key_val.

READ TABLE i_segfld INTO wa_segfld

WITH KEY fieldname = wa_primkey-zprimkey.

IF sy-subrc = 0.

w_index1 = 1.

w_index2 = wa_segfld-pos - 1.

CLEAR : wa_segfld1,

w_pos.

LOOP AT i_segfld INTO wa_segfld1 FROM w_index1 TO w_index2.

w_pos = w_pos + wa_segfld1-expleng.

ENDLOOP.

w_key_val = wa_sdata+w_pos(wa_segfld-expleng).

      • BEGIN OF INSERTION E1BK938247 U212702

*Get primary key and value

wa_primarykey-zvalue = w_key_val.

wa_primarykey-ztable = wa_segfld-fieldname.

wa_primarykey-zprimkey = wa_primkey-zprimkey.

wa_primarykey-mdtype = wa_master-mdtype.

APPEND wa_primarykey TO i_primarykey.

CLEAR: wa_primarykey,

w_key_val.

*Get the request number and mdline.

w_reqid = wa_edidc-serial+0(10).

w_mdline = wa_edidc-serial+10(6).

CLEAR: wa_idoc_satus,

w_status.

*Get the status of idoc

LOOP AT idoc_status INTO wa_idoc_satus.

IF wa_idoc_satus-status EQ '53'.

w_status = '02'.

ENDIF.

*Get the message

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = wa_idoc_satus-msgid

lang = 'EN'

no = wa_idoc_satus-msgno

v1 = wa_idoc_satus-msgv1

v2 = wa_idoc_satus-msgv2

v3 = wa_idoc_satus-msgv3

v4 = wa_idoc_satus-msgv4

IMPORTING

msg = w_msg

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

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

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

ENDIF.

*Populated the Return log of Idoc

CONCATENATE w_return_log 'Idoc Number-' wa_idoc_satus-docnum '|'

'Status-' wa_idoc_satus-status '|' 'Message-'

w_msg '|' INTO w_return_log.

CLEAR: wa_idoc_satus,

w_msg.

ENDLOOP.

IF w_status IS INITIAL.

w_status = '03'.

ENDIF.

DATA : w_rfcdest TYPE zdssysmas-rfcdest.

SELECT SINGLE a~rfcdest

INTO w_rfcdest

FROM zdssysmas AS a JOIN zdsrole AS b

ON asystemname = bsystemname

AND aclnt = bclnt

WHERE b~role = 1.

ENDIF.

CLEAR wa_pkeys.

ENDLOOP.

ENDLOOP.

*update the status of primary key in cluster table

CALL FUNCTION 'Z_DS_XX_UPDATE_PKEY_STATUS'

DESTINATION w_rfcdest

EXPORTING

reqid = w_reqid

mdline = w_mdline

status = w_status

return_log = w_return_log

TABLES

i_primarykey = i_primarykey.

ENDFUNCTION.

0 Kudos

Kunal,

Its very clear that the function CALL FUNCTION wa_master-rcvprg is raising the exception of WRONG FUNCTION MODULE CALLED. That means the function that you are getting into wa_master-rcvprg is not the right function.

Regards,

Ravi

Note : Please mark the helpful answers

0 Kudos

In the case of MATMAS , the interface send program is IDOC_INPUT_MATMAS01 , which if called using process code MATM , workds fine and thus there is no reason why such a exception should be raised.

Also , if the above is happening then how come in WE19 it does not give any error.

0 Kudos

Kunal,

I don't know why its not throwing a error in WE19, but if you can look into the code of the function that you are getting dynamically, there it will be clearly checking the process code, message type that you are passing and then raising the exception.

I can bet that this is the error.

Regards,

Ravi

Note : Please mark the helpful answers