Skip to Content
author's profile photo Former Member
Former Member

hi experts-- no solution coming

hi all

i have a field xyz which is input/output enabled in alv grid output. this field is attached with f4 help.

my requirement is to get or read the row in alv grid when user press f4 on that field so that restricted value should come in f4 help i.e. i have to read current line when user presses f4 i.e. the single line data in alv grid.

so how to get or read the current row when user press f4 i.e user will choose any row in alv grid and this output is on alv grid and there are multiple records.

or in other word is it possible to read current row in alv grid when user presses F4, if yes how???.

i hope u understood the query.

thanx

rocky

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 05:18 AM

    hi

    hope it will help you.

    pls reward if help.

    For F4 Values on Screen:

    PROCESS ON VALUE_REQUEST

    using module call starting with FIELD i.e FIELD field MODULE module

    There are number of function modules that can be used for the purpose, but these

    can fullfill the task easily or combination of them.

    DYNP_VALUE_READ

    F4IF_FIELD_VALUE_REQUEST

    F4IF_INT_TABLE_VALUE_REQUEST

    POPUP_WITH_TABLE_DISPLAY

    DYNP_VALUE_READ

    This function module is used to read values in the screen fields. Use of this

    FM causes forced transfer of data from screen fields to ABAP fields.

    There are 3 exporting parameters

    DYNAME = program name = SY-CPROG

    DYNUMB = Screen number = SY-DYNNR

    TRANSLATE_TO_UPPER = 'X'

    and one importing TABLE parameter

    DYNPFIELDS = Table of TYPE DYNPREAD

    The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD

    to this FM and the values read from the screen will be stored in this table.This

    table consists of two fields:

    FIELDNAME : Used to pass the name of screen field for which the value is to

    be read.

    FIELDVALUE : Used to read the value of the field in the screen.

    e.g.

    DATA: SCREEN_VALUES TYPE TABLE OF DYNPREAD ,

    SCREEN_VALUE LIKE LINE OF SCREEN_VALUES.

    SCREEN_VALUE-FIELDNAME = 'KUNNR' . * Field to be read

    APPEND SCREEN_VALUE TO SCREEN_VALUES. * Fill the table

    CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

    DYNAME = SY-CPROG

    DYNUMB = SY-DYNNR

    TRANSLATE_TO_UPPER = 'X'

    TABLES

    DYNPFIELDS = SCREEN_VALUES.

    READ TABLE SCREEN_VALUES INDEX 1 INTO SCREEN_VALUE.Now the screen value for field KUNNR is in the SCREEN_VALUE-FIELDVALUE and can be used for further processing like using it to fill the internal table to be used as parameter in F4IF_INT_TABLE_VALUE_REQUEST ETC.

    F4IF_FIELD_VALUE_REQUEST

    This FM is used to display value help or input from ABAP dictionary.We have to pass the name of the structure or table(TABNAME) along with the field name(FIELDNAME) . The selection can be returned to the specified screen field if three

    parameters DYNPNR,DYNPPROG,DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.

    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

    EXPORTING

    TABNAME = table/structure

    FIELDNAME = 'field name'

    DYNPPROG = SY-CPROG

    DYNPNR = SY-DYNR

    DYNPROFIELD = 'screen field'

    IMPORTING

    RETURN_TAB = table of type DYNPREAD

    .

    F4IF_INT_TABLE_VALUE_REQUEST

    This FM is used to dsiplay values stored in an internal table as input

    help.This FM is used to program our own custom help if no such input help

    exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD

    is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.

    If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    RETFIELD = field from int table whose value will be returned

    DYNPPROG = SY-CPROG

    DYNPNR = SY-DYNNR

    DYNPROFIELD = 'screen field'

    VALUE_ORG = 'S'

    TABLES

    VALUE_TAB = internal table whose values will be shown.

    RETURN_TAB = internal table of type DDSHRETVAL

    EXCEPTIONS

    parameter_error = 1

    no_values_found = 2

    others = 3.

    POPUP_WITH_TABLE_DISPLAY

    This FM is used to display the contents of an internal table in a popup window.The user can select a row and the index of that is returned in the CHOISE

    parameter.The VALUETAB is used to pass the internal table.

    A suitable title can be set using TITLETEXT parameter. The starting and end position of the popup can be specified by the parameters STARTPOS_COL / ROW and ENDPOS_ROW / COL .

    CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

    EXPORTING

    ENDPOS_COL =

    ENDPOS_ROW =

    STARTPOS_COL =

    STARTPOS_ROW =

    TITLETEXT = 'title text'

    IMPORTING

    CHOISE =

    TABLES

    VALUETAB =

    EXCEPTIONS

    BREAK_OFF = 1

    OTHERS = 2.

    e.g.

    DATA: w_choice TYPE SY-TABIX.

    DATA: BEGIN OF i_values OCCURS 0 WITH HEADER LINE,

    values TYPE I,

    END OF i_values.

    PARAMETRS : id TYPE I.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR id

    i_values-values = '0001'.

    APPEND i_values.

    i_values-values = '0002'.

    APPEND i_values.

    i_values-values = '0003'.

    APPEND i_values.

    i_values-values = '0004'.

    APPEND i_values.

    CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

    EXPORTING

    ENDPOS_COL = 40

    ENDPOS_ROW = 12

    STARTPOS_COL = 20

    STARTPOS_ROW = 5

    TITLETEXT = 'Select an ID'

    IMPORTING

    CHOISE = w_choice

    TABLES

    VALUETAB = i_values

    EXCEPTIONS

    BREAK_OFF = 1

    OTHERS = 2.

    CHECK w_choice > 0.

    READ TABLE i_values INDEX w_choice....now we can process the selection as it is contained

    ...in the structure i_values.

    Other FM that may be used to provide input help is HELP_START .

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 09, 2008 at 05:23 AM

    You can get to know the current row which has been selected with the following statement.

    CONSTANTS : gc_formname_pf_status_set TYPE slis_formname
                                     VALUE 'PF_STATUS_SET',
                gc_formname_user_command  TYPE slis_formname
                                     VALUE 'USER_COMMAND'.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program       = l_repid
                i_callback_pf_status_set = gc_formname_pf_status_set
                i_callback_user_command  = gc_formname_user_command " make sure u pass this
                is_layout                = is_layout
                it_fieldcat              = it_fieldcat
           TABLES
                t_outtab                 = it_tab
           EXCEPTIONS
                program_error            = 1
                OTHERS                   = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    
    FORM user_command USING l_ucomm LIKE sy-ucomm
                            ls_selfield TYPE slis_selfield.
      CASE l_ucomm.
        WHEN '&IC1'. " on double click of the row at ALV output
          READ TABLE it_zamassetcr INTO is_zamassetcr
                     INDEX ls_selfield-tabindex.
          IF sy-subrc = 0.
     " Do your req here with the selected record
          ENDIF.
     " it_tab is the internal table that contined the records shown on ALV output 
      ENDCASE.
    ENDFORM.
    

    Regards

    Gopi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 09, 2008 at 05:38 AM

    Hello Rocky

    Unfortunately you miss to give some important information regarding how you realize your ALV grid (fm or OO-based).

    Assuming that you are using class CL_GUI_ALV_GRID you can use event ONF4 (IMPORTING parameter E_FIELDNAME, ES_ROW_NO) to read the row in which the user called the F4 help.

    Regards,

    Uwe

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 05:40 AM

    Hi Rocky,

    Use Method get_current_cell of class CL_GUI_ALV_GRID and you will get current row and column selected. You can get data for that row number from your internal table and accordinly display your F4 help.

    Regards,

    Mohaiyuddin

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.