Table Creation and Storage
I just downloaded SQL Server 2012 and am trying to create new databases with tables inside of them. However, the tables I create in my query don't get stored in my newly created database; they're stored in the System Database
master. Is there something I'm doing wrong here?
CREATE DATABASE cis430_lab1;
CREATE TABLE EMPLOYEE (
fname varchar(100),
minit char(1),
lname varchar(100),
ssn char(9),
bdate date,
addr varchar(100),
sex char(1),
salary int,
super_ssn char(9),
dno int
CREATE TABLE DEPARTMENT (
dname varchar(100),
dnumber int,
mgr_ssn char(9),
mgr_start_date date
INSERT INTO EMPLOYEE VALUES('John', 'B', 'Smith', '123456789', '09-Jan-55', '731 Fondren, Houston, TX',
'M', 30000, '987654321', 5);
INSERT INTO EMPLOYEE VALUES('Franklin', 'T', 'Wong', '333445555', '08-Dec-45', '638, Voss, Houston, TX',
'M', 40000, '888665555', 5);
INSERT INTO EMPLOYEE VALUES('Joyce', 'A', 'English', '453453453', '31-Jul-62', '5631 Rice, Houston, TX',
'F', 25000, '333445555', 5);
INSERT INTO EMPLOYEE VALUES('Ramesh', 'K', 'Narayen', '666884444', '15-Sep-52', '975 Fire Oak, Houston, TX',
'M', 38000, '333445555', 5);
INSERT INTO EMPLOYEE VALUES('James', 'E', 'Borg', '888665555', '10-Nov-27', '450 Stone, Houston, TX',
'M', 55000, null, 1);
INSERT INTO EMPLOYEE VALUES('Jennifer', 'S', 'Wallace', '987654321', '20-Jun-31', '291 Berry, Bellaire, TX',
'F', 43000, '888665555', 4);
INSERT INTO EMPLOYEE VALUES('Ahmad', 'V', 'Jabbar', '987987987', '29-Mar-59', '980 Dallas, Houston, TX',
'M', 25000, '987654321', 4);
INSERT INTO EMPLOYEE VALUES('Alicia', 'J', 'Zelaya', '999887777', '19-Jul-58', '3321 Castle, Spring, TX',
'F', 25000, '987654321', 4);
INSERT INTO DEPARTMENT VALUES('Headquarters', 1, '888665555', '19-Jun-71');
INSERT INTO DEPARTMENT VALUES('Administration', 4, '987654321', '01-Jan-85');
INSERT INTO DEPARTMENT VALUES('Research', 5, '333445555', '22-May-78');
INSERT INTO DEPARTMENT VALUES('Automation', 7, '123456789', '06-Oct-05');
SELECT * FROM EMPLOYEE;
SELECT * FROM DEPARTMENT;
seperate the script out as below and see
CREATE DATABASE cis430_lab1
GO
USE [cis430_lab1]
GO
CREATE TABLE EMPLOYEE (
fname varchar(100),
minit char(1),
lname varchar(100),
ssn char(9),
bdate date,
addr varchar(100),
sex char(1),
salary int,
super_ssn char(9),
dno int
CREATE TABLE DEPARTMENT (
dname varchar(100),
dnumber int,
mgr_ssn char(9),
mgr_start_date date
INSERT INTO EMPLOYEE VALUES('John', 'B', 'Smith', '123456789', '09-Jan-55', '731 Fondren, Houston, TX',
'M', 30000, '987654321', 5);
INSERT INTO EMPLOYEE VALUES('Franklin', 'T', 'Wong', '333445555', '08-Dec-45', '638, Voss, Houston, TX',
'M', 40000, '888665555', 5);
INSERT INTO EMPLOYEE VALUES('Joyce', 'A', 'English', '453453453', '31-Jul-62', '5631 Rice, Houston, TX',
'F', 25000, '333445555', 5);
INSERT INTO EMPLOYEE VALUES('Ramesh', 'K', 'Narayen', '666884444', '15-Sep-52', '975 Fire Oak, Houston, TX',
'M', 38000, '333445555', 5);
INSERT INTO EMPLOYEE VALUES('James', 'E', 'Borg', '888665555', '10-Nov-27', '450 Stone, Houston, TX',
'M', 55000, null, 1);
INSERT INTO EMPLOYEE VALUES('Jennifer', 'S', 'Wallace', '987654321', '20-Jun-31', '291 Berry, Bellaire, TX',
'F', 43000, '888665555', 4);
INSERT INTO EMPLOYEE VALUES('Ahmad', 'V', 'Jabbar', '987987987', '29-Mar-59', '980 Dallas, Houston, TX',
'M', 25000, '987654321', 4);
INSERT INTO EMPLOYEE VALUES('Alicia', 'J', 'Zelaya', '999887777', '19-Jul-58', '3321 Castle, Spring, TX',
'F', 25000, '987654321', 4);
INSERT INTO DEPARTMENT VALUES('Headquarters', 1, '888665555', '19-Jun-71');
INSERT INTO DEPARTMENT VALUES('Administration', 4, '987654321', '01-Jan-85');
INSERT INTO DEPARTMENT VALUES('Research', 5, '333445555', '22-May-78');
INSERT INTO DEPARTMENT VALUES('Automation', 7, '123456789', '06-Oct-05');
SELECT * FROM EMPLOYEE;
SELECT * FROM DEPARTMENT;
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Similar Messages
-
Dynamic Internal Table creation and population
Hi gurus !
my issue refers to the slide 10 provided in this slideshow : https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae
My example is gonna sound dumb, but anyway: I want to dynamically select from a table into a dynamically created itab.
Letu2019s use only EKPO, and only field MENGE.
For this, I use Classes cl_abap_elemdescr, cl_sql_result_set and the Data Ref for table creation. But while fetching the resultset, program dumps when fields like MENGE, WRBTR are accessed. Obviously their type are not correctly taken into account by my program.
Here it comes:
DATA: element_ref TYPE REF TO cl_abap_elemdescr,
vl_fieldname TYPE string,
tl_components TYPE abap_component_tab,
sl_components LIKE LINE OF tl_components_alv,
linetype_lcl TYPE REF TO cl_abap_structdescr,
ty_table_type TYPE REF TO cl_abap_tabledescr,
g_resultset TYPE REF TO cl_sql_result_set
u2026
CONCATENATE sg_columns-table_name '-' sg_columns-column_name INTO vl_fieldname.
* sg_columns-table_name contains 'EKPO'
* sg_columns-column_name contains 'MENGE'
* getting the element as a component
element_ref ?= cl_abap_elemdescr=>describe_by_name( vl_fieldname ).
sl_components-name = sg_columns-column_name.
sl_components-type ?= element_ref.
APPEND sl_components TO tl_components.
* dynamic creation of internal table
linetype_lcl = cl_abap_structdescr=>create( tl_components ).
ty_table_type = cl_abap_tabledescr=>create(
p_line_type = linetype_lcl ).
u2026
* Then I will create my field symbol table and line. Code has been cut here.
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
u2026
* Then I will execute my query. Here itu2019s: Select MENGE From EKPO Where Rownum = 1.
g_resultset = g_stmt_ref->execute_query( stmt_str ).
* Then structure for the Resultset is set
CALL METHOD g_resultset->set_param_struct
EXPORTING
struct_ref = dy_line.
* Fetching the lines of the resultset => Dumpu2026
WHILE g_resultset->next( ) > 0.
ASSIGN dy_line->* TO <dyn_wa>.
APPEND <dyn_wa> TO <dyn_table>.
ENDWHILE.
Anyone has any clue to how prevent my Dump ??
The component for MENGE seems to be described as a P7 with 2 decimals. And the resultset wanna use a QUAN type... or something like that !Hello
I have expanded your sample coding for selecting three fields out of EKPO:
*& Report ZUS_SDN_SQL_RESULT_SET
*& Thread: Dynamic Internal Table creation and population
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1375510"></a>
*& NOTE: Coding for dynamic structure / itab creation taken from:
*& Creating Flat and Complex Internal Tables Dynamically using RTTI
*& https://wiki.sdn.sap.com/wiki/display/Snippets/Creating+Flat+and+
*& Complex+Internal+Tables+Dynamically+using+RTTI
REPORT zus_sdn_sql_result_set.
TYPE-POOLS: abap.
DATA:
go_sql_stmt TYPE REF TO cl_sql_statement,
go_resultset TYPE REF TO cl_sql_result_set,
gd_sql_clause TYPE string.
DATA:
gd_tabfield TYPE string,
go_table TYPE REF TO cl_salv_table,
go_sdescr_new TYPE REF TO cl_abap_structdescr,
go_tdescr TYPE REF TO cl_abap_tabledescr,
gdo_handle TYPE REF TO data,
gdo_record TYPE REF TO data,
gs_comp TYPE abap_componentdescr,
gt_components TYPE abap_component_tab.
FIELD-SYMBOLS:
<gs_record> TYPE ANY,
<gt_itab> TYPE STANDARD TABLE.
START-OF-SELECTION.
continued. -
Table creation and getting invalid identifier
Thank you so much Ed (and all who replied) to my previious post !!!!, You are all being extremely helpful,
I actually have another issue... SHould I repost a new thread or continue on this one?
Here is my issue.
create table DonationEvent
( "EventID" NUMBER(1,1) Not Null,
"EventNumber" NUMBER(1,1) Not Null,
"Type" Char(30) Not Null,
"OrganizerName" Char(30) Not Null,
"Location" Char(30) Not Null,
"Date" NUMBER(10,1) Not Null,
"Duration" Char(30) Null,
"DonationTotal" NUMBER(10,1) Not Null,
Primary Key (EventID),
Getting ORA-00904: : invalid identifier
Also I am using Express Edition 10g, how can I get a context view to see the line where error is occuring?user8776250 wrote:
Thank you so much Ed (and all who replied) to my previious post !!!!, You are all being extremely helpful,
I actually have another issue... SHould I repost a new thread or continue on this one?
Here is my issue.
create table DonationEvent
( "EventID" NUMBER(1,1) Not Null,
"EventNumber" NUMBER(1,1) Not Null,
"Type" Char(30) Not Null,
"OrganizerName" Char(30) Not Null,
"Location" Char(30) Not Null,
"Date" NUMBER(10,1) Not Null,
"Duration" Char(30) Null,
"DonationTotal" NUMBER(10,1) Not Null,
Primary Key (EventID),
Getting ORA-00904: : invalid identifier
Also I am using Express Edition 10g, how can I get a context view to see the line where error is occuring?Does Express edition have sqlplus?
SQL> set echo on
SQL> @doit1
SQL> create table DonationEvent
2 ( EventID NUMBER(1,1) Not Null,
3 EventNumber NUMBER(1,1) Not Null,
4 Type Char(30) Not Null,
5 OrganizerName Char(30) Not Null,
6 Location Char(30) Not Null,
7 Date NUMBER(10,1) Not Null,
8 Duration Char(30) Null,
9 DonationTotal NUMBER(10,1) Not Null,
10 Primary Key (EventID),
11 );
Date NUMBER(10,1) Not Null,
ERROR at line 7:
ORA-00904: : invalid identifier
SQL>And as SB said,
1) In oracle you really, really, REALLY don't want mixed case object (column, table, etc) names. Lose the double quotes.
2) don't use reserved words (like 'date') as object names.
also
3) there's no good reason to use CHAR instead of VARCHAR2
4) If you want a date (indicated by your badly named column 'date', make the datatype DATE, not number
5) you need to look at how your NUMBER columns are defined and ask yourself if that's what you really want. NUMBER(1,1) means one digit, with one digit in the decimal location. NUMBER(10,1) means a total of 10 digits, with one of them in the decimal location
SQL> create table DonationEvent
2 ( EventID NUMBER(1,1) Not Null primary key,
3 DonationTotal NUMBER(10,1) Not Null
4 );
Table created.
SQL> --
SQL> insert into donationevent values (1.2, 1234567891);
insert into donationevent values (1.2, 1234567891)
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column
SQL> insert into donationevent values ( .2, 1234567891);
insert into donationevent values ( .2, 1234567891)
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column
SQL> insert into donationevent values ( .2, 123456789.1);
1 row created.
SQL> insert into donationevent values ( .3, 12345678.9);
1 row created.
SQL> --
SQL> commit;
Commit complete.
SQL> --
SQL> select * from donationevent;
EVENTID DONATIONTOTAL
.2 123456789
.3 12345678.9
2 rows selected.
SQL> -
Need of buffering in table creation.
what is need of buffering in table creation and data class and delivey class
Definition
The name table (nametab) contains the table and field definitions that are activated in the SAP System. An entry is made in the Repository buffer when a mass activator or a user (using the ABAP Dictionary, Transaction SE11) requests to activate a table. The corresponding name table is then generated from the information that is managed in the Repository.
The Repository buffer is mainly known as the nametab buffer (NTAB), but it is also known as the ABAP Dictionary buffer
The description of a table in the Repository is distributed among several tables (for field definition, data element definition and domain definition). This information is summarized in the name table. The name table is saved in the following database tables:
DDNTT (table definitions)
DDNTF (field descriptions)
The Repository buffer consists of four buffers in shared memory, one for each of the following:
Table definitions TTAB buffer Table DDNTT
Field descriptions FTAB buffer Table DDNTF
Initial record layouts IREC buffer Contains the record layout initialized depending on the field type
There are two kinds of table buffers:
Partial table buffers
Generic table buffers
Check this link for more details.
http://www.abapprogramming.blogspot.com/2007/11/buffering-in-sap-abap.html
Regards, -
Need table name for storage place and supplier nr
Hello everybody,
I have to fill out the PM order via bapi BAPI_ALM_ORDER_MAINTAIN, however I want to fill out the table component with this bapi, but I do not know the storage location of the material. I only have the supplier. So I want to ask, if someone knows the table relation between supplier and storage location of the material, so I can read this information via sql statement?
Thanks in advance for answering my question.
Kind regards,
ErkanHello Durai,
I know this tables but this tables has not the information what I need. I have to fill out the table param "component " of the bapi
BAPI_ALM_ORDER_MAINTAIN. I have the material, the amount and also the supplier, but I do not have the storage location of this material. So I want to know how I can retrieve this information via supplier nr?
Overall thanks for your help. -
Solman table names for BP creation and others
Dear All
I am the new one to Solman.here i want some relevant information
i want the Table names for the follwing areas.
if you have all the table names can u tell me the table names and descriptions
1. Business partner creation.
2.Supports message and its entry flows updated in which table.
3.Change request and its entry flows saved in which table.
Regards
AnandHi,
For lead, activity and opportunity table name is:
1. CRMD_ORDERADM_H - Business Transaction
2. CRMD_ORDERADM_I - Business Transaction Item
Reward points if helpful.
Shridhar
Edited by: Shridhar Deshpande on Jan 30, 2008 7:52 AM -
I am a student, pursuing MBA and currently doing internship with a big fashion and lifestyle company in India. I am stuck at a place where i need help.
We are planning to give customer the control over the time of delivery of their orders as per their convenience. For that I am exploring the possibility of modifying the ARUN table in such a way that an extra column is added into the ARUN table. this field will contain a flag value (1/0) where '0' will indicate that the customer wants to block delivery for the specific items.
at the time of delivery creation, transaction VL04 should check this flag value for every item. So when we try to create delivery for a whole order in one go, the delivery for the items with '0' flag value shouldn't be created.
basically, my whole purpose is to enable our SAP system to create delivery on item level instead of on order level.
Ques:
1. Is it at all possible to do what i am thinking of?
2. has any company customised the ARUN table and delivery creation program before?
3. If we go ahead with this customisation in-house, will the SAP pull back the maintenance support on account of tempering with base programs?
4. Also, please suggest other ways to do what i am trying to do?you can use the Tables SRRELROLES and IDOCREL
if it is inbound delivery the use the business object BUS2015(outbound use LIKP)
first get the ROLEID using the Delivery number as Objectkey(business obecjt BUS2015/LIK) from the SRRELROLES,
then pass the ROLEID to the table IDOCREL to ROLE_A , get the ROLE_B,
use this ROLE_B supply to ROLEID of SRRELROLES table(business object as IDOC, )
get the objkey which is nothing But IDOC. -
I've recently completed a database upgrade from 10.2.0.3 to 11.2.0.1 using the DBUA.
I've since encountered a slowdown when running a script which drops and recreates a series of ~250 tables. The script normally runs in around 19 seconds. After the upgrade, the script requires ~2 minutes to run.
By chance has anyone encountered something similar?
The problem may be related to the behavior of an "after CREATE on schema" trigger which grants select privileges to a role through the use of a dbms_job call; between 10g and the database that was upgraded from 10G to 11g. Currently researching this angle.
I will be using the following table creation DDL for this abbreviated test case:
create table ALLIANCE (
ALLIANCEID NUMBER(10) not null,
NAME VARCHAR2(40) not null,
CREATION_DATE DATE,
constraint PK_ALLIANCE primary key (ALLIANCEID)
using index
tablespace LIVE_INDEX
tablespace LIVE_DATA;When calling the above DDL, an "after CREATE on schema" trigger is fired which schedules a job to immediately run to grant select privilege to a role for the table which was just created:
create or replace
trigger select_grant
after CREATE on schema
declare
l_str varchar2(255);
l_job number;
begin
if ( ora_dict_obj_type = 'TABLE' ) then
l_str := 'execute immediate "grant select on ' ||
ora_dict_obj_name ||
' to select_role";';
dbms_job.submit( l_job, replace(l_str,'"','''') );
end if;
end;
{code}
Below I've included data on two separate test runs. The first is on the upgraded database and includes optimizer parameters and an abbreviated TKPROF. I've also, included the offending sys generate SQL which is not issued when the same test is run on a 10g environment that has been set up with a similar test case. The 10g test run's TKPROF is also included below.
The version of the database is 11.2.0.1.
These are the parameters relevant to the optimizer for the test run on the upgraded 11g SID:
{code}
SQL> show parameter optimizer
NAME TYPE VALUE
optimizer_capture_sql_plan_baselines boolean FALSE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 11.2.0.1
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 100
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
optimizer_use_invisible_indexes boolean FALSE
optimizer_use_pending_statistics boolean FALSE
optimizer_use_sql_plan_baselines boolean TRUE
SQL> show parameter db_file_multi
NAME TYPE VALUE
db_file_multiblock_read_count integer 8
SQL> show parameter db_block_size
NAME TYPE VALUE
db_block_size integer 8192
SQL> show parameter cursor_sharing
NAME TYPE VALUE
cursor_sharing string EXACT
SQL> column sname format a20
SQL> column pname format a20
SQL> column pval2 format a20
SQL> select sname, pname, pval1, pval2 from sys.aux_stats$;
SNAME PNAME PVAL1 PVAL2
SYSSTATS_INFO STATUS COMPLETED
SYSSTATS_INFO DSTART 03-11-2010 16:33
SYSSTATS_INFO DSTOP 03-11-2010 17:03
SYSSTATS_INFO FLAGS 0
SYSSTATS_MAIN CPUSPEEDNW 713.978495
SYSSTATS_MAIN IOSEEKTIM 10
SYSSTATS_MAIN IOTFRSPEED 4096
SYSSTATS_MAIN SREADTIM 1565.746
SYSSTATS_MAIN MREADTIM
SYSSTATS_MAIN CPUSPEED 2310
SYSSTATS_MAIN MBRC
SYSSTATS_MAIN MAXTHR
SYSSTATS_MAIN SLAVETHR
13 rows selected.
{code}
Output from TKPROF on the 11g SID:
{code}
create table ALLIANCE (
ALLIANCEID NUMBER(10) not null,
NAME VARCHAR2(40) not null,
CREATION_DATE DATE,
constraint PK_ALLIANCE primary key (ALLIANCEID)
using index
tablespace LIVE_INDEX
tablespace LIVE_DATA
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 4 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 0 4 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 324
{code}
... large section omitted ...
Here is the performance hit portion of the TKPROF on the 11g SID:
{code}
SQL ID: fsbqktj5vw6n9
Plan Hash: 1443566277
select next_run_date, obj#, run_job, sch_job
from
(select decode(bitand(a.flags, 16384), 0, a.next_run_date,
a.last_enabled_time) next_run_date, a.obj# obj#,
decode(bitand(a.flags, 16384), 0, 0, 1) run_job, a.sch_job sch_job from
(select p.obj# obj#, p.flags flags, p.next_run_date next_run_date,
p.job_status job_status, p.class_oid class_oid, p.last_enabled_time
last_enabled_time, p.instance_id instance_id, 1 sch_job from
sys.scheduler$_job p where bitand(p.job_status, 3) = 1 and
((bitand(p.flags, 134217728 + 268435456) = 0) or
(bitand(p.job_status, 1024) <> 0)) and bitand(p.flags, 4096) = 0 and
p.instance_id is NULL and (p.class_oid is null or (p.class_oid is
not null and p.class_oid in (select b.obj# from sys.scheduler$_class b
where b.affinity is null))) UNION ALL select
q.obj#, q.flags, q.next_run_date, q.job_status, q.class_oid,
q.last_enabled_time, q.instance_id, 1 from sys.scheduler$_lightweight_job
q where bitand(q.job_status, 3) = 1 and ((bitand(q.flags, 134217728 +
268435456) = 0) or (bitand(q.job_status, 1024) <> 0)) and
bitand(q.flags, 4096) = 0 and q.instance_id is NULL and (q.class_oid
is null or (q.class_oid is not null and q.class_oid in (select
c.obj# from sys.scheduler$_class c where
c.affinity is null))) UNION ALL select j.job, 0,
from_tz(cast(j.next_date as timestamp), to_char(systimestamp,'TZH:TZM')
), 1, NULL, from_tz(cast(j.next_date as timestamp),
to_char(systimestamp,'TZH:TZM')), NULL, 0 from sys.job$ j where
(j.field1 is null or j.field1 = 0) and j.this_date is null) a order by
1) where rownum = 1
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.47 0.47 0 9384 0 1
total 3 0.48 0.48 0 9384 0 1
Misses in library cache during parse: 1
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
1 COUNT STOPKEY (cr=9384 pr=0 pw=0 time=0 us)
1 VIEW (cr=9384 pr=0 pw=0 time=0 us cost=5344 size=6615380 card=194570)
1 SORT ORDER BY STOPKEY (cr=9384 pr=0 pw=0 time=0 us cost=5344 size=11479630 card=194570)
194790 VIEW (cr=9384 pr=0 pw=0 time=537269 us cost=2563 size=11479630 card=194570)
194790 UNION-ALL (cr=9384 pr=0 pw=0 time=439235 us)
231 FILTER (cr=68 pr=0 pw=0 time=920 us)
231 TABLE ACCESS FULL SCHEDULER$_JOB (cr=66 pr=0 pw=0 time=690 us cost=19 size=13157 card=223)
1 TABLE ACCESS BY INDEX ROWID SCHEDULER$_CLASS (cr=2 pr=0 pw=0 time=0 us cost=1 size=40 card=1)
1 INDEX UNIQUE SCAN SCHEDULER$_CLASS_PK (cr=1 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 5056)
0 FILTER (cr=3 pr=0 pw=0 time=0 us)
0 TABLE ACCESS FULL SCHEDULER$_LIGHTWEIGHT_JOB (cr=3 pr=0 pw=0 time=0 us cost=2 size=95 card=1)
0 TABLE ACCESS BY INDEX ROWID SCHEDULER$_CLASS (cr=0 pr=0 pw=0 time=0 us cost=1 size=40 card=1)
0 INDEX UNIQUE SCAN SCHEDULER$_CLASS_PK (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 5056)
194559 TABLE ACCESS FULL JOB$ (cr=9313 pr=0 pw=0 time=167294 us cost=2542 size=2529254 card=194558)
{code}
and the totals at the end of the TKPROF on the 11g SID:
{code}
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 4 0
Fetch 0 0.00 0.00 0 0 0 0
total 3 0.00 0.00 0 0 4 0
Misses in library cache during parse: 1
Misses in library cache during execute: 1
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 70 0.00 0.00 0 0 0 0
Execute 85 0.01 0.01 0 62 208 37
Fetch 49 0.48 0.49 0 9490 0 35
total 204 0.51 0.51 0 9552 208 72
Misses in library cache during parse: 5
Misses in library cache during execute: 3
35 user SQL statements in session.
53 internal SQL statements in session.
88 SQL statements in session.
Trace file: 11gSID_ora_17721.trc
Trace file compatibility: 11.1.0.7
Sort options: default
1 session in tracefile.
35 user SQL statements in trace file.
53 internal SQL statements in trace file.
88 SQL statements in trace file.
51 unique SQL statements in trace file.
1590 lines in trace file.
18 elapsed seconds in trace file.
{code}
The version of the database is 10.2.0.3.0.
These are the parameters relevant to the optimizer for the test run on the 10g SID:
{code}
SQL> show parameter optimizer
NAME TYPE VALUE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 10.2.0.3
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 100
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
SQL> show parameter db_file_multi
NAME TYPE VALUE
db_file_multiblock_read_count integer 8
SQL> show parameter db_block_size
NAME TYPE VALUE
db_block_size integer 8192
SQL> show parameter cursor_sharing
NAME TYPE VALUE
cursor_sharing string EXACT
SQL> column sname format a20
SQL> column pname format a20
SQL> column pval2 format a20
SQL> select sname, pname, pval1, pval2 from sys.aux_stats$;
SNAME PNAME PVAL1 PVAL2
SYSSTATS_INFO STATUS COMPLETED
SYSSTATS_INFO DSTART 09-24-2007 11:09
SYSSTATS_INFO DSTOP 09-24-2007 11:09
SYSSTATS_INFO FLAGS 1
SYSSTATS_MAIN CPUSPEEDNW 2110.16949
SYSSTATS_MAIN IOSEEKTIM 10
SYSSTATS_MAIN IOTFRSPEED 4096
SYSSTATS_MAIN SREADTIM
SYSSTATS_MAIN MREADTIM
SYSSTATS_MAIN CPUSPEED
SYSSTATS_MAIN MBRC
SYSSTATS_MAIN MAXTHR
SYSSTATS_MAIN SLAVETHR
13 rows selected.
{code}
Now for the TKPROF of a mirrored test environment running on a 10G SID:
{code}
create table ALLIANCE (
ALLIANCEID NUMBER(10) not null,
NAME VARCHAR2(40) not null,
CREATION_DATE DATE,
constraint PK_ALLIANCE primary key (ALLIANCEID)
using index
tablespace LIVE_INDEX
tablespace LIVE_DATA
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.01 0 2 16 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.01 0.01 0 2 16 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 113
{code}
... large section omitted ...
Totals for the TKPROF on the 10g SID:
{code}
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 1 0.00 0.02 0 0 0 0
Execute 1 0.00 0.00 0 2 16 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.02 0 2 16 0
Misses in library cache during parse: 1
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 65 0.01 0.01 0 1 32 0
Execute 84 0.04 0.09 20 90 272 35
Fetch 88 0.00 0.10 30 281 0 64
total 237 0.07 0.21 50 372 304 99
Misses in library cache during parse: 38
Misses in library cache during execute: 32
10 user SQL statements in session.
76 internal SQL statements in session.
86 SQL statements in session.
Trace file: 10gSID_ora_32003.trc
Trace file compatibility: 10.01.00
Sort options: default
1 session in tracefile.
10 user SQL statements in trace file.
76 internal SQL statements in trace file.
86 SQL statements in trace file.
43 unique SQL statements in trace file.
949 lines in trace file.
0 elapsed seconds in trace file.
{code}
Edited by: user8598842 on Mar 11, 2010 5:08 PMSo while this certainly isn't the most elegant of solutions, and most assuredly isn't in the realm of supported by Oracle...
I've used the DBMS_IJOB.DROP_USER_JOBS('username'); package to remove the 194558 orphaned job entries from the job$ table. Don't ask, I've no clue how they all got there; but I've prepared some evil looks to unleash upon certain developers tomorrow morning.
Not being able to reorganize the JOB$ table to free the now wasted ~67MB of space I've opted to create a new index on the JOB$ table to sidestep the full table scan.
CREATE INDEX SYS.JOB_F1_THIS_NEXT ON SYS.JOB$ (FIELD1, THIS_DATE, NEXT_DATE) TABLESPACE SYSTEM;The next option would be to try to find a way to grant the select privilege to the role without using the aforementioned "after CREATE on schema" trigger and dbms_job call. This method was adopted to cover situations in which a developer manually added a table directly to the database rather than using the provided scripts to recreate their test environment.
I assume that the following quote from the 11gR2 documentation is mistaken, and there is no such beast as "create or replace table" in 11g:
http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_9003.htm#i2061306
"Dropping a table invalidates dependent objects and removes object privileges on the table. If you want to re-create the table, then you must regrant object privileges on the table, re-create the indexes, integrity constraints, and triggers for the table, and respecify its storage parameters. Truncating and replacing have none of these effects. Therefore, removing rows with the TRUNCATE statement or replacing the table with a *CREATE OR REPLACE TABLE* statement can be more efficient than dropping and re-creating a table." -
Table creation - order of events
I am trying to get some help on the order I should be carrying out table creation tasks.
Say I create a simple table:
create table title (
title_id number(2) not null,
title varchar2(10) not null,
effective_from date not null,
effective_to date not null,
constraint pk_title primary key (title_id)
I believe I should populate the data, then create my index:
create unique index title_title_id_idx on title (title_id asc)
But I have read that Oracle will automatically create an index for my primary key if I do not do so myself.
At what point does Oracle create the index on my behalf and how do I stop it?
Should I only apply the primary key constraint after the data has been loaded as well?
Even then, if I add the primary key constraint will Oracle not immediately create an index for me when I am about to create a specific one matching my naming conventions?yeah but just handle it the way you would handle any other constraint violation - with the EXCEPTIONS INTO clause...
SQL> select index_name, uniqueness from user_indexes
2 where table_name = 'APC'
3 /
no rows selected
SQL> insert into apc values (1)
2 /
1 row created.
SQL> insert into apc values (2)
2 /
1 row created.
SQL> alter table apc add constraint apc_pk primary key (col1)
2 using index ( create unique index my_new_index on apc (col1))
3 /
Table altered.
SQL> insert into apc values (2)
2 /
insert into apc values (2)
ERROR at line 1:
ORA-00001: unique constraint (APC.APC_PK) violated
SQL> alter table apc drop constraint apc_pk
2 /
Table altered.
SQL> insert into apc values (2)
2 /
1 row created.
SQL> alter table apc add constraint apc_pk primary key (col1)
2 using index ( create unique index my_new_index on apc (col1))
3 /
alter table apc add constraint apc_pk primary key (col1)
ERROR at line 1:
ORA-02437: cannot validate (APC.APC_PK) - primary key violated
SQL> @%ORACLE_HOME%/rdbms/admin/utlexcpt.sql
Table created.
SQL> alter table apc add constraint apc_pk primary key (col1)
2 using index ( create unique index my_new_index on apc (col1))
3 exceptions into EXCEPTIONS
4 /
alter table apc add constraint apc_pk primary key (col1)
ERROR at line 1:
ORA-02437: cannot validate (APC.APC_PK) - primary key violated
SQL> select * from apc where rowid in ( select row_id from exceptions)
2 /
COL1
2
2
SQL> All this is in the documentation. Find out more.
Cheers, APC -
How to create monthly table creation?
Hi Mates,
Unable to create table by month in analytic database but load the data to the previous table continuous as attached screenshot, Schema user has the creation privilege. We are using Webcenter interaction 10gR4.
How to create monthly table creation please?
Thanks,
KatherineHi Trevor,
Thanks for your help. We were able to create table and load data till Apr as attached.
However the analytic user privilege has been modified on Apr due to server operation.
Since then, there was a message saying there is no permission to create tables in the analytic log,
analytic user privilege has been granted after checked this message, As I suspected, the issue occurred after modifying analytic user privilege.
Currently, analytic users are granted with all privilege.
Any idea please?
Thanks,
Kathy -
hi frds
Give me table name and field name of OPEN PO QUANTITY ..
thanks
Pari Vendhan.RSee the sample code for the open PO's based on Vendor
and do accordingly
*& Report ZMM_PO_REPORT
REPORT ZMM_PO_REPORT message-Id yb
NO STANDARD PAGE HEADING
LINE-COUNT 60(1)
LINE-SIZE 230.
D A T A B A S E T A B L E S D E C L A R A T I O N
TABLES: lfa1, " Vendor Master
t161, " PO Doc Types
t024, " Purchase Groups
ekko. " PO Header
T Y P E S D E C L A R A T I O N S
Purchase Orders Main Structure
TYPES: BEGIN OF s_po,
ebeln TYPE ebeln, " PO No.
ebelp TYPE ebelp, " PO Item
bstyp TYPE bstyp, " PO Category
bukrs TYPE bukrs, " Company Code
bsart TYPE bbsrt, " PO Type
lifnr TYPE lifnr, " Vendor No
ekgrp TYPE bkgrp, " Purchase Group
waers TYPE waers, " Currency
bedat TYPE etbdt, " PO Date
txz01 TYPE txz01, " Material Text
werks TYPE ewerk, " Plant
lgort TYPE lgort_d, " Storage Location
matkl TYPE matkl, " Material Group
menge TYPE bamng, " PR Quantity
meins TYPE bamei, " UOM
bprme TYPE bbprm, " Price Unit
netpr TYPE netpr, " Net price
peinh TYPE peinh, " Price Unit UOM
pstyp TYPE pstyp, " Item Category
knttp TYPE knttp, " Account Assignment Category
END OF s_po.
Purchase Orders History Structure
TYPES: BEGIN OF s_account,
ebeln TYPE ebeln, " PO No.
ebelp TYPE ebelp, " PO Item
gjahr TYPE mjahr, " Fiscal Year
belnr TYPE mblnr, " PO Invoice No
menge TYPE menge_d, " PR Quantity
wrbtr TYPE wrbtr, " Price in Local Currency
dmbtr TYPE dmbtr, " Price in Foreign Currency
waers TYPE waers, " Currency
shkzg TYPE shkzg, " Dr/Cr Indicator
END OF s_account.
Purchase Orders History Structure(Item Sum)
TYPES: BEGIN OF s_inv_sum,
ebeln TYPE ebeln, " PO No.
ebelp TYPE ebelp, " PO Item
menge TYPE menge_d, " PR Quantity
wrbtr TYPE wrbtr, " Price in Foreign Currency
waers TYPE waers, " Currency
END OF s_inv_sum.
Purchase Orders Main Structure
TYPES: BEGIN OF s_rep,
lifnr TYPE lifnr, " Vendor No
ebeln TYPE ebeln, " PO No.
ebelp TYPE ebelp, " PO Item
bstyp TYPE bstyp, " PO Category
bsart TYPE bbsrt, " PO Type
ekgrp TYPE bkgrp, " Purchase Group
waers TYPE waers, " Currency
bedat TYPE etbdt, " PO Date
txz01 TYPE txz01, " Material Text
werks TYPE ewerk, " Plant
lgort TYPE lgort_d, " Storage Location
matkl TYPE matkl, " Material Group
menge TYPE bamng, " PR Quantity
meins TYPE bamei, " UOM
bprme TYPE bbprm, " Price Unit
netpr TYPE netpr, " Net price
peinh TYPE peinh, " Price Unit UOM
pstyp TYPE pstyp, " Item Category
knttp TYPE knttp, " Account Assignment Category
name1 TYPE name1, " Plant
orewr TYPE netpr, " To be Invoiced Price
curr TYPE waers, " Inv Doc Currency
END OF s_rep.
D A T A D E C L A R A T I O N S
DATA: gv_title1 TYPE sylisel, " Report title
gv_dial. " Color flag
C O N S T A N T S D E C L A R A T I O N S
CONSTANTS: c_x VALUE 'X', " Flag X
c_h VALUE 'H', " Debit
c_vgabe TYPE vgabe VALUE '2'. " Transaction Type
I N T E R N A L T A B L E S D E C L A R A T I O N S
DATA: i_po TYPE STANDARD TABLE OF s_po WITH HEADER LINE,
" Purchase Order
i_inv TYPE STANDARD TABLE OF s_inv_sum WITH HEADER LINE,
" PO Invoice Values
i_rep TYPE STANDARD TABLE OF s_rep WITH HEADER LINE,
" PO Invoice Values
i_ekbe TYPE STANDARD TABLE OF s_account WITH HEADER LINE.
" PO Invoice Values
S E L E C T I O N S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr MATCHCODE OBJECT kred,
s_ebeln FOR ekko-ebeln MATCHCODE OBJECT mekk,
s_bsart FOR t161-bsart,
s_ekgrp FOR t024-ekgrp,
s_bedat FOR ekko-bedat.
SELECTION-SCREEN END OF BLOCK b1.
I N I T I A L I Z A T I O N *
INITIALIZATION.
A T S E L E C T I O N - S C R E E N *
AT SELECTION-SCREEN.
Validate the screen fields
PERFORM validate_screen.
S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Fetch main data
PERFORM fetch_data.
T O P - O F - P A G E *
TOP-OF-PAGE.
Header of the List
PERFORM header.
E N D - O F - P A G E *
Footer
END-OF-PAGE.
ULINE.
E N D - O F - S E L E C T I O N *
END-OF-SELECTION.
Display the Report Output data
PERFORM display_data.
At Line-Selection
AT LINE-SELECTION.
When double clicked on EBELN display the details of Purchase Doc
PERFORM line_sel.
*& Form validate_screen
Validation of Selection Screen fields
FORM validate_screen .
Validation of Vendor Number
CLEAR lfa1-lifnr.
IF NOT s_lifnr[] IS INITIAL.
SELECT lifnr UP TO 1 ROWS
INTO lfa1-lifnr
FROM lfa1
WHERE lifnr IN s_lifnr.
ENDSELECT.
IF sy-subrc 0.
MESSAGE e000 WITH 'Invalid Vendor'(002).
ENDIF.
ENDIF.
Validation of PO Number
CLEAR ekko-ebeln.
IF NOT s_ebeln[] IS INITIAL.
SELECT ebeln UP TO 1 ROWS
INTO ekko-ebeln
FROM ekko
WHERE ebeln IN s_ebeln.
ENDSELECT.
IF sy-subrc 0.
MESSAGE e000 WITH 'Invalid Document Number'(003).
ENDIF.
ENDIF.
Validation of PO Document Type
CLEAR t161-bsart.
IF NOT s_bsart[] IS INITIAL.
SELECT bsart UP TO 1 ROWS
INTO t161-bsart
FROM t161
WHERE bsart IN s_bsart.
ENDSELECT.
IF sy-subrc 0.
MESSAGE e000 WITH 'Invalid Purchase Document Type'(004).
ENDIF.
ENDIF.
Validation of Purchasing Group
CLEAR t024-ekgrp.
IF NOT s_ekgrp[] IS INITIAL.
SELECT ekgrp UP TO 1 ROWS
INTO t024-ekgrp
FROM t024
WHERE ekgrp IN s_ekgrp.
ENDSELECT.
IF sy-subrc 0.
MESSAGE e000 WITH 'Invalid Purchasing Group'(005).
ENDIF.
ENDIF.
ENDFORM. " validate_screen
*& Form fetch_data
Fetching the PO related data from Database Tables
FORM fetch_data .
CLEAR i_po.
REFRESH i_po.
SELECT a~ebeln " PO No.
b~ebelp " PO Item
a~bstyp " PO Category
a~bukrs " Company Code
a~bsart " PO Type
a~lifnr " Vendor No
a~ekgrp " Purchase Group
a~waers " Currency
a~bedat " PO Date
b~txz01 " Material Text
b~werks " Plant
b~lgort " Storage Location
b~matkl " Material Group
b~menge " PR Quantity
b~meins " UOM
b~bprme " Price Unit
b~netpr " Net price
b~peinh " Price Unit UOM
b~pstyp " Item Category
b~knttp " Account Assignment Category
INTO TABLE i_po
FROM ekko AS a JOIN ekpo AS b
ON a~ebeln = b~ebeln
WHERE a~ebeln IN s_ebeln AND
a~lifnr IN s_lifnr AND
a~ekgrp IN s_ekgrp AND
a~bsart IN s_bsart AND
a~bedat IN s_bedat.
SORT i_po BY ebeln ebelp.
break-point.
IF NOT i_po[] IS INITIAL.
Fetch the PO History/Invoice Details from EKBE Table
CLEAR i_ekbe.
REFRESH i_ekbe.
SELECT ebeln " PO No.
ebelp " PO Item
gjahr " Fiscal Year
belnr " PO Invoice No
menge " PR Quantity
wrbtr " Price in Local Currency
dmbtr " Price in Foreign Currency
waers " Currency
shkzg " Dr/Cr Indicator
INTO TABLE i_ekbe
FROM ekbe
FOR ALL ENTRIES IN i_po
WHERE ebeln = i_po-ebeln AND
ebelp = i_po-ebelp AND
vgabe = c_vgabe.
IF sy-subrc = 0.
SORT i_ekbe BY ebeln ebelp.
LOOP AT i_ekbe.
IF i_ekbe-shkzg = c_h.
i_ekbe-wrbtr = i_ekbe-wrbtr * -1.
ENDIF.
MODIFY i_ekbe.
ENDLOOP.
break-point.
Sum up the Item wise Invoice totals
LOOP AT i_ekbe.
AT END OF ebelp.
READ TABLE i_ekbe INDEX sy-tabix.
SUM.
MOVE-CORRESPONDING i_ekbe TO i_inv.
APPEND i_inv.
ENDAT.
CLEAR i_inv.
ENDLOOP.
SORT i_inv BY ebeln ebelp.
break-point.
ENDIF.
ENDIF.
Move the Vendor Name and Invoice Values to I_rep Internal Table
LOOP AT i_po.
MOVE-CORRESPONDING i_po TO i_rep.
CLEAR i_inv.
READ TABLE i_inv WITH KEY ebeln = i_po-ebeln
ebelp = i_po-ebelp.
IF sy-subrc = 0.
i_rep-orewr = ( i_po-menge - i_inv-menge ) * i_po-netpr.
i_rep-curr = i_inv-waers.
ELSE.
i_rep-orewr = i_po-menge * i_po-netpr.
i_rep-curr = i_po-waers.
ENDIF.
break-point.
Get the Vendor Name
CLEAR lfa1-name1.
SELECT SINGLE name1 FROM lfa1 INTO lfa1-name1
WHERE lifnr = i_po-lifnr.
IF sy-subrc = 0.
i_rep-name1 = lfa1-name1.
ENDIF.
APPEND i_rep.
CLEAR i_rep.
break-point.
ENDLOOP.
SORT i_rep BY lifnr ebeln ebelp.
DELETE i_rep WHERE orewr LE 0.
break-point.
ENDFORM. " fetch_data
*& Form display_data
Display the Report Output data
FORM display_data .
DATA: lv_flag, " New Flag
lv_rec TYPE i. " No of Records
CLEAR lv_rec.
IF i_rep[] IS INITIAL.
MESSAGE e000 WITH 'No Data found'(022).
ELSE.
LOOP AT i_rep.
Toggle Color
PERFORM toggle_color.
IF lv_flag space.
NEW-LINE.
ENDIF.
At New Purchase Document
AT NEW ebeln.
WRITE:/1 sy-vline, 2(10) i_rep-ebeln INTENSIFIED OFF.
lv_flag = c_x.
lv_rec = lv_rec + 1.
ENDAT.
WRITE: 1 sy-vline,
12 sy-vline,13(4) i_rep-bsart,
17 sy-vline,18(10) i_rep-lifnr,
28 sy-vline,29(35) i_rep-name1,
64 sy-vline,65(4) i_rep-ekgrp,
69 sy-vline,70(10) i_rep-bedat,
80 sy-vline,81(5) i_rep-ebelp,
86 sy-vline,87(40) i_rep-txz01,
127 sy-vline,128(9) i_rep-matkl,
137 sy-vline,138(1) i_rep-pstyp,
139 sy-vline,140(1) i_rep-knttp,
141 sy-vline,142(4) i_rep-werks,
146 sy-vline,147(4) i_rep-lgort,
151 sy-vline,152(13) i_rep-menge UNIT i_rep-meins,
165 sy-vline,166(3) i_rep-meins,
169 sy-vline,170(15) i_rep-netpr CURRENCY i_rep-waers,
185 sy-vline,186(4) i_rep-waers,
190 sy-vline,191(5) i_rep-peinh,
196 sy-vline,197(4) i_rep-bprme,
201 sy-vline,202(15) i_rep-orewr CURRENCY i_rep-curr,
217 sy-vline,218(4) i_rep-curr,
222 sy-vline,223(7) i_rep-bstyp centered,
230 sy-vline.
NEW-LINE.
hide: i_rep-ebeln.
ENDLOOP.
ULINE.
FORMAT COLOR OFF.
WRITE : /2 'Total Number of Purchasing Documents:'(025) COLOR 3,
lv_rec COLOR 3.
ENDIF.
ENDFORM. " display_data
*& Form header
Write the Report Header
FORM header .
FORMAT RESET.
header
WRITE:/1(230) 'LIST OF PURCHASE DOCUMENTS PER VENDOR'(006) CENTERED.
SKIP.
FORMAT COLOR COL_HEADING.
ULINE.
WRITE:/1 sy-vline,2(10) 'Pur.Doc.No'(006) CENTERED,
12 sy-vline,13(4) 'Type'(007),
17 sy-vline,18(10) 'Vendor'(008) CENTERED,
28 sy-vline,29(35) 'Name'(009) CENTERED,
64 sy-vline,65(4) 'PGrp'(010) CENTERED,
69 sy-vline,70(10) 'Doc.Date'(012) CENTERED,
80 sy-vline,81(5) 'Item'(011),
86 sy-vline,87(40) 'Material Short Text'(024) CENTERED,
127 sy-vline,128(9) 'Mat.Group'(013),
137 sy-vline,138(1) 'I',
139 sy-vline,140(1) 'A',
141 sy-vline,142(4) 'Plnt'(014),
146 sy-vline,147(4) 'SLoc'(015),
151 sy-vline,152(13) 'Quantity'(016) CENTERED,
165 sy-vline,166(3) 'UoM'(017),
169 sy-vline,170(15) 'Net Value'(018) CENTERED,
185 sy-vline,186(4) 'Curr'(019),
190 sy-vline,191(5) 'Per'(020),
196 sy-vline,197(4) 'Unit'(021),
201 sy-vline,202(15) 'To be Invoiced'(023) CENTERED,
217 sy-vline,218(4) 'Curr'(019),
222 sy-vline,223(7) 'Doc.Cat'(026),
230 sy-vline.
ULINE.
ENDFORM. " header
*& Form toggle_color
This routine alters the color of the records in the list FORM toggle_color.
IF gv_dial = space.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
gv_dial = c_x.
ELSE.
FORMAT COLOR 1 INTENSIFIED OFF.
CLEAR gv_dial.
ENDIF.
ENDFORM. " toggle_color
*& Form LINE_SEL
*When double clicked on EBELN field display the details of Purchase Doc
FORM line_sel.
CASE sy-lsind.
WHEN '1'.
DATA: lv_field(20),
lv_value(10),
lv_bstyp like i_rep-bstyp.
clear: lv_bstyp,lv_value, lv_field.
GET CURSOR FIELD lv_field VALUE lv_value.
IF lv_field = 'I_REP-EBELN'.
IF NOT lv_value IS INITIAL.
READ LINE sy-index FIELD VALUE i_rep-bstyp
INTO lv_bstyp.
READ CURRENT LINE FIELD VALUE i_rep-bstyp INTO lv_bstyp.
if lv_bstyp = 'F'.
SET PARAMETER ID 'BES' FIELD lv_value.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
elseif ( lv_bstyp = 'K' or lv_bstyp = 'L' ).
SET PARAMETER ID 'VRT' FIELD lv_value.
CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.
elseif lv_bstyp = 'A'.
SET PARAMETER ID 'ANF' FIELD lv_value.
CALL TRANSACTION 'ME43' AND SKIP FIRST SCREEN.
endif.
ENDIF.
ENDIF.
ENDCASE.
ENDFORM. " line_sel{code]
<REMOVED BY MODERATOR>
kushagra
Edited by: Alvaro Tejada Galindo on Feb 18, 2008 2:03 PM -
Immediate TO creation and confirmation during MB1B
Hi
In one of our client scenario , we need to create a immediate TO creation and confirmation with respect to PCN created during stock transfer from one storage location to another storage location with in a same plant .
I have done the neccesay setting in Tcode OMLR , but the system is not been able to create the immidiate TO perhaps system doesn't know from which storage type it sohuld select the material.
Can anybody hleps me how to configure this . Do i need to customise storage location control .if yes then what are steps in details ?
Thanks
RAJK
Edited by: RAJ K on May 3, 2010 10:37 PMPlease refer the following thread: -
TO not created from TR
Thanks
Swagat -
Automatic TO Creation and Confirm for the 321 Mvt type
Hello Experts,
Like to know the customisation invovlved for automatic TO creation and confirmation for the 321 movement type in which QM is activated.
I have already activated in OMKZ as below
1.Automatic TO for 321 mvt ytpe
2.TO item to be confirmed immediately
3.Propose confirmation
Table T333 -AUTTA
T333-SQUIT &
T333-VQUIT is activated.
Please let me know any other settings to be performed
Regards
KrishnaHello Experts,
I am trying to create the Automatic TO and TO confirmation for the mvt type 321.
I made the below settings
I have activated in OMKZ as below
1.Automatic TO for 321 mvt ytpe -"A"
2.TO item to be confirmed immediately - tick mark
3.Propose confirmation - tick mark
Table T333 -AUTTA
T333-SQUIT &
T333-VQUIT is activated.
I have activated in OMKX as below
Table T321-TBFKZ Immediate TO Creation with "A"
T321-TAFKZ TR creation with "X"
After doing the settings i am not able to see the Posting change number in the Material document created for the mvt type 321.
Please let me know how to create the Posting chnage notice for the material document and how to convert the Posting change notice to automatic TO and confirmation.
Thanks & Regards
Krishna
Edited by: Hariharan krishna on May 25, 2011 8:01 AM -
Sales order stock and storage location stock on past date with value
Hi everyone.
I m looking for a report which can give sales order stock with value as it is shown in mb5b and storage location stock with value as in mc.5 is there any report which can give the combination of both the things on past date with values.can you tell me what shall be the fields and table for special stock on past date with value and sloc stock on past date with value
-
Background job fails for BDC profile creation and role assignment
Hi Experts,
I have created a BDC Function module for Tcode 'PFCG' for profile creation and role assignment, and called this FM in my zprogram. the problem is that when i run this program in foreground it executes succesfully, but if i schedule it in background it fails throwing error in job log 'Role 'Z...' does not contain any active authorizations'. But i have created one more program to create authorization objects which runs before this zprogram.I have also checked the authorization object in 'RSECADMIN', it reflects active. I dont understand whats happening exactly when it runs background.
Below is the process of job
1. ZMIS_AUTH_OBJECT_CREATE
Variant : auth-create
2. ZMIS_AUTH_ASSIGN_TO_ROLE
Variant : auth-assign
The problem is in second program, runs in foreground but fails in background.
Code which i have written in my second program
***BDC for Profile creation and assignment to Roles
CALL FUNCTION 'ZROLE'
EXPORTING
ctu = 'X'
mode = p_mode
UPDATE = 'L'
* GROUP =
* USER =
* KEEP =
* HOLDDATE =
nodata = '/'
agr_name_neu_001 = wa_role-role_name
text_002 = wa_role-desc
text_003 = wa_role-desc
text_004 = wa_role-desc
value_01_005 = 'T-ML330881'
h_fval_low_01_006 = wa_role-auth
profn_007 = lv_profile
ptext_008 = lv_text1
* IMPORTING
* SUBRC =
TABLES
messtab = temp_message.
***Generation of Profile created
CALL FUNCTION 'PRGN_AUTO_GENERATE_PROFILE_NEW'
EXPORTING
activity_group = wa_role-role_name
* PROFILE_NAME =
* PROFILE_TEXT =
no_dialog = ' '
rebuild_auth_data = ''
org_levels_with_star = ' '
fill_empty_fields_with_star = 'X'
template = ' '
check_profgen_tables = 'X'
generate_profile = 'X'
authority_check_pfcg = 'X'
EXCEPTIONS
activity_group_does_not_exist = 1
activity_group_enqueued = 2
profile_name_exists = 3
profile_not_in_namespace = 4
no_auth_for_prof_creation = 5
no_auth_for_role_change = 6
no_auth_for_auth_maint = 7
no_auth_for_gen = 8
no_auths = 9
open_auths = 10
too_many_auths = 11
profgen_tables_not_updated = 12
error_when_generating_profile = 13
OTHERS = 14 .
Experts please help me out its very urgent. your help is appreciated and rewarded. Thanking you in advance.
Regards,
ChetanHi Praveen,
Yeah definately, my requirement is that I have to access of some BI reports to certain users, so contract data will be downlaoded from ECC on application server, need to read that file from application server and for the each contract i ahould create a authorization object, role creation and assigning of role to the user and profile generation and activation.
To achieve this i have written two programs
1) ZMIS_AUTH_OBJECT_CREATE- This program will create the Authorization Object using BDC and Role creation Using the BAPI
"" Creation of Authorization Object
CALL FUNCTION 'ZAUTHOBJ'
EXPORTING
ctu = 'X'
mode = p_mode
UPDATE = 'L'
* GROUP =
* USER =
* KEEP =
* HOLDDATE =
nodata = '/'
g_authname_001 = 'ZDUMMY_MIS'
g_targetauth_002 = wa_tab-auth
g_authtxt_003 = wa_tab-short_desc
g_authtxtmd_004 = wa_tab-med_desc
marked_04_005 = 'X'
g_authtxt_006 = wa_tab-short_desc
g_authtxtmd_007 = wa_tab-med_desc
tctiobjnm_04_008 = 'ZBUS_UNIT'
g_authtxt_009 = wa_tab-short_desc
g_authtxtmd_010 = wa_tab-med_desc
marked_05_011 = ''
opt_01_012 = 'EQ'
low_01_013 = wa_tab-bu
g_authtxt_014 = wa_tab-short_desc
g_authtxtmd_015 = wa_tab-med_desc
marked_04_016 = 'X'
g_authtxt_017 = wa_tab-short_desc
g_authtxtmd_018 = wa_tab-med_desc
tctiobjnm_04_019 = 'ZCONTRCT'
g_authtxt_020 = wa_tab-short_desc
g_authtxtmd_021 = wa_tab-med_desc
marked_05_022 = ''
opt_01_023 = 'EQ'
low_01_024 = lv_contract
g_authtxt_025 = wa_tab-short_desc
g_authtxtmd_026 = wa_tab-med_desc
g_authtxt_027 = wa_tab-short_desc
g_authtxtmd_028 = wa_tab-med_desc
g_authname_029 = wa_tab-auth
* IMPORTING
* SUBRC =
TABLES
messtab = temp_message.
"" Creation of role
LOOP AT it_role INTO wa_role.
CLEAR wa_text.
wa_text-text = wa_role-desc.
wa_text-langu = 'E'.
APPEND wa_text TO it_text.
wa_jobrole-agr_name = wa_role-role_name.
wa_parentrole-agr_name = 'ZM_CT_DUMMY_MIS'.
wa_method-usmethod = 'CHANGE'.
CALL FUNCTION 'ZBAPI_JOBROLE_CLONE'
EXPORTING
jobrole = wa_jobrole
parent = wa_parentrole
method = wa_method
TABLES
* RETURN =
shorttext = it_text
* LONGTEXT =
* MENU_NODES =
* MENU_TEXTS =.
ENDLOOP.
2) ZMIS_AUTH_ASSIGN_TO_ROLE - This program will generate the profile created assign it to the role.
""*BDC for Profile creation and assignment to Roles
CALL FUNCTION 'ZROLE'
EXPORTING
ctu = 'X'
mode = p_mode
UPDATE = 'L'
* GROUP =
* USER =
* KEEP =
* HOLDDATE =
nodata = '/'
agr_name_neu_001 = wa_role-role_name
text_002 = wa_role-desc
text_003 = wa_role-desc
text_004 = wa_role-desc
value_01_005 = 'T-ML330881'
h_fval_low_01_006 = wa_role-auth
profn_007 = lv_profile
ptext_008 = lv_text1
* IMPORTING
* SUBRC =
TABLES
messtab = temp_message .
COMMIT WORK AND WAIT.
""*Generation of Profile created
LOOP AT it_role INTO wa_role.
CALL FUNCTION 'PRGN_AUTO_GENERATE_PROFILE_NEW'
EXPORTING
activity_group = wa_role-role_name
* PROFILE_NAME =
* PROFILE_TEXT =
no_dialog = ' '
rebuild_auth_data = ''
org_levels_with_star = ' '
fill_empty_fields_with_star = 'X'
template = ' '
check_profgen_tables = 'X'
generate_profile = 'X'
authority_check_pfcg = 'X'
EXCEPTIONS
activity_group_does_not_exist = 1
activity_group_enqueued = 2
profile_name_exists = 3
profile_not_in_namespace = 4
no_auth_for_prof_creation = 5
no_auth_for_role_change = 6
no_auth_for_auth_maint = 7
no_auth_for_gen = 8
no_auths = 9
open_auths = 10
too_many_auths = 11
profgen_tables_not_updated = 12
error_when_generating_profile = 13
OTHERS = 14
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDLOOP.
For creating authorization objects, role & profile i have created one dummy auth, dummy role & dummy profile respectively.
i have created dummy objects to copy the roles from dummy object and assign the same to new Auth obj, role & profile.
Let me know what needs to be done. because these both the programs run perfectly in foreground, but fails in background.
Regards,
Chetan
Maybe you are looking for
-
New 10.6 server machine. (Actually 3 of them.) If we install every update offered in Software Update except safari 5.1.4 and machine is fine. Once the safari update is taken and the machine reboots, Software Update crashes a bit after launch. Whe
-
Error-lsmw -in the step specify file
HI ALL, Iam struck up in lsmw . I doing for the transaction "mb11" , opening inventory balance . when i do the step " SPECIFY FILE " , iam getting error like "specify a logical path " . I have choosed a file on the local pc . what would be the proble
-
Share calendar on two Ipads (one Imac with two users)
Hi community, I'm looking for some help and where to look for if not here. Let me quickly describe my setup at home and what I try to achieve. My partner and I have both their own iPad and iPhone. There is one iMac where we live. We are using it toge
-
APPLET ALERT with IE7 and latest JRE
Hi all, I am having the problem that if i go to www.map24.de I get bombarded with applet alerts (e.g. The applet is attempting to invoke the java/lang/System.gc() operation), but WHY? Similar configuration on another PC (Win XP, IE7, Java 6u2), the p
-
Data Manipulation on a Text Field
I have an HTML form in which I enter information about a data provider. The first field in this form is composed of three pieces of data, separated by underscores. Is it possible for me to extract each of these individual pieces, and use them to popu