Skip to Content
0
Former Member
Sep 04, 2006 at 02:58 PM

At Selection Screen output

18 Views

hi

I am facing a problem in this event, when a user presses F4 I am capturing the value and using a select statement to retrieve the correspoding records and accordingly getting the next field modified directly using FM,

now my problem is that ST_CODE and ST_NAME are modified but CURRPR is not changing even though i can see that the value T_CURRPR in the debug mode,

I dont know whats the problem, please help

The code goes like this


AT SELECTION-SCREEN ON VALUE-REQUEST FOR ST_NAME.

  DATA: RETURN TYPE TABLE OF DDSHRETVAL WITH HEADER LINE.
  DATA: DYNFIELDS TYPE TABLE OF DYNPREAD WITH HEADER LINE.

  CLEAR: FIELD_VALUE, DYNPRO_VALUES.
  REFRESH DYNPRO_VALUES.
  FIELD_VALUE-FIELDNAME = 'EXCH'.

  APPEND FIELD_VALUE TO DYNPRO_VALUES.

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      DYNAME             = SY-CPROG
      DYNUMB             = SY-DYNNR
      TRANSLATE_TO_UPPER = 'X'
    TABLES
      DYNPFIELDS         = DYNPRO_VALUES.

  READ TABLE DYNPRO_VALUES INDEX 1 INTO FIELD_VALUE.

  IF FIELD_VALUE-FIELDVALUE IS NOT INITIAL.

    IF SY-SUBRC = 0 AND FIELD_VALUE-FIELDVALUE = 1.

      FIELD_VALUE-FIELDVALUE = 'BSE'.

    ELSEIF SY-SUBRC = 0 AND FIELD_VALUE-FIELDVALUE = 2.

      FIELD_VALUE-FIELDVALUE = 'NSE'.

    ENDIF.

    SELECT STOCK ST_NAME
                 CURRPR
                 FROM
                 ZEXCH
                 INTO TABLE TEMP_ITAB
                 WHERE EXCH = FIELD_VALUE-FIELDVALUE.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        RETFIELD    = 'ST_NAME'
        DYNPPROG    = SY-CPROG
        DYNPNR      = SY-DYNNR
        DYNPROFIELD = 'ST_NAME'
        VALUE_ORG   = 'S'
      TABLES
        VALUE_TAB   = TEMP_ITAB
        RETURN_TAB  = RETURN.

    SELECT STOCK CURRPR
                 FROM ZEXCH
                 INTO (T_CODE, T_CURRPR)
                 WHERE ST_NAME = RETURN-FIELDVAL.
    ENDSELECT.

    CLEAR DYNPRO_VALUES[].
<b>
    FIELD_VALUE-FIELDNAME = 'ST_NAME'.
    FIELD_VALUE-FIELDVALUE = RETURN-FIELDVAL.
    APPEND  FIELD_VALUE  TO DYNPRO_VALUES .

    FIELD_VALUE-FIELDNAME = 'ST_CODE'.
    FIELD_VALUE-FIELDVALUE = T_CODE.
    APPEND  FIELD_VALUE  TO DYNPRO_VALUES .

    FIELD_VALUE-FIELDNAME = 'CURRPR'.
    FIELD_VALUE-FIELDVALUE = T_CURRPR.
    APPEND  FIELD_VALUE  TO DYNPRO_VALUES .

* Update the dynpro values.
    CALL FUNCTION 'DYNP_VALUES_UPDATE'
      EXPORTING
        DYNAME     = SY-CPROG
        DYNUMB     = SY-DYNNR
      TABLES
        DYNPFIELDS = DYNPRO_VALUES.

    LOOP AT SCREEN.

      IF SCREEN-NAME = 'EXCH' OR
         SCREEN-NAME = 'ST_NAME'.

        SCREEN-INPUT = 0.
        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ENDIF.</b>