Application Development 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: 

downloading problem

Former Member
0 Kudos

Dear friends,

There is a problem while i am downloading a file in text format.

out1(6) type c,

out2(6) type c,

out3(6) type c,

out1 = A78956. out2 = B54678. out3 = D58964.

concatenate out1 out2 out3 into write1.

o/p:

A78956 B54678 D58964

if out2 value is empty, then the out3 value is truncated with out1.

A78956 D58964

but i want the text file to be downloaded in the below format

A78956 D58964

6 spaces should be there in between the out1 and out3.

I am using WS_DOWNLOAD for downloading to text.

thanks & reagards

Arun

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

To solve your problem use offsets.

Follow this below code.

out1(6) type c,

out2(6) type c,

out3(6) type c,

result(18) type c.

out1 = A78956. out2 = B54678. out3 = D58964.

result+0(6) = out1.

result+6(6) = out2.

result+12(6) = out3.

Then download it using FM GUI_DOWNLOAD (WS_DOWNLOAD is now obsolute).

This will def solve your problem.

If so please mark this question answered.

Regards.

4 REPLIES 4

Former Member
0 Kudos

Hi arun,

WS_DOWNLOAD is an absolete fn mode and pls avoid using that.

Use the fn mod GUI_DOWNLOAD.

<b>Pls reward if helpful.</b>

Former Member
0 Kudos

Hi,

To solve your problem use offsets.

Follow this below code.

out1(6) type c,

out2(6) type c,

out3(6) type c,

result(18) type c.

out1 = A78956. out2 = B54678. out3 = D58964.

result+0(6) = out1.

result+6(6) = out2.

result+12(6) = out3.

Then download it using FM GUI_DOWNLOAD (WS_DOWNLOAD is now obsolute).

This will def solve your problem.

If so please mark this question answered.

Regards.

Former Member
0 Kudos

Hi

see this program for downloading

parameters: P_DSNI(75) TYPE C MODIF ID ABG DEFAULT

'/usr/local/sapdata/amit.dat' LOWER CASE.

data: begin of itab occurs 0,

pernr(8),

sp1(1) value ',',

werks(4),

sp2(1) value ',',

persg(1),

sp3(1) value ',',

persk(2),

end of itab.

OPEN DATASET P_DSNI FOR OUTPUT IN LEGACY TEXT MODE.

PERFORM FETCH_DATA.

&----


*& Form FETCH_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FETCH_DATA .

SELECT * FROM PA0001 WHERE PERNR IN S_PERNR.

MOVE-CORRESPONDING PA0001 TO ITAB.

TRANSFER ITAB TO P_DSNI.

APPEND ITAB.

ENDSELECT.

CLOSE DATASET P_DSNI.

ENDFORM. " FETCH_DATA

Former Member
0 Kudos

Try this it may work

data : text1(6) ,"value 'ABCDEF',

text2(6) value 'SDFGHJ',

text3(6) value 'GHIJKL',

result(30),

pos type i.

if text1 is initial.

do 6 times.

text1+pos(1) = '*'.

pos = pos + 1.

enddo.

endif.

if text2 is initial.

do 6 times.

text2+pos(1) = '*'.

pos = pos + 1.

enddo.

endif.

concatenate text1 text2 text3 into result separated by space.

translate result using '* '.

write : / result.

regards

shiba dutta