Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Select-options restrict possible entries

Former Member
0 Kudos

Hi

I use select options like in this example

select-options: so_matnr for mara-matnr.

In my report,when running, if pressing f4 for possible entries i only want to have material 123 and 234 for example,and not the whole list of materials.How can i restrict this possible entries to only my desired materials.

thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Maybe you try this function :



AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_spmon.
  PERFORM monat_f4.

FORM MONAT_F4 .
DATA : i_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE.
  DATA: ihelp_fields LIKE help_value OCCURS 0 WITH HEADER LINE.

  DATA: BEGIN OF helptab OCCURS 100,
         feld(40),
      END OF helptab.

  FREE : ihelp_fields, helptab.

  ihelp_fields-tabname     = 'ZTSURTIP'.
  ihelp_fields-fieldname   = 'xxxxxx'.
  ihelp_fields-selectflag  = ''.           APPEND ihelp_fields.
  ihelp_fields-tabname     = 'ZTSURTIP'.
  ihelp_fields-fieldname   = 'SURUMTIPI'.
  ihelp_fields-selectflag  = 'X'.           APPEND ihelp_fields.
  ihelp_fields-tabname     = 'ZTSURTIP'.
  ihelp_fields-fieldname   = 'SURUMTANIMI'.
  ihelp_fields-selectflag  = ''.           APPEND ihelp_fields.


  SELECT * FROM ztsurtip.
    MOVE ztsurtip-zzzz TO helptab-feld. APPEND helptab.
    MOVE ztsurtip-xxxx TO helptab-feld. APPEND helptab.
    MOVE ztsurtip-yyyy TO helptab-feld. APPEND helptab.
  ENDSELECT.

  helptab-feld = 'GNST'. APPEND helptab.
  helptab-feld = 'GNST'. APPEND helptab.
  helptab-feld = 'GNST'. APPEND helptab.

  CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
       EXPORTING
            fieldname                 = 'SURUMTIPI'
            tabname                   = 'ZTSURTIP'
       IMPORTING
            select_value              = ztsurtip-surumtipi
       TABLES
            fields                    = ihelp_fields
            valuetab                  = helptab
       EXCEPTIONS
            field_not_in_ddic         = 01
            more_then_one_selectfield = 02
            no_selectfield            = 03.
 

  

ENDFORM .


Regards ,

Serkann .

9 REPLIES 9

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Create custom F4 help

matt
Active Contributor
0 Kudos

You can write your own search help (see MATCHCODE OBJECT addition to SELECT-OPTIONS), or write your own code in AT SELECTION SCREEN... ON VALUE-REQUEST.

Read the documentation for more information.

matt

GauthamV
Active Contributor
0 Kudos

Plz SEARCH in SCN before posting.

SEARCH in SCN for this Fm F4IF_INT_TABLE_VALUE_REQUEST you will get lot of posts.

Former Member
0 Kudos

Hi,

next 2 select option 1 arrow mark icon is there,click on it give ur value in single value->enter or f8.

u can give any value or range for that.

hope u'll get some idea.

Regards,

Sneha.

0 Kudos

Hi,

I searched the forum for this problem but did not find it.

After pressing f4 i right_clicked the items i needed for my list and choose the option "add to personal list"

or something like that,and now i have only my items for selection.

thanks

0 Kudos

>

> Hi,

> I searched the forum for this problem but did not find it.

> After pressing f4 i right_clicked the items i needed for my list and choose the option "add to personal list"

> or something like that,and now i have only my items for selection.

>

> thanks

Hi, Seba

Test the following Sample Code Hope it will solve out your problem,

TABLES: mara.

SELECT-OPTIONS somatnr FOR mara-matnr.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR somatnr-low.

  TYPES: BEGIN OF ty_mara,
    matnr LIKE mara-matnr,
  END OF ty_mara.

  DATA: it_mara TYPE STANDARD TABLE OF ty_mara WITH HEADER LINE.

  SELECT mara~matnr
    INTO CORRESPONDING FIELDS OF TABLE it_mara
    FROM mara
    WHERE matnr BETWEEN '000000000000000001' AND '000000000000000999'. " You can Give Condition Here for Number of Matnrs

  SORT it_mara BY matnr.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield    = 'MARA'
      dynpprog    = sy-repid
      dynpnr      = sy-dynnr
      dynprofield = 'SOMARA-LOW'
      value_org   = 'S'
    TABLES
      value_tab   = it_mara.

Above will work with SOMATNR-LOW for SOMATNR-HIGH you need to repeat the above steps for somatnr-high too.

Please Reply if any Issue,

Best Regards,

Faisal

Former Member
0 Kudos

