Restricting values in F4 help for the fields on selection-screen

By Aboli Kshirsagar, Cognizant

We can restrict the values in F4 help of one parameter depending upon the values selected in the previous parameter on the selection screen. 

For example: In the following selection-screen if you select a particular value for the field ERNAM (created by) then the F4 help for material should show only the material numbers on the particular date, i.e., the value entered in the ERNAM (created by) field. 

DATA : it_return1 LIKE ddshretval OCCURS 0 WITH HEADER LINE,
       it_return2 LIKE ddshretval OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF it_ernam OCCURS 0,
      ernam LIKE mara-ernam,
      END OF it_ernam.
DATA: BEGIN OF it_matnr OCCURS 0,
      matnr LIKE mara-matnr,
      END OF it_matnr.
PARAMETERS: p_ernam LIKE mara-ernam,
            p_matnr LIKE mara-matnr.
DATA m LIKE mara-matnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ernam.
  SELECT ernam FROM mara INTO TABLE it_ernam.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'P_ERNAM'
      value_org       = 'S'
    TABLES
      value_tab       = it_ernam
      return_tab      = it_return1
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  p_ernam = it_return1-fieldval.
  SELECT matnr FROM mara INTO TABLE it_matnr WHERE ernam = p_ernam.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
 CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'P_MATNR'
      value_org       = 'S'
    TABLES
      value_tab       = it_matnr
      return_tab      = it_return2
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image