Urgent - Append data to internal table from Application server
Hi All,
I encountered the problem while read the input file from Application server...then append it to internal table. I manage to read the input file from presentation and append the data to internal table.
Below are my coding which cause me not able the append data from Application server. Please kindly help me to solving/correct my coding. Thanks in advance .
PARAMETERS : p_inpfl LIKE rlgrap-filename. "Material Input File
SELECTION-SCREEN BEGIN OF LINE.
Application Server
SELECTION-SCREEN COMMENT 1(19) text-002 FOR FIELD rb_ux.
SELECTION-SCREEN POSITION 33.
PARAMETERS: rb_ux RADIOBUTTON GROUP g1.
Presentation Server
SELECTION-SCREEN COMMENT 40(21) text-003 FOR FIELD rb_pc.
SELECTION-SCREEN POSITION 65.
PARAMETERS: rb_pc RADIOBUTTON GROUP g1 DEFAULT 'X'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK b01.
FORM f_Input_file.
CLEAR: v_f_exists.
CHECK NOT p_inpfl IS INITIAL. "input file exist
IF NOT rb_pc IS INITIAL. " Pc check
PERFORM f_read_tab_delimited_file TABLES i_input
USING c_09
p_inpfl
rb_ux
CHANGING v_ifile_str_with_tab
v_f_exists
v_ifile_record_count
v_message.
IF v_f_exists EQ '1' .
UPLOAD FILE could not be read
MESSAGE e546 .
ENDIF .
IF v_ifile_record_count EQ 0 .
Zero records in upload file
MESSAGE e547 .
ENDIF.
ELSE.
OPEN DATASET p_inpfl FOR INPUT IN TEXT MODE.
DO.
READ DATASET p_inpfl INTO i_input.
IF sy-subrc EQ 0.
APPEND i_input.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET p_inpfl.
ENDIF.
Hi,
Refere the following code for the poulating internal from the application server.
PARAMETERS : pr_sfile TYPE filename-fileintern,
Here give the logical file name from the application serevr.
data : w_param_1 LIKE filename-fileintern,
x_file(500),
w_move_file LIKE epsf-epsfilnam,
w_from_dir LIKE epsf-epsdirnam,
w_path LIKE rlgrap-filename,
input_line(1000),
w_path LIKE rlgrap-filename,
w_file LIKE rlgrap-filename,
w_dir LIKE rlgrap-filename,
w_dir1 LIKE epsf-epsdirnam,
w_file1 LIKE epsf-epsfilnam,
**************Start of the code***************
MOVE '*' TO w_param_1.
PERFORM get_file_name USING pr_sfile w_param_1.
LOOP AT it_file WHERE name CP w_file1.
CLEAR : x_file, w_path,
w_move_file, w_from_dir.
REFRESH : it_input,
it_input_err.
IF w_flag IS INITIAL.
CONCATENATE w_dir it_file-name INTO x_file.
CONDENSE x_file.
TO Move file from sever for backup storing the file name and path
w_path = x_file.
CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = x_file
IMPORTING
stripped_name = w_move_file
file_path = w_from_dir
EXCEPTIONS
x_error = 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.
********here it_input will be the structure of the file present on the application server
PERFORM read_file TABLES it_input
USING x_file.
CLEAR it_input_err.
REFRESH it_input.
ENDLOOP.
*******************end of the code****************
*& Form read_file
text
-->P_X_FILE text
FORM read_file TABLES it_tab
USING x_file.
OPEN DATASET x_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
WRITE : / text-006.
ELSE.
DO.
READ DATASET x_file INTO input_line.
IF sy-subrc = 0.
CLEAR: it_input, count.
DO.
ADD 1 TO count.
ASSIGN COMPONENT count OF STRUCTURE it_tab TO <fs>.
IF sy-subrc = 0.
SPLIT input_line AT separator INTO <fs> input_line.
ELSE.
EXIT.
ENDIF.
ENDDO.
APPEND it_tab.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET x_file.
*& Form get_file_name
text
-->P_P_SFILE text
-->P_W_PARAM_1 text
FORM get_file_name USING p_sfile
w_param_1.
CHANGING x_file.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
client = sy-mandt
logical_filename = p_sfile
parameter_1 = w_param_1
IMPORTING
file_name = x_file
EXCEPTIONS
file_not_found = 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.
w_path = x_file.
CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = w_path
IMPORTING
stripped_name = w_file
file_path = w_dir
EXCEPTIONS
x_error = 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.
w_dir1 = w_dir.
w_file1 = w_file.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = w_dir1
file_mask = w_file1
TABLES
dir_list = it_file
EXCEPTIONS
invalid_eps_subdir = 1
sapgparam_failed = 2
build_directory_failed = 3
no_authorization = 4
read_directory_failed = 5
too_many_read_errors = 6
empty_directory_list = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE : / text-006.
ENDIF.
Hope this will help you.
Similar Messages
-
Sending data from final internal table to application server in xml format
hi to all ,
can anyone send details about send data from final internal table to application server in xml format.right now i am able to download data to presentation server in xml format . love to here soon from all the abap gigs.welcome to SDN.
are you using call transformation to convert itab to XML? the XML string is in which format?
convert it to xstring and then use the following code to store it in application server.
OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
TRANSFER XML_content TO FNAME.
CLOSE DATASET FNAME.
where fname is the path to the file name.
Regards
Raja -
Export internal table to application server
hello all!
i would like to export the contents of an internal table to the appliation server. i tried via OPEN DATASET, but my itab contains not only character type data.
i do not want to copy all content into a parallel structure with all character type colums
do you know a way to export an internal table on application server, in a way that it is readable by ms excel?
thanks!Hi Matthias, i think that the only solution is using a parallel structure with all character type colums. Also use 'SAP_CONVERT_TO_CSV_FORMAT' to convert the internal table to csv format in order to be readable by ms excel.
Regards,
Andrez -
i m calling one FM inside the loop, this FM will return data in internal table. for each loop count i want to save this data to same other internal table, how to do that?
i want to append the one internal tables data to another internal table how to do that?
ThanksHi Lucky,
Refer this code :
LOOP AT I_TAB1.
CALL FUNCTION <FUNCTION NAME>
EXPORTING
IMPORTING
TABLES = I_TAB2.
APEEND LINES OF I_TAB2 to I_TAB3.
REFRESH I_TAB2.
ENDLOOP.
REWARD POINTS IF HELPFUL.
Regards,
Hemant -
Function module to get data into internal table from Excel file sheets
Hi,
I have to upload customers from excel file.
we are donloading customer data excel file sheets.
Customer data in 1 sheet, tax data the other sheet of same excel file, Customer master-Credit data in other sheet of same excel file.
so i have 3-4 sheet in one excel file.
now my requirement is to get the data from excel file into internal table.
is there any function module.
Thanks & RegardsI am sending you the idea with an example how you can upload data from an EXCEL file into an internal table. I am not sure if you can take data from different sheet in the same EXCEL file. I think that this is not possible (try it )
Upload the data into an internal table, like the way that I am describing in the above:
DATA: L_MAX_COL_NB TYPE I.
DATA: l_file_name LIKE RLGRAP-FILENAME.
Just to be sure that is the correct type for the FM.
l_file_name = P_FILE_NAME.
L_MAX_COL_NB = 58. "Maximum nb of colums that the FM can read.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = l_file_name
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = L_MAX_COL_NB
I_END_ROW = 9999
TABLES
INTERN = PT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
Now you should upload the data into your own itab. The Function Module will return to you all the an itab
from all fields and columns. Define the structure of the uploading file into SE11 - Data Dictionary. Then read the fieldcatalog of this structure. In the code that I am sending to you, I am insearting an empty line into the internal table and then I am assigning this line into a corresponding field-symbol. Then I am able to change the working area - so and the line of the itab. Propably you could you the statement APPEND INITIAL LINE TO (your_table_name) ASSIGNING <your_field_symbol>, but the example was written in an old SAP version.
FIELD-SYMBOLS:
<F_REC> LIKE WA_UPLOAD_FILE, "working are of the uploading file
<F_FIELD> TYPE ANY.
DATA: COLUMN_INT TYPE I,
C_FIELDNAME(30) TYPE C.
PERFORM GET_FIELDCATOLG TABLES FIELDCAT
USING 'ZECO_CHARALAMBOUS_FILE'.
LOOP AT PT_EXCEL.
AT NEW ROW.
ASSIGN WA_UPLOAD_FILE TO <F_REC>.
ENDAT.
COLUMN_INT = PT_EXCEL-COL.
READ TABLE FIELDCAT INTO WA_FIELDCAT INDEX COLUMN_INT.
CONCATENATE '<F_REC>-' WA_FIELDCAT-FIELDNAME INTO C_FIELDNAME.
ASSIGN (C_FIELDNAME) TO <F_FIELD>.
<F_FIELD> = PT_EXCEL-VALUE.
AT END OF ROW.
APPEND WA_UPLOAD_FILE TO GT_UPLOAD_FILE.
CLEAR WA_UPLOAD_FILE.
ENDAT.
ENDLOOP.
With Regards
George
Edited by: giorgos michaelaris on Mar 4, 2010 3:44 PM -
FM for uploading data into internal table from Excel sheet
Hi,
I have a slight problem in one of the function modules that I have created. Actually it has been copied from a standard SAP function module KCD_EXCEL_OLE_TO_INT_CONVERT. Now my created function module is throwing me a dump suggesting Data objects in a Unicode program are not convertible. Can anybody help me out in removing the error .
Actually the need of copying the standard FM to a ZFM is to increase the length of the column which can be uploaded thru this FM. The standard FM has a restriction of being able to upload 32 characters whereas my requirement is to upload data having at least 150 characters. So in order to care the need I made a ZStructure ZAKHIL_CELLS taking the Value parameters as 150 characters instead of 32 characters.
Well this is all done because I wanted to upload a excel sheet into an internal table and not use a tab delimited file. Can anybody help in this regard or suggest some other function module which can upload more than 150 characters from a excel sheet .
m also attaching structure of my ZStructure for ur reference .
STRUCTURE ZAKHIL_CELLS1 .
ROW KCD_EX_ROW_N NUMC 4 Flexible Excel upload: row number
COL KCD_EX_COL_N NUMC 4 Column
VALUE KCD_VALUE CHAR 150 External Data Transfer: Values of Parameters or Variables
Thanks & Rgds,
Akhilhi,
sample excel sheet.
coloumn 1 is name and column 2 is age
name age
A 8
C 13
D 55
DATA : int_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
data : record like db_name_age occurs 0 with header line.
DATA : v_start_col TYPE i VALUE '1', "starting col
v_start_row TYPE i VALUE '1', " starting row
v_end_col TYPE i VALUE '2', " total columns
v_end_row TYPE i VALUE '10'. "total no of record
FORM f_upload .
CLEAR : int_excel, int_excel[].
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = wf_filename
i_begin_col = v_start_col
i_begin_row = v_start_row
i_end_col = v_end_col
i_end_row = v_end_row
TABLES
intern = int_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
*Message is 'Unable to upload data from ' wf_filename.
MESSAGE e169(zm050) WITH wf_filename.
ELSE.
SORT int_excel BY row col.
REFRESH : record.
CLEAR : record.
LOOP AT int_excel.
CASE int_excel-col. "go thru each column.
WHEN 1.
record-name = int_excel-value.
WHEN 2.
record-age = int_excel-value.
ENDCASE.
AT END OF row.
APPEND record.
CLEAR record.
ENDAT.
ENDLOOP.
*inserting into table
ENDIF.
if this helped pld rewrd points,
rgrds
anver -
Regarding fetching data into internal table from D.B Tables, D.B View
Hi All,
I Have following 5 tables in my Database.
LTAP
TABNAME
FIELDNAME
KEYFLAG
LTAP
MANDT
X
LTAP
LGNUM
X
LTAP
TANUM
X
LTAP
TAPOS
X
LTAP
VLPLA
Z0MNH
TABNAME
FIELDNAME
KEYFLAG
Z0MNH
MANDT
X
Z0MNH
WERKS
X
Z0MNH
ZMANNO
X
Z0MNH
LGNUM
X
Z0MNH
AENAM
Z0MNH
BUDAT
Z0MNH
CPUTM
Z0MNH
LAEDA
Z0MNH
STATUS
Z0MNH
USNAM
Z0MNH
ZARDAT
Z0MNH
ZARTIM
Z0MNH
ZCLDAT
Z0MNH
ZCLTIM
Z0MNH
ZDPDAT
Z0MNH
ZDPTIM
Z0MNH
ZDRIVR
Z0MNH
ZINDAT
Z0MNH
ZINTIM
Z0MNH
ZLOAD
Z0MNH
ZNOTES
Z0MNH
ZPRDAT
Z0MNH
ZPRTIM
Z0MNH
ZSUPR
Z0MNH
ZTRAILR
Z3MANBOXIDHDR
TABNAME
FIELDNAME
KEYFLAG
Z3MANBOXIDHDR
MANDT
X
Z3MANBOXIDHDR
WERKS
X
Z3MANBOXIDHDR
ZMANNO
X
Z3MANBOXIDHDR
EXIDV
X
Z3MANBOXIDHDR
NLPLA
Z3MANBOXIDHDR
NLTYP
Z3MANBOXIDHDR
VLTYP
Z3MANBOXIDHDR
Z0PAL
Z3MANBOXIDHDR
Z3COMENT
Z3MANBOXIDHDR
Z3RECPT_FLAG
Z3MANBOXIDITM
TABNAME
FIELDNAME
KEYFLAG
Z3MANBOXIDITM
MANDT
X
Z3MANBOXIDITM
WERKS
X
Z3MANBOXIDITM
ZMANNO
X
Z3MANBOXIDITM
EXIDV
X
Z3MANBOXIDITM
ITEM_NO
Z3MANBOXIDITM
MATNR
Z3MANBOXIDITM
VEMEH
Z3MANBOXIDITM
VEMNG
Z3MANBOXIDITM
Z_CARTON
Z3MANBOXIDSERIAL
TABNAME
FIELDNAME
KEYFLAG
Z3MANBOXIDSERIAL
MANDT
X
Z3MANBOXIDSERIAL
WERKS
X
Z3MANBOXIDSERIAL
EXIDV
X
Z3MANBOXIDSERIAL
ZMANNO
X
Z3MANBOXIDSERIAL
ITEM_NO
Z3MANBOXIDSERIAL
SERNR
Based on all the above tables i need to fill in below internal table field as given below:
<b>Internal Table I_TAB
ZMANNO
LGNUM
WERKS
EXIDV
ITEM_NO
MATNR
SERNR
VEMNG
VEMEH
VLTYP
NLTYP
VLPLA
NLPLA
ZLOAD
USNAM
STATUS
BUDAT
CPUTM
ZINDAT
ZINTIM
ZARDAT
ZARTIM
ZCLDAT
ZCLTIM</b>
Extract data from Manifest header <b>Z0MNH, Z3MANBOXIDHDR,
Z3MANBOXIDITM, Z3MANBOXIDSER and LTAP</b> tables based on selection parameter.
Selection Screen will have folowing Select-option fields-
<b>LGNUM
WERKS
ZMANNO
USNAM
ZLOAD
EXIDV
MATNR
SERNR
VLTYP
NLTYP
VLPLA
NLPLA
BUDAT
ZINDAT
ZARDAT
ZCLDAT</b>
Based on above selection criteria i need to fetch above internal table fields data.
Then need to Move corresponding header and item data in ITAB_RESULT internal table.
I need to fetch above fields based on above 5 tables and put in final Internal Table.
Can anybody tell me the logic how can i write the same.
Also can anybody tell me i am trying to create a DataBaseView for
Z0MNH, Z3MANBOXIDHDR, Z3MANBOXIDITM, Z3MANBOXIDSERIAL and LTAP tables.
<b>Note:
1. Z3MANBOXIDITM table may contain multiple material[MATNR] for same box-id[EXIDV] (with another line item).
2. Z3MANBOXIDSERIAL table may contain multiple record for one box id[EXIDV]+item_no[ITEM_NO].</b>
But what are the <b>TABLE/JOIN Conditions</b> i need to write while creating <b>DB View</b> for above <b>5</b> tables.
Can anybody solve above 2 issues!
Thanks in advance.
Thanks,
Deep.Hi Deep,
While creation of DB view just make sure abt the key relation between the tables. Based on that u can join the tables...First fetch the data from header table then by using for all entries u can fetch the line items data.
Hope this helps you. Reply for queries, shall post the updates.
Regards.
Kumar. -
To Load data to internal Table from the spoolrequest
HI All,
I'm trying to load a data to the internal table with the reference of spoolrequest generated by the programme during background process. Can anyone help me.
Regards,
S.JANANIhttp://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO. -
Req : to capture the filter data in internal table from ALV
hi friends..
i have an requirement, plz guide me to solve this..
let consider in alv grid i m displaying 10 data(10 rows)
by using filter let assume now i m getting 5 rows (from the 10 rows).
i want to capture these 5 rows in an internal table..
plz giude me to resolve this..
thanks in advance
by
selvaHi
u can think to do this programatically.
1 add one button on alv tool bar say capture.
2. filetr the requiredd rows .
3. seelct all filterd rows.
4. say capture.
5.At user command write a code to get the selcted alv rows
in different internal table.
6 you can use FM get_selected_rows for this purpose. -
How to get data to internal table from function module tr_inspect_objects
How to get data from funtion module to an internal table .
function module name is tr_inspect_objects(code inspectore se10)
how top collect all task request data into one internal table using this fm or we have to create another fm .
If you have already made FM please give us the code .Hi,
You can use tables E070 or E071 to get data into your internal tables instead of a function module.
Hope this helps.
BR
Dep -
Re: How to download an internal table to application server.. Unicode
Hi..
i have populated an internal table of a big structure (custom table) which has more than 100 fields.
i wanted to download it into the application server.. as a tab de-limited file..
Can anyone guide me how to proceed with
Thanks In Advance
Guhapriyan..HI
this program will convert the internal table to the xml document
Report ZPRUEBA_MML_13 *
Export an internal table to XML document *
NO BORRAR ESTE CODIGO *
REPORT Z_table_xml.
PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
TYPES: BEGIN OF TURNOS,
LU LIKE T552A-TPR01,
MA LIKE T552A-TPR01,
MI LIKE T552A-TPR01,
JU LIKE T552A-TPR01,
VI LIKE T552A-TPR01,
SA LIKE T552A-TPR01,
DO LIKE T552A-TPR01,
END OF TURNOS.
TYPE SOCIO *
TYPES: BEGIN OF SOCIO,
NUMERO LIKE PERNR-PERNR,
REPOSICION LIKE PA0050-ZAUVE,
NOMBRE LIKE PA0002-VORNA,
TURNOS TYPE TURNOS,
END OF SOCIO.
TYPE SOCIO *
ESTRUCTURA ACCESOS *
DATA: BEGIN OF ACCESOS OCCURS 0,
SOCIO TYPE SOCIO,
END OF ACCESOS.
ESTRUCTURA ACCESOS *
START OF SELECTION *
START-OF-SELECTION.
PERFORM LLENA_ACCESOS.
PERFORM DESCARGA_XML.
END-OF-SELECTION.
END OF SELECTION *
FORM LLENA_ACCESOS *
FORM LLENA_ACCESOS.
REFRESH ACCESOS.
CLEAR ACCESOS.
MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,
'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,
'0' TO ACCESOS-SOCIO-REPOSICION,
'T1' TO ACCESOS-SOCIO-TURNOS-LU,
'T2' TO ACCESOS-SOCIO-TURNOS-MA,
'T3' TO ACCESOS-SOCIO-TURNOS-MI,
'T4' TO ACCESOS-SOCIO-TURNOS-JU,
'T5' TO ACCESOS-SOCIO-TURNOS-VI,
'T6' TO ACCESOS-SOCIO-TURNOS-SA,
'T7' TO ACCESOS-SOCIO-TURNOS-DO.
APPEND ACCESOS.
CLEAR ACCESOS.
MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,
'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,
'0' TO ACCESOS-SOCIO-REPOSICION,
'T1' TO ACCESOS-SOCIO-TURNOS-LU,
'T2' TO ACCESOS-SOCIO-TURNOS-MA,
'T3' TO ACCESOS-SOCIO-TURNOS-MI,
'T4' TO ACCESOS-SOCIO-TURNOS-JU,
'T5' TO ACCESOS-SOCIO-TURNOS-VI,
'T6' TO ACCESOS-SOCIO-TURNOS-SA,
'T7' TO ACCESOS-SOCIO-TURNOS-DO.
APPEND ACCESOS.
ENDFORM.
FORM LLENA_ACCESOS *
FORM DESCARGA_XML *
FORM DESCARGA_XML.
DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,
M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
G_IXML TYPE REF TO IF_IXML,
W_STRING TYPE XSTRING,
W_SIZE TYPE I,
W_RESULT TYPE I,
W_LINE TYPE STRING,
IT_XML TYPE DCXMLLINES,
S_XML LIKE LINE OF IT_XML,
W_RC LIKE SY-SUBRC.
DATA: XML TYPE DCXMLLINES.
DATA: RC TYPE SY-SUBRC,
BEGIN OF XML_TAB OCCURS 0,
D LIKE LINE OF XML,
END OF XML_TAB.
CLASS CL_IXML DEFINITION LOAD.
G_IXML = CL_IXML=>CREATE( ).
CHECK NOT G_IXML IS INITIAL.
M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
CHECK NOT M_DOCUMENT IS INITIAL.
WRITE: / 'Converting DATA TO DOM 1:'.
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
NAME = 'ACCESOS'
DATAOBJECT = ACCESOS[]
IMPORTING
DATA_AS_DOM = L_DOM
CHANGING
DOCUMENT = M_DOCUMENT
EXCEPTIONS
ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
SY-SUBRC.
ENDIF.
CHECK NOT L_DOM IS INITIAL.
W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
IF W_RC IS INITIAL.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
W_RC.
ENDIF.
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
DOCUMENT = M_DOCUMENT
IMPORTING
XML_AS_STRING = W_STRING
SIZE = W_SIZE
TABLES
XML_AS_TABLE = IT_XML
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
SY-SUBRC.
ENDIF.
LOOP AT IT_XML INTO XML_TAB-D.
APPEND XML_TAB.
ENDLOOP.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_SIZE
FILENAME = GK_RUTA
FILETYPE = 'BIN'
TABLES
DATA_TAB = XML_TAB
EXCEPTIONS
OTHERS = 10.
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 DESCARGA_XML *
u can check the link
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/abap-code-samples/conversion of abap data to xml.doc
Regards,
Naveen -
Append data into the file in application server
Hi Friends,
I have an issue where i have a job which has three different stepst for same program. If i run the job the program will create a file in the application server and append the other two steps in the same file without overwriting the file or creating a new file.
My problem is like its creating three different files in application server for that particular job since it has three steps . Its not appending into one particular file .
I am using the FM 'Z_INTERFACE_FILE_WRITE' where i have used the pi_append in the exportng parameter . ITs working when i specify the file in local system. It is appending correctly when i run the report normally to apppend into local system.
But when i schedule a job to append the file in application server its creating three different files.
Kindly help me if anyone is aware of this issue
Thanks in advance
KishoreHi,
Please use open dataset to write and append files.Please check the logic of Z FM which you are using .
To open and write into a file use
OPEN DATASET FNAME FOR OUTPUT.
To append data into existing file use
OPEN DATASET FNAME FOR APPENDING.
To write into file:
v_file = file path on application server
OPEN DATASET v_file FOR output.
IF sy-subrc NE 0.
write:/ 'error opening file'.
ELSE.
TRANSFER data TO v_file.
ENDIF.
CLOSE DATASET v_file.
For appending :
OPEN DATASET v_file fOR APPENDING.(file is opened for appending data position is set to the end of the file).
Thanks and Regards,
P.Bharadwaj -
Problem in uploading the file of internal table into appliaction server
i want to send the data of internal table to application server through selection screen and in selection screen and in selection screen parameter it should show the path of application server and through that path internal table data should go to application server , if possible give the code
Hi,
form download_file_appl_server.
open dataset p_dlf2 for output
in text mode encoding default .
if sy-subrc ne 0.
message:i005 with text-415 text-407.
endif.
loop at i_final into wa_final.
transfer wa_final to p_dlf2.
endloop.
close dataset p_dlf2.
endform. " OPENDATA_CLOSE
where p_dlf2 is the seelction screen parameter which give the application server file path
You can use this code for ur purpose.
Reward if useful.
Regards
Shibin -
Dump while downloading data from Application Server File in 4.6 system
Hi,
When we are trying to upload data from Application Server to internal table using dataset statements, it is resulting in a dump. System we are using is 4.6c.
When we faced similar kind of issue in ECC version, we have used the statement, Ignoring Conversion Errors.
Please let me know how to handle this situation in 4.6 System.
Thanks for your inputs.
Regards,
PhaniHi All,
I am sorry. My question was wrong. It should be while uploading data from internal table to application server, if there are any special characters, it is going to dump.
I will let you know the dump details and code at the earliesst.
Sorry and Thanks again for your prompt response.
Regards,
Phani. -
Read Tilda separated file from Application Server
I have a requirement to read a tilda separated file from application server and write a tilda separeted output to application server. Please suggest how to to get data from tilda separated file to internal table ? and also How to create a tilda separated file from internal table to application server.
Hi again,
This some sample code for outputing data on application server with tilda separator.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. " MESSAGE msg.
IF sy-subrc <> 0.
message i812(LQ).
LEAVE LIST-PROCESSING.
ENDIF.
LOOP AT gs_input INTO wa_input.
CONCATENATE wa_input-wadat_ist
wa_input-sort2
wa_input-name1
wa_input-street
wa_input-region
wa_input-post_code1
wa_input-zzchep
wa_input-vbeln
wa_input-bstkd
wa_input-zfrom
wa_input-zland
wa_input-zccode
wa_input-zrcvd
wa_input-zfref
wa_input-znorc
wa_input-zsepr
wa_input-zvers
wa_input-zlout
wa_input-zinfo
wa_input-zinco
wa_input-zsqal
wa_input-zscod
wa_input-zrqal
wa_input-zeqal
wa_input-zecod
wa_input-zcust
wa_input-ztran INTO g_path SEPARATED BY '~'.
TRANSFER g_path TO p_file.
CLEAR : g_path, wa_input.
ENDLOOP.
CLOSE DATASET p_file.
Hope this will be helpful for you.
Regards,
Vijay
Maybe you are looking for
-
How can i use ADF code in Trinidad
Hi, I'm having an small Application which is Implemented to some extent using oracle ADF faces components But now, as the Trinidad is an open source i would like to do it in trinidad. If i replace the libraries to trinidad does my implement code in A
-
Hello I have two tables in an Oracle database: PARENT and CHILD. The PARENT table has a column called IDENTIFIER (String) The CHILD table has a column called PARENT_IDENTIFIER (String) I want to markup my Parent has having a collection of Children. T
-
Missing Files and Locating Bug
Hi, In LR2, if I relocated a folder of files/photos, for example move them from a primary hard drive (on my macbook) to an external hard drive, the catalogue would indicate missing files with a '?' icon in the top right hand corner of the file. To re
-
Hi BI Gurus, I have written a report in the Bex and I have included the infoobject 0BILL_BLOCK and on the properties of this, I have turned on Standard: Key and text on Display As option. It's ok in terms of displaying the key and text. It's displayi
-
Excise modvat accounts not defined for EWPO transaction and 13 excise group
Dear All During execution of report in j2ier1 I am getting following error. For One plant it is giving following error Excise modvat accounts not defined for EWPO transaction and 13 excise group. And for other plant it is giving following error Excis