Application Development and Automation 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: 
Read only

Dynamic Possible Values for Parameter Fields

Former Member
0 Likes
718

Hi,

Can anyone throw some idea on how to implement Dynamic possible value list for parameter field.

I have three parameter fields with F4 option. First Company Code; if the user selects a company code from the list only valid personnel areas of that company code should be available for second field (Personnel area).

And the third field Personnel Sub Area should display only valid entries for selected Personnel Area in the second field.

Thank you,

Ram Sanjeev

6 REPLIES 6
Read only

Former Member
0 Likes
642

Hey,

When the user takes the F4 help on the 2nd field you need to read the value entered in the company code field using the function DYNP_VALUES_READ and show the entries relating to the entered company code.

Similar logic has to be implemented for the F4 help on the 3rd field.

DYNP_VALUES_READ function is the key...

-Kiran

Read only

Former Member
0 Likes
642

Ram,

See the below example. You could use same technique, or a search helf if exists , or the F4* function modules.

Cheers,

Thomas.

Please mark points if helpful.

REPORT ZTEST .

PARAMETERS: P_CARR_1 TYPE MARA-MATNR,
            P_CARR_2 TYPE SPFLI-CARRID.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_CARR_2.
  CALL SCREEN 100 STARTING AT 2 5
                  ENDING   AT 80 50.

MODULE VALUE_LIST OUTPUT.
  SUPPRESS DIALOG.
  LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
  SET PF-STATUS SPACE.
  NEW-PAGE NO-TITLE.
  WRITE 'Star Alliance' COLOR COL_HEADING.
  ULINE.
  P_CARR_2 = 'AC '.
  WRITE: / P_CARR_2 COLOR COL_KEY, 'Air Canada '.
  HIDE P_CARR_2.
  P_CARR_2 = 'LH '.
  WRITE: / P_CARR_2 COLOR COL_KEY, 'Lufthansa'.
  HIDE P_CARR_2.
  P_CARR_2 = 'SAS'.
  WRITE: / P_CARR_2 COLOR COL_KEY, 'SAS'.
  HIDE P_CARR_2.
  P_CARR_2 = 'THA'.
  WRITE: / P_CARR_2 COLOR COL_KEY, 'Thai International'.
  HIDE P_CARR_2.
  P_CARR_2 = 'UA '.
  WRITE: / P_CARR_2 COLOR COL_KEY, 'United Airlines'.
  HIDE P_CARR_2.
  CLEAR P_CARR_2.
  SKIP 10 .
  WRITE: /30 'Applied Materials Confidential' COLOR 5.
ENDMODULE.

AT LINE-SELECTION.
  CHECK NOT P_CARR_2 IS INITIAL.
  LEAVE TO SCREEN 0.

Read only

Former Member
0 Likes
642

Hello,

U can do it through the FM F4IF_INT_TABLE_VALUE_REQUEST.

Once the User Gave the companz code in the first field,

Then select the personal area of that company code and pass it to the FM F4IF_INT_TABLE_VALUE_REQUEST.

DO the same for the third field also.

Before selecting check the BUKRS field is initial or not.

Reward if useeful.

Vasanth

Read only

Former Member
0 Likes
642

Hi,

Check the sample code..

REPORT  ZTEST_F4HELP                              .

*---Report with selection screen and to display the list of
* possible entries for field 'B' as per the value in field 'A'.


parameters: p_vbeln type vbak-vbeln,
            p_posnr type vbap-posnr.

at selection-screen on value-request for p_posnr.


  data: begin of help_item occurs 0,
          posnr type vbap-posnr,
          matnr type vbap-matnr,
          arktx type vbap-arktx,
        end of help_item.

  data: dynfields type table of dynpread with header line.


  dynfields-fieldname = 'P_VBELN'.
  append dynfields.

  call function 'DYNP_VALUES_READ'
       exporting
            dyname               = sy-cprog
            dynumb               = sy-dynnr
            translate_to_upper   = 'X'
       tables
            dynpfields           = dynfields
       exceptions
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            invalid_parameter    = 7
            undefind_error       = 8
            double_conversion    = 9
            stepl_not_found      = 10
            others               = 11.


  read table dynfields with key fieldname = 'P_VBELN'.

  p_vbeln = dynfields-fieldvalue.


  call function 'CONVERSION_EXIT_ALPHA_INPUT'
       exporting
            input  = p_vbeln
       importing
            output = p_vbeln.

  select posnr matnr arktx into table help_item
                 from vbap
                      where vbeln = p_vbeln.



  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       exporting
            retfield    = 'POSNR'
            dynprofield = 'P_POSNR'
            dynpprog    = sy-cprog
            dynpnr      = sy-dynnr
            value_org   = 'S'
       tables
            value_tab   = help_item.

Regards

vijay

Read only

0 Likes
642

Thank you all for quick response.

Cheers,

Ram

Read only

Former Member
0 Likes
642

hi, sample code is ::

REPORT Z_TEST.

SELECT-OPTIONS: S_CARRID FOR SFLIGHT-CARRID,

S_CONNID FOR SFLIGHT-CONNID.

DATA: BEGIN OF HELP_ITEM OCCURS 0,

CONNID TYPE SFLIGHT-CONNID,

END OF HELP_ITEM.

DATA: DYNFIELDS TYPE TABLE OF DYNPREAD WITH HEADER LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CONNID.

DYNFIELDS-FIELDNAME = 'S_CARRID'.

APPEND DYNFIELDS.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = SY-CPROG

DYNUMB = SY-DYNNR

TRANSLATE_TO_UPPER = 'X'

TABLES

DYNPFIELDS = DYNFIELDS

EXCEPTIONS

INVALID_ABAPWORKAREA = 1

INVALID_DYNPROFIELD = 2

INVALID_DYNPRONAME = 3

INVALID_DYNPRONUMMER = 4

INVALID_REQUEST = 5

NO_FIELDDESCRIPTION = 6

INVALID_PARAMETER = 7

UNDEFIND_ERROR = 8

DOUBLE_CONVERSION = 9

STEPL_NOT_FOUND = 10

OTHERS = 11.

READ TABLE DYNFIELDS WITH KEY FIELDNAME = 'S_CARRID'.

S_CARRID = DYNFIELDS-FIELDVALUE.

SELECT S_CONNID INTO TABLE HELP_ITEM FROM SFLIGHT WHERE CARRID IN S_CARRID .

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'CONNID'

DYNPROFIELD = 'S_CONNID'

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNNR

TABLES

VALUE_TAB = HELP_ITEM.