‎2006 Jun 08 2:35 PM
Hello!
Can anybody help me with the following problem:
I have two select-options (VKORG and VTWEG) on my selection screen. Now there should be the possibility to restrict the values shown as input help for VTWEG after having selected a value for VKORG.
I've already tried to do this by using a matchcode object but for VKORG and VTWEG I was not able to find suitable search helps.
In my opinion this should be possible without using the "AT SELECTION-SCREEN ON VALUE-REQUEST FOR ...". If not, it would be interesting to getting to know your approaches to this task.
Thank you in advance!
‎2006 Jun 08 4:11 PM
You don't have to do any special coding, I've seen this work in 4.6c and 5.0.
Try the following code:
tables vbak.
select-options: s_vkorg for vbak-vkorg,
s_vtweg for vbak-vtweg.
start-of-selection.
....
....
....
Once you select a value for vkorg, vtweg match code automatically shows distribution channels for the selected sales org.
Regards
Sridhar
‎2006 Jun 08 2:39 PM
you can refer to the following code
and you can write the code in the same way as per your requirement
*&---------------------------------------------------------------------*
*& Report ZRKTEST5 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZRKTEST5 .
DATA: PROGNAME TYPE SY-REPID,
DYNNUM TYPE SY-DYNNR,
DYNPRO_VALUES TYPE TABLE OF DYNPREAD,
FIELD_VALUE LIKE LINE OF DYNPRO_VALUES.
DATA: BEGIN OF T_T001L OCCURS 0,
WERKS TYPE WERKS_D,
LGORT TYPE LGORT_D,
END OF T_T001L.
DATA: V_WERKS TYPE WERKS_D,
V_LGORT TYPE LGORT_D.
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS: P_PLANT LIKE MSEG-WERKS,
P_STOLOC LIKE MSEG-LGORT.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIZATION.
PROGNAME = SY-REPID.
DYNNUM = SY-DYNNR.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_STOLOC.
CLEAR: FIELD_VALUE, DYNPRO_VALUES. REFRESH DYNPRO_VALUES.
FIELD_VALUE-FIELDNAME = 'P_PLANT'.
APPEND FIELD_VALUE TO DYNPRO_VALUES.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = PROGNAME
DYNUMB = DYNNUM
TRANSLATE_TO_UPPER = 'X'
TABLES
DYNPFIELDS = DYNPRO_VALUES.
READ TABLE DYNPRO_VALUES INDEX 1 INTO FIELD_VALUE.
SELECT WERKS LGORT INTO TABLE T_T001L FROM T001L WHERE WERKS = FIELD_Value-fieldvalue.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'P_STOLOC'
DYNPPROG = PROGNAME
DYNPNR = DYNNUM
DYNPROFIELD = 'P_STOLOC'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = T_T001L.
START-OF-SELECTION.
WRITE:/ 'TEST F4 PROGRAM'.
END-OF-SELECTION.<b></b>
reward points if helpfull
Regards
Vikure
‎2006 Jun 08 2:40 PM
how did u ever know that VKORG was selected? VGWEG is dependent on VKORG based on the configuration data on that sitew, so, use parameer id's in assosiation with your paramerer id's.
‎2006 Jun 08 2:42 PM
You should use of fm 'DYNP_VALUES_READ' to read the values on selection screen in at selection screen of second field. Then you can check and restrict the user.
Regds
Manohar
‎2006 Jun 08 2:42 PM
Hi, if you can't get it to work any other way, you can try this.
report zrich_0002 .
parameters: p_vkorg type vbak-vkorg,
p_vtweg type vbak-vtweg.
at selection-screen on value-request for p_vtweg.
data: begin of help_item occurs 0,
vkorg type vbak-vkorg,
vtweg type vbak-vtweg,
end of help_item.
data: dynfields type table of dynpread with header line.
dynfields-fieldname = 'P_VKORG'.
append dynfields.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-cprog
dynumb = sy-dynnr
translate_to_upper = 'X'
tables
dynpfields = dynfields
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
others = 11.
read table dynfields with key fieldname = 'P_VKORG'.
p_vkorg = dynfields-fieldvalue.
clear help_item. refresh help_item.
select vkorg vtweg into table help_item
from tvkov
where vkorg = p_vkorg.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'VTWEG'
dynprofield = 'P_VTWEG'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
tables
value_tab = help_item.
Regarsds,
Rich Heilman
‎2006 Jun 08 4:11 PM
You don't have to do any special coding, I've seen this work in 4.6c and 5.0.
Try the following code:
tables vbak.
select-options: s_vkorg for vbak-vkorg,
s_vtweg for vbak-vtweg.
start-of-selection.
....
....
....
Once you select a value for vkorg, vtweg match code automatically shows distribution channels for the selected sales org.
Regards
Sridhar
‎2006 Jun 08 4:15 PM
‎2006 Jun 09 9:05 AM
Thank you Sridhar, that solved the problem!
A further question regarding this topic:
I've selected a VKORG and a VTWEG. On the selection screen there is another input field to select one or more materials.
Is it possible to restrict the selectable materials to only those, which are maintained for the selected VKORG and VTWEG? Perhaps as easy as the first solution?
Thank you in advance!
‎2006 Jun 09 9:19 AM
HI empe,
1. Is it possible to restrict the selectable materials to only those, which are maintained for the selected VKORG and VTWEG?
Yes its possible thru
search help (either standard or our own)
2. The search help should contain
all these 3 fields.
a) then we can use IMPORT checkbox
(when we make search help)
for the fields
VKORG and VTWEG
b) so that, when we press F4 for material,
only those material will come
which are related to the values entered
in the fields
VKORG and VTWEG
(this is made done by making them IMPORT
checkbox tick, while making search help,
-- that is the main purpose of it)
regards,
amit m.
‎2006 Jun 09 9:25 AM
Hi
You can do it easly by a dictionary structure.
By SE11 create a structure ZMVKE like this:
FIELD| DATA ELEMENT| CHECK TABLE| SEARCH HELP
VKORG| VKORG | TVKO |
VTWEG| VTWEG | TVKOV |
MATNR| MATNR | MVKE | MAT1S
So use this structure to define yuor select-options:
Max