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

What is the best way to send 8 lakh records from ZTABLE to FTP location in XML file.

0 Likes
1,482

Hello all

What is the best way to send 8 lakh records from ZTABLE to FTP location in XML file.

System: SAP BASIS 6.2 SP57

While i am doing it in Z program i get numerous dumps.

Runtime errors:

1. tvs_tnew_page_alloc_failed Description: No storage available for extending the internal table.

2. Runtime errors: call_function_remote_error Description: The termination occurred in the ABAP program ""SAPLSFTP"" in ""FTP_R3_TO_SERVER""." Showing nothing (only like that "" "")

Any suggestion of handling bulk data.

Sachin Jain

1 ACCEPTED SOLUTION
Read only

former_member228164
Participant
0 Likes
1,130

Try to use the Underneath Function Modules and tell if it works(Depends on ur EHP version)...

Regards,

Abid Ali

SAP Abap Consultant

type-pools: ixml.

tables: vbak.

types: begin of ty_vbak,
vbeln type vbak-vbeln,
auart type vbak-auart,
end of ty_vbak.

data: ty_ftp type standard table of zftpinfo,
wa_ftp type zftpi,
l_slen type i,
lv_user(30) type c,
lv_pwd(30) type c,
c_key type i value 26101957.

data: begin of t_title occurs 0,
title(4000) type c,
end of t_title.
data: temp_file(200) type c.
data: to_file type char30000.
data: c_gw type string.
data: mi_handle type i.

data: t_vbak type ty_vbak occurs 0 with header line.

selection-screen begin of block b1 with frame title text-001.
select-options: so_num for vbak-vbeln.
selection-screen end of block b1.

*START OF SELECTION
start-of-selection.

select
vbeln auart
from vbak into corresponding fields of table t_vbak
where vbeln in so_num.

"" FOR GETTING FTP SEVER CONNECTION INFO FROM MAINTAING TABLE

select * from zftpinfo client specified
into corresponding fields of table ty_ftp
where mandt = sy-mandt
and zcountry = 'BD'.

clear wa_ftp.
read table ty_ftp into wa_ftp index 1.

*CONNECTING TO FTP SERVER.
perform ftp_connect using wa_ftp-zuser wa_ftp-zpasswd wa_ftp-zhost.

*CHECKING SUCCESSFUL FTP CONNECTION
check sy-subrc = 0.

if t_vbak[] is not initial.
perform c_xml. " FOR CREATING XML FILE
endif.

form c_xml.

clear t_title[].

*SERVER DESTINATION FILE PATH.
concatenate 'SERVER FILE PATH' 'SOINFO' '.xml' into to_file.

*BUILDING THE XML FILE
t_title-title = '<?xml version="1.0" encoding="UTF-8"?>'.
append t_title.
t_title-title = '<n1:SalesOderInfo xmlns:n1="SalesOderInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.
append t_title.

loop at t_vbak.
concatenate '<SONUM>' t_vbak-vbeln '</SONUM>' into temp_file.
t_title-title = temp_file.
append t_title.
clear temp_file.

concatenate '<DOCTYPE>' t_vbak-auart '</DOCTYPE>' into temp_file.
t_title-title = temp_file.
append t_title.
clear temp_file.

endloop.

t_title-title = '</n1:SalesOderInfo>'.
append t_title.

perform r3_ftp using to_file.
endform.


form r3_ftp using to_file.
call function 'FTP_R3_TO_SERVER'
exporting
handle = mi_handle
fname = to_file "file path of destination system
character_mode = 'X'
tables
text = t_title
exceptions
tcpip_error = 1
command_error = 2
data_error = 3
others = 4.
endform.

form ftp_connect using lv_user lv_pwd lv_host.

l_slen = strlen( lv_pwd ).

call function 'HTTP_SCRAMBLE'
exporting
source = lv_pwd
sourcelen = l_slen
key = c_key
importing
destination = lv_pwd.

call function 'FTP_CONNECT'
exporting
user = lv_user "Your SAP-UNIX FTP user name (case sensitive)
password = lv_pwd "Your SAP-UNIX server host name (case sensitive)
host = lv_host
rfc_destination = 'SAPFTPA'
importing
handle = mi_handle
exceptions
not_connected = 1
others = 2.

endform.

7 REPLIES 7
Read only

former_member228164
Participant
0 Likes
1,131

