2 weeks ago
Hello,
when we have a Customizing-Table, we want the user to enter only allowed values. To achieve this, we define Foreign-Key-Checks in SE11. Excample:
WERKS
LGORT
MY_Z_FIELD
We define a Foreign-Key to Table T001L(Storage-Locations). Very often the Customers want to allow Wildcard-Input (*) like this:
WERKS LGORT MY_Z_FIELD
1000 1000 A
1000 * B
* * C
In ABAP we implement a FALLBACK-LOGIC:
To do so, we must not definie Foreign-Key's because the Plant * neither the Storage-Location * exist. This has several drawbacks....To create a Plant/Stor-Loc * in the Foreign Tables is not a good solution(....) Lets imagine we have 100 Plants with 100 Storage-Locations each. In this case we would have to create 101 new entries in T001L, all with a description *****DO NOT USE*****
Has someone delt with this Problem before and can offer a simple solution?
Hello @master1980
That can't be done with foreign key definition only. You'd need to implement a custom check in SM30. See how it is done for instance in the LE-WM view V_T321 for the field LGNUM. It allows *** entry, which of course is not a valid warehouse number:
The foreign key and screen check are defined for V_T321-LGNUM:
However the foreign key check is deactivated in Screen Painter:
That allows to put any value in the LGNUM (warehouse number) field. That is not what we need yet, as we want to validate if the LGNUM value is either a valid warehouse number or *** mask.
Then a check is implemented in the flow logic in V_T321_CHECK module:
PROCESS AFTER INPUT.
MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
MODULE LISTE_BEFORE_LOOP.
LOOP AT EXTRACT.
MODULE LISTE_INIT_WORKAREA.
CHAIN.
FIELD V_T321-LGNUM.
FIELD V_T321-RBLVS.
FIELD V_T321-BSLVS.
FIELD V_T321-KZBEW.
FIELD V_T321-SOBKZ.
FIELD V_T321-BSSKZ.
FIELD V_T321-LGREF.
FIELD V_T321-BWLVS.
* field v_t321-bestq.
* field v_t321-bstqa.
* field v_t321-bstqe.
FIELD V_T321-TBFKZ.
FIELD V_T321-UBFKZ.
FIELD V_T321-TAFKZ.
FIELD V_T321-MAILK.
FIELD V_T321-WEDKZ.
FIELD V_T321-WENUM.
FIELD V_T321-KUNWE.
FIELD V_T321-LFART.
FIELD V_T321-LIFNR.
MODULE V_T321_CHECK ON CHAIN-REQUEST.
MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
ENDCHAIN.
FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
CHAIN.
FIELD V_T321-LGNUM.
FIELD V_T321-RBLVS.
FIELD V_T321-BSLVS.
FIELD V_T321-KZBEW.
FIELD V_T321-SOBKZ.
FIELD V_T321-BSSKZ.
MODULE LISTE_UPDATE_LISTE.
ENDCHAIN.
ENDLOOP.
MODULE V_T321_CHECK.
*........Lagernummer prüfen ( Tabelle T300 )...........................
IF NOT V_T321-LGNUM IS INITIAL AND V_T321-LGNUM <> MASK3.
PERFORM T300_LESEN USING V_T321-LGNUM.
IF SY-SUBRC NE 0.
MESSAGE E001 WITH V_T321-LGNUM.
ENDIF.
ENDIF.
I think you can use a similar approach to implement your requirements.
Best regards
Dominik Tylczynski
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is a good point, thank you. But It want the system to check the foreign Key's (error Message) with the Exception of (*). The User must inpu either an existing Value of the check Table or (*).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There's no screen check of the entered value if you unselect "Check required":
The value help will still be available.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
9 | |
8 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.