09-29-2005 6:19 AM
HI ALL,
i have two fields in a screen of a z transaction.
Now i have attached one F4 help to one field (VKORG), and i want to design the F4 help for the second field (VTWEG),in such a way that, if the user select a value for VKORG and go F4 for VTWEG , only the valid value vtweg for that choosen VKORG will be popped up.
The VKORG-VTWEG values are mapped in ZMAP table (userdefined).
Some values=>
VKorg.....................VTWEG
1000.......................10
1000.......................12
1100.......................13
1100.......................14
So my requirement is=>
the user selected vkorg =1000 from F4 help. now when he press F4 in vtweg field, he will get only (10,12) for selection..not all the values. I hope i made the question clear..help me out, reward is guaranteed
09-29-2005 6:45 AM
Hi,
First of all you need to catch the value entered in
VKORG. You can do it by using FM <b>'DYNP_VALUES_READ'</b>
that reads the screen parameters.
Since you need to read only one fields value from the screen the code can be written as.
move <b>'W_VKORG'</b> to t_dynpfield-fieldname.
append t_dynpfield.
Note : Assume 'W_VKORG' is the name of the first field.
call function <b>'DYNP_VALUES_READ'</b>exporting
dyname = w_dyname
dynumb = w_dynumb
translate_to_upper = 'X'
tables
dynpfields = t_dynpfield
exceptions
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
IF t_dynpfield-FIELDVALUE IS INITIAL.
MESSAGE s032(zi) with 'Enter the VKORG Field.
Then use
<b>LOOP AT ZMAP into wa_ZMAP.
if wa_ZMAP-VKORG = W_VKORG
append wa_VTWEG to t_VTWEG " Intctable for VTWEG
endif.
ENDLOOP.</b>
Note : t_VTWEG is an internal table to hold values for
VTWEG. You need to declare this earlier.
Now you have enough values in t_VTWEG.Pass this to F4 help function mudule.i.e
DATA t_field like DFIES occurs 0.
CALL FUNCTION <b>'F4IF_INT_TABLE_VALUE_REQUEST'</b>
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'W_VTWEG
PVALKEY = ' '
DYNPPROG = " Your prog name"
DYNPNR = sy-dynnr
DYNPROFIELD = 'W_VTWEG'
STEPL = 0
WINDOW_TITLE = 'VTWEG'
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
TABLES
VALUE_TAB = t_VTWEG
FIELD_TAB = t_field
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
Please reward points if this explanation useful.
Thanks,
Siva
09-29-2005 6:31 AM
Hi,
I am giving the sample code I hope it will help you.
SELECT vkorg vtweg FROM ztable INTO (itab-vkorg, itab-vtweg)
WHERE ..............
APPEND itab.
ENDSELECT.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'vtweg'
dynpprog = w_progname
dynpnr = w_scr_num
dynprofield = 'itab-vtweg'
value_org = 'S'
display = 'F'
stepl = g_stepl
TABLES
value_tab = itab
return_tab = return_values
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE .
hide: itab-vkorg.
modify table itab transporting vkorg vtweg.
I hope it will help you.............
CHEERS
If your problem is solved please reward points....
Message was edited by: Deepak333 k
09-29-2005 6:46 AM
HI Deepak,
its a module pool program and the field is in screen no 0100, so can just give some hint, where to put the code that you have provided.
09-29-2005 6:59 AM
Please do this.
Note <b>W_VTWEG</b> is the name of the second field in your screen.
Write the following in the <b>Flow logic.</b>
PROCESS ON VALUE-REQUEST.
Field <b>W_VTWEG</b> module get_dir_grp.
Double click on this above stauemen and write the code that I exlained further.
The code that Deepak gave will work unless you press enter or in PAI of any eveny.If you need to direcly press F4 on field 2 after entering the value in Field1 the you need to use FM <b>DYNP_VALUES_READ</b>
Please reward points if this explanation useful.
Regards,
Siva
09-29-2005 7:01 AM
Hi,
In your screen 100 in PAI.
PROCESS AFTER INPUT.
MODULE USER_COMMAND.
LOOP AT itab.
endloop.
process on value-request.
****After this place that code what ever i gave you earlier.
CHEERS
09-29-2005 6:45 AM
Hi,
First of all you need to catch the value entered in
VKORG. You can do it by using FM <b>'DYNP_VALUES_READ'</b>
that reads the screen parameters.
Since you need to read only one fields value from the screen the code can be written as.
move <b>'W_VKORG'</b> to t_dynpfield-fieldname.
append t_dynpfield.
Note : Assume 'W_VKORG' is the name of the first field.
call function <b>'DYNP_VALUES_READ'</b>exporting
dyname = w_dyname
dynumb = w_dynumb
translate_to_upper = 'X'
tables
dynpfields = t_dynpfield
exceptions
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
IF t_dynpfield-FIELDVALUE IS INITIAL.
MESSAGE s032(zi) with 'Enter the VKORG Field.
Then use
<b>LOOP AT ZMAP into wa_ZMAP.
if wa_ZMAP-VKORG = W_VKORG
append wa_VTWEG to t_VTWEG " Intctable for VTWEG
endif.
ENDLOOP.</b>
Note : t_VTWEG is an internal table to hold values for
VTWEG. You need to declare this earlier.
Now you have enough values in t_VTWEG.Pass this to F4 help function mudule.i.e
DATA t_field like DFIES occurs 0.
CALL FUNCTION <b>'F4IF_INT_TABLE_VALUE_REQUEST'</b>
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'W_VTWEG
PVALKEY = ' '
DYNPPROG = " Your prog name"
DYNPNR = sy-dynnr
DYNPROFIELD = 'W_VTWEG'
STEPL = 0
WINDOW_TITLE = 'VTWEG'
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
TABLES
VALUE_TAB = t_VTWEG
FIELD_TAB = t_field
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
Please reward points if this explanation useful.
Thanks,
Siva