03-15-2007 5:14 PM
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 .
ENDIF.
IF flag_f1popup = '1'
AND SKB1-WAERS IS INITIAL.
Providing F1 help to 'Currency' field.
CALL FUNCTION 'HELP_OBJECT_SHOW_FOR_FIELD'
EXPORTING
DOKLANGU = SY-LANGU
DOKTITLE = ' '
CALLED_BY_TCODE =
CALLED_BY_PROGRAM =
CALLED_BY_DYNP =
CALLED_FOR_TAB = 'SKB1'
CALLED_FOR_FIELD = 'WAERS'
CALLED_FOR_TAB_FLD_BTCH_INPUT =
CALLED_BY_CUAPROG =
CALLED_BY_CUASTAT =
MERGE_DZ_IF_AVAILABLE =
MEMORYID =
EXPLICIT_MEMORYID = ' '
TABLES
LINKS =
EXCLUDEFUN =
EXCEPTIONS
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.
ENDIF.
ENDLOOP.
ENDIF. " IF SCR-MACCT IN r_zgfld[]
endmodule. " currency_visibility OUTPUT
03-15-2007 5:18 PM
Sorry my problem is it is giving F1 pop up each time when user presses 'ENTER'. It should only shows POP up when field (SKB1-WEARS) first becomes available for entry
03-16-2007 10:37 AM
Hi Sam Kumar ,
You need to use a flag that will be set the first time your pop up is displayed. Next time when it reaches the module, the execution of the popup will fail as the flag will no longer be initial.
Hope this solves your problem
PS : Please reward points if solution is helpful
03-15-2007 7:24 PM
Hi,
Try this logic.
Say if the user enters value in SKB1-WAERS. then are you performing an action for that in the PAI. If yes create one flag at your action .
*write this in PAI.
Module currency_visibility INPUT.
if SKB1-WAERS is not initial.
v_first = 1.
endif.
endmodule.
*Now in PBO.
keep this flag while calling the function module.
meaning it will trigger only at first instance when there is no value in the field.
IF flag_f1popup = '1'
AND SKB1-WAERS IS INITIAL and <b>v_flag is initial</b>.
Providing F1 help to 'Currency' field.
CALL FUNCTION 'HELP_OBJECT_SHOW_FOR_FIELD'
EXPORTING
DOKLANGU = SY-LANGU
DOKTITLE = ' '
CALLED_BY_TCODE =
CALLED_BY_PROGRAM =
CALLED_BY_DYNP =
CALLED_FOR_TAB = 'SKB1'
CALLED_FOR_FIELD = 'WAERS'
CALLED_FOR_TAB_FLD_BTCH_INPUT =
CALLED_BY_CUAPROG =
CALLED_BY_CUASTAT =
MERGE_DZ_IF_AVAILABLE =
MEMORYID =
EXPLICIT_MEMORYID = ' '
TABLES
LINKS =
EXCLUDEFUN =
EXCEPTIONS
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.
ENDIF.
Br,
Laxmi