01-29-2008 8:51 AM
Hi all,
I am trying to transfer data from my internal table to application server. When i use
Open Dataset e_file for output in text mode encoding Default
Statement its throwing run time error as
The current statement is defined for character-type data objects only.
My internal table consist of many fields(more than sixty) from tables BSEC,BSEG,KNA1,T001,T880,PAYR. Plz help me to resolve this.
Thanks
Dhurga R
01-29-2008 8:55 AM
Your internal table must have some field/fields whose data type is not character type. 'Open dataset' only allowed for character type data types. so before transfering to application server convery all of your data type as character type and then transfer.
01-29-2008 8:55 AM
Your internal table must have some field/fields whose data type is not character type. 'Open dataset' only allowed for character type data types. so before transfering to application server convery all of your data type as character type and then transfer.
01-29-2008 8:55 AM
It allows to transfer only character type data.So, declare the internal table field as character type.
01-29-2008 8:56 AM
01-29-2008 8:55 AM
Dhurga,
This is the area where you are getting error.Better to paste your code here.
01-29-2008 8:55 AM
Put the cursor on the keyword OPEN and press F1, than read the online help. Do that before asking here. Its clearly stated in the online help on how to output binary data.
01-29-2008 9:00 AM
Hi see this program where
EXCEL to INTERNAL table and then to APPLICATION SEVER
&----
*& Report ZSD_EXCEL_INT_APP
*&
&----
*&
*&
&----
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 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.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop.
03-05-2008 9:06 AM
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
Mention the file name P_file correctly. U have defaulted the file name with out giving the path (directory) name.
The file name should start with \<directory path>\TEST3.txt