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: 

set status of Outbound Idoc in IDOC_OUTPUT_INVOIC

Former Member
0 Kudos

Hi,

I need to set the status for an INVOIC Idoc to 51 when it fails a check for multiple POs, the function module used for generating the Idoc is IDOC_OUTPUT_INVOIC.

I have as of yet been unable to determine where the idoc gets created so i can add a status 51 record against it as I presume it needs to be created first before i can add a status record.

Any help would be appreciated.

Thanks,

Will

13 REPLIES 13

Former Member
0 Kudos

Hi,

Check for user exits/enhancement points available in that standard function module for adding the logic required.

Regards,

Kalpana

Former Member
0 Kudos

Hi,

in the functin module IDOC_OUTPUT_INVOIC search/Find CALL CUSTOMER here you find the below function module exit..in that you can implement your code.. or check on CALL CUSTOMER in the global find...

CALL CUSTOMER-FUNCTION '001' ( EXIT_SAPLVEDF_001 in SE37 )

vinod_vemuru2
Active Contributor
0 Kudos

Hi,

As suggested by others, first find out the appropriate exit. Place your checks in the exit.

If your check fails.

MESSAGE 'appropriate message' TYPE 'E'.

ENDIF.

Thanks,

Vinod.

Former Member
0 Kudos

Thanks everyone for your responses.

There is presently already a check in the customer function. What I would like to do is upon failure set the status of the idoc however I noticed that there is no idoc status table available to append a status 51 against it.

I presume I will have to build the idoc status table within the user exit and somehow associate it with the idoc? Creation of this table and applying it to the idoc is where I am having difficulty.

0 Kudos

Hi,

If the posting is failed status is set to 51. Did u try in issuing the error message in the exit and see the status?

Thanks,

Vinod.

0 Kudos

Hi Vinod,

The code that was implemented in the customer function already has an E type message call where it fails the check. I check in WE02 and can see that the idoc has not been created after this error message has been output.

The message call itself is as follows:

 message e068(zsd) raising error_message_received

I'm afraid I cannot find a status table to examine there is only the Control record EDIDC and idoc content INT_EDIDD that I can see after the error message is raised.

Any ideas?

0 Kudos

Hi,

This should suffice your requirement. Is your IDOC status set to 51 after the error? You can just backtrace the calls.

Exception raised from exit is passed on to FM in process code and then to standard code. based on the exception, messages are filled seperately in standard code. You don't need to bother about this.

Error log is also coming correct right?

If you see the FM IDOC_OUTPUT_INVOIC, this doesn't have any table for errors. So no chance for populating. Standard code will take care of this based on the exception raised in the FM.

PS: You can go ahead with this approach.

Thanks,

Vinod.

0 Kudos

Hi Vinod,

Thanks for your response, unfortunately as I mentioned earlier there is no idoc created after the error message when i check in WE02.

There should be an INVOIC Idoc in outbound but there is nothing there. As such I cannot check the status since there is no idoc.

0 Kudos

Hi,

Sorry. I have completely missed out this. Are you generating outbound IDOC???

If yes, an outbound IDOC can't have status above 49.

If the IDOC status is in between 1 and 49, then it is an Outbound IDOC. If the status is in between 50 and 75, then it is an inbound IDOC

status 51: Posting failed means, posting of the SAP document failed(Like order, delivery invoice etc) but not the IDOC itself.

Usually errors in outbound IDOC are related to syntax or customization. What happens a message of type S and display like E and then RAISE the exception?

Thanks,

Vinod.

0 Kudos

Hi Vinod,

Yes it is an outbound Idoc sorry for the confusion with status 51 I didn't realise that outbound Idocs errors are confined to 1-49 (this is good to know).

I'm afraid I don't understand your last question can please elaborate?

0 Kudos

Hi,

I mean to say try in this way.

MESSAGE 'Your error message' TYPE 'I' DISPLAY LIKE 'E'.

RAISE error_occured.

But not sure if this works for your requirement.

Syntax errors are related to the IDOC definition. Like segments should be arranged in the same order as they were defined, correct port name etc.

I feel there is no use in creating an outbound IDOC with error status(As it won't be processed further). Instead same message can be logged to the application log of the output type when you issue error message in your exit. Hope you can convince your users with this.

Thanks,

Vinod.

0 Kudos

Hi Vinod,

I'm afraid that method didn't work either. I managed to find an article on the wiki around setting status records for Outbound Idocs.

It involves exporting the idoc status table that you want to set to Idoc with to a memory id., then after the Idoc is created in IDOC_CREATE_ON_DATABASE we reimport this memory id and write the status to the newly created idoc with IDOC_STATUS_WRITE_TO_DATABASE.

This method has worked and an erroneous Idoc can now be seen in the monitor for our operations teams to pick up during their Idoc monitoring.

This is the link for the original wiki article:

link:[http://wiki.sdn.sap.com/wiki/display/XI/UserSpecificErrorHandlingforOutboundIDocs]

Thanks for all your responses.

Former Member
0 Kudos

http://wiki.sdn.sap.com/wiki/display/XI/UserSpecificErrorHandlingforOutboundIDocs