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

F4 programatic call

Hello,

I have an ALV field with F4 help defined, without check table. I need to allow input in this field only possible values from the F4 help. How can I do this? Is there a way to programatically call the F4 help and check the values found ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

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

    hai.

    check this.

    See the following ex:

    TYPES: BEGIN OF TY_MBLNR,

    MBLNR LIKE MKPF-MBLNR,

    END OF TY_MBLNR.

    DATA: IT_MBLNR TYPE STANDARD TABLE OF TY_MBLNR WITH HEADER LINE.

    data: it_ret like ddshretval occurs 0 with header line.

    At selection-screen on value-request for s_mat-low.

    Select MBLNR from mkpf into table it_mblnr.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    • DDIC_STRUCTURE = ' '

    RETFIELD = 'MBLNR'

    • PVALKEY = ' '

    • DYNPPROG = ' '

    • DYNPNR = ' '

    • DYNPROFIELD = ' '

    • STEPL = 0

    • WINDOW_TITLE =

    • VALUE = ' '

    VALUE_ORG = 'S'

    • MULTIPLE_CHOICE = ' '

    • DISPLAY = ' '

    • CALLBACK_PROGRAM = ' '

    • CALLBACK_FORM = ' '

    • MARK_TAB =

    • IMPORTING

    • USER_RESET =

    TABLES

    VALUE_TAB = IT_MBLNR

    • FIELD_TAB =

    RETURN_TAB = IT_RET

    • DYNPFLD_MAPPING =

    • EXCEPTIONS

    • PARAMETER_ERROR = 1

    • NO_VALUES_FOUND = 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 SY-SUBRC = 0.

    read table it_ret index 1.

    move it_ret-fieldval to S_mat-low.

    ENDIF.

    Go through the test program.

    REPORT Ztest_HELP .

    TABLES : MARA.

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

    PARAMETERS : P_MATNR(10) TYPE C.

    SELECTION-SCREEN END OF BLOCK B1.

    DATA : BEGIN OF ITAB OCCURS 0,

    MATNR TYPE MATNR,

    END OF ITAB.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.

    SELECT MATNR

    FROM MARA

    INTO TABLE ITAB

    UP TO 10 ROWS.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    RETFIELD = 'MATERIAL NUMBER'

    DYNPPROG = SY-REPID

    DYNPNR = SY-DYNNR

    DYNPROFIELD = 'P_MATNR'

    VALUE_ORG = 'S'

    TABLES

    VALUE_TAB = ITAB

    EXCEPTIONS

    PARAMETER_ERROR = 1

    NO_VALUES_FOUND = 2

    OTHERS = 3.

    regards.

    sowjanya.b

    Add a comment
    10|10000 characters needed characters exceeded

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

    hi dear use field catalog like this

    and create help view and attached to this

    RES_ID is help view field and ZPP013_004 is the table

    if you have any doubts reply me in

    nelson.rodrigo@loadstarlk.com

    WA_FIELDCAT-FIELDNAME = 'RES_ID' . "Reason - Less Planning

    WA_FIELDCAT-TABNAME = 'IT_ZPP013_003' .

    WA_FIELDCAT-SELTEXT_M = 'Reason - Less Plan'.

    *-Start of Editable field

    WA_FIELDCAT-REF_FIELDNAME = 'RES_ID'.

    WA_FIELDCAT-EDIT = 'X'.

    WA_FIELDCAT-REF_TABNAME = 'ZPP013_004'.

    *- End of Editable field

    WA_FIELDCAT-OUTPUTLEN = 20 .

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Marisca,

      You need to do a validation in your AT Selection Screen Event to check if user has entered values from the F4 table only.

      For example:

      SELECT-OPTIONS:   s_potobj      FOR pernr-orgeh.

      In LOAD-OF-PROGRAM.
      Get the internal table itab to be displayed in F4.

      AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_potobj-low.
      Use FM F4IF_INT_TABLE_VALUE_REQUEST to populate F4 Help.

      In AT SELECTION-SCREEN.
      Validate if user has selected values from F4.
      Loop at s_potobj.
      Read table itab with key fld1 = s_potobj-low.
      if sy-subrc is not initial.
      Message 'Select correct value' type 'E'.
      endif.
      Endloop.

      Hope it helps...

      Lokesh

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.