How best store files on application server: Tables vs File system
Hi Experts,
We want to let users to upload files to application server. The number of files can potencially grow over time (1000 files every month) though I whould like to limit size of each file not more than 1-2 MB.
Also files should be classified (having custom attributes) so later on we need to search, select files according to attributes.
So what are the best options in long run (for performance, reliability etc)?
We have NW system 7.0 with MaxDB
I can think of the following options:
1. Store files in TRANSPARENT table in RAWSTRING. Easiest variant (to select files etc) Here I have concerns how this table and database behave after some period of time and what will happen if size will grow to let say 50 GB. Will it work? What are normal size limits for transparent tables?
2. Store files in CLUSTER table in RAWSTRING. Less convenient to work with (joins are not allowed etc). Will cluster table help to handle big size of table? What are practical size limits for cluster tables?
3. Store files on file system (on application server) and write info (attributes etc) into ztable. Select from ztable and read content file from file system (dataset commands?). So files will be written to one directory just one after another.
What are the best option to follow? I would personally prefer option 1 as easiest but have servious concerns regarding size of one transparent table.
What do you recommend?
Regards,
Dmitry.
Edited by: Dmitry Kalmykov on Jul 28, 2009 8:58 AM
Hi,
I too feel that option 1 would be best choice.
For your ref: Check the Transp.table REPOSRC and the field name DATA
Also Check the technical settings (Size category).
Similar Messages
-
Transfer file in application server to another file
Hello guys I have another major hurdle I am encountering for a little task I am doing.
I need to send a downloaded file within the SAP application server to another file automatically using ABAP via Background Processing(most preferable a directory in the <b>newtwork</b>).
What I need to do is, after saving a list from an abap report and saves in the application server (which I have already done), I need it to transport to a the web server. All done in background.
I really appreciate the help you guys have given to me thus far. Thank you guys and take care.Hi
U have to use unix command for same
i have seen some function module just check it out
SXPG_CALL_SYSTEM you can check the user's authorization for the specified command and run the command. The command runs on the host system on which the function module is executed. The function module is RFC capable. It can therefore be run on the host system at which a user happens to be active or on another designated host system at which an R/3 server is active.
<b>SXPG_COMMAND_CHECK</b> Check whether the user is authorized to execute the specified command on the target host system with the specified arguments.
<b>SXPG_COMMAND_DEFINITION_GET</b> Read the definition of a single external OS command from the R/3 System's database.
<b>
SXPG_COMMAND_EXECUTE</b> Check a user's authorization to use a command, as in SXPG_COMMAND_CHECK. If the authorization check is successful, then execute the command on the target host system.
<b>SXPG_COMMAND_LIST_GET</b> Select a list of external OS command definitions.
<b>RZL_READ_DIR_LOCAL</b> Read a directory on the Application Server
<b>SUBST_GET_FILE_LIST</b> Return table with file list for the given directory (pattern allowed)
regards
vinod -
How to download file from application server to local file using tcode
Hi,
I want to download one report output in application sever(/temp/xxx) to local.
But downloaded excel sheet improper format.
In downloaded excel sheet having one complete record(12 fields) in one cell.
I want to separate it each field in each cell in proper format..[requirement]
restriction : without using any programs using standard tcode like CG3Y.
THANKS IN ADVANCE....
Regards,
Ragavendran K.
Moderator message: please search for available information/documentation before asking.
Edited by: Thomas Zloch on Dec 21, 2010 5:15 PMIn downloaded excel sheet having one complete record(12 fields) in one cell.
You did it wrong then. Post your code and someone will tell you what's wrong with it (or you could search the forum). -
How to Upload Excel file to Application Server
Hi Friends,
ALSM_EXCEL_TO_INTERNAL_TABLE this F.M is to upload the excel format into internal table , The problem here is after uploading the excel file the format has been changed according to the F.M ... so Im not able to compare the value with my final internal table because the structure is different ... even if I could match with the values Im not able to upload it to my application server ... is there any F.M which doesn't change the excel format and upload it to the internal table ? ... Or is there any other way of doing it other than using at new , case endcase. ? ...
Thanks in advance ...
CheersHi friend,
Simply use GUI_UPLOAD function to get data from excel, txt etc.., into internal table in program.
Try this program.. It performs downloading and uploading functions in both excel and .txt format.
*& Report ZAWI_DEMODOWNLOAD *
REPORT zawi_demodownload .
*Types
TYPES: BEGIN OF g_r_mara,
matnr LIKE mara-matnr,
ersda LIKE mara-ersda,
laeda LIKE mara-laeda,
mtart LIKE mara-mtart,
mbrsh LIKE mara-mbrsh,
END OF g_r_mara.
TYPES: BEGIN OF g_r_mara1,
matnr TYPE string,
ersda TYPE string,
laeda TYPE string,
mtart TYPE string,
mbrsh TYPE string,
END OF g_r_mara1.
*Data
DATA: g_t_mara TYPE TABLE OF g_r_mara,
g_t_mara1 TYPE TABLE OF g_r_mara,
g_t_mara2 TYPE TABLE OF g_r_mara1,
filename TYPE string,
f1 TYPE string,
f2 TYPE string,
x TYPE string,
x1 TYPE string,
x2 TYPE string,
x3 TYPE strng,
c TYPE string,
g_r_wa TYPE g_r_mara,
g_r_wa1 TYPE g_r_mara1,
g_r_wa2 TYPE g_r_mara1,
g_t_mara2 TYPE TABLE OF g_r_mara1,
str TYPE string.
*Tables
TABLES: mara.
*Selection Screen
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 10(20) text-001 FOR FIELD p1.
PARAMETERS:p1 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 10(20) text-002 FOR FIELD p2.
PARAMETERS p2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF LINE.
*Input validation.
DATA: s_high TYPE mara-matnr,
s_low TYPE mara-matnr.
AT SELECTION-SCREEN ON s_matnr.
IF NOT s_matnr-high IS INITIAL.
s_high = s_matnr-high.
SELECT SINGLE * FROM mara WHERE matnr = s_high.
IF sy-subrc <> 0.
IF NOT s_matnr-low IS INITIAL.
s_low = s_matnr-low.
SELECT SINGLE * FROM mara WHERE matnr = s_low.
IF sy-subrc <> 0.
MESSAGE e012(zawi_demo).
ELSE.
MESSAGE e011(zawi_demo).
ENDIF.
ENDIF.
ENDIF.
AT SELECTION-SCREEN.
SELECT SINGLE * FROM mara WHERE matnr IN s_matnr.
IF sy-subrc <> 0.
IF s_matnr-low IS INITIAL.
str = s_matnr-high.
ELSE.
str = s_matnr-low.
ENDIF.
MESSAGE e010(zawi_demo) WITH str..
ENDIF.
START-OF-SELECTION.
*Data retrival
SELECT matnr ersda laeda mtart mbrsh
INTO CORRESPONDING FIELDS OF TABLE g_t_mara
FROM mara
WHERE matnr IN s_matnr.
IF p1 = 'X'.
filename = 'C:\Testing.xls'.
Downloading data from internal table to excel or txt
f1 = filename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = filename
filetype = 'ASC'
append = 'X'
write_field_separator = 'X'
col_select = 'X'
TABLES
data_tab = g_t_mara.
ELSE.
filename = 'C:\Testing.txt'.
f2 = filename.
LOOP AT g_t_mara INTO g_r_wa.
CONCATENATE g_r_wa-matnr ';' INTO g_r_wa1-matnr.
CONCATENATE g_r_wa-ersda ';' INTO g_r_wa1-ersda.
CONCATENATE g_r_wa-laeda ';' INTO g_r_wa1-laeda.
CONCATENATE g_r_wa-mtart ';' INTO g_r_wa1-mtart.
CONCATENATE g_r_wa-mbrsh ';' INTO g_r_wa1-mbrsh.
APPEND g_r_wa1 TO g_t_mara2.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = filename
filetype = 'ASC'
append = 'X'
write_field_separator = 'X'
col_select = 'X'
TABLES
data_tab = g_t_mara2.
ENDIF.
Uploading data from excel to internal table 1
IF filename = f1.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = g_t_mara1.
WRITE: / 'Uploaded data' COLOR = 1.
WRITE:/.
CLEAR g_r_wa.
LOOP AT g_t_mara1 INTO g_r_wa.
WRITE:/ g_r_wa-matnr, g_r_wa-ersda, g_r_wa-laeda, g_r_wa-mtart, g_r_wa-mbrsh.
ENDLOOP.
ELSE.
IF filename = f2.
IF sy-subrc <> 0.
ENDIF.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
filetype = 'ASC'
has_field_separator = 'X'
replacement = ''
TABLES
data_tab = g_t_mara2.
WRITE: / 'Uploaded data' COLOR = 1.
WRITE:/.
CLEAR g_r_wa1.
LOOP AT g_t_mara2 INTO g_r_wa1.
g_r_wa2-matnr = g_r_wa1-matnr.
TRANSLATE g_r_wa2-matnr USING '; ' .
WRITE:/ g_r_wa2-matnr, g_r_wa2-ersda, g_r_wa2-laeda, g_r_wa2-mtart, g_r_wa2-mbrsh.
CLEAR g_r_wa2.
ENDLOOP.
ENDIF.
ENDIF.
OR
Use T-codes:
CG3Y - Download file - Download file from Application server
CG3Z - Upload file - Upload file to Application server -
Urgent : Download file from Application Server via Process Chain.
Hi Experts,
My requirement is to download the file from Application Server to local work station using an ABAP Program .
I want including the above ABAP program in a process chain to execute the program daily,
I tried to use ARCHIVFILE_SERVER_TO_CLIENT and GUI_DOWNLOAD but unfortunately both the above FM doesn't support to run through Process chain.
Can any one of you help me to send the code which selects a file from application server, downloads to local system and deletes it.
Thank you very much for spending your precious time in this regard.Hi Sailekha,
Regarding your case ..
I suggest you to create the program where it run this function: WS_DOWNLOAD.
After it, the program is run by your process chain.
Hopefully it can help you a lot.
Regards,
Niel.
thanks for the points you choose to assign. -
How to store file in Application server.
Hi all,
I have done a report where using excel sheet data i hv to insert in ztable. I have done it i hav converted excel sheet data into internal table and then inserted into ztable. It is working properly. using p_file like rlgraph-filename i have taken the parameter and function module filename_f4 uploaed file.
Now i when i am runing the report it is inserting properly in foreground. But i have requirement that i have to run the report in background but it is giving error in background. So what i do is the excel sheet which i take as input should be stored in Application server and then i have to pick up the file from application server during the background process. So any body can tell me how to write the program to store file in application server and pickup that file again to run it in background.
<b>useful answers will be rewarded</b>
Regards,
Sunil kumar.HI
see this program where EXCEL to INTERNAL TABLE and then TO APPLICATION server
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
* PROGRAM_NAME = SYST-REPID
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
STATIC = 'X'
* MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop. -
How to upload a file in application server to an internal table
Hi,
I am asked to upload a file from application server to internal table. Can you please suggest me the ways to do it or the function module which helps to browse the application server file names.
I have done a program. But its giving problem in searching the files from application server. I am pasting my code for ur review. Please tell me which part i have to correct or suggest me some other ways to do it.
*& Report ZUPLOAD1
REPORT ZUPLOAD1.
type-pools: truxs.
parameters: p_upl_ps radiobutton group g1 default 'X', "upload from pres. server
p_path type rlgrap-filename,
p_upl_as radiobutton group g1, "upload from appln server
<b>p_dir LIKE filepath-pathintern DEFAULT 'Y_ABAP',
p_file LIKE filepath-pathintern lower case,</b>
p_test as checkbox.
constants: c_x value 'X',
c_tab type c value cl_abap_char_utilities=>horizontal_tab.
types: ty_data(1000) type c. "structure to hold legacy data
data: i_data type standard table of ty_data. "internal table of ty_data
types: begin of stritab,
land1 type v_t604-land1, "structure of legacy file.
stawn type v_t604-stawn,
bemeh type v_t604-bemeh,
impma type v_t604-impma,
minol type v_t604-minol,
end of stritab.
data: gi_itab type standard table of stritab, "internal table of legacy file
gw_itab type stritab. "work area
data: i_raw type truxs_t_text_data,
v_fullpath type string.
at selection-screen on value-request for p_path.
if p_upl_ps = c_x. "if presentation server is selected
perform get_file.
else. "if application server is selected
perform set_file_path.
perform upload_from_server.
perform split_data.
endif.
form get_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = p_path. "getting the file name of pres server
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X' "converting excel to sap and filling in
I_TAB_RAW_DATA = i_raw "internal table
I_FILENAME = p_path
TABLES
I_TAB_CONVERTED_DATA = gi_itab
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
form set_file_path. "Getting the file path of application server
data: lv_file type p_file.
lv_file = p_file.
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_PATH = p_dir
OPERATING_SYSTEM = SY-OPSYS
PARAMETER_1 = ' '
PARAMETER_2 = ' '
PARAMETER_3 = ' '
USE_BUFFER = ' '
FILE_NAME = lv_file
USE_PRESENTATION_SERVER = ' '
ELEMINATE_BLANKS = 'X'
IMPORTING
FILE_NAME_WITH_PATH = v_fullpath
EXCEPTIONS
PATH_NOT_FOUND = 1
MISSING_PARAMETER = 2
OPERATING_SYSTEM_NOT_FOUND = 3
FILE_SYSTEM_NOT_FOUND = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
form upload_from_server.
data: lv_msg type string,
lw_data type ty_data.
open dataset v_fullpath for input message lv_msg in text mode encoding default.
if sy-subrc <> 0.
message lv_msg type 'i'.
stop.
endif.
do.
read dataset v_fullpath into lw_data.
if sy-subrc <> 0.
write:/5 'Error in processign data set'.
exit.
endif.
append lw_data to i_data.
enddo.
close dataset v_fullpath.
if sy-subrc <> 0.
write: /5 'Error closing dataset'.
endif.
endform.
form split_data.
data: lw_data type ty_data.
data: lw_itab type stritab.
data: begin of ty_itab,
land1 type v_t604-land1,
stawn type v_t604-stawn,
bemeh type v_t604-bemeh,
impma type v_t604-impma,
minol type v_t604-minol,
end of ty_itab.
loop at i_data into lw_data.
split lw_data at c_tab into
ty_itab-land1
ty_itab-stawn
ty_itab-bemeh
ty_itab-impma
ty_itab-minol.
lw_itab-land1 = ty_itab-land1.
lw_itab-stawn = ty_itab-stawn.
lw_itab-bemeh = ty_itab-bemeh.
lw_itab-impma = ty_itab-impma.
lw_itab-minol = ty_itab-minol.
append lw_itab to gi_itab.
endloop.
endform.
start-of-selection.
loop at gi_itab into gw_itab.
write: /5 'COUNTRY', 'IMPORT CODE', 'SUP UNIT', 'FIRST UOM', 'SECOND UOM',
/5 gw_itab-land1, gw_itab-stawn,gw_itab-bemeh,gw_itab-impma,gw_itab-minol.
endloop.
end-of-selection.
I hope problem must be in p_dir and p_file which are in bold.. Kindly help me out. Thanks in advance.see the following ex:
*& Form SUB_GET_FILEPATH
text
--> p1 text
<-- p2 text
FORM SUB_GET_FILEPATH .
GFILE = 'D:\SAP_INT\INBOUND\INBOX'. "Path
ENDFORM. " SUB_GET_FILEPATH
*& Form SUB_GET_FILE
text
--> p1 text
<-- p2 text
FORM SUB_GET_FILE .
DATA: P_FDIR(200) TYPE C.
DATA: IT_FILEDIR1 TYPE STANDARD TABLE OF TY_FILEDIR WITH HEADER LINE.
P_FDIR = GFILE.
CALL FUNCTION 'RZL_READ_DIR_LOCAL'
EXPORTING
NAME = P_FDIR
TABLES
FILE_TBL = IT_FILEDIR.
REFRESH : IT_FILEDIR1.
LOOP AT IT_FILEDIR.
IF IT_FILEDIR-NAME(4) = 'ZINC' OR IT_FILEDIR-NAME(4) = 'zinc'.
MOVE IT_FILEDIR-NAME TO IT_FILEDIR1-NAME.
APPEND IT_FILEDIR1.
ENDIF.
ENDLOOP.
IF IT_FILEDIR1[] IS INITIAL.
STOP.
ENDIF.
LOOP AT IT_FILEDIR1.
REFRESH: I_TAB.
CLEAR: I_TAB.
NAME = IT_FILEDIR1-NAME.
CONCATENATE: GFILE '\' NAME INTO G_FILE.
OPEN DATASET G_FILE FOR INPUT IN TEXT MODE
ENCODING DEFAULT
IGNORING CONVERSION ERRORS.
IF SY-SUBRC EQ 0.
CONCATENATE 'FILENAME : ' G_FILE INTO I_MSG1.
APPEND I_MSG1.
DO.
READ DATASET G_FILE INTO RECORD.
IF SY-SUBRC = 0.
SPLIT RECORD AT ',' INTO I_TAB-BUKRS I_TAB-EBELN
I_TAB-BLDAT I_TAB-XBLNR I_TAB-LIFNR I_TAB-AMOUNT
I_TAB-CURR I_TAB-BUSAREA
I_TAB-BKTXT I_TAB-DMBTR I_TAB-MENGE I_TAB-SRNO.
MOVE-CORRESPONDING I_TAB TO I_TAB1.
ELSE.
EXIT.
ENDIF.
APPEND I_TAB1.
CLEAR: I_TAB, I_TAB1.
ENDDO.
ENDIF.
CLOSE DATASET G_FILE. -
How to delete the Generated files from application server(open hub)?
hi experts,
when i try to execute process chain the DTP it is giving below dump. Exception CX_RSBK_REQUEST_LOCKED logged.
when i execute the DTP manually and trying to delete the previous request, it is giving for dump ITAB_DUPLICATE_KEY.
so to delete the generated file from application server, how to delete it for specific dates?
Information on where terminated
Termination occurred in the ABAP program "GPD6S3OE0BCVGC6L9DBNVYQARZM" - in
"START_ROUTINE".
The main program was "RSBATCH_EXECUTE_PROZESS ".
In the source code you have the termination point in line 2874
of the (Include) program "GPD6S3OE0BCVGC6L9DBNVYQARZM".
The program "GPD6S3OE0BCVGC6L9DBNVYQARZM" was started as a background job.
and when i check the dump it is point out at below code
" Populate the lookup table for 0STOR_LOC
SELECT * from /BI0/TSTOR_LOC
into CORRESPONDING FIELDS OF table L_0STOR_LOC_TEXT
FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
STOR_LOC = SOURCE_PACKAGE-STOR_LOC.
but the programme is syntactically correct only.
how to rectify the issue.
regards
venuscm
Edited by: venugopal vadlamudi on Sep 28, 2010 1:59 PMhi experts,
We have written start routine to get the storage location text and sending to File located at Application server through OPEN HUB.
here is the code written in the Transformations
In the global section
Text for 0STOR_LOC
DATA: l_0stor_loc_text TYPE HASHED TABLE OF /bi0/tstor_loc
WITH UNIQUE KEY stor_loc.
DATA: l_0stor_loc_text_wa TYPE /bi0/tstor_loc.
and in the code to get the text
" Populate the lookup table for 0STOR_LOC
*SELECT * from /BI0/TSTOR_LOC*
into CORRESPONDING FIELDS OF table L_0STOR_LOC_TEXT
FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
STOR_LOC = SOURCE_PACKAGE-STOR_LOC.
im sure there is problem with the Routine only. i think i need to change the code if so please provide me the modified one.
thanks
venuscm
Edited by: venugopal vadlamudi on Sep 29, 2010 9:37 AM -
How to send File on application server for Attachment
Hi,
Friends in my application file is to be sent with Email as an attachment.
all this to be done via servlet for that i have to send the file to application server from there servlet will send mail via Email server.
How can send this file to server.
plz help me .
ThanksHi,
The following program illustrates the creation of ifle in app server and reading the file from appli server:
DATA: ITAB LIKE vbakOCCURS 0 WITH HEADER LINE.
PARAMETERS: P_VBELN LIKE VBAP-VBELN.
START-OF-SELECTION.
SELECT *
FROM VBAP
INTO TABLE ITAB
WHERE VBELN = P_VBELN
PERFORM WRITE_DATA.
PERFORM READ_DATA.
*& Form WRITE_DATA
text
--> p1 text
<-- p2 text
FORM WRITE_DATA.
OPEN DATASET 'VBAP_DATA' FOR OUTPUT IN TEXT MODE.
LOOP AT ITAB.
TRANSFER ITAB TO 'VBAP_DATA'.
ENDLOOP.
CLOSE DATASET 'VBAP_DATA'.
CLEAR: ITAB, ITAB[].
ENDFORM. " WRITE_DATA
*& Form READ_DATA
text
--> p1 text
<-- p2 text
FORM READ_DATA.
OPEN DATASET 'VBAP_DATA' FOR INPUT IN TEXT MODE.
DO.
READ DATASET 'VBAP_DATA' INTO ITAB.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
APPEND ITAB.
ENDDO.
CLOSE DATASET 'VBAP_DATA'.
LOOP AT ITAB.
WRITE:/ ITAB-VBELN,
ITAB-POSNR.
ENDLOOP.
ENDFORM. " READ_DATA
If it is helpful rewards points
Regards
Pratap.M -
How to create file on application server?
how to create file on application server?
Hi,
The following program illustrates the creation of ifle in app server and reading the file from appli server:
DATA: ITAB LIKE vbakOCCURS 0 WITH HEADER LINE.
PARAMETERS: P_VBELN LIKE VBAP-VBELN.
START-OF-SELECTION.
SELECT *
FROM VBAP
INTO TABLE ITAB
WHERE VBELN = P_VBELN
PERFORM WRITE_DATA.
PERFORM READ_DATA.
*& Form WRITE_DATA
text
--> p1 text
<-- p2 text
FORM WRITE_DATA.
OPEN DATASET 'VBAP_DATA' FOR OUTPUT IN TEXT MODE.
LOOP AT ITAB.
TRANSFER ITAB TO 'VBAP_DATA'.
ENDLOOP.
CLOSE DATASET 'VBAP_DATA'.
CLEAR: ITAB, ITAB[].
ENDFORM. " WRITE_DATA
*& Form READ_DATA
text
--> p1 text
<-- p2 text
FORM READ_DATA.
OPEN DATASET 'VBAP_DATA' FOR INPUT IN TEXT MODE.
DO.
READ DATASET 'VBAP_DATA' INTO ITAB.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
APPEND ITAB.
ENDDO.
CLOSE DATASET 'VBAP_DATA'.
LOOP AT ITAB.
WRITE:/ ITAB-VBELN,
ITAB-POSNR.
ENDLOOP.
ENDFORM. " READ_DATA
If it is helpful rewards points
Regards
Pratap.M -
How to download file from application server
Hi Experts,
I developed report and execute in background mode. for this i used Open dataset transfer and close dataset . i got the requried output . But in this case user want downloaded file on presentation server so can anyone tell me How to download file from application server?
i know it is possible through Tcode CG3Y. but i want code in program.This code will download a file to your Client package by package, so it will also work for huge files.
*& Report ZBI_DOWNLOAD_APPSERVER_FILE
REPORT zbi_download_appserver_file.
PARAMETERS: lv_as_fn TYPE sapb-sappfad
DEFAULT '/usr/sap/WBP/DVEBMGS00/work/ZBSPL_R01.CSV'.
PARAMETERS: lv_cl_fn TYPE string
DEFAULT 'C:\Users\atsvioli\Desktop\Budget Backups\ZBSPL_R01.CSV'.
START-OF-SELECTION.
CONSTANTS blocksize TYPE i VALUE 524287.
CONSTANTS packagesize TYPE i VALUE 8.
TYPES ty_datablock(blocksize) TYPE x.
DATA lv_fil TYPE epsf-epsfilnam.
DATA lv_dir TYPE epsf-epsdirnam.
DATA ls_data TYPE ty_datablock.
DATA lt_data TYPE STANDARD TABLE OF ty_datablock.
DATA lv_block_len TYPE i.
DATA lv_package_len TYPE i.
DATA lv_subrc TYPE sy-subrc.
DATA lv_msgv1 LIKE sy-msgv1.
DATA lv_processed_so_far TYPE p.
DATA lv_append TYPE c.
DATA lv_status TYPE string.
DATA lv_filesize TYPE p.
DATA lv_percent TYPE i.
"Determine size
SPLIT lv_as_fn AT '/' INTO lv_dir lv_fil.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
file_name = lv_fil
dir_name = lv_dir
IMPORTING
file_size_long = lv_filesize.
"Open the file on application server
OPEN DATASET lv_as_fn FOR INPUT IN BINARY MODE MESSAGE lv_msgv1.
IF sy-subrc <> 0.
MESSAGE e048(cms) WITH lv_as_fn lv_msgv1 RAISING file_read_error.
EXIT.
ENDIF.
lv_processed_so_far = 0.
DO.
REFRESH lt_data.
lv_package_len = 0.
DO packagesize TIMES.
CLEAR ls_data.
CLEAR lv_block_len.
READ DATASET lv_as_fn INTO ls_data MAXIMUM LENGTH blocksize LENGTH lv_block_len.
lv_subrc = sy-subrc.
IF lv_block_len > 0.
lv_package_len = lv_package_len + lv_block_len.
APPEND ls_data TO lt_data.
ENDIF.
"End of file
IF lv_subrc <> 0.
EXIT.
ENDIF.
ENDDO.
IF lv_package_len > 0.
"Put file to client
IF lv_processed_so_far = 0.
lv_append = ' '.
ELSE.
lv_append = 'X'.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = lv_package_len
filename = lv_cl_fn
filetype = 'BIN'
append = lv_append
show_transfer_status = abap_false
TABLES
data_tab = lt_data.
lv_processed_so_far = lv_processed_so_far + lv_package_len.
"Status display
lv_percent = lv_processed_so_far * 100 / lv_filesize.
lv_status = |{ lv_percent }% - { lv_processed_so_far } bytes downloaded of { lv_filesize }|.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING "percentage = lv_percent - will make it fash
text = lv_status.
ENDIF.
"End of file
IF lv_subrc <> 0.
EXIT.
ENDIF.
ENDDO.
"Close the file on application server
CLOSE DATASET lv_as_fn. -
How to upload file from Application Server?
Dear Friends,
How to upload file from Application Server?
Plz. with example...
Regards,
Dharmeshhi,
check the code for upload from application server.
tables: kna1.
types: begin of s_file,
customer type kna1-kunnr,
country type kna1-land1,
name type kna1-name1,
region type kna1-regio,
end of s_file.
*--Internal tables
data: it_file type s_file occurs 0 with header line.
*-- Selection screen
selection-screen: begin of block b1 with frame title text-001.
parameter: p_file type rlgrap-filename default 'C:/customer.txt'
obligatory.
selection-screen: end of block b1.
*-- At selection screen
at selection-screen on value-request for p_file.
perform file_help using p_file.
*-- Process File
start-of-selection.
perform upload_file using p_file.
*-- write File data to o/p
end-of-selection.
perform write_data.
*& Form file_help
form file_help using p_p_file.
data: l_filepath type ibipparms-path.
call function 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
importing
file_name = l_filepath
p_p_file = l_filepath.
endform. " file_help
*& Form upload_file
form upload_file using p_p_file.
call function 'WS_UPLOAD'
exporting
filename = p_p_file
filetype = 'DAT'
IMPORTING
FILELENGTH =
tables
data_tab = it_file
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
others = 11
if sy-subrc <> 0.
message i001.
endif.
endform. " upload_file
*& Form write_data
form write_data .
loop at it_file.
write:/ it_file-customer, it_file-country, it_file-name,
it_file-region.
endloop.
endform.
regards,
keerthi. -
XML data into Oracle Tables. XML file on Application Server.Oracle Apps R12
Hi All,
My Database version : 11.2.0.2.0
I have an XML file which needs to be loaded into the Database Tables. How ever i do not want to use the XMLTYPE as given below
insert into test1 (
SELECT PrcDate, PmtType, PmtStatus, PmtTypeCount, PmtTypeAmt
FROM XMLTABLE(
'/WFPaymentAck/RejectedDom1ACH'
PASSING XMLTYPE( BFILENAME('ECX_UTL_LOG_DIR_OBJ','wf_test_xml.XML'), NLS_CHARSET_ID('UTF8') )
COLUMNS
PrcDate VARCHAR2(2000) PATH '@PrcDate' ,
PmtType VARCHAR2(2000) PATH '@PmtType' ,
PmtStatus VARCHAR2(100) PATH '@PmtStatus' ,
PmtTypeCount VARCHAR2(100) PATH 'PmtTypeCount' ,
PmtTypeAmt VARCHAR2(100) PATH 'PmtTypeAmt'
Because this way the XML file needs to reside on the DB server.
I am looking into other option of loading the XML file into a CLOB column of a table and reading it from that column.
I did a couple of tests and feel that this way also the XML file has to reside on the Database Server itself. I am not sure if this is correct or if there is any problem with our TEST instance.
++Can anyone let me know if i need to have the XML file on the DB server instead of the Application server to load into a CLOB column of table ??++
++Or++
++Is there any other workaround for me to load XML into Oracle Tables, while having the XML file on Application Server.++
Your immediate help is appreciated. I need to get past this ASAP.
Thanks in Advance.
VJ1) Are you asking me to create a folder on Database directory which points to a folder on the Apps server ?I suggest creating an Oracle directory object (a database object) pointing to a real location (folder) on Application server.
we DONOT want a hand shake between the DB Server and the APPS server.I don't see where the problem is.
I'm not familiar with Apps R12 but there's no doubt the two servers are already communicating, at least App server should be able to access the DB for the whole thing to run.
As I said :
One way or another, the data has to make its way to the database, there's no workaround to that.How do you imagine the data will end up in a database table if it doesn't come to the DB server?
There's no magical method out there, both servers have to communicate at some point.
About client-server approaches (client being here the App server), you can read about accessing the XML DB repository in the XML DB Developer's Guide : http://download.oracle.com/docs/cd/E11882_01/appdev.112/e23094/toc.htm
Other option : SQL*Loader can load a CLOB, or an XMLType column too
Edited by: odie_63 on 19 déc. 2011 20:22 -
Upload XML file from Application Server to Internal Table
Hi Experts,
i have xml file in application server and i want to convert to internal table .
i have tried this link http://wiki.sdn.sap.com/wiki/display/ABAP/UploadXMLfiletointernal+table.
Here the file is loaded from local(presentation Server) ..
i want to know how to select file from application layer ..and schedule in background..
i also tried FM '/SAPDMC/LSM_F4_SERVER_FILE' but this need front end selection of file from application server..
i need to select a xml file from application server and convert into internal table in background.. help me on this..Have a look on
Re: How to convert XML data to different ABAP internal table
Thanks
Ravin -
How to upload XML file from Application server.
Hi,
How to upload XML file from Application server.Please tell me as early as possible.
Regards,
Sagar.Hi,
parameters : p_file type ibipparms-path obligatory.
***DOWNLOAD---->SAP INTO EXCEL
filename1 = p_file.
call function 'GUI_DOWNLOAD'
exporting
BIN_FILESIZE =
filename = filename1
filetype = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = it_stock
FIELDNAMES =
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
others = 22
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Regards,
Deepthi.
Maybe you are looking for
-
Is there a way to have tooltips for every column in a TableView?
Hi there! I found in documentation that any node and control can show a tooltip ( http://docs.oracle.com/javafx/2/api/javafx/scene/control/Tooltip.html ) but I can't get tooltips to work for TableColumn (a column from TableView). Do you have any idea
-
How to recover datafile.when control file auto backup is off
hi friend i took hot backup of my database using following command rman>backup database; in my case controlfile auto backup is off. and i have lost my all controlfiles as well as datafiles except spfile. i have recovered control file using dbms_backu
-
New hard drive, reinstall upgrade from CS2 to CS4 Question
Hi, I upgraded my CS2 to CS4 Extended early this year, my hard drive just bit the dust and I have to re-install the CS4, will I have to call customer service again to get my copy of CS4 Extended activated, again? Thanks, Charles Grubbs / futurexboy
-
Network interface cards tested with cisco agent desktop and CTI Toolkit Desktop Silent Monitor
Hi Guys, My Customer is testing the Silent Monitoring, but, not is working. He is using the NIC Intel 82579LM, version 17.4 - 64 bits. I read the documentation the link http://www.cisco.com/en/US/prod/voicesw/custcosw/ps5693/ps14/prod_system_requirem
-
What does the I phone 4s newest update the 6.1 do for the I phone 4s??
What does the I phone newest update the 6.1 do for the I phone 4s