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: 

VA01 Enhancement

FranklinAsis
Explorer
0 Kudos

Hi,

Heres my scenario;

Recently, an enhancement has been made to the tcode va01, specific for our client, which was done by my teammate. The enhancement prevents the transaction from saving an already existing PO number, thus, preventing the transaction to continue unless a new PO number is entered.

And now, I was tasked to add an additional condition to that enhancement. The current task involves checking if the PO number is within range of what the user specified. This means I will be creating a custom table that contains valid PO number ranges, then the enhancement will be validating the PO number against this table.

The question is, how do i access the existing enhancement so that i could add the validation code? I think the enhancement was implemented using a BADI, but how do i get my hands on the coding area of this BADI..

Thanks,

Frank

6 REPLIES 6

Former Member
0 Kudos

Transaction Code - VA01 Create Sales Order

SDTRM001 Reschedule schedule lines without a new ATP check

V45A0001 Determine alternative materials for product selection

V45A0002 Predefine sold-to party in sales document

V45A0003 Collector for customer function modulpool MV45A

V45A0004 Copy packing proposal

V45E0001 Update the purchase order from the sales order

V45E0002 Data transfer in procurement elements (PRreq., assembly)

V45L0001 SD component supplier processing (customer enhancements)

V45P0001 SD customer function for cross-company code sales

V45S0001 Update sales document from configuration

V45S0003 MRP-relevance for incomplete configuration

V45S0004 Effectivity type in sales order

V45W0001 SD Service Management: Forward Contract Data to Item

V46H0001 SD Customer functions for resource-related billing

V60F0001 SD Billing plan (customer enhancement) diff. to billing plan

Rewards if useful

0 Kudos

Hi Sravan,

I would appreciate it if you can tell me how i can insert my codes to the existing enhancement for VA01. I think its a BADI, but i dont know how i can access that or how to find it.

Thanks,

Frank

0 Kudos

Hi,

Excute the below program you will get the list of User exits and BADI'S for your reqired transaction.

REPORT z_find_userexit NO STANDARD PAGE HEADING.

&----


*& Enter the transaction code that you want to search through in order

*& to find which Standard SAP User Exits exists.

*&

&----


&----


*& Tables

&----


TABLES : tstc, "SAP Transaction Codes

tadir, "Directory of Repository Objects

modsapt, "SAP Enhancements - Short Texts

modact, "Modifications

trdir, "System table TRDIR

tfdir, "Function Module

enlfdir, "Additional Attributes for Function Modules

tstct. "Transaction Code Texts

&----


*& Variables

&----


DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.

DATA : field1(30).

DATA : v_devclass LIKE tadir-devclass.

&----


*& Selection Screen Parameters

&----


SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.

SELECTION-SCREEN SKIP.

PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN END OF BLOCK a01.

&----


*& Start of main program

&----


START-OF-SELECTION.

  • Validate Transaction Code

SELECT SINGLE * FROM tstc

WHERE tcode EQ p_tcode.

  • Find Repository Objects for transaction code

IF sy-subrc EQ 0.

SELECT SINGLE * FROM tadir

WHERE pgmid = 'R3TR'

AND object = 'PROG'

AND obj_name = tstc-pgmna.

MOVE : tadir-devclass TO v_devclass.

IF sy-subrc NE 0.

SELECT SINGLE * FROM trdir

WHERE name = tstc-pgmna.

IF trdir-subc EQ 'F'.

SELECT SINGLE * FROM tfdir

WHERE pname = tstc-pgmna.

SELECT SINGLE * FROM enlfdir

WHERE funcname = tfdir-funcname.

SELECT SINGLE * FROM tadir

WHERE pgmid = 'R3TR'

AND object = 'FUGR'

AND obj_name = enlfdir-area.

MOVE : tadir-devclass TO v_devclass.

ENDIF.

ENDIF.

  • Find SAP Modifactions

SELECT * FROM tadir

INTO TABLE jtab

WHERE pgmid = 'R3TR'

AND object = 'SMOD'

AND devclass = v_devclass.

SELECT SINGLE * FROM tstct

WHERE sprsl EQ sy-langu

AND tcode EQ p_tcode.

FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.

WRITE:/(19) 'Transaction Code - ',

20(20) p_tcode,

45(50) tstct-ttext.

SKIP.

IF NOT jtab[] IS INITIAL.

WRITE:/(95) sy-uline.

FORMAT COLOR COL_HEADING INTENSIFIED ON.

WRITE:/1 sy-vline,

2 'Exit Name',

21 sy-vline ,

22 'Description',

95 sy-vline.

WRITE:/(95) sy-uline.

LOOP AT jtab.

SELECT SINGLE * FROM modsapt

WHERE sprsl = sy-langu AND

name = jtab-obj_name.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

WRITE:/1 sy-vline,

