2006 Oct 26 12:54 PM
Hi,
I created a table and table maintenance program.
The table consists of a few fields.
When inserting new lines, the user should fill the first value and the value he fills should determine
the range of values for the second field.
How can I implement restricting the range of values of the second field based on the selection of the first field?
Thanks.
Promise to award points...
Ruthie.
2006 Oct 26 1:02 PM
Hi,
This sample code will help you.It will deal with F4 help for a field.You can two similar code for your requirement.
PROCESS BEFORE OUTPUT.
PROCESS AFTER INPUT.
FIELD s_begru MODULE abc ON INPUT.
Process on value-request.
field s_begru module f4_help.
REPORT ZZZ_JAYTEST1 .
tables kna1.
data:
begin of t_values occurs 2,
value like kna1-begru,
end of t_values,
t_return like ddshretval occurs 0 with header line.
data s_begru like kna1-begru.
call screen 9000.
&----
*& Module f4_help INPUT
&----
text
----
module f4_help input.
*do your logic to populate t_values
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'BEGRU'
value_org = 'S'
tables
value_tab = t_values
return_tab = t_return
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc = 0.
read table t_return index 1.
s_begru = t_return-fieldval.
endif.
endmodule. " f4_help INPUT
&----
*& Module abc INPUT
&----
text
----
module abc input.
read table t_values with key value = s_begru.
if sy-subrc ne 0.
clear s_begru.
endif.
endmodule. " abc INPUT
Hi,
I created a table and table maintenance program.
The table consists of a few fields.
When inserting new lines, the user should fill the first value and the value he fills should determine
the range of values for the second field.
How can I implement restricting the range of values of the second field based on the selection of the first field?
Thanks.
Promise to award points...
Ruthie.
2006 Oct 26 1:02 PM
Hi,
This sample code will help you.It will deal with F4 help for a field.You can two similar code for your requirement.
PROCESS BEFORE OUTPUT.
PROCESS AFTER INPUT.
FIELD s_begru MODULE abc ON INPUT.
Process on value-request.
field s_begru module f4_help.
REPORT ZZZ_JAYTEST1 .
tables kna1.
data:
begin of t_values occurs 2,
value like kna1-begru,
end of t_values,
t_return like ddshretval occurs 0 with header line.
data s_begru like kna1-begru.
call screen 9000.
&----
*& Module f4_help INPUT
&----
text
----
module f4_help input.
*do your logic to populate t_values
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'BEGRU'
value_org = 'S'
tables
value_tab = t_values
return_tab = t_return
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc = 0.
read table t_return index 1.
s_begru = t_return-fieldval.
endif.
endmodule. " f4_help INPUT
&----
*& Module abc INPUT
&----
text
----
module abc input.
read table t_values with key value = s_begru.
if sy-subrc ne 0.
clear s_begru.
endif.
endmodule. " abc INPUT
2006 Oct 26 1:16 PM
Dear Jayanthi,
I am familiar with the code you wrote.
But - how can I combine the code of the screen with a database system table?
Thanks.
Ruthie.