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

Get value without press enter in selection screen

Former Member
0 Likes
12,827

Dear All,

Any ideas how we can get the selection screen field value in report without press enter ?

Example : My selection have 2 fields Field A and Field B. When the user select the Field A value from search help, without press the enter i can get the value from field A and assign the value generate the data from Field B seach help.

THanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,864

Hi

Use DYNP_VALUES_READ to get the values entered in firlst field

Check the below thread

http://help.sap.com/saphelp_nw70/helpdata/en/9f/dbaac935c111d1829f0000e829fbfe/content.htm

"You can use this even for Selection Screen PARAMETERS now
parameters : P_carrid type sflight-carrid,
 connid type sflight-connid.

At selection-screen on value-request for p_connid
 
  DATA : BEGIN OF f4_tab OCCURS 0,
         carrid TYPE sflight-carrid,
         connid TYPE sflight-connid,
    END OF f4_tab.
   CLEAR lin.
 
 
  DATA : dynpread TYPE TABLE OF dynpread WITH HEADER LINE. 
  REFRESH dynpread.
  CLEAR dynpread.
  dynpread-fieldname = 'P_CARRID'.

  APPEND dynpread.
  CLEAR dynpread.
 
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname                               = sy-repid
      dynumb                               = sy-dynnr
    TABLES
      dynpfields                           = dynpread
   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
            .
  IF sy-subrc IS INITIAL.
    READ TABLE dynpread WITH KEY fieldname = 'P_CARRID'.
    IF sy-subrc IS INITIAL.
      SELECT carrid connid FROM sflight
            INTO TABLE f4_tab
             WHERE carrid = dynpread-fieldvalue.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield               = 'CONNID'
         dynpprog               = sy-repid
         dynpnr                 = sy-dynnr
         dynprofield            = 'P_CONNID'
         value_org              = 'S'
        TABLES
          value_tab              = f4_tab
    ENDIF.
  ENDIF.
ENDMODULE.                 " f4_get  INPUT


Now you can use it for Selection Screen Also

You can omit the part whihc you dont want in the above FM

Cheerz

Ram

Dear All,

Any ideas how we can get the selection screen field value in report without press enter ?

Example : My selection have 2 fields Field A and Field B. When the user select the Field A value from search help, without press the enter i can get the value from field A and assign the value generate the data from Field B seach help.

THanks

7 REPLIES 7
Read only

Former Member
0 Likes
5,865

Hi

Use DYNP_VALUES_READ to get the values entered in firlst field

Check the below thread

http://help.sap.com/saphelp_nw70/helpdata/en/9f/dbaac935c111d1829f0000e829fbfe/content.htm

"You can use this even for Selection Screen PARAMETERS now
parameters : P_carrid type sflight-carrid,
 connid type sflight-connid.

At selection-screen on value-request for p_connid
 
  DATA : BEGIN OF f4_tab OCCURS 0,
         carrid TYPE sflight-carrid,
         connid TYPE sflight-connid,
    END OF f4_tab.
   CLEAR lin.
 
 
  DATA : dynpread TYPE TABLE OF dynpread WITH HEADER LINE. 
  REFRESH dynpread.
  CLEAR dynpread.
  dynpread-fieldname = 'P_CARRID'.

  APPEND dynpread.
  CLEAR dynpread.
 
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname                               = sy-repid
      dynumb                               = sy-dynnr
    TABLES
      dynpfields                           = dynpread
   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
            .
  IF sy-subrc IS INITIAL.
    READ TABLE dynpread WITH KEY fieldname = 'P_CARRID'.
    IF sy-subrc IS INITIAL.
      SELECT carrid connid FROM sflight
            INTO TABLE f4_tab
             WHERE carrid = dynpread-fieldvalue.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield               = 'CONNID'
         dynpprog               = sy-repid
         dynpnr                 = sy-dynnr
         dynprofield            = 'P_CONNID'
         value_org              = 'S'
        TABLES
          value_tab              = f4_tab
    ENDIF.
  ENDIF.
ENDMODULE.                 " f4_get  INPUT


Now you can use it for Selection Screen Also

You can omit the part whihc you dont want in the above FM

Cheerz

Ram

Read only

0 Likes
5,864

Thankyou it worked for me.

Read only

Former Member
0 Likes
5,864

Dear Ram,

this function apply in report selection screen ? i tried this b4 but i can read the value from the field.

Any ideas ?

THanks,

Read only

Former Member
0 Likes
5,864

Sorry ..... for wrong spealling

Dear Ram,

this function apply in report selection screen ? i tried this b4 but i CANNOT read the value from the field.

Any ideas ?

THanks,

Read only

0 Likes
5,864

Hi,

You must create a custom search help. This new search help must contain a reference to table in dictionary in which your fields are linked one to each other with this search help.

Let's say you have a transparent table ZTABLE:

ZTABLE-FIELD1 -> Search help ZH_MY_HELP

ZTABLE-FIELD2 -> Search help ZH_MY_HELP

In search help ZH_MY_HELP, you defined this ZTABLE as your reference table, and FIELD1 and FIELD2 are explicitly mentioned as fields for search.

Doing this, when you define in your selection screen:

PARAMETERS: param1 TYPE ZTABLE-FIELD1,

param2 TYPE ZTABLE-FIELD2.

Values from param2 will depend of values from param1, when pressing F4. This is what I think your "read value from selection screen, without pressing enter" problem is.

Best regards!

Julio Almeida

Read only

Former Member
0 Likes
5,864

This message was moderated.

Read only

0 Likes
5,864

Hi,

Try below code.

TABLES: MARA.

types: begin of ty,

          matnr type matnr,

         werks type werks_d,

        end of ty.

data: it2 type standard table of dselc,

       wa2 type dselc.

data: it type standard table of ty,

       wa_return type ddshretval,

       i_return type standard table of ddshretval,

       repid type sy-repid,

       dynnr type sy-dynnr.

parameters:

          p_matnr   type mara-matnr,

          p_werks    type marc-werks.

SELECT-OPTIONS: S_BUKRS FOR MARA-MATNR.

at selection-screen output.

**  loop at screen.

**    if screen-name = 'P_WERKS'.

**      screen-input = '0'.

**      screen-DISPLAY_3D = 'X'.

**      modify screen.

**    endif.

**  endloop.

at selection-screen on value-request for p_matnr.

   repid = sy-repid.

   dynnr = sy-dynnr.

   select matnr werks

               from marc up to 20 rows

               into table it.

   check sy-subrc = 0.

   wa2-fldname = 'F0001'.

   wa2-dyfldname = 'P_MATNR'.

   append wa2 to it2.

   wa2-fldname = 'F0002'.

   wa2-dyfldname = 'P_WERKS'.

   append wa2 to it2.

   call function 'F4IF_INT_TABLE_VALUE_REQUEST'

        exporting

             retfield        = 'WERKS'

             dynpprog        = repid

             dynpnr          = dynnr

             dynprofield     = 'P_WERKS'

             value_org       = 'S'

             display         = 'F'

        tables

             value_tab       = it

             dynpfld_mapping = it2

        exceptions

             parameter_error = 1

             no_values_found = 2

             others          = 3.