Maybe you try this function :



AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_spmon.
  PERFORM monat_f4.

FORM MONAT_F4 .
DATA : i_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE.
  DATA: ihelp_fields LIKE help_value OCCURS 0 WITH HEADER LINE.

  DATA: BEGIN OF helptab OCCURS 100,
         feld(40),
      END OF helptab.

  FREE : ihelp_fields, helptab.

  ihelp_fields-tabname     = 'ZTSURTIP'.
  ihelp_fields-fieldname   = 'xxxxxx'.
  ihelp_fields-selectflag  = ''.           APPEND ihelp_fields.
  ihelp_fields-tabname     = 'ZTSURTIP'.
  ihelp_fields-fieldname   = 'SURUMTIPI'.
  ihelp_fields-selectflag  = 'X'.           APPEND ihelp_fields.
  ihelp_fields-tabname     = 'ZTSURTIP'.
  ihelp_fields-fieldname   = 'SURUMTANIMI'.
  ihelp_fields-selectflag  = ''.           APPEND ihelp_fields.


  SELECT * FROM ztsurtip.
    MOVE ztsurtip-zzzz TO helptab-feld. APPEND helptab.
    MOVE ztsurtip-xxxx TO helptab-feld. APPEND helptab.
    MOVE ztsurtip-yyyy TO helptab-feld. APPEND helptab.
  ENDSELECT.

  helptab-feld = 'GNST'. APPEND helptab.
  helptab-feld = 'GNST'. APPEND helptab.
  helptab-feld = 'GNST'. APPEND helptab.

  CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
       EXPORTING
            fieldname                 = 'SURUMTIPI'
            tabname                   = 'ZTSURTIP'
       IMPORTING
            select_value              = ztsurtip-surumtipi
       TABLES
            fields                    = ihelp_fields
            valuetab                  = helptab
       EXCEPTIONS
            field_not_in_ddic         = 01
            more_then_one_selectfield = 02
            no_selectfield            = 03.
 

  

ENDFORM .


Regards ,

Serkann .

venkat_o
Active Contributor
0 Kudos

Hi Seba, 1. Demo program for F4 help on Selection-screen : <b>demo_selection_screen_f4.</b> 2. Sample program

   REPORT zvenkat_f4_for_selops MESSAGE-ID zmsg .
   TABLES :marc.
   TYPES:
      BEGIN OF t_t001w,
        werks       TYPE t001w-werks,
        name1       TYPE t001w-name1,
      END OF t_t001w,
      t_return_tab  TYPE ddshretval.
   DATA:
       w_t001w      TYPE t_t001w,
       w_return_tab TYPE t_return_tab.
   DATA:
       i_t001w      TYPE STANDARD TABLE OF t_t001w,
       i_return_tab TYPE STANDARD TABLE OF t_return_tab.
*&---------------------------------------------------------------------*
*&      SELECTION-SCREEN
*&---------------------------------------------------------------------*

   SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
   SELECT-OPTIONS : s_werks FOR marc-werks.
   SELECTION-SCREEN END OF BLOCK b1.

*&---------------------------------------------------------------------*
*&      AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks
*&---------------------------------------------------------------------*
   AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_werks-low.
     PERFORM f4_help_for_palant USING 'S_WERKS-LOW'.

   AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_werks-high.
     PERFORM f4_help_for_palant USING 'S_WERKS-HIGH'.
*&---------------------------------------------------------------------*
*&      Form  f4_help_for_palant
*&---------------------------------------------------------------------*
   FORM f4_help_for_palant USING l_dynprofield.


     SELECT werks name1
     FROM t001w
     INTO TABLE i_t001w.

     CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
         retfield        = 'WERKS'
         dynpprog        = sy-repid
         dynpnr          = sy-dynnr
         dynprofield     = l_dynprofield
         value_org       = 'S'
       TABLES
         value_tab       = i_t001w
         return_tab      = i_return_tab
       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.
   ENDFORM.                    " f4_help_for_palant
I hope that it solves your problem. Thanks Venkat.O

Former Member
0 Kudos

Hi,

Check the below code.

data: v_matnr type mara-matnr.

select-options: s_matnr for v_matnr.

data: begin of itab occurs 0,

matnr type mara-matnr,

end of itab.

at selection-screen on value-request for s_matnr-low.

itab-matnr = 123.

append itab.

itab-matnr = 234.

append itab.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'MATNR'

DYNPPROG = sy-cprog

DYNPNR = sy-dynnr

DYNPROFIELD = 'S_MATNR-LOW'

VALUE_ORG = 'S'

tables

value_tab = itab

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.

Regards,

Kumar Bandanadham