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 - Transfer to Problem

Former Member
0 Likes
624

Hello ABAP Gurus,

When I perform OPEN DATASET for INPUT in Text Mode with default encoding, and do transfer I encounter the following problems :

1. I have to convert mandatorily all the Decimal fields of the Internal Table structure to Character.

My Question is : Is it necessary???

2 When I perform transfer <var> to filename, the <var> length is 512 inspite of this it puts only 100

odd characters.

My Question : Am I doing something wrong???

My Code :

DATA : fname(80) VALUE '/bdcusers/test.dat'.

DATA : BEGIN OF i_tab,

rcomponen(18),

month1(30), " these were actually : typedec 23- 5

month2(30),

month3(30),

month4(30),

month5(30),

month6(30),

month7(30),

month8(30),

month9(30),

month10(30),

month11(30),

month12(30),

total(30),

srno(8),

END OF i_tab.

OPEN DATASET fname FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT. "WITH SMART LINEFEED.

LOOP AT it_data INTO i_data.

MOVE-CORRESPONDING i_data TO i_tab.

CONCATENATE i_tab-rcomponen i_tab-month1 i_tab-month2

i_tab-month3 i_tab-month4 i_tab-month5 i_tab-month6

i_tab-month7 i_tab-month8 i_tab-month9 i_tab-month10

i_tab-month11 i_tab-month12 i_tab-total i_tab-srno

INTO xtab SEPARATED BY '|'.

TRANSFER i_tab TO fname. " LENGTH 1024.

ENDLOOP.

CLOSE DATASET fname.

Any help in this regard will be highly appreciated.

Regds,

JGupta

Hello ABAP Gurus,

When I perform OPEN DATASET for INPUT in Text Mode with default encoding, and do transfer I encounter the following problems :

1. I have to convert mandatorily all the Decimal fields of the Internal Table structure to Character.

My Question is : Is it necessary???

2 When I perform transfer <var> to filename, the <var> length is 512 inspite of this it puts only 100

odd characters.

My Question : Am I doing something wrong???

My Code :

DATA : fname(80) VALUE '/bdcusers/test.dat'.

DATA : BEGIN OF i_tab,

rcomponen(18),

month1(30), " these were actually : typedec 23- 5

month2(30),

month3(30),

month4(30),

month5(30),

month6(30),

month7(30),

month8(30),

month9(30),

month10(30),

month11(30),

month12(30),

total(30),

srno(8),

END OF i_tab.

OPEN DATASET fname FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT. "WITH SMART LINEFEED.

LOOP AT it_data INTO i_data.

MOVE-CORRESPONDING i_data TO i_tab.

CONCATENATE i_tab-rcomponen i_tab-month1 i_tab-month2

i_tab-month3 i_tab-month4 i_tab-month5 i_tab-month6

i_tab-month7 i_tab-month8 i_tab-month9 i_tab-month10

i_tab-month11 i_tab-month12 i_tab-total i_tab-srno

INTO xtab SEPARATED BY '|'.

TRANSFER i_tab TO fname. " LENGTH 1024.

ENDLOOP.

CLOSE DATASET fname.

Any help in this regard will be highly appreciated.

Regds,

JGupta

1 REPLY 1
Read only

Former Member
0 Likes
410

Hi,

1. You can use this FM HR_99S_COPY_STRUC1_STRUC2 to convert the intrenal table wa to string type.From this you can overcome converting decimal fields to char fields. If ypu try to transfer the decimal fileds then it gives short dump so you need to convert to char type.

2. Regarding the number characters getting dispayed in the AL11 is restricted upon the configuration to how much to display. Try to download the same file after upload and check wether all the data is getting downloaded.

Edited by: Avinash Kodarapu on Jan 30, 2009 11:13 AM