‎2008 Sep 04 10:22 AM
Hi all,
Below i have a program where i am trying to put data into application server
Firstly my data is well placed in application server in a well alligned way.
But when i am trying to put the same data placed in application server to another system using FTP.
the data is transffered but the allignment is not correct.
Frnds i wanted to know that do i need to make any changes
in the current program or any other thing.
Respond to my query frnds.
<code>
REPORT Ztest_prg line-count 65 line-size 160 no standard page heading.
tables: zissts, vbak.
*primary selection Criteria
SELECTION-SCREEN BEGIN OF BLOCK BLK0 WITH FRAME TITLE TEXT-001.
select-options so_kunnr for zissts-kunnr no intervals.
select-options so_bdate for vbak-erdat.
select-options so_tdate for zissts-zzdepdate.
PARAMETERS: P_dsn(90) TYPE C LOWER CASE.
SELECTION-SCREEN end OF BLOCK BLK0.
types: begin of ty_data,
vbeln like vbak-vbeln,
zztour_pr like zissts-zztour_pr,
zzcom like zissts-zzcom,
names(100),
end of ty_data.
types: begin of ty_file,
vbeln(10),
zztour_pr(15),
zzcom(15),
names(100),
end of ty_file.
data it_file type ty_file occurs 0 with header line.
data it_data type ty_data occurs 0 with header line.
data it_zissts like zissts occurs 0 with header line.
data it_zissph like zissph occurs 0 with header line.
data c_name(50).
start-of-selection
start-of-selection.
perform select-data.
perform preapre-data.
perform download-data.
perform write-data.
end-of-selection.
&----
*& Form SELECT-DATA
&----
text
----
--> p1 text
<-- p2 text
----
FORM SELECT-DATA .
select * from zissts into table it_zissts
where zzdepdate in so_tdate
and kunnr in so_kunnr
and zzactflg = 'X'
and zzbkst = 'PIF'.
if not so_bdate is initial.
Loop at it_zissts.
select single * from vbak
where vbeln = it_zissts-vbeln
and erdat in so_bdate.
if sy-subrc <> 0.
delete it_zissts.
endif.
endloop.
endif.
if not it_zissts[] is initial.
select * from zissph into table it_zissph
for all entries in it_zissts
where vbeln = it_zissts-vbeln
and zzpbkst <> 'EXP'
and zzpbkst <> 'CANC'.
endif.
ENDFORM. " SELECT-DATA
&----
*& Form PREAPRE-DATA
&----
text
----
--> p1 text
<-- p2 text
----
FORM PREAPRE-DATA .
sort it_zissts by vbeln.
sort it_zissph by vbeln zzpax_id descending.
loop at it_zissts.
move-corresponding it_zissts to it_data.
loop at it_zissph where vbeln = it_zissts-vbeln.
concatenate it_zissph-zzname_fst it_zissph-zzname_lst into c_name separated by ' '.
concatenate c_name it_data-names into it_data-names separated by ','.
clear c_name.
endloop.
append it_data.
clear it_data.
endloop.
ENDFORM. " PREAPRE-DATA
&----
*& Form DOWNLOAD-DATA
&----
text
----
--> p1 text
<-- p2 text
----
FORM DOWNLOAD-DATA .
LOOP AT IT_data.
write it_data-vbeln to it_file-vbeln.
write it_data-zztour_pr to it_file-zztour_pr.
write it_data-zzcom to it_file-zzcom.
write it_data-names to it_file-names.
move-corresponding it_data to it_file.
append it_file.
endloop.
concatenate p_dsn 'gepayfeed' sy-datum '.txt' into p_dsn.
OPEN DATASET P_DSN FOR OUTPUT IN text mode encoding default.
IF SY-SUBRC NE 0.
IF SY-BATCH NE SPACE.
WRITE:/2 'Error opening file', P_DSN.
ELSE.
MESSAGE I911(FB) WITH 'Error opening file' P_DSN.
LEAVE PROGRAM.
ENDIF.
ENDIF.
loop at it_file.
TRANSFER IT_file TO P_DSN.
endloop.
Close File
close dataset p_dsn.
ENDFORM. " DOWNLOAD-DATA
&----
*& Form WRITE-DATA
&----
text
----
--> p1 text
<-- p2 text
----
FORM WRITE-DATA .
uline (160).
loop at it_data.
write:/ it_data-vbeln , it_data-zztour_pr ,
it_data-zzcom , it_data-names.
endloop.
uline (160).
</code>
regards,
kamal
‎2008 Sep 04 10:57 AM
‎2008 Sep 04 12:59 PM
hi,
there is no code in your prog to transfer the file to FTP. where to find the error?
also, what is the use of the "write" statement in the write_data subroutine?
i had developed a program once with exactly the same requirement. it was working perfectly. but i couldnt find the code for FTP so i am confused.
‎2008 Sep 04 1:02 PM