How to truncate data in a subpartition
Hi All,
I am using oracle 11gr2 database.
I have a table as given below
CREATE TABLE SCMSA_ESP.PP_DROP
ESP_MESSAGE_ID VARCHAR2(50 BYTE) NOT NULL ,
CREATE_DT DATE DEFAULT SYSDATE,
JOB_LOG_ID NUMBER NOT NULL ,
MON NUMBER GENERATED ALWAYS AS (TO_CHAR("CREATE_DT",'MM'))
TABLESPACE SCMSA_ESP_DATA
PARTITION BY RANGE (JOB_LOG_ID)
SUBPARTITION BY LIST (MON)
PARTITION PMINVALUE VALUES LESS THAN (1)
( SUBPARTITION PMINVALUE_M1 VALUES ('01') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M2 VALUES ('02') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M3 VALUES ('03') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M4 VALUES ('04') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M5 VALUES ('05') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M6 VALUES ('06') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M7 VALUES ('07') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M8 VALUES ('08') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M9 VALUES ('09') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M10 VALUES ('10') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M11 VALUES ('11') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMINVALUE_M12 VALUES ('12') TABLESPACE SCMSA_ESP_DATA
PARTITION PMAXVALUE VALUES LESS THAN (MAXVALUE)
( SUBPARTITION PMAXVALUE_M1 VALUES ('01') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M2 VALUES ('02') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M3 VALUES ('03') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M4 VALUES ('04') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M5 VALUES ('05') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M6 VALUES ('06') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M7 VALUES ('07') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M8 VALUES ('08') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M9 VALUES ('09') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M10 VALUES ('10') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M11 VALUES ('11') TABLESPACE SCMSA_ESP_DATA,
SUBPARTITION PMAXVALUE_M12 VALUES ('12') TABLESPACE SCMSA_ESP_DATA
ENABLE ROW MOVEMENT;
I have populate two sets of data.
One with Positive job_log_id and another with Negative job logid as given below.
Step 1:
Data going to PMAXVALUE Partition
INSERT INTO PP_DROP ( ESP_MESSAGE_ID, CREATE_DT,JOB_LOG_ID)
SELECT LEVEL, SYSDATE+TRUNC(DBMS_RANDOM.VALUE(1,300)), 1 FROM DUAL CONNECT BY LEVEL <=300;
Step 2:
Data going to PMINVALUE partition
INSERT INTO PP_DROP ( ESP_MESSAGE_ID, CREATE_DT,JOB_LOG_ID)
SELECT LEVEL, SYSDATE+TRUNC(DBMS_RANDOM.VALUE(1,300)), -1 FROM DUAL CONNECT BY LEVEL <=300;
Now the question is how to truncate the data that is present only in the Positive partitions subpartition
Like in the PMAXVALUE partition I have 10 subpartitions and I need to truncate the data in the JAN MONTH Partition only of the PMAXVALUE partition.
Appreciate your valuable response.
Thanks,
MK.
For future reference:
http://www.morganslibrary.org/reference/truncate.html
The library index is located at
http://www.morganslibrary.org/library.html
Similar Messages
-
Truncated data value displayed in Answer
Hi All ,
When i make a query using a column in BI Answer, i am getting the truncated data.
It does not display complete text data.
I am using a XLS as data source. Size of this text data is 500 -600 char. By default it's data type is Varchar and size 255 at physical layer. Even If i increase it's size to 1000 , it shows only 255 characters.
I also tried to change it's datatype to Longvarchar , but still same problem persists.
Any idea in this regard? How can i resolve this problem?Hi Cosimo,
Thanks for the reply.
But i think ,in my case data format option is not required.
Using Data Format option we can format only the displayed content of that column in
the report. My problem is little bit different. Each time when i do ad hoc query using the
column, i get the truncated result. I am not going to create any report using that
column.
The issue is due to some data type and it's size. But i am not able to find out any solution of this problem. -
How to find data dictionary and oracle schema tables for UTF8 char conversi
I am doing UTF8 char conversition, i got lot of convertable objects,as per document we don't need to worry about data dictionary objects and how to find data dictionary and oracle schema objects for UTF8 char conversition.
USER.TABLE Convertible Truncation Lossy
MDSYS.OPENLS_NODES 17 0 0
MDSYS.SDO_COORD_OP_PARAM_VALS 200 0 0
MDSYS.SDO_GEOR_XMLSCHEMA_TABLE 1 0 0
MDSYS.SDO_STYLES_TABLE 78 0 0
MDSYS.SDO_XML_SCHEMAS 3 0 0
ORDDATA.ORDDCM_CT_PRED_OPRD 51 0 0
ORDDATA.ORDDCM_DOCS 9 0 0
ORDDATA.ORDDCM_MAPPING_DOCS 1 0 0
SYS.METASTYLESHEET 178 0 0
SYS.REGISTRY$ERROR 2 0 0
SYS.RULE$ 21 0 0
SYS.SCHEDULER$_EVENT_LOG 182 0 0
SYS.WRH$_SQLTEXT 2,099 0 0
SYS.WRH$_SQL_PLAN 1,736 0 0
SYS.WRI$_ADV_ACTIONS 5,452 0 0
SYS.WRI$_ADV_DIRECTIVE_META 5 0 0
SYS.WRI$_ADV_OBJECTS 2,278 0 0
SYS.WRI$_ADV_RATIONALE 9,594 0 0
SYS.WRI$_ADV_SQLT_PLANS 455 0 0
SYS.WRI$_ADV_SQLT_PLAN_STATS 288 0 0
SYS.WRI$_DBU_FEATURE_METADATA 188 0 0
SYS.WRI$_DBU_FEATURE_USAGE 16 0 0
SYS.WRI$_DBU_HWM_METADATA 20 0 0
SYS.WRI$_REPT_FILES 27 0 0
XDB.XDB$DXPTAB 2 0 0
XML CSX Dictionary Tables:
USER.TABLE Convertible Truncation Lossy
Application Data:
USER.TABLE Convertible Truncation Lossy
APPLSYS.BISM_OBJECTS 4 0 0
APPLSYS.DR$FND_LOBS_CTX$I 0 103 1,260,883
APPLSYS.FND_CONC_PROG_ANNOTATIONS 272 0 0
APPLSYS.FND_OAM_CONTEXT_FILES 15 0 0
APPLSYS.FND_OAM_DOC_LINK 1 0 0
APPS.FND_OAM_CONTEXT_FILES_1 6 0 0
AZ.AZ_APIS 11 0 0
AZ.AZ_SELECTION_SET_ENTITIES_B 48 0 0
ECX.ECX_DTDS 205 0 0
ECX.ECX_FILES 91 0 0
IBC.IBC_ATTRIBUTE_BUNDLES 41 0 0
JTF.JTF_HEADER_DTD 1 0 0
JTF.JTF_MESSAGE_OBJECTS 82 0 0
JTF.JTY_TRANS_USG_PGM_SQL 29 0 0
ODM.ODM_PMML_DTD 1 0 0
OKC.OKC_REPORT_SQL_B 3 0 0
OKC.OKC_REPORT_SQL_TL 2 0 0
OKC.OKC_REPORT_XSL_TL 5 0 0
XDP.XDP_PROC_BODY 10 0 0
[Distribution of Convertible, Truncated and Lossy Data by Column]
Data Dictionary Tables:
USER.TABLE|COLUMN Convertible Truncation Lossy
MDSYS.OPENLS_NODES|SYS_NC00004$ 17 0 0
MDSYS.SDO_COORD_OP_PARAM_VALS|PARAM_VALUE_FILE 200 0 0
MDSYS.SDO_GEOR_XMLSCHEMA_TABLE|XMLSCHEMA 1 0 0
MDSYS.SDO_STYLES_TABLE|DEFINITION 78 0 0
MDSYS.SDO_XML_SCHEMAS|XMLSCHEMA 3 0 0
ORDDATA.ORDDCM_CT_PRED_OPRD|SYS_NC00004$ 51 0 0
ORDDATA.ORDDCM_DOCS|SYS_NC00005$ 9 0 0
ORDDATA.ORDDCM_MAPPING_DOCS|SYS_NC00007$ 1 0 0
SYS.METASTYLESHEET|STYLESHEET 178 0 0
SYS.REGISTRY$ERROR|MESSAGE 1 0 0
SYS.REGISTRY$ERROR|STATEMENT 1 0 0
SYS.RULE$|CONDITION 21 0 0
SYS.SCHEDULER$_EVENT_LOG|ADDITIONAL_INFO 182 0 0
SYS.WRH$_SQLTEXT|SQL_TEXT 2,099 0 0
SYS.WRH$_SQL_PLAN|OTHER_XML 1,736 0 0
SYS.WRI$_ADV_ACTIONS|ATTR5 2,726 0 0
SYS.WRI$_ADV_ACTIONS|ATTR6 2,726 0 0
SYS.WRI$_ADV_DIRECTIVE_META|DATA 5 0 0
SYS.WRI$_ADV_OBJECTS|ATTR4 2,278 0 0
SYS.WRI$_ADV_RATIONALE|ATTR5 9,594 0 0
SYS.WRI$_ADV_SQLT_PLANS|OTHER_XML 455 0 0
SYS.WRI$_ADV_SQLT_PLAN_STATS|OTHER 288 0 0
SYS.WRI$_DBU_FEATURE_METADATA|INST_CHK_LOGIC 21 0 0
SYS.WRI$_DBU_FEATURE_METADATA|USG_DET_LOGIC 167 0 0
SYS.WRI$_DBU_FEATURE_USAGE|FEATURE_INFO 16 0 0
SYS.WRI$_DBU_HWM_METADATA|LOGIC 20 0 0
SYS.WRI$_REPT_FILES|SYS_NC00005$ 27 0 0
XDB.XDB$DXPTAB|SYS_NC00006$ 2 0 0
XML CSX Dictionary Tables:
USER.TABLE|COLUMN Convertible Truncation Lossy
Application Data:
USER.TABLE|COLUMN Convertible Truncation Lossy
APPLSYS.BISM_OBJECTS|SYS_NC00023$ 4 0 0
APPLSYS.DR$FND_LOBS_CTX$I|TOKEN_TEXT 0 103 1,260,883
APPLSYS.FND_CONC_PROG_ANNOTATIONS|PROGRAM_ANNOTAT 272 0 0
APPLSYS.FND_OAM_CONTEXT_FILES|TEXT 15 0 0
APPLSYS.FND_OAM_DOC_LINK|DOC_LINK_INFO 1 0 0
APPS.FND_OAM_CONTEXT_FILES_1|TEXT 6 0 0
AZ.AZ_APIS|FILTERING_PARAMETERS 11 0 0
AZ.AZ_SELECTION_SET_ENTITIES_B|FILTERING_PARAMETE 48 0 0
ECX.ECX_DTDS|PAYLOAD 205 0 0
ECX.ECX_FILES|PAYLOAD 91 0 0
IBC.IBC_ATTRIBUTE_BUNDLES|ATTRIBUTE_BUNDLE_DATA 41 0 0
JTF.JTF_HEADER_DTD|HEADER_DTD 1 0 0
JTF.JTF_MESSAGE_OBJECTS|BUS_OBJ_DTD 41 0 0
JTF.JTF_MESSAGE_OBJECTS|BUS_OBJ_SQL 41 0 0
JTF.JTY_TRANS_USG_PGM_SQL|BATCH_DEA_SQL 1 0 0
JTF.JTY_TRANS_USG_PGM_SQL|BATCH_INCR_SQL 5 0 0
JTF.JTY_TRANS_USG_PGM_SQL|BATCH_TOTAL_SQL 6 0 0
JTF.JTY_TRANS_USG_PGM_SQL|INCR_REASSIGN_SQL 5 0 0
JTF.JTY_TRANS_USG_PGM_SQL|REAL_TIME_INSERT 6 0 0
JTF.JTY_TRANS_USG_PGM_SQL|REAL_TIME_SQL 6 0 0
ODM.ODM_PMML_DTD|DTD 1 0 0
OKC.OKC_REPORT_SQL_B|SQL_TEXT 3 0 0
OKC.OKC_REPORT_SQL_TL|HELP_TEXT 2 0 0
OKC.OKC_REPORT_XSL_TL|HELP_TEXT 2 0 0
OKC.OKC_REPORT_XSL_TL|XSL_TEXT 3 0 0
XDP.XDP_PROC_BODY|PROC_BODY 10 0 0
-------------------------------------------------- ---------------- ---------------- ----------------Hi;
Please run below query which could be helpful for your issue:
select * from dictionary where TABLE_NAME LIKE '%NLS%'
select * from dictionary where TABLE_NAME LIKE '%GLOBAL%'
Regard
Helios -
hello friends
I created a table called log as follows
create table log(logid number,login_date date);
insert into log values(101,sysdate);
after 10 mins i created a cursor as follows..
declare
uname varchar2(30);
logdate date;
cursor name_c is
select logid,login_date from log where logid=101 and login_date=sysdate;
begin
open name_c;
fetch name_c into uname,logdate;
if(name_c%FOUND) then
dbms_output.put_line( 'FOUND');
end if;
close name_c;
end;
set serveroutput on;
PL/SQL procedure successfully completed.
But i got no result..I found the reason that when i insert into table sysdate stores all fields
including hour,min,sec etc.. But i fetch cursor sysdate[After 10 min] So the time fields change.So only the cursor fetch no rows...Please help me to fetch the row from log table..
How to truncate sysdate field to fetch only date like('18-feb-2011')..hi there
use trunc(sysdate) in ur cursor
and one more thing
use
exit when name_c%notfound;refer this
DECLARE
uname VARCHAR2 (30);
logdate DATE;
CURSOR name_c
IS
SELECT logid, login_date
FROM LOG
WHERE logid = 101 AND trunc(login_date) = trunc(SYSDATE);
BEGIN
OPEN name_c;
FETCH name_c INTO uname, logdate;
exit when name_c%notfound;
IF (name_c%FOUND)
THEN
DBMS_OUTPUT.put_line ('FOUND');
END IF;
CLOSE name_c;
END;
/regards
Hitesh -
Print a report on doc format truncate data
hi
I have a report launching with a form in an oracle applications, when I print a report on pdf format looks ok
but when I print the same report on doc format truncate data on left and right side.
Can you help me
thanksHi Herbe
Reports does not support .doc format. Are you referring .rtf format?
In any case, you must contact Oracle Support to get the issue resolved.
Regards
Sripathy -
How to populate data in table control .
hi all,
i put matnr no. in screen no. 103
validation is done at that screen only.
now when i want to modify dat record
when i put matnr no. at screen 103
so how i will get all data of dat number to table control screen.Hi Darshan,
Here is a detailed description of how to update data in table controll.
Updating data in table control
The ABAP language provides two mechanisms for loading the table control with data from the internal table and then storing the altered rows of the table control back to the internal table.
Method 1: Read the internal table into the Table Control in the screenu2019s flow logic. Used when the names of the Table Control fields are based on fields of the internal table.
Method 2: Read the internal table into the Table Control in the module pool code. Used when the names of the Table Control fields are based on fields of the database table.
Method 1 (table control fields = itab fields)
In the flow logic we can read an internal table using the LOOP statement. Define the reference to the relevant able control by specifying WITH CONTROL <ctrl>
Determine which table entry is to be read by specifying CURSOR <ctrl>-CURRENT_LINE.
After the read operation the field contents are placed in the header line of the internal table. If the fields in the table control have the same name as the internal they will be filled automatically. Otherwise we need to write a module to transfer the internal table fields to the screen fields.
We must reflect any changes the user makes to the fields of the table control in the internal table otherwise they will not appear when the screen is redisplayed after PBO processing, (eg, after the user presses Enter or scrolls) However, this processing should be performed only if changes have actually been made to the screen fields of the table control (hence the use of the ON REQUEST)
PROCESS BEFORE OUTPUT.
LOOP AT ITAB_REG WITH CONTROL TCREG
CURSOR TCREG-CURRENT_LINE.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT ITAB_REG.
MODULE MODIFY_ITAB_REG.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Method 2 (table control fields = dict. fields)
If using a LOOP statement without an internal table in the flow logic, we must read the data in a PBO module which is called each time the loop is processed.
Since, in this case, the system cannot determine the number of internal table entries itself, we must use the EXIT FROM STEP-LOOP statement to ensure that no blank lines are displayed in the table control if there are no more corresponding entries in the internal table.
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TCREG.
MODULE READ_ITAB_REG.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP WITH CONTROL TCREG.
CHAIN.
FIELD: ITAB_REG-REG,
ITAB_REG-DESC.
MODULE MODIFY_ITAB_REG
ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE READ_ITAB_REG OUTPUT.
READ TABLE ITAB_REG INDEX TCREG-CURRENT_LINE.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING ITAB_REREG TO TCREG.
ELSE.
EXIT FROM STEP-LOOP.
ENDIF.
ENDMODULE.
MODULE MODIFY_ITAB_REG INPUT.
MOVE-CORRESPONDING TCREG TO ITAB_REG.
MODIFY ITAB_REG INDEX
TCREG-CURRENT_LINE.
ENDMODULE.
Updating the internal table
Method 1
PROCESS AFTER INPUT.
LOOP AT ITAB_REG.
CHAIN.
FIELD: ITAB_REG-REG,
ITAB_REG-DESC.
MODULE MODIFY_ITAB_REG ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
ITAB_REG-MARK = u2018Xu2019.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Method 2
PROCESS AFTER INPUT.
LOOP WITH CONTROL TCREG.
CHAIN.
FIELD: TCREG-REG,
TCREG-DESC.
MODULE MODIFY_ITAB_REG ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
MOVE-CORRESPONDING TCREG TO ITAB_REG.
ITAB_REG-MARK = u2018Xu2019.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Updating the database
MODULE USER_COMMAND_100.
CASE OK_CODE.
WHEN u2018SAVEu2019.
LOOP AT ITAB-REG.
CHECK ITAB_REG-MARK = u2018Xu2019.
MOVE-CORRESPONDING ITAB_REG TO TCREG.
UPDATE TCREG.
ENDLOOP.
WHEN u2026
u2026
ENDCASE.
ENDMODULE.
Hope this will solve your problem.
Regards,
Pavan.
Edited by: PAVAN CHANDRASEKHAR GANTI on Aug 3, 2009 12:48 PM -
How to populate data in PAY_PEOPLE_GROUPS table (People Group Flexfiled)
Hello
We are migrating the data from one oracle instance to another oracle instance which are in same version of Oralce Applications 11.5.10.2. As a part of migration can anybody let me know how to populate data in "People Group Key Flexfiled" (PAY_PEOPLE_GROUPS table), ideally I will create or update employee records from the source instance to destination instance, so while creating or updating the employee records in can pass people_group_id while calling to the assignment api but my question here is before passing group id to the api i should have the data populated in PAY_PEOPLE_GROUPS TABLE so that i can fetch the group id as per the combination and pass it in to the api.. please suggest...Thanks for your information! by any chance do you have any sample code which will create/update assignments with People Group Flexfield; when i check "hr_assignment_api.update_emp_asg_criteria" it only has parameter to pass people group id and not having segments parameters to pass individual segments.
Also let me know the links if you have any for all HR API guide which will help me to develope the interfaces...
My requirement is we have two instances in which in one instance we are treating as source for HR which will be used to master for all HR related activities and we are planning to develope an interface which will bring master instance in sync with dummy instance. -
Open Hub: How-to doc "How to Extract data with Open Hub to a Logical File"
Hi all,
We are using open hub to download transaction files from infocubes to application server, and would like to have filename which is dynamic based period and year, i.e. period and year of the transaction data to be downloaded.
I understand we could use logical file for this purpose. However we are not sure how to have the period and year to be dynamically derived in filename.
I have read in sdn a number of posted messages on a similar topic and many have suggested a 'How-to' paper titled "How to Extract data with Open Hub to a Logical Filename". However i could not seem to be able to get document from the link given.
Just wonder if anyone has the correct or latest link to the document, or would appreciate if you could share the document with all in sdn if you have a copy.
Many thanks and best regards,
VictoriaHi,
After creating open hub press F1 in Application server file name text box from the help window there u Click on Maintain 'Client independent file names and file paths' then u will be taken to the Implementation guide screen > click on Cross client maintanance of file name > create a logical file path by clicking on new entiries > after creating logical file path now go to Logical file name definition there give your Logical file , name , physical file (ur file name followed by month or year what ever is applicable (press f1 for more info)) , data format (ASC) , application area (BW) and logical path (choose from F4 selection which u have created first), now goto Assignment of physical path to logical path > give syntax group >physical path is the path u gave at logical file name definition.
however we have created a logical path file name to identify the file by sys date but ur requirement seems to be of dynamic date of tranaction data...may u can achieve this by creating a variable. U can see the help from F1 that would be of much help to u. All the above steps i have explained will help u create a dynamic logical file.
hope this helps u to some extent.
Regards -
How to set data in rtf document?
Hi friends,
I have a rtf document can anyone suggest how to set data in cells of an rtf document?Is there any way?
Thanks in advance..
Regards ,
SoumyanilConvert the resultSet from the db to a Object[][], let's call it result.
Then create a JTable (jTable1).
On the JTable you need to define the headers, and the data itself.
You can get the headers from ResultSetMetaData. Convert these to an array again (headers).
Now use these methods to create a model and set the model of the JTable.
Model model = new DefaultTableModel(result, headers);
jTable1.setModel(model);That's about the basics.
If you need more info, use at the tutorial at sun's homepage.
How to use Tables:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html -
How to upload data from excel to form using webutil
Hi,
In the sample provided by Oracle
http://www.oracle.com/technology/products/forms/htdocs/webutil/howto_ole.html
Note 247606.1 How to Copy Records From a Form Into Excel
It shown the methods of how to copy data from form to excel but is there any sample to provide the step on how to read the cell from excel into Form in 10g.declare
args client_ole2.list_type;
application client_ole2.obj_type;
vworkbooks client_ole2.obj_type;
vdoc client_ole2.obj_type;
vworksheet client_ole2.obj_type;
vrange client_ole2.obj_type;
begin
-- create app object
application := client_ole2.create_obj('Excel.Application');
client_OLE2.SET_PROPERTY(application, 'Visible','True');
-- get workbooks object
vworkbooks := client_ole2.get_obj_property(application, 'Workbooks');
-- and open a file
args := client_ole2.create_arglist;
client_ole2.ADD_ARG(args, 'c:\tp_ae.xls');
vdoc :=client_ole2.INVOKE_OBJ(vworkbooks,'Open',args);
client_ole2.destroy_arglist(args);
-- get a worksheet object
-- for this to work you need to know the sheet name or its index
args := client_ole2.create_arglist;
client_ole2.ADD_ARG(args, 1); <-- name or index
vworksheet := client_ole2.get_obj_property(vdoc,'Worksheets',args);
client_ole2.destroy_arglist(args);
-- get a range object which in this case is just a cell
-- for this to work you need to know the cell coordinates
args := client_ole2.create_arglist;
client_ole2.ADD_ARG(args, 'B6');
vrange := client_ole2.get_obj_property(vworksheet,'Range',args);
client_ole2.destroy_arglist(args);
-- and here you get the value
message(client_ole2.get_char_property(vrange,'Value'));
-- release objects
client_ole2.release_obj(vrange);
client_ole2.release_obj(vworksheet);
client_ole2.release_obj(vdoc);
client_ole2.release_obj(vworkbooks);
client_ole2.release_obj(application);
end; -
HOW TO UPLOAD DATA FROM EXCEL TO INTERNALTABLE
HI,
HOW TO UPLOAD DATA FROM EXCEL TO INTERNALTABLE? & WITH EXAMPLE.hi,
chk this, put the data into an excel file.
fields inside it are name and age.
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
modfiy db_name_age from table record.
ENDIF.
<i><b>ANOTHER EXAMPLE</b></i>
TYPE-POOLS truxs.
types: begin of t_tab,
col1(5) type c,
col2(5) type c,
col3(5) type c,
end of t_tab.
data : itab type standard table of t_tab,
wa type t_tab.
data it_type type truxs_t_text_data.
parameter p_file type rlgrap-filename.
data ttab type tabname.
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.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
i_tab_raw_data = it_type
i_filename = p_file
tables
i_tab_converted_data = 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.
end-of-selection.
loop at itab into wa.
write : wa-col1,
wa-col2,
wa-col3.
endloop.
rgds,
anver
<i>if hlped pls mark points</i> -
How to upload data from excel to SAP and options to be used
How to upload data from excel to SAP and options to be used
thank you,
Regards,
Jagrut Bharatkumar shuklaHi Jagrut,
You can use gui_upload.
chk the sample program mentioned below.
REPORT ZFTP .
DATA: BEGIN OF I_FILE OCCURS 0,
DATA(2000) TYPE C,
END OF I_FILE.
DATA: BEGIN OF I_FILE2 OCCURS 0,
DATA(2000) TYPE C,
END OF I_FILE2.
DATA: W_COUNT TYPE I.
PARAMETERS: P_FILEN TYPE STRING,
P_FILE2 TYPE STRING,
P_NUM(4) TYPE N..
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILEN.
PERFORM F_FILE_GET USING P_FILEN TEXT-G01.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE2.
PERFORM F_FILE_GET USING P_FILE2 TEXT-G01.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = P_FILEN
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = I_FILE
IF SY-SUBRC <> 0.
MESSAGE E024(Z1).
ENDIF.
LOOP AT I_FILE.
W_COUNT = W_COUNT + 1.
IF NOT W_COUNT > P_NUM.
MOVE I_FILE TO I_FILE2.
APPEND I_FILE2.
ENDIF.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = P_FILE2
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 = I_FILE2
FIELDNAMES =
*& Form F_FILE_GET
text
-->P_P_FILEN text
-->P_TEXT_G01 text
FORM F_FILE_GET USING L_FILENA L_TEXT.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = ' '
MASK = ',.,*.TXT.'
MODE = 'O'
TITLE = L_TEXT
IMPORTING
FILENAME = L_FILENA
rc =
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 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.
Reward if helpful.
Regards,
Harini.S -
How to load data to a cube from multiple infosources ?
Hi friends,
How to load data to a cube from multiple infosources ? could u please answer this question .
thanks in advance......Hi ,
say for example you need to load data to 1 cube from 3 info sources:
1) You need to create 3 update rules for the Cube.
2) Each time you create the update rules. Mention the name the name of the Info source. and create update rules correspondingly.
Regards
satish
Message was edited by:
satish murthy -
How to stored data after clicking checkbox save in database table
TYPE-pools: slis.
tables:mkpf,mseg,mard,COWB_COMP.
TYPES: BEGIN OF tp_data,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
lgpbe LIKE mard-lgpbe,
charg LIKE mseg-charg,
bwart LIKE mseg-bwart,
budat LIKE mkpf-budat,
menge LIKE mseg-menge,
meins LIKE mseg-meins,
kostl LIKE mseg-kostl,
aufnr LIKE mseg-aufnr,
rsnum LIKE mseg-rsnum,
endkz like COWB_COMP-endkz,
END OF tp_data,
tp_tbl_data TYPE STANDARD TABLE OF tp_data.
*data: t_data like ztable occurs 0 with header line.
Constants
Data objects (variable declarations and definitions)
Report data to be shown.
DATA: it_data TYPE STANDARD TABLE OF tp_data.
Heading of the report.
DATA: t_heading TYPE slis_t_listheader.
========================== Selection Screen ==========================
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:smblnr FOR mseg-mblnr MODIF ID m1,
smatnr FOR mseg-matnr MODIF ID m2,
swerks FOR mard-werks MODIF ID m3,
slgort FOR mard-lgort MODIF ID m4,
slgpbe FOR mard-lgpbe MODIF ID m5,
scharg FOR mseg-charg MODIF ID m6,
sbwart FOR mseg-bwart MODIF ID m7,
skostl FOR mseg-kostl MODIF ID m8,
saufnr FOR mseg-aufnr MODIF ID m9,
srsnum FOR mseg-rsnum MODIF ID m10.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS:pre RADIOBUTTON GROUP radi USER-COMMAND ucomm DEFAULT 'X',
pse RADIOBUTTON GROUP radi,
bps RADIOBUTTON GROUP radi.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETER:layout TYPE i.
SELECTION-SCREEN END OF BLOCK b3.
=========================== Event Blocks =============================
AT selection-SCREEN.
start-OF-selection.
PERFORM get_data USING it_data.
END-OF-selection.
PERFORM build_alv USING it_data t_heading.
=========================== Subroutines ==============================
*& Form get_data
Gets the information to be shown in the report.
FORM get_data USING t_data TYPE tp_tbl_data.
SELECT msegmblnr msegmatnr mardwerks mardlgort mardlgpbe msegcharg msegbwart mkpfbudat
msegmenge msegmeins msegkostl msegaufnr mseg~rsnum
INTO CORRESPONDING FIELDS OF TABLE t_data
FROM mseg
JOIN mard ON mardmatnr EQ msegmatnr
JOIN mkpf ON msegmblnr EQ mkpfmblnr
WHERE mseg~matnr IN smatnr.
ENDFORM. " get_data
*& Form build_alv
Builds and display the ALV Grid.
FORM build_alv USING t_data TYPE tp_tbl_data
t_heading TYPE slis_t_listheader.
ALV required data objects.
DATA: w_title TYPE lvc_title,
w_comm TYPE slis_formname,
w_status TYPE slis_formname,
x_layout TYPE slis_layout_alv,
t_event TYPE slis_t_event,
t_fieldcat TYPE slis_t_fieldcat_alv,
t_sort TYPE slis_t_sortinfo_alv.
REFRESH t_fieldcat.
REFRESH t_event.
REFRESH t_sort.
CLEAR x_layout.
CLEAR w_title.
Field Catalog
PERFORM set_fieldcat2 USING:
1 'MBLNR' 'MBLNR' 'MSEG' space space space space space space space space space space space space t_fieldcat ,
2 'MATNR' 'MATNR' 'MSEG' space space space space space space space space space space space space t_fieldcat ,
3 'WERKS' 'WERKS' 'MARD' space space space space space space space space space space space space t_fieldcat,
4 'LGORT' 'LGORT' 'MARD' space space space space space space space space space space space space t_fieldcat ,
5 'LGPBE' 'LGPBE' 'MARD' space space space space space space space space space space space space t_fieldcat ,
6 'CHARG' 'CHARG' 'MSEG' space space space space space space space space space space space space t_fieldcat ,
7 'BWART' 'BWART' 'MSEG' space space space space space space space space space space space space t_fieldcat,
8 'BUDAT' 'BUDAT' 'MKPF' space space space space space space space space space space space space t_fieldcat,
9 'MENGE' 'MENGE' 'MSEG' space space space space space space space space space space space space t_fieldcat,
10 'MEINS' 'MEINS' 'MSEG' space space space space space space space space space space space space t_fieldcat,
11 'KOSTL' 'KOSTL' 'MSEG' space space space space space space space space space space space space t_fieldcat,
12 'AUFNR' 'AUFNR' 'MSEG' space space space space space space space space space space space space t_fieldcat,
13 'RSNUM' 'RSNUM' 'MSEG' space space space space space space space space space space space space t_fieldcat,
14 'ENDKZ' 'ENDKZ' 'COWB_COMP' space space 'select' 'Select this row' 'Sel' 'Select this row' space space space 'X' 'X' space t_fieldcat.
Layout
x_layout-zebra = 'X'.
Top of page heading
PERFORM set_top_page_heading USING t_heading t_event.
Events
PERFORM set_events USING t_event.
GUI Status
w_status = ''.
User commands
w_comm = 'USER_COMMAND'.
Order
Example
PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
PERFORM set_order USING 'MBLNR' 'IT_DATA' 'X' space 'X' t_sort.
PERFORM set_order USING 'EBELN' 'IT_DATA' 'X' space 'X' t_sort.
PERFORM set_order USING 'EBELP' 'IT_DATA' 'X' space space t_sort.
Displays the ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = t_fieldcat
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
TABLES
t_outtab = t_data
EXCEPTIONS
program_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.
ENDFORM. " build_alv.
*& Form set_top_page_heading
Creates the report headings.
FORM set_top_page_heading USING t_heading TYPE slis_t_listheader
t_events TYPE slis_t_event.
DATA: x_heading TYPE slis_listheader,
x_event TYPE LINE OF slis_t_event.
Report title
CLEAR t_heading[].
CLEAR x_heading.
x_heading-typ = 'H'.
x_heading-info = 'Reporte Prueba'(001).
APPEND x_heading TO t_heading.
Program name
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Program: '.
x_heading-info = sy-repid.
APPEND x_heading TO t_heading.
User who is running the report
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'User: '.
x_heading-info = sy-uname.
APPEND x_heading TO t_heading.
Date of execution
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Date: '.
WRITE sy-datum TO x_heading-info.
APPEND x_heading TO t_heading.
Time of execution
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Time: '.
WRITE sy-uzeit TO x_heading-info.
APPEND x_heading TO t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-FORM = 'TOP_OF_PAGE'.
APPEND x_event TO t_events.
ENDFORM.
*& Form set_events
Sets the events for ALV.
The TOP_OF_PAGE event is alredy being registered in
the set_top_page_heading subroutine.
FORM set_events USING t_events TYPE slis_t_event.
DATA: x_event TYPE LINE OF slis_t_event.
Example
clear x_event.
x_event-name = .
x_event-form = .
append x_event to t_event.
ENDFORM.
*& Form set_order
Adds an entry to the order table.
FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
t_sort TYPE slis_t_sortinfo_alv.
DATA: x_sort TYPE slis_sortinfo_alv.
CLEAR x_sort.
x_sort-fieldname = p_fieldname.
x_sort-tabname = p_tabname.
x_sort-UP = p_up.
x_sort-down = p_down.
x_sort-subtot = p_subtot.
APPEND x_sort TO t_sort.
ENDFORM. "set_order
*& Form set_fieldcat2
Adds an entry to the field catalog.
FORM set_fieldcat2 USING p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-HOTSPOT = p_hotspot.
wa_fieldcat-CHECKBOX = p_checkbox.
wa_fieldcat-ICON = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set reference fieldname, tablenam and rollname.
If p_ref_tabname is not given, the ref_fieldname given is a data element.
If p_ref_tabname is given, the ref_fieldname given is a field of a table. In case ref_fieldname is not given, it is copied from the fieldname.
IF p_ref_tabname IS INITIAL.
wa_fieldcat-rollname = p_ref_fieldname.
ELSE.
wa_fieldcat-ref_tabname = p_ref_tabname.
IF p_ref_fieldname EQ space.
wa_fieldcat-ref_fieldname = wa_fieldcat-fieldname.
ELSE.
wa_fieldcat-ref_fieldname = p_ref_fieldname.
ENDIF.
ENDIF.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
Set as editable or not.
IF p_edit IS NOT INITIAL.
wa_fieldcat-INPUT = 'X'.
wa_fieldcat-EDIT = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
=========================== Subroutines called by ALV ================
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'XXXXX'
it_list_commentary = t_heading.
ENDFORM. " alv_top_of_page
*& Form user_command
Called on user_command ALV event.
Executes custom commands.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM. "user_command
this is my code, how to store data after clicking checkbox in databasetable,
how to write that cide.
plz send me code.hi!,
use MODIFY to update data into the data base table.
regards
anjali -
How to access data of all users in a page?
Hi all, I am new to APEX and have a query.
I have installed APEX on my local machine, created a workspace, and added a few users with roles.
I am creating an application, similar to a Library app, where I have a table that stores Books information (BOOK_ID, BOOK_NAME, etc). I'd like to create another table BOOK_USER with two columns, BOOK_ID and USER_ID. BOOK_ID would refer to the BOOKS table, and I want USER_ID to refer to the table that stores user details of the workspace that I am using. The data entry would happen from a page that has two LOVs, one for book name (using BOOK_ID as the value) and another for user name (USER_ID, or whatever field APEX uses to store user's ID). Can I do that in APEX? I've found ways to access and authenticate a user for a page, but how to get data of all users in the workspace? In other words, how to get all usernames in a LOV?
As I am new to APEX, I'd appreciate if someone can guide me through the steps, or post links to tutorial, etc.Assuming that you are using the Application Express User Accounts for authentication, in that case you have to use built-in apex views
selet * from APEX_WORKSPACE_APEX_USERSAnd use USER_NAME column instead of user_id
See http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/priv_public001.htm#HTMDB25949
Maybe you are looking for
-
How can I display my laptop thru appletv on my hdtv
How can I display my sony VAIO laptop using APPLETV on my HDTV?
-
Error messages in Process chains
Hello BI fans In which transaction can I maintain batch-initiated error messages from process chains. I am not looking for the process chain variant for messages. I would like to create messages only for errorness messages. thanks BEO
-
Unable to download Itunes - get the message 'unknown publisher' followed by the following error message - 'C:\documents & settings\owner\local settings\temporary internetfiles\content IES\1LKLCFM9\itunes set up (1).exe is not a valid win 32 applicati
-
Quicktime with a question mark
I am trying to play some Mp4 movies that I uploaded to my MobileMe gallery and I cannot play the same on my Mac. I get a question mark within the Q symbol. No movies on my MobileMe is playing after upgrading to 10.6. Any suggestions?
-
Hi, I am running a German version of FrameMaker. All commands in the EDD appear in German. What happens when someone uses the EDD with an English or Chinese version of FrameMaker? Will this work as well? If editors have a look at the EDD, do they see