Skip to Content
author's profile photo Former Member
Former Member

At Selection Screen output

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>

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 05, 2006 at 03:05 PM

    Hi,

    I'm not sure if I can help you, but please try to use variables instead of SY-CPROG and SY-DYNNR because this could change while calling the function.

    Hope that helps.

    Regards

    Nicola

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 05, 2006 at 03:13 PM

    Hi Rahul,

    You need to update selection screen with the new values.

    Followed is the sample code.

    • IT for changing fields on the screen

    t_dynp_flds LIKE dynpread OCCURS 0 WITH HEADER LINE.

    t_dynp_flds-fieldname = 'LFA1-LIFNR'.

    t_dynp_flds-fieldvalue = t_lfa1-lifnr.

    APPEND t_dynp_flds.

    CLEAR t_dynp_flds.

    t_dynp_flds-fieldname = 'LFA1-STCD1'.

    t_dynp_flds-fieldvalue = t_lfa1-stcd1.

    APPEND t_dynp_flds.

    CLEAR t_dynp_flds.

    t_dynp_flds-fieldname = 'LFA1-NAME1'.

    t_dynp_flds-fieldvalue = t_lfa1-name1.

    APPEND t_dynp_flds.

    CLEAR t_dynp_flds.

    • Change screen field contents w/o PBO

    CALL FUNCTION 'DYNP_VALUES_UPDATE'

    EXPORTING

    dyname = 'ZFFI_ZFW9_TAXID'

    dynumb = '1300'

    TABLES

    dynpfields = t_dynp_flds

    EXCEPTIONS

    invalid_abapworkarea = 1

    invalid_dynprofield = 2

    invalid_dynproname = 3

    invalid_dynpronummer = 4

    invalid_request = 5

    no_fielddescription = 6

    undefind_error = 7

    OTHERS = 8.

    -Anu

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.