Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

open dataset

Former Member
0 Likes
654

i have written below code.

IF NOT it_final_itab[] IS INITIAL.

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.

IF sy-subrc NE 0.

MESSAGE 'Error on output file read' TYPE 'E'.

ELSE.

LOOP AT it_final_itab INTO wa_final_itab.

TRANSFER wa_final_itab TO p_file.

ENDLOOP.

CLOSE DATASET p_file.

ENDIF.

ENDIF.

when i am executing i am getting following error dump

Only character-type data objects are supported at the argument

position "f" for the statement

"TRANSFER f TO ...".

In this case, the operand "f" has the non-character-type "ST_FINAL_ITAB". The

current program is flagged as a Unicode program. In the Unicode context,

type X fields are seen as non-character-type, as are structures that

contain non-character-type components.

kindly help me on this.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
618

Hi,

data : l_line type string.

Open dataset p_file for output in text mode encoding default.

If sy-subrc ne 0.

error message.

endif.

else.

loop at it_final_itab into wa_final_itab.

concatenate wa_final_itab-field1

wa_final_itab-field2

wa_final_itab-field3

.

.

.

into l_line seperated by ','. (seperated by ',' ,'|' according to your requirement).

Transfer l_line to p_file.

endloop.

close dataset p_file.

endif.

endif.

If you are using quantity fields (like kwmeng) or price fields (netwr) then you have to assign that field to char and then you have to use.

Suppose if you are using quantity field (kwmeng) then

data :l_kwmeng (19) type c,

l_line type string.

Open dataset p_file for output in text mode encoding default.

If sy-subrc ne 0.

error message.

endif.

else.

loop at it_final_itab into wa_final_itab.

clear l_kwmeng.

l_kwmeng = wa_final_itab-kwmeng.

concatenate wa_final_itab-field1

wa_final_itab-field2

wa_final_itab-field3

.

.

.

l_kwmeng

into l_line seperated by ','. (seperated by ',' ,'|' according to your requirement).

Transfer l_line to p_file.

endloop.

close dataset p_file.

endif.

endif.

Hope this is clear,

thanks.

4 REPLIES 4
Read only

Former Member
0 Likes
618

Hi,

There is problem with the Syntac Check It once.

type F is not allowed while uploading into a file..............this is treated as non-charecter formate....................so write into a another character field and use that while uploading into the application server.

Read only

Former Member
0 Likes
618

Hi,

type F is not allowed while uploading into a file..............this is treated as non-charecter formate....................so write into a another charecter field and use that while uploading into the application server.

Regards,

Vamshidhar.

Read only

Former Member
0 Likes
618

hi use this ..

data: outrec(200) type c .

IF NOT it_final_itab[] IS INITIAL.

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING default.

LOOP AT it_final_itab.

output0(10) = it_final_itab0(10) .

output10(10) = it_final_itab10(10) .

output20(10) = it_final_itab20(10) .

transfer outrec to p_file .

ENDLOOP.

CLOSE DATASET p_file.

ENDIF.

ENDIF.

regards,

venkat.

Read only

Former Member
0 Likes
619

Hi,

data : l_line type string.

Open dataset p_file for output in text mode encoding default.

If sy-subrc ne 0.

error message.

endif.

else.

loop at it_final_itab into wa_final_itab.

concatenate wa_final_itab-field1

wa_final_itab-field2

wa_final_itab-field3

.

.

.

into l_line seperated by ','. (seperated by ',' ,'|' according to your requirement).

Transfer l_line to p_file.

endloop.

close dataset p_file.

endif.

endif.

If you are using quantity fields (like kwmeng) or price fields (netwr) then you have to assign that field to char and then you have to use.

Suppose if you are using quantity field (kwmeng) then

data :l_kwmeng (19) type c,

l_line type string.

Open dataset p_file for output in text mode encoding default.

If sy-subrc ne 0.

error message.

endif.

else.

loop at it_final_itab into wa_final_itab.

clear l_kwmeng.

l_kwmeng = wa_final_itab-kwmeng.

concatenate wa_final_itab-field1

wa_final_itab-field2

wa_final_itab-field3

.

.

.

l_kwmeng

into l_line seperated by ','. (seperated by ',' ,'|' according to your requirement).

Transfer l_line to p_file.

endloop.

close dataset p_file.

endif.

endif.

Hope this is clear,

thanks.