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: 

Validations before SO creation using exits in IDOC_INPUT_ORDERS

Former Member
0 Kudos
480

Hi All,

I hv a requirement to perform some checks (validations) before creation of the Sales order using idoc IDOC_INPUT_ORDERS. I hv found 2 exits EXIT_SAPLVEDA_001 and EXIT_SAPLVEDA_009, which could be used , but I am not sure which one would meet the requirement.

Please suggest.

Thanks

Anand

1 ACCEPTED SOLUTION

ralf_schfer
Explorer
0 Kudos
254

Hello,

Exit EXIT_SAPLVEDA_009 is ok for self made checks during booking of an orders idoc.

You have to fill the DERRTAB if you want to throw an error.

Corresponding exit for ORDCHG is EXIT_SAPLVEDB_007.

14 REPLIES 14

ralf_schfer
Explorer
0 Kudos
255

Hello,

Exit EXIT_SAPLVEDA_009 is ok for self made checks during booking of an orders idoc.

You have to fill the DERRTAB if you want to throw an error.

Corresponding exit for ORDCHG is EXIT_SAPLVEDB_007.

0 Kudos
254

Hi,

Thanks for your reply. I am a bit confused about the logic that I should follow to populate the error table (DERRTAB) . I would be really thankful, if you can provide me the logic for the same.

Thanks in advance.

regards

Anand

0 Kudos
254

Anad,

You can use EXIT_SAPLVEDA_009. In validation fails u can raise an exception -user-error, which is provided already. exception sample code:

IF l_amount NE l_kbetr.

MESSAGE ID 'ZXXXX'

TYPE 'E'

NUMBER '123'

WITH l_amount l_kbetr

RAISING user_error.

LEAVE PROGRAM.

-


Reddy

0 Kudos
254

Hi Reddy,

Thanks a lot, your suggestion was helpful. I am getting an Exception message below, but the problem is Idoc is not getting posted i:e the idoc is in status 'YELLOW'. I want it in status 'RED' with the defined error message.

Thanks in advance

Regards

Anand

0 Kudos
254

Try without LEAVE PROGRAM.

0 Kudos
254

Anand,

It's working for me with LEAVE PROGRAM. Try to create message id & ..etc in se91 b4 using those details.

MESSAGE ID 'ZXXXX'

NUMBER '123'

---

Reddy

0 Kudos
254

Hi Reddy,

I used the process suggested by you, but while trying to post the idoc thru WE19, I am getting the error message in the status bar and the Idoc number is not getting generated, as it normally does. When I am checking it in WE05, the status of the idoc is 'YELLOW', and there are no messages to show in the status record. Ideally the Idoc status shud be 'RED' along with the custom error message.

Below is the code I am using inside the exit. The message class is created using SE91.

MESSAGE ID 'ZIDOC_MSG'

TYPE 'E'

NUMBER '001'

RAISING user_error

Leave program.

0 Kudos
254

Anand,

There could be some other problem with the data, that is making dump or termination for the process. Keep a break point in ur exit and see.

MESSAGE ID 'ZMSG_XB'

TYPE 'E'

NUMBER '000'

WITH v_xxxx v_xxx

RAISING user_error.

LEAVE PROGRAM.

In your code ....WITH is missing, where you can give custom message and that will appear in status 51.

--

first try with out ur exit, see if the document is getting posted or not..then try with exit.

-


Reddy

0 Kudos
254

Hi Reddy,

The order is getting created successfully without the exit, and neither am I getting any dump at any point. In the exit, I am simply wrting an error message, created via SE91 raising with the exception as explained earlier. While trying to post the Idoc via WE19, I am getting the error message on the status bar may be bcoz exception has been raised and the idoc posting is halted. later on checking with WE05, the status showing is 'YELLOW'. I tried using WITH statement, but the problem persists. if possible, pls share your contact ( I may be wrong in asking for it ), so that I can provide you with screenshots of the error.

Thanks in advance

Regards

Anand

0 Kudos
254

Anand,

Use background mode on WE19. simply copy below code and replace your message id & number. Try now!

What is the status ur getting'yellow' means? there should be some text

--

Reddy

0 Kudos
254

In EXIT_SAPLVEDA_009:

IF 1 NE 2.

MESSAGE ID 'ZMSG_WB'

TYPE 'E'

NUMBER '000'

WITH 'New message from error'

RAISING user_error.

LEAVE PROGRAM.

ENDIF.

--

Reddy

0 Kudos
254

Hi anand09

Write below code in your Exit EXIT_SAPLVEDA_009.

IF <Condition>.

sy-msgid = <id>

sy-msgno = <Number>.

sy-msgv1 = <Parameter 1>.

sy-msgv2 = <Parameter 2>.

sy-msgv3 = <Parameter 3>.

sy-msgv4 = <Parameter 4>.

RAISE user_error.

ENDIF.

This will solve your problem..

Let me know if have any problem on this,,,,

Thanks

Ramesh

0 Kudos
254

Hi Reddy, Hi Ramesh,

Thanks a lot for your very helpful suggestions. It is working fine inside the exit EXIT_SAPLVEDA_009. But pls dont mind bcoz I hv one more query ( I am asking this bcoz both of your suggestions were really very helpful ). When I am writing the same code inside the exit EXIT_SAPLVEDA_001, the Idoc is erroring out ( which shud ideally happen ), but I am getting the same error message 62 times in WE02. I am confused, on how to rectify this issue. Pls suggest.

Thanks in advance

regards

Anand

0 Kudos
254

EXIT_SAPLVEDA_001 is called so many times . EXIT_SAPLVEDA_009 is suitable for validations.

--

Reddy