Posted: Sun Nov 04, 2007 4:49 pm Post subject: How to Create Popup Help
How to Create Popup Help
This example was done mostly from memory, not in the ABAP editor, so it probably will not compile, it is only to show how to call the functions used here.
Code:
REPORT z_sh_test.
TABLES: pa0001, *pa0001, pa0008, *pa0008.
DATA: ltab_dynpselect TYPE TABLE OF dselc WITH HEADER LINE,
ltab_dynpvaluetab TYPE TABLE OF dval WITH HEADER LINE.
PARAMETERS: p_sacha TYPE sacha,
p_trfgr TYPE trfgr,
p_trfst TYPE trfst.
*-- F4 help for Payroll Administrator
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_sacha.
PERFORM values_sacha.
*-- F4 help for Pay Scale Group
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_trfgr.
*-- F4 help for Pay Scale Level
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_trfst.
*---------------------------------------------------------------------*
* FORM VALUES_SACHA
*---------------------------------------------------------------------*
* Provide popup help for the Payroll Admin field
*---------------------------------------------------------------------*
FORM values_sacha.
REFRESH: ltab_dynpselect,
ltab_dynpvaluetab.
PERFORM read_value_from_screen USING sy-repid
sy-dynnr
'PA0001-WERKS'
CHANGING ltab_dynpselect-fldname
ltab_dynpselect-fldinh.
PERFORM show_help TABLES ltab_dynpselect
ltab_dynpvaluetab
USING 'T526'
'SACHX'
CHANGING pa0001-sacha.
ENDFORM. " VALUES_SACHA
*---------------------------------------------------------------------*
* FORM VALUES_TRFGR
*---------------------------------------------------------------------*
* Provide popup help for Pay Scale Group
*---------------------------------------------------------------------*
FORM values_trfgr.
ltab_dynpselect-fldname = 'MOLGA'.
SELECT SINGLE molga FROM t001p
INTO ltab_dynpselect-fldinh
WHERE werks = *pa0001-werks
AND btrtl = *pa0001-btrtl.
IF sy-subrc NE 0.
ltab_dynpselect-fldinh = space.
ENDIF.
APPEND ltab_dynpselect.
ltab_dynpselect-fldname = 'TRFKZ'.
SELECT SINGLE trfkz FROM t503
INTO ltab_dynpselect-fldinh
WHERE persg = *pa0001-persg
AND persk = *pa0001-persk.
IF sy-subrc NE 0.
ltab_dynpselect-fldinh = space.
ENDIF.
APPEND ltab_dynpselect.
PERFORM show_help TABLES ltab_dynpselect
ltab_dynpvaluetab
USING 'T510'
'TRFGR'
CHANGING pa0008-trfgr.
PERFORM update_value_on_screen USING sy-repid
sy-dynnr
'PA0008-TRFGR'
pa0008-trfgr.
ENDFORM. " VALUES_TRFGR
*---------------------------------------------------------------------*
* FORM VALUES_TRFST
*---------------------------------------------------------------------*
* Provide popup help for Pay Scale Area
*---------------------------------------------------------------------*
FORM values_trfst.
ltab_dynpselect-fldname = 'MOLGA'.
SELECT SINGLE molga FROM t001p
INTO ltab_dynpselect-fldinh
WHERE werks = *pa0001-werks
AND btrtl = *pa0001-btrtl.
IF sy-subrc NE 0.
ltab_dynpselect-fldinh = space.
ENDIF.
APPEND ltab_dynpselect.
ltab_dynpselect-fldname = 'TRFKZ'.
SELECT SINGLE trfkz FROM t503
INTO ltab_dynpselect-fldinh
WHERE persg = *pa0001-persg
AND persk = *pa0001-persk.
IF sy-subrc NE 0.
ltab_dynpselect-fldinh = space.
ENDIF.
APPEND ltab_dynpselect.
PERFORM read_value_from_screen USING sy-repid
sy-dynnr
'PA0008-TRFGR'
CHANGING ltab_dynpselect-fldname
ltab_dynpselect-fldinh.
PERFORM show_help TABLES ltab_dynpselect
ltab_dynpvaluetab
USING 'T510'
'TRFST'
CHANGING pa0008-trfst.
PERFORM update_value_on_screen USING sy-repid
sy-dynnr
'PA0008-TRFST'
pa0008-trfst.
ENDFORM. " VALUES_TRFST
*---------------------------------------------------------------------*
* FORM SHOW_HELP *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> FTAB_DYNPSELECT *
* --> FTAB_DYNPVALUETAB *
* --> FSTR_HELP_INFO *
* --> F_NEWVALUE *
*---------------------------------------------------------------------*
FORM show_help TABLES ftab_dynpselect STRUCTURE dselc
ftab_dynpvaluetab STRUCTURE dval
USING f_checktable LIKE help_info-checktable
f_checkfield LIKE help_info-checkfield
CHANGING f_newvalue.
DATA: lstr_help_info LIKE help_info.
DATA: lc_selection_value LIKE help_info-fldvalue.
DATA: lc_selection(1) TYPE c.
*-- Fill in fields required for help function call
lstr_help_info-call = 'T'.
lstr_help_info-object = 'F'.
lstr_help_info-spras = sy-langu.
lstr_help_info-checktable = f_checktable.
lstr_help_info-checkfield = f_checkfield.
DATA: ltab_fields LIKE dynpread OCCURS 0 WITH HEADER LINE.
DATA: lc_dyname LIKE sy-repid.
DATA: lc_dynumb LIKE sy-dynnr.
DATA: lc_dummy(1) TYPE c.
*-- Read the screen to see if the user has entered a value for WERKS
ltab_fields-fieldname = f_fieldname_in.
APPEND ltab_fields.
lc_dyname = f_repid.
lc_dynumb = f_dynnr.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = lc_dyname
dynumb = lc_dynumb
TABLES
dynpfields = ltab_fields
EXCEPTIONS
OTHERS = 01.
READ TABLE ltab_fields INDEX 1.
*-- Return the value from the screen
IF sy-subrc EQ 0.
SPLIT ltab_fields-fieldname AT '-'
INTO lc_dummy
f_fieldname_out.
f_fieldvalue = ltab_fields-fieldvalue.
ENDIF.
ENDFORM. " READ_VALUE_FROM_SCREEN
*---------------------------------------------------------------------*
* FORM UPDATE_VALUE_ON_SCREEN *
*---------------------------------------------------------------------*
* The PROCESS ON VALUE-REQUEST does not always return blanks. *
* If a blank value is to be returned, this routine must be *
* called.
*---------------------------------------------------------------------*
* --> F_REPID *
* --> F_DYNNR *
* --> VALUE(F_FIELDNAME) *
* --> F_FIELDVALUE *
*---------------------------------------------------------------------*
FORM update_value_on_screen USING f_repid
f_dynnr
value(f_fieldname)
f_fieldvalue.
DATA: ltab_fields LIKE dynpread OCCURS 0 WITH HEADER LINE.
DATA: lc_dyname LIKE sy-repid.
DATA: lc_dynumb LIKE sy-dynnr.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.