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

screen fields f4

Hallo Experts,

I have two fields say street and city on a module pool screen say 100. these are taken from the dictionary so they have a associated search help. now I want to have a logic. that when i select any street from the drop down the corresponding city field should be populated along with the street field . can any one suggest how can i do that?

Thanks.

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 Feb 27, 2009 at 08:19 AM

    HI,

    Check this Code... Get the PLNAL based on the PLNNR selection

    PROCESS ON VALUE-REQUEST.
    * Module to get the F4 help for the
    * field Discount Code WRT Branch
      FIELD p_plnal 
      MODULE f4_help_discount_code.
    
    PERFORM  f4_help_discount_code.
      data:
        lg_condition    type string.
    
      data:
         lwa_ddshretval type ddshretval,
         lwa_dselc      type dselc,
         lwa_dynpread   type dynpread.
      data:
         li_f4_insp     type standard table of t_f4_insp,
         li_ddshretval  type standard table of ddshretval,
         li_dselc       type standard table of dselc,
         li_dynpread    type standard table of dynpread.
    
    
      lwa_dynpread-fieldname = 'P_WERKS'.
      append lwa_dynpread to li_dynpread.
      clear lwa_dynpread.
    * Read Screen Field Values.
      call function 'DYNP_VALUES_READ'
        exporting
          dyname     = sy-repid
          dynumb     = sy-dynnr
        tables
          dynpfields = li_dynpread.
    
    * Read the first record as only one record will be present
      read table li_dynpread into lwa_dynpread index 1.
      p_werks = lwa_dynpread-fieldvalue.
    
      if p_werks is initial.
        move 'PLNTY EQ ''Q''' to lg_condition.
      else.
        move 'WERKS EQ P_WERKS AND PLNTY EQ ''Q''' to lg_condition.
      endif.
    
    * Fetch Data
      select werks
             plnnr
             plnal
             plnty
             ktext
        into table li_f4_insp
        from plko
        where (lg_condition).
    
      lwa_dselc-fldname = 'F0002'.
      lwa_dselc-dyfldname = 'PLNNR'.
      append lwa_dselc to li_dselc.
      clear lwa_dselc.
      lwa_dselc-fldname = 'F0003'.
      lwa_dselc-dyfldname = 'PLNAL'.
      append lwa_dselc to li_dselc.
      clear lwa_dselc.
    * FM For F4 Help
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
        exporting
          retfield        = 'PLNNR'
          dynpprog        = sy-cprog
          dynpnr          = sy-dynnr
          dynprofield     = 'PLNNR'
          value_org       = 'S'
        tables
          value_tab       = li_f4_insp
          return_tab      = li_ddshretval
          dynpfld_mapping = li_dselc
        exceptions
          parameter_error = 1
          no_values_found = 2
          others          = 3.
    
      if sy-subrc eq 0.
        refresh li_dynpread.
        read table li_ddshretval into lwa_ddshretval index 1.
        if sy-subrc eq 0.
          move lwa_ddshretval-fieldval to p_plnnr.
          lwa_dynpread-fieldname = 'P_PLNNR'.
          lwa_dynpread-fieldvalue = lwa_ddshretval-fieldval.
          append lwa_dynpread to li_dynpread.
          clear lwa_dynpread.
        endif.                             " IF sy-subrc EQ 0.
        read table li_ddshretval into lwa_ddshretval index 2.
        if sy-subrc eq 0.
          move lwa_ddshretval-fieldval to p_plnal.
          lwa_dynpread-fieldname = 'P_PLNAL'.
          lwa_dynpread-fieldvalue = lwa_ddshretval-fieldval.
          append lwa_dynpread to li_dynpread.
          clear lwa_dynpread.
        endif.                             " IF sy-subrc EQ 0.
      endif.                               " IF sy-subrc EQ 0.
    
    * Set Screen Field Values.
      call function 'DYNP_VALUES_UPDATE'
        exporting
          dyname               = sy-repid
          dynumb               = sy-dynnr
        tables
          dynpfields           = li_dynpread
        exceptions
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          undefind_error       = 7
          others               = 8.
    
      check sy-subrc eq 0.
    
    ENDFORM.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2009 at 08:20 AM

    use this code...

      PERFORM read_dynprofield USING '<field_name>'
                                 CHANGING <field_name>.
    
      *select statement****************************
    
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = '<return_field>'
          dynpprog        = sy-repid
          dynpnr          = sy-dynnr
          dynprofield     = '<table_name-filed_name>'
          value_org       = 'S'
        TABLES
          value_tab       = it_help
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    

    *&---------------------------------------------------------------------*
    *&      Form  READ_DYNPROFIELD
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_FIELDNAME  text
    *      <--P_VALUE  text
    *----------------------------------------------------------------------*
    FORM read_dynprofield  USING    p_fieldname
                           CHANGING p_value.
    
      DATA it_dynfield4 TYPE STANDARD TABLE OF dynpread WITH HEADER LINE.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname               = sy-repid
          dynumb               = sy-dynnr
          request              = 'A'
          translate_to_upper   = 'X'
        TABLES
          dynpfields           = it_dynfield4
        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 it_dynfield4 WITH KEY fieldname = p_fieldname.
    
      p_value = it_dynfield4-fieldvalue.
    
    ENDFORM.                    " READ_DYNPROFIELD
    

    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.