I have two screen fields
1). SCR-MACCT 2). SKB1-WAERS
IF SCR-MACCT value is in range table r_zgfld,
then SKB1-WAERS field should be enabled with F1help pop up and this F1 pop up should only shows up when it first becomes available for user entry.
Below is my code :
module currency_visibility output.
Main account - SCR-MACCT is in range table
IF SCR-MACCT IN r_zgfld.
CHECK sy-subrc = 0.
LOOP AT SCREEN.
IF ( screen-name = 'SKB1-WAERS' ) .
screen-input = '1'.
flag_f1popup = flag_f1popup + 1.
MODIFY SCREEN .
IF flag_f1popup = '1'
AND SKB1-WAERS IS INITIAL.
Providing F1 help to 'Currency' field.
CALL FUNCTION 'HELP_OBJECT_SHOW_FOR_FIELD'
DOKLANGU = SY-LANGU
DOKTITLE = ' '
CALLED_FOR_TAB = 'SKB1'
CALLED_FOR_FIELD = 'WAERS'
EXPLICIT_MEMORYID = ' '
OBJECT_NOT_FOUND = 1
SAPSCRIPT_ERROR = 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. " IF SCR-MACCT IN r_zgfld
endmodule. " currency_visibility OUTPUT