Reading TXT file to SAP table.
Hi everyone,
my task is to read data from chosen text file into table I created.
Text file look like this:
ID_ASK|DATA_OD|DATA_DO|
1234|20140517|20140824|
ID_MAG|ID_ASO|ID_KAT_ASO|SOURCE|NAME|
12|23|34|600156|TEST NAME1|
ID_MAG|ID_ASO|ID_KAT_ASO|SOURCE|NAME|
23|24|54|600156|TEST_NUMR2|
Header "ID_ASK|DATA_OD|DATA_DO|" occurs only once, while header "ID_MAG|ID_ASO|ID_KAT_ASO|SOURCE|NAME|" can occur many times.
I want to insert those values (except of headers, of course) into my SAP table:
Table Fields
Fields from file
ZIDASK
ID_ASK
ZIDMAG
ID_MAG
ZIDASO
ID_ASO
ZIDKAT
ID_KAT_ASO
ZZRCEL
SOURCE
ZDAOD
DATA_OD
ZDADO
DATA_DO
ZKATNAM
NAME
I want user to choose file from browser and I am using F4_FILENAME function.
1. To avoid reading header into table I think I'll use something like this (in loop, of course):
IF (lv_linecounter MOD 2) = 1.
CONTINUE.
ELSE.
SPLIT something AT '|' INTO those_fields.
2. What should be next function to call?
3. Is declaring separate types for those two headers a good idea?
TYPES: BEGIN OF ty_output_hdr,
id_ask type zask-zidask,
data_od TYPE zask-zdaod,
data_do TYPE zask-zdado,
END OF ty_output_hdr.
TYPES: BEGIN OF ty_output_pos,
id_mag TYPE zask-zidmag,
id_aso TYPE zask-zidaso,
id_kat_aso TYPE zask-zidkat,
source TYPE zask-zzrcel,
name TYPE zask-zkatnam,
END OF ty_output_pos.
With kind regards,
Bartlomiej
Hello Bartlomiej,
His logic for processing (item 1) is correct and you can do the processing in this way without any problems.
Regarding item 2, after the process of SPLIT, you can assign information to a structure and then insert the contents in the table individually.
SPLIT gs_line
AT '|'
INTO gv_fieldA
gv_fieldB
gv_fieldC.
gs_data-fieldA = gv_fieldA.
gs_data-fieldB = gv_fieldB.
gs_data-FieldC = gv_fieldC.
INSERT FROM ZTABLE gs_data.
Regarding item 3, a separate statement, however it manages more lines, is the best method that can be applied, allowing a subsequent maintenance will not affect other component.
Regarding F4_FILENAME object, you can use it on AT SELECTION-SCREEN event of report:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = '
IMPORTING
file_name = p_file.
Tks
Renato Bertizini
Similar Messages
-
How to read XLS file to sap table in backgroung
hii
i want to read file (XLS) type to sap table in background
can u help me to do that ??
thanks
Owesat EhsanHi,
Use FN Module TEXT_CONVERT_XLS_TO_SAP'
Declare Type pools: TYPE-POOLS: truxs.
Declare Data: Data i_raw TYPE truxs_t_text_data.
Declare Parameter : p_fname TYPE rlgrap-filename.
Better to Have a it_excel all fields in Char or string type. in order to avoid type mismatches.
Call FN Module and pass variables
FORM file_upload_fname USING p_fname TYPE rlgrap-filename.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_tab_raw_data = i_raw
i_filename = p_fname
TABLES
i_tab_converted_data = it_excel.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
To delete header line
IF it_excel IS NOT INITIAL.
DELETE it_excel INDEX 1.
ELSE.
MESSAGE i000(0k) WITH 'No Data in Excel File'.
ENDIF.
ENDFORM. " FILE_UPLOAD_FNAME
Regards,
shiva -
Read text file insert into table using utl_file
Hi
i have script for read and insert into table but i want error records load into error table so i sent you my script and please fix the error log table
script
DECLARE
v_line VARCHAR2(2000);
v_file utl_file.file_type;
v_dir VARCHAR2(250);
v_filename VARCHAR2(50);
BEGIN
v_dir :='MID5010_DOC1TP';
v_filename := 'OPT_CM_BASE.txt';
v_file := utl_file.fopen(v_dir, v_filename, 'r');
LOOP
BEGIN
utl_file.get_line(v_file, v_line);
EXCEPTION
WHEN no_data_found THEN
EXIT;
END ;
v_line := REPLACE(v_line,'|','|~');
INSERT
INTO optum_icd10cm_base VALUES
( REPLACE(TRANSLATE(regexp_substr(v_line,'[^|~]+',1,1),'a~','a'),'.'),
TRANSLATE(regexp_substr(v_line,'[^|~]+',1,2),'a~','a'),
TRANSLATE(regexp_substr(v_line,'[^|~]+',1,3),'a~','a'),
TRANSLATE(regexp_substr(v_line,'[^|~]+',1,4),'a~','a'),
TRANSLATE(regexp_substr(v_line,'[^|~]+',1,5),'a~','a'),
CASE
WHEN LENGTH(regexp_substr(v_line,'[^|~]+',1,6)) < 10
THEN to_date(ltrim(TRANSLATE(regexp_substr(v_line,'[^|~]+',1,6),'a~','a'),'0'),'mm-yyyy')
ELSE to_date(TRANSLATE(regexp_substr(v_line,'[^|]+',1,6),'a~','a'),'mm-dd-yyyy')
END,
CASE
WHEN LENGTH(regexp_substr(v_line,'[^|~]+',1,7)) < 10
THEN to_date(ltrim(TRANSLATE(regexp_substr(v_line,'[^|~]+',1,7),'a~','a'),'0'),'mm-yyyy')
ELSE to_date(TRANSLATE(regexp_substr(v_line,'[^|]+',1,7),'a~','a'),'mm-dd-yyyy')
END,
CASE
WHEN LENGTH(regexp_substr(v_line,'[^|~]+',1,8)) < 10
THEN to_date(ltrim(TRANSLATE(regexp_substr(v_line,'[^|~]+',1,8),'a~','a'),'0'),'mm-yyyy')
ELSE to_date(TRANSLATE(regexp_substr(v_line,'[^|]+',1,8),'a~','a'),'mm-dd-yyyy')
END,
CASE
WHEN LENGTH(regexp_substr(v_line,'[^|~]+',1,9)) < 10
THEN to_date(ltrim(TRANSLATE(regexp_substr(v_line,'[^|~]+',1,9),'a~','a'),'0'),'mm-yyyy')
ELSE to_date(TRANSLATE(regexp_substr(v_line,'[^|]+',1,9),'a~','a'),'mm-dd-yyyy')
END,
CASE
WHEN LENGTH(regexp_substr(v_line,'[^|~]+',1,10)) < 10
THEN to_date(ltrim(TRANSLATE(regexp_substr(v_line,'[^|~]+',1,10),'a~','a'),'0'),'mm-yyyy')
ELSE to_date(TRANSLATE(regexp_substr(v_line,'[^|]+',1,10),'a~','a'),'mm-dd-yyyy')
END,
TRANSLATE(regexp_substr(v_line,'[^|~]+',1,11),'a~','a')
-----commit;
END LOOP;
utl_file.fclose(v_file);
END;
text file
A50.0||Short|Long|Full|01-01-2009|01-2009||01-01-2013|09-18-2012|C|
A50.1||Short|Long|Full|01-01-2009|01-01-2009||001-2013|09-18-2012|C|
A50.2||Short|Long|Full|01-01-2009|01-01-2009|67|01-01-2013|09-18-2012|C|
A50.3||Short|Long|Full|011-2009|01-01-2009||01-01-2013|09-18-2012|C|
A50.4||Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|5|
A50.5|R|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A50.6||Short|Long||01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A50.7||Short||Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
2345||Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.0|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.1|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.2|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.3|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.4|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.5|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.6|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.7|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.8|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.9|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A70.0|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A70.1|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A70.2|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A70.3|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A70.4|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
B222|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.1|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.2|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.3|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.4|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.5|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.6|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.7|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.8|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.9|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A5.0|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A5.1|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A5.2|D|Short|Long|Full|01-01-2009|01-01-2009|01-10-2013|01-01-2013|09-18-2012|C|
A5.3|D|Short|Long|Full|01-01-2009|01-01-2009|01-10-2013|01-01-2013|09-18-2012|C|
D642|D|Short|Long|Full|01-01-2009|01-01-2009|01-10-2013|01-01-2013|09-18-2012|C|
A5.5|D|Short|Long|Full|01-01-2009|01-01-2009|01-10-2013|01-01-2013|09-18-2012|C|
A5.6|D|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A5.7|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A001|C|Short Updated|Long Updated|Full Updated|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A009|C|Short Updated|Long Updated|Full Updated|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A5.10|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A0109|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.0|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.1|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.2|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.3|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.4|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.5|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.6|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.7|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A30|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A316|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A317|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
----clearly read text file insert into table and error records load into error table
please help mehI
i am using utl_file prepared script but i got error like 01861. 00000 - "literal does not match format string"
script:
DECLARE
f utl_file.file_type;
s VARCHAR2(32000);
f1 VARCHAR2(100);
f2 varchar2(100);
F3 VARCHAR2(100);
F4 VARCHAR2(100);
F5 VARCHAR2(100);
F6 DATE;
F7 DATE;
F8 DATE;
F9 DATE;
F10 DATE;
f11 CHAR(1);
BEGIN
--DBMS_OUTPUT.ENABLE(100000);
f := utl_file.fopen('MID5010_DOC1TP', 'OPT_CM_BASE.txt', 'R');
LOOP
BEGIN
UTL_FILE.GET_LINE(f, s);
f1 := REGEXP_SUBSTR (s,'[^|]+',1,1);
f2 := REGEXP_SUBSTR (REPLACE(s,'||','||'),'[^|]+', 1,2);
F3 := REGEXP_SUBSTR (REPLACE(s,'||','||'),'[^|]+', 1,3);
F4 := REGEXP_SUBSTR (REPLACE(s,'||','||'),'[^|]+', 1,4);
F5 := REGEXP_SUBSTR (REPLACE(s,'||','||'),'[^|]+', 1,5);
F6 := to_date(REGEXP_SUBSTR (REPLACE(s,'||','||'),'[^|]+',1,6),'mm-dd-yyyy');
F8 := to_date(REGEXP_SUBSTR (REPLACE(s,'||','||'),'[^|]+',1,8),'mm-dd-yyyy');
F7 := to_date(REGEXP_SUBSTR (REPLACE(s,'||','||'),'[^|]+',1,7),'mm-dd-yyyy');
F9 := to_date(REGEXP_SUBSTR (REPLACE(s,'||','||'),'[^|]+',1,9),'mm-dd-yyyy');
F10 :=to_date(REGEXP_SUBSTR (REPLACE(s,'||','||') ,'[^|]+',1,10),'mm-dd-yyyy');
f11 := REGEXP_SUBSTR (REPLACE(s,'||','||'),'[^|]+', 1,11);
INSERT
INTO OPTUM_ICD10CM_BASE
( CODE,
STATUS,
SHORT_DESCRIPTION,
LONG_DESCRIPTION,
FULL_DESCRIPTION,
CODE_EFFECTIVE_DATE,
CHANGE_EFFECTIVE_DATE,
TERMINATION_DATE,
RELEASE_DATE,
CREATION_DATE,
VALIDITY
VALUES
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
f11
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
UTL_FILE.FCLOSE(F);
END;
please help me(in my org looks utl_file standards only) -
Uploading .txt file to z table
Hai Friends,
I want to upload a .txt file to Z table which contains around 27 fields. but .txt file contains data in two lines by as follows.
4.5 2.36 21.56 25 36.14 47.00 145.3 1247.6
10.2 4.6 23.5 589.1 20.1 45.6
Is it possible to upload the .txt file.Hi,
It is possible to upload txt file to ztable. You need to write small program for that.
Please see the example code below. Here from excel they are converting to internal table, use 'GUI_UPLOAD' to convert text file data to internal table and use this internal table to upload data into ztable. use MODIFY ZTABLE FROM TABLE ITAB.
Also maintain the internal table structure and structure of the ZTABLE should match.
**& Report Z_DEMO_FILL_TABLE
report z_demo_fill_table no standard page heading line-size 255.
selection-screen begin of block b1 with frame title text-003.
selection-screen skip.
*File Name
selection-screen begin of line.
selection-screen comment 5(28) text-001 for field p_file.
parameters: p_file type rlgrap-filename.
selection-screen end of line.
selection-screen skip.
selection-screen end of block b1.
data declarations.
*data: get_po_header type standard table of BAPIEKKOC,
get_PO_HEADER_ADD_DATA type standard table of BAPIEKKOA,
get_PO_ITEMS type standard table of BAPIEKPOC,
get_PO_ITEM_ADD_DATA type standard table of BAPIEKPOA,
data: get_poheader type standard table of bapimepoheader,
get_poitem type standard table of bapimepoitem,
it_data type table of alsmex_tabline initial size 0.
data: wa_poheader like line of get_poheader,
wa_poitem like line of get_poitem,
wa_data like line of it_data,
*tables used for catching messages returned by bapi
gt_return type standard table of bapiret2,
gt_return1 type standard table of bapiret2.
types: begin of x_po_tab,
doc_date type bapimepoheader-doc_date,
comp_code type bapimepoheader-comp_code,
purch_org type bapimepoheader-purch_org,
pur_group type bapimepoheader-pur_group,
vendor type bapimepoheader-vendor,
po_number type bapimepoheader-po_number,
pmnttrms type bapimepoheader-pmnttrms,
po_item type bapimepoitem-po_item,
material type bapimepoitem-material,
plant type bapimepoitem-plant,
stge_loc type bapimepoitem-stge_loc,
tax_code type bapimepoitem-tax_code,
end of x_po_tab.
Search help for file *
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
field_name = 'P_FILE'
importing
file_name = p_file.
START-OF-SELECTION *
start-of-selection.
perform for uploading Excel file
perform upload_file_path.
perform for transfering Excel data to Internal table
perform excel_to_itab.
perform int_process.
*& Form upload_file_path
text
--> p1 text
<-- p2 text
form upload_file_path .
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 12
i_end_row = 5000
tables
intern = it_data
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e000(zdbm) with 'Error in getting filename'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " upload_file_path
*& Form excel_to_itab
text
--> p1 text
<-- p2 text
form excel_to_itab .
loop at it_data into wa_data.
at new row.
clear: wa_poheader, wa_poitem.
endat.
case wa_data-col.
when '001'.
move wa_data-value to wa_poheader-doc_date.
when '002'.
move wa_data-value to wa_poheader-comp_code.
when '003'.
move wa_data-value to wa_poheader-purch_org.
when '004'.
move wa_data-value to wa_poheader-pur_group.
when '005'.
move wa_data-value to wa_poheader-vendor.
when '006'.
move wa_data-value to wa_poheader-po_number.
when '007'.
move wa_data-value to wa_poheader-pmnttrms.
when '008'.
move wa_data-value to wa_poitem-po_item.
when '009'.
move wa_data-value to wa_poitem-material.
when '010'.
move wa_data-value to wa_poitem-plant.
when '011'.
move wa_data-value to wa_poitem-stge_loc.
when '012'.
move wa_data-value to wa_poitem-tax_code.
endcase.
at end of row.
append wa_poheader to get_poheader.
append wa_poitem to get_poitem.
endat.
clear: wa_data.
endloop.
endform. " excel_to_itab
*& Form Int_process
text
--> p1 text
<-- p2 text
form int_process .
loop at get_poheader into wa_poheader.
read table get_poitem into wa_poitem index 1.
call function 'BAPI_PO_CREATE1'
exporting
poheader = wa_poheader
POHEADERX =
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
EXPPURCHASEORDER =
EXPHEADER =
EXPPOEXPIMPHEADER =
tables
RETURN =
poitem = get_poitem
POITEMX =
POADDRDELIVERY =
POSCHEDULE =
POSCHEDULEX =
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
endloop.
endform. " Int_process -
SQL Loader problem while loading records from txt file to database table.
I am getting following error while loading records from flat txt file into database table with the help of 'sqlldr' command. I have executed catldr.sql from RDBMS folder but it is still showing same error. I am setting DIRECT = TRUE while issuing sqlldr command. If I try with DIRECT = FALSE then it works fine. Database is Oracle 8i.
SQL*Loader-951: Error calling once/load initialization
ORA-24329: invalid character set identifier
F1 Please.Hello,
Direct path load, can only be used with SQL*Loader and Database have the same version.
Care to tell the database version and sql*loader version you are using.
-Sri -
Question about reading csv file into internal table
Some one (thanks those nice guys!) in this forum have suggested me to use FM KCD_CSV_FILE_TO_INTERN_CONVERT to read csv file into internal table. However, it can be used to read a local file only.
I would like to ask how can I read a CSV file into internal table from files in application server?
I can't simply use SPLIT as there may be comma in the content. e.g.
"abc","aaa,ab",10,"bbc"
My expected output:
abc
aaa,ab
10
bbb
Thanks again for your help.Hi Gundam,
Try this code. I have made a custom parser to read the details in the record and split them accordingly. I have also tested them with your provided test cases and it work fine.
OPEN DATASET dsn FOR input IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET dsn INTO record.
PERFORM parser USING record.
ENDDO.
*DATA str(32) VALUE '"abc",10,"aaa,ab","bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"bbc"'.
*DATA str(32) VALUE '"a,bc","aaaab",10,"bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"b,bc"'.
*DATA str(32) VALUE '"abc","aaaab",10,"bbc"'.
FORM parser USING str.
DATA field(12).
DATA field1(12).
DATA field2(12).
DATA field3(12).
DATA field4(12).
DATA cnt TYPE i.
DATA len TYPE i.
DATA temp TYPE i.
DATA start TYPE i.
DATA quote TYPE i.
DATA rec_cnt TYPE i.
len = strlen( str ).
cnt = 0.
temp = 0.
rec_cnt = 0.
DO.
* Start at the beginning
IF start EQ 0.
"string just ENDED start new one.
start = 1.
quote = 0.
CLEAR field.
ENDIF.
IF str+cnt(1) EQ '"'. "Check for qoutes
"CHECK IF quotes is already set
IF quote = 1.
"Already quotes set
"Start new field
start = 0.
quote = 0.
CONCATENATE field '"' INTO field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
CONDENSE field.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
* WRITE field.
ELSE.
"This is the start of quotes
quote = 1.
ENDIF.
ENDIF.
IF str+cnt(1) EQ ','. "Check end of field
IF quote EQ 0. "This is not inside quote end of field
start = 0.
quote = 0.
CONDENSE field.
* WRITE field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CONCATENATE field str+cnt(1) INTO field.
cnt = cnt + 1.
IF cnt GE len.
EXIT.
ENDIF.
ENDDO.
WRITE: field1, field2, field3, field4.
ENDFORM.
Regards,
Wenceslaus. -
I want read PDF file from SAP directory and create a spool request or print
Hi all,
I want read PDF file from SAP directory and create a spool request or print the pdf through SAP. Can any body help me in this.
Also please write to me if its possible to open PDF from SAP directory to adobe pdf reader.
Thanks in advance,
SunnyHi Sunny,
Check these links.
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
http://www.erpgenie.com/sap/abap/pdf_creation.htm
http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
Hope this resolves your query.
Reward all the helpful answers.
Regards -
Create an outbound flat file .txt file from SAP to UAPM.
How to Create an outbound flat file .txt file from SAP to UAPM (Unicenter Asset Portfolio Management).
What do u want in flat file and what is your doubt please let me know as iam working i can help u
-
Hi,
is it possible to give a user read access to an SAP table but to restrict it to a subset of columns?
Thanks,
DigeshHi Digesh,
If your requirement is to restrict the excess to specific rows it is possible to use S_TABU_LIN, but it works only for table which contains org units, like plant, company code, etc.
Please search for S_TABU_LIN if this is your requirement.
Otherwise please follow Alex's suggestion.
BR,
Mangesh -
Hy
My problem is to read TXT-Files in Webmode. In Client-Server mode it works fine. I use the function "text_io". In Webmode i get an error "No data found" (i think it is FRM-40375).
In which virtual directory should the files placed on the OAS????
Does anybody have some examples for me???You need to specify the directory unless your files are in the current working directory of the servlet container.
The following can help you see some of your application context:
// Get the server configuration information and display it.
String thisServer= getServletConfig().getServletContext().getServerInfo();
System.out.println("The servlet Engine version: " + thisServer);
// What is the servlet root path ?
String prefix = getServletContext().getRealPath("/");
System.out.println("prefix = '" + prefix + "'");
// What is the app root ?
String AppRootDir = getServletConfig().getServletContext().getRealPath("/");
System.out.println("The app root directory : " + AppRootDir ); -
Is it possible to read txt files on the new ipod nano? as it was on the 5th gen
is it possible to read txt files on the new ipod nano? as it was on the 5th gen.
We won't know for sure until either the iPod is released and somebody can verify that or when the manual is available online from Apple.
B-rock -
Read a txt file, display a table of values, select a value to set min value for DAQMX
Hello everyone, I am having trouble with the following data importing. I want to do the following:
Open a txt file, have it be imported as a table. Allow the user in the GUI to select a value on the 2nd column, set that value as either min or max for a daqmx analog output. I'll attach the .txt file being used. I can add the code but I was basically using the read from text.vi example with no luck.
Attachments:
090414-200-800-16x.txt 1 KBThank you all, I have set up this input but I have a couple more questions. First now that I have the ability to have a mouse click to set a value, is it possible to have two events, such that the first sets a certain value and the second retains a different one?
In addition (im not sure if this would be ok to post here but for the sake of clarity and decluttering the forum I shall post it here) is it possible to switch from a constant voltage mode (in DAQMX analog output) to a waveform mode ( attacthed the binary waveform) all while maintaining a constant min value (untill updated from the table by user, which is also attached).
I have attachted a vi (Labview version 8.2) that I threw together today.
Thank you all,
DB
Attachments:
calib.csv 3 KB
Example.vi 157 KB -
Update string table from continious reading "*.txt" file
Hello community ,
I read a txt file continiously and try to catch the next data written each time the txt file is modified. My problem is that I can't use an event structure inside the while loop to catch the new data written.
So the process write new data in the txt file line per line without erasing previous data like this:
data1
data2
data3
etc....
I just want to catch the new data writen when it's written.
Thank for any inputs......
Attachments:
zip.zip 11 KBWhat you are doing is basically what you have to do, you must poll the file somehow. If you have an event structure you can always use the timeout event to time the polling.
The only other workaround would depend on the producer of the data file. If it is a LabVIEW program you cna make it send the consumer VI an event telling it to read. Although at that point I would just have it send the data. -
How do i Batch Update the table by reading .txt file
HI All,
Suppose we are going to update a database table for a number of records; the record IDs are stored in a text file and may be tens of thousands.
Regards,
KrishnaHI Bajaranglal,
Thanks for your response. I have thousands of records in a text file. Read the file and update the database table.anyhow i resolved the problem.
Hay are you from orissa? if so, please let me know from which place?
Thanks & Regards,
Krishna -
How do I read txt file and add items to dropdownlist or checkbox
I want to add items to a dropdown or check box by reading from a text file(and select one of them). (I donot use any table or database). The list of items is sometimes upto 20MB and hence cannot populate using session bean.I want items to be added to either checkbox or listbox during a button action. I have done this for textarea but unable so far to acheive for checkbox or listbox. I use following code which does not work:
public String button3_action() {
try{
FileReader fr = new FileReader "F:/CreatorProjects/checkboxtst.prs");
BufferedReader br = new BufferedReader(fr);
String s;
while((s=br.readLine())!=null) {
dropdown1.setValue(s);
br.close();
fr.close();
}catch(Exception e) {
e.printStackTrace();
return null;
I know I cant just transplant textarea code for dropdownlist or checkbox.
Any help is greatly appreciated.
Thanks.
Dr.AM.Mohan RaoI am able to read from txt file to a listbox if i write in sessionsbean1:
try{
FileReader fr = new FileReader("F:/CreatorProjects/checkboxtst.prs");
BufferedReader br = new BufferedReader(fr);
String s1="";
String s="";
while((s=br.readLine())!=null) {
s1 = s1+s;
s1= s1+"\n";
disOptions = new com.sun.rave.web.ui.model.Option[] {
new Option(s1,s1)};
diseases = new String[] {};
fr.close();
br.close();
catch(Exception e) {
e.printStackTrace();
But I get all data in one line!! if I click submit button text area gets all. How to display items in each line????Please help...
Dr.AM. Mohan Rao
Maybe you are looking for
-
Restoring Mail from Time Machine onto a different Macbook
My 2008 MBP died given the well known NVidia video card problem. Since Apple called my MBP an "antique" and any service or warranty due to the video card issue is expired, I'm left with a heavy paperweight. I'm not in a position to buy a new MBP cu
-
Open in Smart View option not working.
Hey there, We have been having this problem for a few days now, We have Hyperion 11.1.1.3 on a UNIX Server,and when users try to open a planning data form using the "Open In SmartView" it never opens. All that it says is "Windows is trying to run som
-
XML file creation in Tool 8.45
Hello All, I am on tools 8.45. I have a requirement to create an XML file from peoplesoft and send it to an ESB server(Enterprise Service Bus). How can i achieve this. I need to do delta as well as full publish. For example whenever there is job data
-
How do I transfer pics from my old iPhone 5 to new iphone6
Transferring pic
-
About the latest version of Mozilla FireFox
Hi there, if I suspect that my Mozilla Firefox is already outdated. How can I check for the latest version of Mozilla Firefox, and how to upgrade to the latest version? Thanks a million in advance for your sincere help.