Try to use the Underneath Function Modules and tell if it works(Depends on ur EHP version)...

Regards,

Abid Ali

SAP Abap Consultant

type-pools: ixml.

tables: vbak.

types: begin of ty_vbak,
vbeln type vbak-vbeln,
auart type vbak-auart,
end of ty_vbak.

data: ty_ftp type standard table of zftpinfo,
wa_ftp type zftpi,
l_slen type i,
lv_user(30) type c,
lv_pwd(30) type c,
c_key type i value 26101957.

data: begin of t_title occurs 0,
title(4000) type c,
end of t_title.
data: temp_file(200) type c.
data: to_file type char30000.
data: c_gw type string.
data: mi_handle type i.

data: t_vbak type ty_vbak occurs 0 with header line.

selection-screen begin of block b1 with frame title text-001.
select-options: so_num for vbak-vbeln.
selection-screen end of block b1.

*START OF SELECTION
start-of-selection.

select
vbeln auart
from vbak into corresponding fields of table t_vbak
where vbeln in so_num.

"" FOR GETTING FTP SEVER CONNECTION INFO FROM MAINTAING TABLE

select * from zftpinfo client specified
into corresponding fields of table ty_ftp
where mandt = sy-mandt
and zcountry = 'BD'.

clear wa_ftp.
read table ty_ftp into wa_ftp index 1.

*CONNECTING TO FTP SERVER.
perform ftp_connect using wa_ftp-zuser wa_ftp-zpasswd wa_ftp-zhost.

*CHECKING SUCCESSFUL FTP CONNECTION
check sy-subrc = 0.

if t_vbak[] is not initial.
perform c_xml. " FOR CREATING XML FILE
endif.

form c_xml.

clear t_title[].

*SERVER DESTINATION FILE PATH.
concatenate 'SERVER FILE PATH' 'SOINFO' '.xml' into to_file.

*BUILDING THE XML FILE
t_title-title = '<?xml version="1.0" encoding="UTF-8"?>'.
append t_title.
t_title-title = '<n1:SalesOderInfo xmlns:n1="SalesOderInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.
append t_title.

loop at t_vbak.
concatenate '<SONUM>' t_vbak-vbeln '</SONUM>' into temp_file.
t_title-title = temp_file.
append t_title.
clear temp_file.

concatenate '<DOCTYPE>' t_vbak-auart '</DOCTYPE>' into temp_file.
t_title-title = temp_file.
append t_title.
clear temp_file.

endloop.

t_title-title = '</n1:SalesOderInfo>'.
append t_title.

perform r3_ftp using to_file.
endform.


form r3_ftp using to_file.
call function 'FTP_R3_TO_SERVER'
exporting
handle = mi_handle
fname = to_file "file path of destination system
character_mode = 'X'
tables
text = t_title
exceptions
tcpip_error = 1
command_error = 2
data_error = 3
others = 4.
endform.

form ftp_connect using lv_user lv_pwd lv_host.

l_slen = strlen( lv_pwd ).

call function 'HTTP_SCRAMBLE'
exporting
source = lv_pwd
sourcelen = l_slen
key = c_key
importing
destination = lv_pwd.

call function 'FTP_CONNECT'
exporting
user = lv_user "Your SAP-UNIX FTP user name (case sensitive)
password = lv_pwd "Your SAP-UNIX server host name (case sensitive)
host = lv_host
rfc_destination = 'SAPFTPA'
importing
handle = mi_handle
exceptions
not_connected = 1
others = 2.

endform.

Read only

0 Likes
1,130

Hi Abid

Thanks for response. Let me rewrite program as per your suggestions, and i will revert if it is working or not.

Sachin

Read only

Sandra_Rossi
Active Contributor
1,130

LAKH = Indian word for one hundred thousands

Read only

0 Likes
1,130

Hi Abid

It works for some set of records but when another data set is used, it gives same dump. We are further investigating.

Sachin

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,130

Thanks! Gets me every time. 🙂

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,130

On (1) what did you search for exactly if you didn't find any helpful information online? I googled "tvs_tnew_page_alloc_failed" and it found 7690 items, Wiki pages, SCN posts, etc.

On (2) check in your system, there is much more information in the short dump. Again - Google.

Read only

0 Likes
1,130

Hi

It is working using the suggested code in this thread and i have tested with few sets of data. This thread can be marked as answered.

Sachin