Skip to Content
0

How to Validate Address Fields of Vendor Master XK01/XK02

Apr 26 at 07:45 AM

102

avatar image

Can Anyone help me to validate Address Fields (Street, Street 2, Street 3, Street 4, Name 1 , Name 2 ) of Vendor Master -XK01/XK02.

I have a requirement to add field length restriction for specific companies.

I've found BADI - ADDRESS_UPDATE but it's not suitable as company field is not available.

Thanks in Advance.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Nic Teunckens Apr 26 at 08:24 AM
1

See if you can use the UserExit "EXIT_SAPMF02K_001" for this (Prgr. "ZXF05U01") as the Address-Handle is provided ...

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Thanks Nic .

can't use this Exit as Address data not available in Address Handle.

0

The "I_LFA1" Structure provides the Address-Number ("I_LFA1-ADRNR") that allows you to fetch the Address, then include your intended validation ... You could use FunctionModule "ADDR_GET" to read Address-data based upon the AddressNumber (or directly from "ADRC"-table Selection).

I see that these Structures are also provided in the "VENDOR_ADD_DATA" BAdI, see Methods such as "CHECK_ALL_DATA" where you could do the same ...


Hope this helps

Nic T.

1

Thanks a lot.

But Through ADRC can not get live data.

I need to restrict fields once user entered the value & click on save (Means before save the transaction)

Though Address number i_lfa1-adrnr, can get existing old data instead of updated data.

0

Either through the mentioned UserExit or Badi, you could read the Address-Data from Memory.

Go into Debugging, put BREAK and check "(SAPMF02K)ADDR_COMPLETE-ADDR1_TAB[1]-DATA" ...

That should offer you the Data as is it Put on the Screen Fields of the transaction.

Using this construct in your Code in the UExit or the BAdI will provide your with the Address that is entered on the Screen.

0
Raymond Giuseppi Apr 26 at 09:28 AM
0

You could try BAdI ADDRESS_CHECK method ADDRESS_POSTAL_CHECK. Don't use BAdI ADDRESS_UPDATE which is not suitable to perform some custom check.

To get the company code value, you could either use memory-id BUK or export the field (and others if required) to memory in a vendor master data exit such as BAdI VENDOR_ADD_DATA[_CS] or exit SAPMF02K/EXIT_SAPMF02K_001 and read them in the address BAdI.

Question: But the address (LFA1-ADRNR) is not dependent on the company code, so check exact requirement with functional? What should be done for vendor defined for multiple companies, should you also look for other LFB1 records in database to get the more restrictive rule?

Show 6 Share
10 |10000 characters needed characters left characters exceeded

Thanks a lot, Raymond

BADI ADDRESS_CHECK does not have Fields Name 1 & Name 2

I've a requirement to restrict fields Name 1, Name 2 , Street, Street 2, Street 3, Street 4 if user entered value greater than 35 Chars for specific companies & Account Group


0

For the fields that are not part of the 'postal address' you could use VENDOR_ADD_DATA method CHECK_ALL_DATA. In this BAdI, also export company code and account group to memory so ADDRESS_CHECK will be able to read those?

Summary:

VENDOR_ADD_DATA - CHECK_ALL_DATA

  • (Export I_LFB1-BUKRS and I_LFA1-KTOKK to memory) optional
  • Check length of I_LFA1-NAME1, I_LFA1-NAME2

VENDOR_ADD_DATA - SET_USER_INPUTS

  • Export I_BUKRS and I_KTOKK to memory

ADDRESS_CHECK

  • Import BUKRS and KTOKK from memory
  • Check length of CH_ADRC_STRUC-STREET, STR_SPPL1, STR_SPPL2, STR_SPPL3 (you are also allowed to change their values)
1

Same thing I've done.

But Problem is,

VENDOR_ADD_DATA - CHECK_ALL_DATA

when user entered more than 35 chars, not coming full value in I_LFA1-NAME1, I_LFA1-NAME2 fields as both have Data type - Char35 .

And I need to add length validation for more than 35 chars.

0

You should look in the PAI of the dynpro (in address management function group) for available BAdI (such as duplicate check, etc.) or implicit enhancement spots.

0

No I didn't check.

Can you please help me to find out appropriate enhancement spot for program SAPMF02K

0

The enhancement you look for should be in an address function group, so in some SAPLSZA1 main program. Navigate from a test session to dynpro field, F1, tech info, double-click on dy npro Nr to PAI logic and from MODULE to FORM statement.

0