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

how to fetch data from database table based on table control values

hi experts,

i have developed table control in which 5 columns are there,what i need is that when i enter values for example first column is matnr,when i entered matnr no in first column and i have pressed enter button.it has to select all values of mara table based on first column matnr no and fill table control.

anyone can help me for the same.

regards,

vinodh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 04, 2013 at 03:31 PM

    Hi

    You can develop a module in PAI process in order to fill your table control, this module should be triggered as soon as the value of the first field is changed.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 04, 2013 at 04:09 PM

    In the PAI module, do the following

    PROCESS AFTER INPUT.

    LOOP WITH CONTROL T_C.

    MODULE update_table.

    ENDLOOP.

    module update_table INPUT.

    read table itab index t_c-current_line.

    * Get all database values based on column 1

    select ..... where col1 = itab-col1.

    * Set all other values in the internal table work area.

    itab-col2 =

    itab-col3 =

    modify itab index t_c-current_line.

    ENDMODULE.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      It seems you're using the same workarea (wa_zpp_mpo) for the dynpro field and the internal table, so the data can be overwritten, you should use a different workarea while reading the internal table and read it after getting the data you need

      module update_table INPUT.

      read table it_zpp_mpo INTO wa_zpp_mpo index TBC_9003-current_line.

      * Create another temperoray work area wa_zpp_mpo_tmp.

      SELECT single * FROM ZPP_MPO_MASTER1 INTO wa_zpp_mpo_tmp

      WHERE matnr = wa_zpp_mpo-matnr.

      if sy-subrc = 0.

      clear wa_zpp_mpo_tmp.

      endif.

      read table it_zpp_mpo INTO wa_zpp_mpo_tmp_2 index TBC_9003-current_line.

      read_rc = sy-subrc

      if read_rc <> 0.

      clear wa_zpp_mpo_tmp_2.

      endif.

      wa_zpp_mpo_tmp_2-matnr = wa_zpp_mpo-matnr.

      wa_zpp_mpo = wa_zpp_mpo_tmp_2.


      WA_ZPP_MPO-MCARDNO = wa_zpp_mpo_tmp-mcardno.

      WA_ZPP_MPO-ZFQTY = wa_zpp_mpo_tmp-zfqty.

      WA_ZPP_MPO-REMAKS = wa_zpp_mpo_tmp-remaks

      if read_rc = 0.

      modify it_zpp_mpo FROM wa_zpp_mpo index TBC_9003-current_line.

      else.

      append wa_zpp_mpo to it_zpp_mpo.

      endif

      Max

  • author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2013 at 10:14 AM

    HI Vinodh,

    Try this.


    1st.png (7.0 kB)
    2nd.png (9.2 kB)
    3rd.png (10.5 kB)
    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.