SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Search Help



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Fri Sep 14, 2007 3:41 pm    Post subject: Search Help Reply with quote

F4_DATE - displays a calendar in a popup window and allows user to choose a date, or it can be displayed read only.

F4_IF_FIELD_VALUE_REQUEST - Use values from a DDIC table to provide a list of possible values. TABNAME and FIELDNAME are required fields, and when MULTIPLE_CHOICE is selected, more than one value can be returned.


HELP_VALUES_GET - F4 help

Code:
  PARAMETERS p_grund TYPE t157d-grund.
CALL FUNCTION 'HELP_VALUES_GET'
    EXPORTING
      fieldname    = 'GRUND'
      tabname      = 'T157D'
    IMPORTING
      select_value = p_grund.



F4IF_INT_TABLE_VALUE_REQUEST - F4 help that returns the values selected in an internal table. Very handy when programming your very own F4 help for a field.
Code:

data:
    begin of t_values occurs 2,
      value like kna1-begru,
    end of t_values,

    t_return like ddshretval occurs 0 with header line.

  t_values = 'PAR*'.
  append t_values.

  t_values = 'UGG'.
  append 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.

    o_begru-low = t_return-fieldval.

    if o_begru-low = 'PAR*'.
      o_begru-option = 'CP'.
    else.
      o_begru-option = 'EQ'.
    endif.

    o_begru-sign = 'I'.

    append o_begru to s_begru.
  else.
    o_begru = i_begru.
  endif.


F4IF_SHLP_EXIT_EXAMPLE - documents the different reasons to use a search help exit, and shows how it is done.

HELP_START - Display help for a field. Useful for doing AT SELECTION SCREEN ON VALUE REQUEST for those fields that do not provide F4 help at the DDIC level.

HELP_VALUES_GET_WITH_TABLE - Show a list of possible values for F4 popup help on selection screens. This function module pops up a screen that is just like all the other F4 helps, so it looks like the rest of the SAP system. Very useful for providing dropdowns on fields that do not have them predefined.
Code:

tables: t001w.

DATA: lc_werks      LIKE t001w-werks,
      ltab_fields LIKE help_value OCCURS 0 with header line,

      BEGIN OF ltab_values OCCURS 0,
        feld(40) TYPE c,
      END OF ltab_values.

*-- Set up fields to retrieve data
  ltab_fields-tabname    = 'T001W'.
  ltab_fields-fieldname  = 'WERKS'.
  ltab_fields-selectflag = 'X'.
  APPEND ltab_fields.

  ltab_fields-tabname    = 'T001W'.
  ltab_fields-fieldname  = 'NAME1'.
  ltab_fields-selectflag = space.
  APPEND ltab_fields.

*-- Fill values
  select * from t001w.
    ltab_values-feld = t001w-werks.
    append ltab_values.
    ltab_values-feld = t001w-name1.
    append ltab_values.
  endselect.

CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
     EXPORTING
          fieldname                 = 'WERKS'
          tabname                   = 'T001W'
          title_in_values_list      = 'Select a value'
     IMPORTING
          select_value              = lc_werks
     TABLES
          fields                    = ltab_fields
          valuetab                  = ltab_values
     EXCEPTIONS
          field_not_in_ddic         = 01
          more_then_one_selectfield = 02
          no_selectfield            = 03.


F4_BASIS_PERSONALIZATION - персональные настройки

HELP_START - при настройках как ниже, позволяет вызвать search help не только при нажатии F4, но и enter


Code:
CONSTANTS: lc_dynprofld_street TYPE help_info-dynprofld VALUE 'ZPRU_KLADR_SCREEN-KNAME_STREET',
                 lc_dynpprog TYPE help_info-dynpprog VALUE 'SAPLZDBM_KLADR'.

DATA:   ftab_dynpselect TYPE TABLE OF dselc WITH HEADER LINE,
                  ftab_dynpvaluetab TYPE TABLE OF dval WITH HEADER LINE.

          DATA: ls_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
          ls_help_info-call       = 'V'.
          ls_help_info-object     = 'F'.
          ls_help_info-mcobj      = 'ZHRPADRU_KLADR_STREET'.
          ls_help_info-menufunct  = 'HC'.
          ls_help_info-spras      = sy-langu.

          ls_help_info-program = 'SAPLZDBM_KLADR'.
*          ls_help_info-dynpro = sy-dynnr. " remark is important
          ls_help_info-tabname  = 'ZPRU_KLADR_SCREEN'.

          ls_help_info-dynpprog  = 'SAPLZDBM_KLADR'.
          ls_help_info-dynprofld  = lc_dynprofld_street.

          PERFORM read_value_from_screen USING 'SAPLZDBM_KLADR'
                   sy-dynnr
                   lc_dynprofld_street
          CHANGING ftab_dynpselect-fldname
                   ftab_dynpselect-fldinh.

          APPEND ftab_dynpselect.

          ls_help_info-fldvalue = ftab_dynpselect-fldinh.
          ls_help_info-fieldname = ftab_dynpselect-fldname.

          CALL FUNCTION 'HELP_START'
            EXPORTING
              help_infos   = ls_help_info
            IMPORTING
              selection    = lc_selection
              select_value = lc_selection_value
            TABLES
              dynpselect   = ftab_dynpselect
              dynpvaluetab = ftab_dynpvaluetab
            EXCEPTIONS
              OTHERS       = 1.

          IF NOT lc_selection IS INITIAL AND sy-subrc IS INITIAL.
            zpru_kladr_screen-kname_street = lc_selection_value.
          ENDIF.

*---------------------------------------------------------------------*
*       FORM READ_VALUE_FROM_SCREEN               *
*---------------------------------------------------------------------*
*       ........              *
*---------------------------------------------------------------------*
*  -->  F_REPID               *
*  -->  F_DYNNR               *
*  -->  VALUE(F_FIELDNAME_IN) *
*  -->  F_FIELDNAME_OUT       *
*  -->  F_FIELDVALUE          *
*---------------------------------------------------------------------*
FORM read_value_from_screen USING f_repid
              f_dynnr
              value(f_fieldname_in)
     CHANGING f_fieldname_out
              f_fieldvalue.

  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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
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.