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: 

Validation for bill- to - party based on sold- to party in va01

former_member1716
Active Contributor
0 Kudos

Hi All,

Am new to ABAP

User Exit or BAdI to validate ship-to-part based on sold-to-party in VA01.

When we enter sold-to-party and other mandatory fields and press enter bill-to-party gets filled after i select particular party, Now we change the bill-to-party to some values which is not there  in KNVP table and press enter then alsoorder is getting created.Need to do validation for this.

Required Field exits , screen exits,userexits.

I came to know that we can code in

Program 'SAPMV45A' -> include 'MV45ai0a' -> include 'MV45ai0a_auftraggeber_pruefen'.

Going inside this 'perform' statement and at the end of the standard code using 'implicit enhancement' we can code.

is this right?

Can you also help on giving Codes to this scenario.

Please reply ASAP its urgent.

Thanks

1 ACCEPTED SOLUTION

Sijin_Chandran
Active Contributor
0 Kudos

Hello Satish ,

Use USER EXIT MV45AFZZ

> FORM USEREXIT_SAVE_DOCUMENT_PREPARE.

find Internal Table xvbpa there containing all Partner Details ( Sold-to-party , ship-to-party , bill-to-party , payer etc ) related to a Sale Document ( Sale Order ) and Code accordingly.



10 REPLIES 10

Sijin_Chandran
Active Contributor
0 Kudos

Hello Satish ,

Use USER EXIT MV45AFZZ

> FORM USEREXIT_SAVE_DOCUMENT_PREPARE.

find Internal Table xvbpa there containing all Partner Details ( Sold-to-party , ship-to-party , bill-to-party , payer etc ) related to a Sale Document ( Sale Order ) and Code accordingly.



0 Kudos

Hi Sij,

Thanks for showing interest.

But my requirement i have code only in 'SAPMV45A' -> include 'MV45ai0a' -> include 'MV45ai0a_auftraggeber_pruefen'.

Could you please help me to code the scenario.

0 Kudos

I have coded for a very similar requirement like yours and I used MV45AFZZ.

But my requirement i have code only in 'SAPMV45A' -> include 'MV45ai0a' -> include 'MV45ai0a_auftraggeber_pruefen'

Can you tell why you want to stick with this only ?

0 Kudos

BTW , inside the Include Program you have highlighted there is Subroutine ,

PERFORM AUFTRAGGEBER_PRUEFEN.

Double click on that and you need to Implicitly Enhance this code in Order to Put your check , if you want to stick with Program 'SAPMV45A' -> include 'MV45ai0a' -> include 'MV45ai0a_auftraggeber_pruefen' itself .

Inside Internal table da_xvbpa you can find all Sale Document Partners.

0 Kudos

It is the requirement here.

Can you please tell me in detail about coding in MV45AFZZ.

Since am very new to this ABAP field, this is my first developmet project.

Can you please help me with the codings too.

0 Kudos

Sij,

Thanks for your patience.

Hope i conveyed my requirement clearly can you please Give me sample code that you used.

Am not able find the details of sold to party bil to party in da_xvbpa.

How to validate for that bill to party filed.

Thanks for your support.

0 Kudos

I am not able to understand for what reasons you are suggested or asked to use

Program 'SAPMV45A' -> include 'MV45ai0a' -> include 'MV45ai0a_auftraggeber_pruefen'.


As I can see that it is not being triggered while changing any of the Partners in VA02  , I put a break point in my system and it didn't stop there . May it work for VA01 only .

But such a check is Efficient only if it works for Creation and Changing Tcodes as well.

Check MV45AFZZ in SE38 there Search for FORM USEREXIT_SAVE_DOCUMENT_PREPARE

and set a breakpoint inside it and after that create a Sale Order and analyse , see the content of Internal Table XVBPA there.

Try to workout with your SD team and then revert.

0 Kudos

Code something like this ,

read table xvbpa into wa_vbpa1 with key parvw = 'WE'.

                 if sy-subrc eq 0.

                    read table xvbpa into wa_vbpa2 with key parvw = 'RG'.

                       if sy-subrc eq 0.

                          if wa_vbpa1-kunnr ne wa_vbpa2-kunnr.

                            message 'Please maintain the Payer same as Ship-to-party' type 'E'.

                          endif.

                       endif.

                 endif.

In VBPA table field PARVW is Partner Function , which identifies whether a Partner is Sold to party or ship to party or bill to party or payer or any other.

PARVW values :

AG    for Sold-to Party

RE    for Bill-to Party

RG    for Payer

WE   for Ship-to Party.

0 Kudos

Hi sij let me try this and get back to you.

And thank you very much for your help.

former_member1716
Active Contributor
0 Kudos

Hi All,

I am inform you all that I have created a document for this partner functions validations under the link below,

http://scn.sap.com/docs/DOC-52249

Please check Thanks for all your support

Thanks and Regards,

Satish