2018 Apr 26 8:45 AM
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.
2018 Apr 26 9:24 AM
2018 Apr 26 10:18 AM
Thanks Nic .
can't use this Exit as Address data not available in Address Handle.
2018 Apr 26 10:34 AM
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.
2018 Apr 26 11:23 AM
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.
2018 Apr 27 7:49 AM
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.
2018 Apr 26 10:28 AM
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?
2018 Apr 26 12:59 PM
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
2018 Apr 26 3:33 PM
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
VENDOR_ADD_DATA - SET_USER_INPUTS
ADDRESS_CHECK
2018 Apr 27 7:14 AM
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.
2018 Apr 27 7:53 AM
2018 Apr 27 12:01 PM
No I didn't check.
Can you please help me to find out appropriate enhancement spot for program SAPMF02K
2018 Apr 27 12:23 PM