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: 

Enhancement in va01 while saving

former_member1716
Active Contributor
0 Kudos

Hello Experts,

I need to validate the fields bill-to-party, Ship-to-party,Payer field in the header data for a particular sold-to-party.

This validation must commence when click on the save button during va01 transaction which will lead to creation of thr order.

I know thw code for validation, But i need to know the exit where i can place my code

ihave already tried exits

  USEREXIT_MOVE_FIELD_TO_VBAP

and

  USEREXIT_SAVE_DOCUMENT_PREPARE.

but not working, Can you please help me with the wright user - exits.

Thanks,

Satish

8 REPLIES 8

Former Member
0 Kudos

I have done validation before for the va01. The user exit is: USEREXIT_SAVE_DOCUMENT_PREPARE.

Remember to test for the transaction and the action button name in USEREXIT_SAVE_DOCUMENT_PREPARE.

In my case the code I use for the validation is:

IF SY-UCOMM EQ 'SICH' and SY-TCODE EQ 'VA01'.

     IF VALIDATION_FAIL.

          MESSAGE 'The request is to be stopped ... REASON ...' TYPE 'I'.

          leave to screen 0.

     ENDIF.

ENDIF.

0 Kudos

Hi Victor,

Could you please tell me what  is SY-UCOMM EQ 'SICH', What you are testing here actually.

0 Kudos

Hi Victor,

Am using the same code as i used in another userexit which will work when i press enter, There it worked fine.

This is my code in That user exit,

   DATA LX_VBPA LIKE XVBPA.
READ TABLE XVBPA[] INTO LX_VBPA WITH KEY PARVW = 'RE'.

IF SY-UNAME EQ 'SBALASUBRAMA'.
IF SY-SUBRC EQ 0.

SELECT COUNT( * )
FROM KNVP
WHERE KUNNR  EQ KUAGV-KUNNR AND
      VKORG  EQ VBAK-VKORG  AND
      VTWEG  EQ VBAK-VTWEG  AND
      SPART  EQ VBAK-SPART  AND
      PARVW  EQ 'RE'        AND
      KUNN2  EQ LX_VBPA-KUNNR.

IF SY-SUBRC NE 0.

MESSAGE E000(ZSD_610770_BP) DISPLAY LIKE 'I'.

ENDIF.

ENDIF.

Am using the same code in save_document_prepare exit.

But what happening here is, When i give a wrong value for bill to party and press save it is showing a pop up correctly as below screen shot,

After that the screen becomes grayed out and not allowing me to enter values like this,

Now if i press back button i see the order is being created as below, But

But now when gointo header details now there no record exists and all fileds are empty as below,

What i need is, wen i press enter by giving wrong value the system shows me the error message and stays in the same screen and allows me to enter the correct value, The same should happen when i press save button also.Hope you got it.

Thanks For replying to my issues.

Thanks,

Satish

former_member182546
Contributor
0 Kudos

Dear Satish ,

I have mentioned a generic link below with Enhancments (user exits ) related to SD.

Kindly check for the T code VA01 in this link.

http://wiki.scn.sap.com/wiki/display/ERPLO/Enhancements+andBusiness+add-ins+used+in+standard+t-codes...

.

I hope so this will be useful for you.

Thanks.

With Regards,

Sudhir S

0 Kudos

Hi Sudhir,

Thanks for the info,

But can you be specific with a particular user exit that is used while saving, beacuse i have tried with those user exits that you have provided already.

0 Kudos

Hi Satish,

The SY-UCOMM EQ 'SICH' is the command name that is set when the save disk is clicked. You can verify it by pressing f1 on the keyboard itself and read the function name of the button. Remember that the save icon must be foccussed.

In my case I throw them out of va01, but in your case you could use the message with type E and send them to the screen you want with: "LEAVE TO SCREEN #."

The # you can get it from the system/status in the menu bar when you are in the correct window.

haresh_manani
Explorer
0 Kudos

Hi Satish,

Write the code in include LV09CF66 in form on_request_1000,do the enhancement it will definitely work.

Thanks & Regards,

Haresh Manani.

former_member1716
Active Contributor
0 Kudos

Hi All,

I have created a document on Partner Functions Validations on sales and service order documents in the link below,

you may find it useful please check.

http://scn.sap.com/docs/DOC-52249#comment-457018