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: 

At Selection Screen

Former Member
0 Kudos
92

hi friends,

I have task like this,, for example, lets assume that there are tow fields in the slection screen, one sales org and the pther a plant, when the user input the sales org i need to get th ecooresponding palnts which belongs to sales org inthe select-option of the plant..

is this poosible in at-slection screen event? please let me know how you would process this?

Thanks in advance

Rinky

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos
63

Hi,

Check this code..

REPORT  ZTESTF4                                .

DATA: progname TYPE sy-repid,
      dynnum   TYPE sy-dynnr,
      dynpro_values TYPE TABLE OF dynpread,
      field_value LIKE LINE OF dynpro_values.

data: begin of t_t001l occurs 0,
        werks type werks_d,
        lgort type lgort_d,
      end of t_t001l.

data: v_werks type werks_d,
      V_lgort type lgort_d.


SELECTION-SCREEN BEGIN OF BLOCK B1.
  PARAMETERS: P_PLANT LIKE MSEG-WERKS,
              P_STOLOC LIKE MSEG-LGORT.
SELECTION-SCREEN END OF BLOCK B1.

INITIALIZATION.
  PROGNAME = SY-REPID.
  DYNNUM = SY-DYNNR.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_STOLOC.

  CLEAR: field_value, dynpro_values. REFRESH dynpro_values.
  field_value-fieldname = 'P_PLANT'.
  APPEND field_value TO dynpro_values.

  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            dyname             = progname
            dynumb             = dynnum
            translate_to_upper = 'X'
       TABLES
            dynpfields         = dynpro_values.

  READ TABLE dynpro_values INDEX 1 INTO field_value.

  select werks lgort into TABLE t_T001L from T001L where werks = field_value-fieldvalue.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
            retfield    = 'P_STOLOC'
            dynpprog    = progname
            dynpnr      = dynnum
            dynprofield = 'P_STOLOC'
            value_org   = 'S'
       TABLES
            value_tab   = t_T001L.

START-OF-SELECTION.
  WRITE:/ 'TEST F4 PROGRAM'.
END-OF-SELECTION.

Regards

Vijay

3 REPLIES 3

laxmanakumar_appana
Active Contributor
0 Kudos
63

Hi,

Use FM : F4IF_INT_TABLE_VALUE_REQUEST at AT SELECTION-SCREEN event to get required F4 help.

Check this link for sample code :

Regards

Appana

former_member188685
Active Contributor
0 Kudos
64

Hi,

Check this code..

REPORT  ZTESTF4                                .

DATA: progname TYPE sy-repid,
      dynnum   TYPE sy-dynnr,
      dynpro_values TYPE TABLE OF dynpread,
      field_value LIKE LINE OF dynpro_values.

data: begin of t_t001l occurs 0,
        werks type werks_d,
        lgort type lgort_d,
      end of t_t001l.

data: v_werks type werks_d,
      V_lgort type lgort_d.


SELECTION-SCREEN BEGIN OF BLOCK B1.
  PARAMETERS: P_PLANT LIKE MSEG-WERKS,
              P_STOLOC LIKE MSEG-LGORT.
SELECTION-SCREEN END OF BLOCK B1.

INITIALIZATION.
  PROGNAME = SY-REPID.
  DYNNUM = SY-DYNNR.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_STOLOC.

  CLEAR: field_value, dynpro_values. REFRESH dynpro_values.
  field_value-fieldname = 'P_PLANT'.
  APPEND field_value TO dynpro_values.

  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            dyname             = progname
            dynumb             = dynnum
            translate_to_upper = 'X'
       TABLES
            dynpfields         = dynpro_values.

  READ TABLE dynpro_values INDEX 1 INTO field_value.

  select werks lgort into TABLE t_T001L from T001L where werks = field_value-fieldvalue.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
            retfield    = 'P_STOLOC'
            dynpprog    = progname
            dynpnr      = dynnum
            dynprofield = 'P_STOLOC'
            value_org   = 'S'
       TABLES
            value_tab   = t_T001L.

START-OF-SELECTION.
  WRITE:/ 'TEST F4 PROGRAM'.
END-OF-SELECTION.

Regards

Vijay

rahulkavuri
Active Contributor
0 Kudos
63

HI i JUST WORKED ON SIMILAR CASE, IT WORKS FOR MY CASE, REFER TO THIS EDITED CODE ONCE AGAIN

<b>*&---------------------------------------------------------------------*
*& Report  Z_SAM                                                       *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  Z_SAM                                   .

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

    PARAMETERS: TEMP TYPE MANDT DEFAULT '300'.
    PARAMETERS: ERSDA TYPE DATS.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF SCREEN-NAME = 'TEMP'.

      IF TEMP = '300'.

        select ERSDA from mara into ERSDA where matnr =
'000000000000000002'.
        ENDSELECT.
*        MODIFY SCREEN.

      ENDIF.

    ENDIF.

  ENDLOOP.

START-OF-SELECTION.

  WRITE:/ ERSDA.</b>

This doesn't use any select statements ofcourse, award points if found helpful

Message was edited by: Rahul Kavuri