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

Internal Tables

Hi,

My problem is.

I have 5 internal tables with different structure and different data. and to download this data i used the function module module WS_UPLOAD, in this function module i have to pass the internal table. Now my problem is, how to pass internal table to this function module dynamically, in order to avoid the number of lines of code.

Thanks and regards

sree

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2005 at 04:49 PM

    Hi sree,

    probably the FM you use to download is the <b>WS_DOWNLOAD</b>... in any case, try using a field-symbol.

    hi,

    Stefano

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 03, 2005 at 05:00 PM

    Hi Sree

    As suggested by Stefano, you can use field symbols. Secondly, use the FM <b>"GUI_UPLOAD"</b> instead of <b>"WS_UPLOAD"</b> since the latter one is obsolete.

    <u><b>e.g.</b></u>

    DATA lv_tabname(30) TYPE c .
    FIELD-SYMBOLS <b><f></b> TYPE TABLE .
    
    CASE <i><case></i> .
      WHEN <i><case_1></i> .
       lv_tabname = <i><name_of_itab_1></i> .
      WHEN <i><case_2></i> .
       lv_tabname = <i><name_of_itab_2></i> .
      ...
      WHEN <i><case_5></i> .
       lv_tabname = <i><name_of_itab_5></i> .
    ENDCASE .
    
    ...
    
    ASSIGN (lv_tabname) TO <b><f></b> .
    IF sy-subrc NE 0 .
    *--Handle Error
    ENDIF .
    
    CALL FUNCTION <b>'GUI_UPLOAD'</b>
      ...
      TABLES
        itab = <b><f></b> 
    ...
    

    *--Serdar

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Sree,

      Sorry I missed the key part(as Christian pointed out) in the code mentioned in my response. Change your code as follows and it should work.

      DATA lv_tabname(30) TYPE c.
        FIELD-SYMBOLS <fs> TYPE STANDARD TABLE.
       
        CASE sy-dynnr .
          WHEN '0110'.
            lv_tabname = 'TBL_MATSTR[]'.
          WHEN '0120'.
            lv_tabname = 'TBL_MATHAND[]'.
          WHEN '0130'.
            lv_tabname = 'TBL_PCDEL[]'.
          WHEN '0140'.
            lv_tabname = 'TBL_INLOG[]'.
          WHEN '0150'.
            lv_tabname = 'TBL_PKNG[]'.
        ENDCASE.
       
        ASSIGN (lv_tabname) TO <fs>.
        IF sy-subrc = 0.
          CALL FUNCTION 'WS_DOWNLOAD'
               EXPORTING
                    filename = p_p_file1
                    filetype = 'DAT'
               TABLES
                    data_tab = <fs>.
          IF sy-subrc <> 0.
      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        ELSE.
      *-- Problem with assignment
        ENDIF.

      Let us know if it solved your problem.

      Srinivas

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2005 at 07:51 PM

    Hi Sree,

    Below you can find a short program in which data from 2 internal tables are downloaded to the presentation server in a loop. Please note that the solution is based on <b>Serdar's answer</b> and take into consideration this issue when you give points:

    DATA: lt_sflight TYPE TABLE OF sflight,

    lt_sbook TYPE TABLE OF sbook,

    lt_tables TYPE TABLE OF tablename,

    lv_name TYPE string,

    lv_file_length TYPE i,

    lv_file_name TYPE string.

    FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.

    *fill an internal table which holds names of your *internal tables

    APPEND 'LT_SBOOK' TO lt_tables.

    APPEND 'LT_SFLIGHT' TO lt_tables.

    *data selection

    SELECT * FROM sflight

    INTO TABLE lt_sflight

    WHERE carrid = 'LH'.

    SELECT *

    FROM sbook UP TO 20 ROWS

    INTO TABLE lt_sbook.

    LOOP AT lt_tables INTO lv_name.

    CONCATENATE 'C:\'

    lv_name

    '.txt'

    INTO lv_file_name.

    ASSIGN (lv_name) TO <fs_table>.

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    filename = lv_file_name

    IMPORTING

    filelength = lv_file_length

    TABLES

    data_tab = <fs_table>

    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2005 at 02:56 AM

    Hi

    To download data from Internal table to presentation server make use of the funcion ws_download where in function wud ask for the internal table.secondly for dynamically selecting the table u shud define a field symbol and based on the user selection u shud assign the internal table to the field symbol and same has to be passed on to the function called ws_download.

    regards

    suresh krishnan

    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.