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: 

How to put an IDOC's segment in error with custom check in EXIT?

alexandreourth
Active Participant
1,342

Hello experts

Context :

We are using the idoc WGSREQ (WGSREQ02 base type) with function module IDOC_INPUT_STOREORDER to create a PO. A strange standard behaviour occurs when we put an non existing materiel inside one item segment :

The standard, despite the anomaly, creates the PO with the 2 good other items where it should cancel the creation of the PO...

Workaround :

I ve found 2 exits in order to cancel the creation of the PO.

  • EXIT_SAPLWPUE_050 to check if there is an error message in I_WPLST
  • EXIT_SAPLWVFB_002 to cancel the PO creation by raising an exception.

Now in WE02, the second item segment is not highlighted in red and there is no error message....

I thought the standard would do that but no.....

The only way we found to check the anomaly is to go in WPER monitor

But the message is at header level (nothing custom here, all standard behaviour...)

Worst is when i correct the segment in WE02, and i reprocess the idoc in BD87, only the second item segment is reprocessed instead of all the items. After some debug, i saw it's checking the table WPTST

I changed the 3;3 with 2;4 and this do the trick to make all my items reprocessed during BD87. But i can't believe there is nothing smoother than modify these fields before they are set into the table....

Questions :

During IDOC processing :

  • How can i set a segment in error so he can be seen red "error" in WE02 after a custom control?
  • How do i set a custom error message for this particular segment ?
  • How can i stop the processing of the IDOC in a clean way (i want the idoc to be created, but i don't want it to generate the PO). Because i feel my exits are too much of a DIY instead of proper way too stop the process.
  • How can i tell my BD87 to reprocess all my items instead of just one?

From a global point of view : Why is the standard behaving like this ? Is this the same for all idocs, or just this one is a mess?

Thanks a lot if you find the courage to read everything and help me 🙂

Have a great day.

Regards,

Alexandre

1 ACCEPTED SOLUTION

alexandreourth
Active Participant
909

Hello sandra.rossi,

Thanks a lot for your answer.

Customer needed a fix quickly so i tried to found a solution. I told them that, in the long term, if there will be new errors for this idoc, they should consider to create ticket to SAP support.

I didn't succeed to add a message at item level (had no time left to work more on the subject).

Thanks again for your help.

2 REPLIES 2

Sandra_Rossi
Active Contributor
909

If there are too many problems, it's best to put the responsibility of correcting it onto SAP Support, otherwise you spend a lot of time to correct standard bugs!

For information, EDIDS contains the error messages, column SEGNUM indicates what segment is concerned.

alexandreourth
Active Participant
910

Hello sandra.rossi,

Thanks a lot for your answer.

Customer needed a fix quickly so i tried to found a solution. I told them that, in the long term, if there will be new errors for this idoc, they should consider to create ticket to SAP support.

I didn't succeed to add a message at item level (had no time left to work more on the subject).

Thanks again for your help.