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

IDOC: Incorrect function module problem

Former Member
0 Likes
2,613

Hi,

I am working on inbound IDOC processing. I created an extension for an IDOC. I created custom segment & included it in the extension that I created. The Message type was also custom. (I merely copied an existing standard Message Type for some other purpose). I also assigned Function Module to Message Type & IDOC type. I have other necessary settings configured as required. The problem that I am encountering is as follows:

Incorrect function module IDOC_INPUT_SHPCPR called up

Message no. B1044

Diagnosis

The function module IDOC_INPUT_SHPCPR, which was called for the application input, was not able to process the IDoc. A possible cause is that the IDoc has wrong message type or IDoc type.

Procedure

Please check the message type assignment for the application function module in the ALE customizing.

Now to troubleshoot the above error, I made sure that I have an entry with FM. IDOC_INPUT_SHPCPR, IDOC Basic Type ,custom IDOC extension & custom Message Type. But even then I see the above error. This error appears as Status 51 for the test IDOC that I processed.

Can anyone please tell me how to solve this? Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,006

Hi,

The Message type was also custom. (I merely copied an existing standard Message Type for some other purpose).

This is incorrect.

You must use the standard message type here. There is a check in the function module to see if the message type is SHPCPR and if not it will error out.

regards,

Advait

12 REPLIES 12
Read only

Former Member
0 Likes
2,007

Hi,

The Message type was also custom. (I merely copied an existing standard Message Type for some other purpose).

This is incorrect.

You must use the standard message type here. There is a check in the function module to see if the message type is SHPCPR and if not it will error out.

regards,

Advait

Read only

0 Likes
2,006

Hi Advait,

In that case, what can I do to resolve the issue? There is a reason for using a copy of the standard message type & would like to accomodate changes for the same. So could you please let me know the possible solution for the problem?

Look forward for your reply.

Thank you.

Read only

0 Likes
2,006

Hi,

Generally we don't copy message types to create custom message types. If you have implemented extensions and that is the reason you are creating custom message type, then this approach is incorrect.

Extensions are a standard way of including custom segments into IDoc types/Basic type.

Then depending on the message type and extension type you can do the furter processing in the function module's user exits.

The solution is to keep the standard message type with extensions or copy the function module to a custom function module and make changes and use that function instead. But the latter approach is a dirty one and I would not recommend it.

regards,

Advait

Read only

0 Likes
2,006

Hi Advait,

Thanks for the response.. So in case I am required to create a custom FM, what part of the standard FM/ where do I change it? The requirement of using a custom Message type has been decided because some other processing will be carried out based on the Message Type. So to accomodate that functionality, the custom message type idea was proposed.

Also could you please point me out where exactly it's checking for the message type to be the standard message type? I am kind of lost because I was going through the FM & could not find it.

Please let me know. Look forward for your reply.

Thank you.

Edited by: Sap Help on Jan 26, 2009 10:08 AM

Edited by: Sap Help on Jan 26, 2009 10:09 AM

Read only

0 Likes
2,006

On line 49 of the function module :


* Loop through the IDocs' control records
  LOOP AT idoc_contrl.
*   Check the IDOCs message type
    current_mestyp = idoc_contrl-mestyp.
    PERFORM idoc_message_type_check
                 TABLES   idoc_status
                 USING    idoc_contrl
                          mestyp-shpcpr
                 CHANGING subrc.

Perform looks like this ( in Include LV56IF0C...)




FORM idoc_message_type_check
          TABLES   t_idoc_status  STRUCTURE bdidocstat
          USING    f_idoc_contrl  STRUCTURE edidc
                   default_mestyp LIKE edidc-mestyp
          CHANGING subrc          LIKE sy-subrc.

  IF current_mestyp <> default_mestyp.   " Here the variable default_mestyp has the value SHPCPR
    MESSAGE ID      msg-id             "Global variable
            TYPE    'E'
            NUMBER  msg-nr_wrong_function    "Global variable
            WITH    current_mestyp     "message type
                    'IDOC_INPUT_SHIPPL'"Your function module
                    f_idoc_contrl-sndprt     "Sender partner type
                    f_idoc_contrl-sndprn     "Sender number
            RAISING wrong_function_called.

Again let me warn you that you will have to copy the entire function group V56I. Copying the function module alone will not help because there are many reusable subroutines in different includes of the function-pool.

regards,

Advait

Read only

0 Likes
2,006

Hi Advait,

Thanks for the info. How can I find out the corresponding function group? And does that mean I have to create a Z function group? I am just going to use the Z FM. So what are the changes that I need to do in this case?

Kindly let me know.

Thank you.

Read only

0 Likes
2,006

Hi,

The function group is V56I, but what changes you need to do is impossible to say. You will have to make the changes and test the same.

regards,

Advait

Read only

0 Likes
2,006

Hi,

Thanks. You are right. There are many sub-routines. Will have to try it now by making a custom group.

Thanks for all the help.

Read only

0 Likes
2,006

Instead of creating a new message type, check if it's best to define a message variant or message function (you can see these fields in WE20 and WE57; these fields + the message type uniquely identify the message).

Now, if you still can't do that, instead of duplicating the function group, enhance function group using enhancement framework if you have nw 7.0, or make a modification of standard if you have a lower release.

(I think that copying whole sap programs to just change a few lines of code is a bad practice because upgrades (SPAU) will not be able to detect/adjust this copied program)

Read only

0 Likes
2,006

Hi,

Thanks for your reply. Will try & check if it can work once done with the current solution proposal at hand. I am in the midst of it, so would like to finish it off first & see.

Thanks again.

Read only

ThomasZloch
Active Contributor
0 Likes
2,006

After quickly peeking into the code I suspect there is a check inside IDOC_INPUT_SHPCPR to allow only SHPCPR as message type, so your custom message type conflicts with that.

Thomas

Read only

0 Likes
2,006

Hi Thomas,

Could you please tell me how to solve this issue then? Create a custom FM with the changes as needed? What do you suggest?

Look forward to your reply.

Thank you.