2 jtab-obj_name HOTSPOT ON,

21 sy-vline ,

22 modsapt-modtext,

95 sy-vline.

ENDLOOP.

WRITE:/(95) sy-uline.

DESCRIBE TABLE jtab.

SKIP.

FORMAT COLOR COL_TOTAL INTENSIFIED ON.

WRITE:/ 'No of Exits:' , sy-tfill.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(95) 'No User Exit exists'.

ENDIF.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(95) 'Transaction Code Does Not Exist'.

ENDIF.

  • Take the user to SMOD for the Exit that was selected.

AT LINE-SELECTION.

GET CURSOR FIELD field1.

CHECK field1(4) EQ 'JTAB'.

SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).

CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN

Regards

jaideepsharma
Active Contributor
0 Kudos

Hi Franklin,

If you need to find out the BADI'S for any transaction then you can follow the steps given below which enable you to find any BADI related to any transaction in a matter of minutes.

1) Go to the transaction SE37 and locate the function SXV_GET_CLIF_BY_NAME.

2) Put a breakpoint there.

3) Now open a new session.

4) Go to your transaction eg. VA01.

5) At that time, it will stop at this function module.

6) Double click on the function field EXIT_NAME or NAME.

7) That will give us the name of the BADI that is provided in our transaction.

In case you want to know anything else please revert back. Kindly, reward points if you think the matter above is useful to you..

Former Member
0 Kudos

Hello Franklin,

if it's a BADI implementation, the BADI definition name is 'BADI_SD_SALES' , might be the methods SAVE_DOCUMENT_PREPARE or SAVE_DOCUMENT_PREPARE_PART2.

You could search existing implementations to this BADI using SE18 -> Implementation -> Overview.

Another possibility is that these recent changes were made in the old fashioned way using the include-report MV45AFZZ. There it would be the form USEREXIT_SAVE_DOCUMENT_PREPARE. You could check this via SE38.

Hope you'll find them.

Regards Wolfgang

0 Kudos

Hello Wolfgang,

Thanks for the info, i found the part where i should place the validation.. apologies for marking this question as unanswered, your info is very helpful.

I do have another question for if You dont mind..

In the previous enhancement of VA01, the PO number (fxvbkd-bstkd) which was entered in the 'PO Number' field in 'Create Direct - Pull Out: Overview' screen, is being checked if it has been used before. Pls. See Codes:

METHOD if_ex_badi_sd_sales~save_document_prepare.

DATA: wa_fxvbkd TYPE vbkd,

v_bstnk TYPE vbak-bstnk.

IF fvbak-auart = 'ZDRE' OR

fvbak-auart = 'ZORE' OR

fvbak-auart = 'ZOKA' OR

fvbak-auart = 'ZMKA'.

READ TABLE fxvbkd INTO wa_fxvbkd INDEX 1.

  • Check if RRC number is already used

SELECT SINGLE bstnk FROM vbak INTO v_bstnk WHERE ( auart = 'ZDRE'

OR auart = 'ZORE'

OR auart = 'ZOKA'

OR auart = 'ZMKA' )

AND bstnk = wa_fxvbkd-bstkd.

IF sy-subrc = 0.

MESSAGE e002(z_msg) .

ENDIF.

ENDIF. "IF fvbak-auart = 'ZDRE' OR

ENDMETHOD.

What I need to add now is check PO Number is within the Range the user defined AND it is for a particular Forwarder.

The range is maintained in a user defined/maintained table which i already created, it has 4 fields (Forwarder, From, To, Company Code). I have to dissect the PO number that the user entered (FOxxxxxxxxxx) into 2 parts, the first part is for the 'FO', which is validated against the Company Code field of the user defined table and the 2nd part 'xxxxxxxxxx' should be validated if it is between the From and To field of the user-defined table. Now, in the screen 'Create Direct - Pull Out: Overview' there is a button for 'Display doc. Header Details', i clicked on this button right after entering the necessary data. The screen 'Create Direct - Pull Out: Header Data', I go to the 'Partners' Tab to fill out the 'partner function' and the 'Partner' field. The question is, how do i capture the value entered in the 'Partner' field? so i can validate it against the 'Forwarder' field of the user-defined table. The over all condition for the transaction to save should be:

IF the PO number has NOT been used before (this is the previous enhancement).

In my enhancement:

IF the value entered (Trucker) in the 'Partner' field exists in the user defined table AND if that value (Trucker) has a 'Company Code' that is equal to the first 2 characters entered (FO) by the user AND if the last 10 characters of the PO number is between the From and To fields of the user-defined table that has a Forwarder value of (Trucker) and Company Code (FO).

My question is quite long. I do Hope you can help me...

Thanks,

Frank

Edited by: Franklin Asis on Jan 30, 2008 10:16 AM

Edited by: Franklin Asis on Jan 30, 2008 10:22 AM