‎2005 Jan 03 4:16 PM
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
‎2005 Jan 03 4: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
‎2005 Jan 03 5: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
‎2005 Jan 04 3:01 PM
Hi,
Thank u very much for your help.
I implemented ur technique.
the sample code is
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>.
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.
When i executed, i got the dump.
its stated
Error analysis
You attempted to access an unassigned field symbol
(data segment 32770).
This error occurs:
- if you address a typed field symbol before it has been set with
ASSIGN or
- if you address a field symbol that has been reset with UNASSIGN
or pointed to a local field that no longer exists, or
- if you address a field symbol that pointed to a line of an internal
table that has now been deleted, or
- if you address a global function interface partameter, even
though the relevant function module is not active,
i.e. it is not in the list of active calls. You can get the list
of active calls from the this short dump.
Plz kindly help me in this regard
sree
‎2005 Jan 04 3:22 PM
According to the dump you have failed to assign the internal table. To find out what happened you should debug the asssing statement and check the contents of lv_tabname. Make sure that it contains the variablename of the internal table in capital letters.
Since there are no apostrophes around TBL_MASTER (and the others) , I assume that TBL_MASTER holds the name of the internal table. If it is the internal table, use 'TBL_MASTER'.
BTW to avoid dumps make sure to check sy-subrc = 0 after the assign statement.
Christian
‎2005 Jan 04 3:53 PM
Hi Sree,
Change your code as follows.
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
‎2005 Jan 05 2:38 PM
Hi frinds,Problem again.
sanmple code
FORM download_file USING P_P_FILE1.
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>.
ELSE.
Message E000(0) with 'not assigned'.
ENDIF.
ENDFORM. " download_file
please do help me solve this
regards
sree
‎2005 Jan 05 3:18 PM
I can imagine that the lover case t in 'TBL_MAtSTR' gives problems.
Ferdi
‎2005 Jan 06 7:49 AM
Hi,
No problem with the case as i did not used that options..
i was checking with screen no 140 only.
plz help me
regards
sree
‎2005 Jan 06 10:52 AM
Does it still dump, or does it run into your error message
What is the value of lv_tabname?
Can you show us the part where you have declared the internal table?
Does your internal table have a header? in this case you have to assign ('TAB_MATSTR[]') to the field symbol (in this case the brackets indicate that you were referring to the body not the header.
Christian
‎2005 Jan 06 3:20 PM
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
‎2005 Jan 03 7: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.
‎2005 Jan 04 2: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