Call BAPI directly or use bus object types
Hi,
A quick question.
At a customer, I need to create a targetgroup in a CRM system from an ABAP program
I found that there exists the standard business object type BUS1185, what in fact has several methods which call BAPI functions ( for example BAPI_TARGETGROUP_CREATE )
My question is know what is the best way to create the targetgroup, call the BAPI directly or use the object type ( via include <CNTN01> and the macro's SWC...
Thanks in advance for your advice
Erwin
the only reason for using the BO macro's in regular ABAP programming, is if you want to emulate workflow behaviour, or if extra logic of the business object is needed (for instance if you have to know the content of several (virtual) attributes)). In the last case you also have to instantiate the BO.
Other than that, just use the BAPI.
Kind regards, Rob dielemans
Similar Messages
-
How to use an Object Type from Another Database
Hi,
I have this requirement that I need to call a stored procedure from another DB (db1) but I am having a problem with this because one of the input parameters uses an object type defined in that DB (db1). Is it possible to use an object type from another database? TIA!Sven W. wrote:
At least for queries, but I think also for procedure arguments..You (both) probably missed my post?
We can't use a remote type as procedure argument, even with the same OID.
It's OK for query on a remote object column though :
SQL> conn remote_user@remote_db
Entrez le mot de passe :
Connecté.
SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
2 as object (att1 number);
3 /
Type créé.
SQL> create table mytable (col1 mytype);
Table créée.
SQL> insert into mytable values (mytype(777));
1 ligne créée.
SQL> create or replace function myfunc (p_in in mytype) return number
2 is
3 begin
4 return p_in.att1;
5 end;
6 /
Fonction créée.
SQL> disconn
Déconnecté de Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> conn my_user@local_db
Entrez le mot de passe :
Connecté.
SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
2 as object (att1 number);
3 /
Type créé.
SQL> select * from mytable@test_dbl;
COL1(ATT1)
MYTYPE(777)
SQL> declare
2 res number;
3 begin
4 res := myfunc@test_dbl(mytype@test_dbl(777));
5 end;
6 /
res := myfunc@test_dbl(mytype@test_dbl(777));
ERREUR à la ligne 4 :
ORA-06550: Ligne 4, colonne 26 :
PLS-00331: référence non valide à REMOTE_USER.MYTYPE@TEST_DBL.WORLD
ORA-06550: Ligne 4, colonne 2 :
PL/SQL: Statement ignored
SQL> declare
2 res number;
3 begin
4 res := myfunc@test_dbl(mytype(777));
5 end;
6 /
res := myfunc@test_dbl(mytype(777));
ERREUR à la ligne 4 :
ORA-06550: Ligne 4, colonne 9 :
PLS-00306: numéro ou types d'arguments erronés dans appel à 'MYFUNC'
ORA-06550: Ligne 4, colonne 2 :
PL/SQL: Statement ignored -
Using Multiple Object Types in a FIM Managed Criteria Distribution Group
Is it possible to use multiple object types in a criteria based distribution group. So when building your criteria filter, "Select (object type) that match (all/any) of the following condiftions". Currently you can only choose 1 object type and
I want to be able to choose object type "user" and a custom object type I create for my contactsYou can create main condition as "any" and later add two sub-conditions - one that object in set "All People" and other sub-condition that object in set "All Contacts" or "All Groups".
If you found my post helpful, please give it a Helpful vote. If it answered your question, remember to mark it as an Answer. -
BAPI 001 No instance of object type purchaseorder has been created
Hello All,
I get teh following error message in SC monitor (backend application error) as well as in RZ20. I tried to push into backend but no luck.Scenario Classic.SRM 5.0
Shopping cart XXXXX(PO XXXXX) BAPI 001 No instance of object type purchaseorder has been created.
The latest log in BBP_PD
0000000001 I1111 Item in Transfer Process X
0000000001 I1112 Error in transmission
Any clue is appreciated.
Muthu
Edited by: Muthuraman Govindasamy on Oct 7, 2008 2:59 PMHi Andrea
We can create a PO vis sourcing cockpit in classic mode.
SC: Error in transmission BAPI 001
Note :- 973952 and follow the Peter instructions. This error message misleads
regards
Muthu -
BAPI 001 No instance of object type PurchaseOrder has been created. Externa
HI,
we have the below mentioned issue when we are creating SC through describe requirement.
BAPI 001 No instance of object type PurchaseOrder has been created. External reference: (Document Number XXXXXXXXXXX
06 213 Error in net price calculation, item 000010 (Please correct) (Document Number XXXXXXXXXXX)
we are trying to assign the inforrecord when we are creating the SC through describe requirement.
Could any one suggest what is going wrong
regards
subbuthis error is misleading error message from SRM SIDE . click follow on document icon via monitor sc. you will get real error message in application monitor or rz20.
check the real error message in rz20.
update here what is ther error message...
muthu -
How to call a Oracle Proc,which contains Object Type as in Param, from java
Hi
Would like to know how to call a Oracle Procedure which contains the Object Type Parameter from java.
Here is my code will look like...
1. CREATE OR REPLACE TYPE emp AS OBJECT
Empno NUMBER,
Ename VARCHAR2(50)
[COLOR=royalblue]In step1 I have created object type.[COLOR]
2.CREATE OR REPLACE PACKAGE ref_pkg IS
TYPE tab_emp IS TABLE OF emp;
END ref_pkg;
[COLOR=royalblue]In step2,I have created a table type which is of type emp;[COLOR]
3. CREATE OR REPLACE PROCEDURE p_emp(p_emptab IN ref_pkg.tab_emp) as
BEGIN
FOR I IN 1..p_emptab.COUNT
LOOP
Some code written here
END LOOP;
END;
[COLOR=royalblue]In step3 I have passed tabletype which is of type emp as argument.[COLOR]
Now I need to invoke this procedure from JAVA.
Calling a procedure doesn�t matter.
But how I can map objecttype ? how will java recognize oracle object ?
How can I implement this ?
Any Help/Clues is Appreciated.
Thanks
KrishnaHi Bob
You can call a stored proc from a database control with the jc:sql annotation itself.
Assume a stored proc taking one In parameter
* @jc:sql statement="call sp_updateData({id})"
void call_sp_updateCust(int id);
You can even call stored proc with OUT parameters using
* @jc:sql statement="{call sp_MyProc(?, ?)}"
void call_sp_MyProc(SQLParameter[] params)
You can also call stored functions via db control.
More info and diff ways to call at
http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conStoredProcedures.html
Thanks
Vimala -
Problem using Oracle Object Types and Arrays.
I'm currently trying to work with oracle object types in java and I'm running into some issues when trying to add an item to an array.
The basic idea is that I have a header object and a detail object (both only containing an ID and a description). Inside of my java code I'm trying to add a new detail line to the header that has been retrieved from the database.
Here's what I'm working with.
--Oracle Objects:
CREATE OR REPLACE TYPE dtl_obj AS OBJECT
detail_id INTEGER,
header_id INTEGER,
detail_desc VARCHAR2(300)
CREATE TYPE dtl_tab AS TABLE OF dtl_obj;
CREATE OR REPLACE TYPE hdr_obj AS OBJECT
header_id INTEGER,
src VARCHAR(30),
details dtl_tab
CREATE TYPE hdr_tab AS TABLE OF hdr_obj;
/--Java test methods
public static void main(String[] args) throws SQLException,
ClassNotFoundException
// Initialize the objects
Test t = new Test();
t.connect(); //Connects to the database
//The oracle connection will be accessible through t.conn
// Create the oracle call
String query = "{? = call get_header(?)}";
OracleCallableStatement cs = (OracleCallableStatement) t.conn.prepareCall(query);
cs.registerOutParameter(1, OracleTypes.ARRAY, "HDR_TAB"); //Register the out parameter and associate it with our oracle type
int[] hdrs = { 240 }; //we just want one for testing.
ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor(
"ARRAY_T", t.conn);
oracle.sql.ARRAY oHdrs = new ARRAY(descriptor, t.conn, hdrs);
cs.setARRAY(2, oHdrs); //Set the headers to retrieve
// Execute the query
cs.executeQuery();
try
ARRAY invArray = cs.getARRAY(1);
// Start the retrieval process
Class cls = Class.forName(Header.class.getName());
Map<String, Class<?>> map = t.conn.getTypeMap();
map.put(Header._SQL_NAME, cls);
Object[] invoices = (Object[]) invArray.getArray();
ArrayList<Header> invs = new ArrayList(
java.util.Arrays.asList(invoices));
if (invs != null)
for (Header inv : invs)
System.out.println(inv.getHeaderId() + " " + inv.getSrc());
t.addDetail(inv, "new line");
for (Detail dtl : inv.getDetails().getArray()) // Exception thrown here
// java.sql.SQLException: Fail to construct descriptor: Invalid arguments
// at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
// at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
// at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:861)
// at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:128)
// at oracle.jpub.runtime.MutableStruct.toDatum(MutableStruct.java:109)
// at com.pcr.tst.Detail.toDatum(Detail.java:40)
// at oracle.jpub.runtime.Util._convertToOracle(Util.java:151)
// at oracle.jpub.runtime.Util.convertToOracle(Util.java:138)
// at oracle.jpub.runtime.MutableArray.getDatumElement(MutableArray.java:1102)
// at oracle.jpub.runtime.MutableArray.getOracleArray(MutableArray.java:550)
// at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:689)
// at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:695)
// at com.pcr.tst.DetailTable.getArray(DetailTable.java:76)
// at com.pcr.tst.Test.main(Test.java:91)
System.out.println(dtl.getDetailDesc());
catch (Exception ex)
System.out.println("Error while retreiving header");
ex.printStackTrace();
public void addDetail(Header hdr, String desc) throws Exception
if (hdr == null)
throw new Exception("header not initialized");
// Convert the current list to an ArrayList so we can easily add to it.
ArrayList<Detail> dtlLst = new ArrayList<Detail>();
dtlLst.addAll(java.util.Arrays.asList(hdr.getDetails().getArray()));
// Create the new detail
Detail dtl = new Detail();
dtl.setDetailDesc(desc);
// add the new detail
dtlLst.add(dtl);
Detail[] ies = new Detail[dtlLst.size()];
ies = dtlLst.toArray(new Detail[0]);
DetailTable iet = new DetailTable(ies);
hdr.setDetails(iet);
}I know its the addDetail method causing the issue because if I comment out the t.addDetail(inv, "new line"); call it works fine.
Message was edited by:
pcristiniOracle® Database Object-Relational Developer's Guide
Also note that object relational database design is often less performant and scalable than relational. It is not very often used in production environments.
However, the object orientated programming feature that is provided with Oracle object feature set are used and can make development and interfaces a lot easier.
So in a nutshell. Say no to ref and nested table columns. Say yes to most of the other object features. IMO of course... -
Calling BAPI and manipulating using macros
Hello Guys,
Calling BAPI from SAP and manipulating the same using some macros or similar kind of code in MS Excel.
Can u give one example to the above scenario with step by step procedure.
thanks.
Regards,
reddy.Hello Guys,
Calling BAPI from SAP and manipulating the same using some macros or similar kind of code in MS Excel.
Can u give one example to the above scenario with step by step procedure.
thanks.
Regards,
reddy. -
Need some help on procedure calling procedure using object type reg
dear all,
i need to test one procedure by passing only one value but how do i pass single value. i am showing the details of few section on which i am working on. here is few details about the package.
Description: package pkj_emp contains two procedure pkj_emp and procedure proc_rem.
purpose:based on passing dname values to procedure pkj_emp, cursor cur_emp will fetch empid from emp table and then we are passing 4 empid records to procedure proc_rem using empid object type.Inside the procedure proc_rem it will delete all 4 records of table A,B,C and D at one short.
Requirement:i need to test for only one value that means is it possible i can pass only one value using the cursor cur_emp.
create or replace package pkj_emp
TYPE obj_emp IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
procedure proc_emp(empid obj_emp);
create or replace package body pkj_emp
as
procedure(
dname varchar2;
as
cursor cur_emp is select emp_id from emp a,dept d
where a.deptid=d.deptid
and d.deptname=dname;
begin
count:=0;
for cur_emp_rec in cur_emp LOOP
empid(count) := cur_emp_rec.emp_id;
IF (count = 4) THEN
proc_rem(empid); // calling another procedure
commit;
END IF;
count := count + 1;
END LOOP;
end;
proc_rem(
empid obj_emp;
is
begin
delete from A where emp_id in (empid(0),empid(1),empid(2),empid(3));
delete from B where emp_id in (empid(0),empid(1),empid(2),empid(3));
delete from c where emp_id in (empid(0),empid(1),empid(2),empid(3));
delete from d where emp_id in (empid(0),empid(1),empid(2),empid(3));
end;
regards
LaxmanYou have hardcoded your IN LIST in the REM procedure. I recommend changing the code to take a variable number of inputs. You could do something like the following:
SQL> CREATE TABLE A (ID NUMBER);
Table created.
SQL> CREATE TABLE B (ID NUMBER);
Table created.
SQL> CREATE TABLE C (ID NUMBER);
Table created.
SQL> CREATE TABLE D (ID NUMBER);
Table created.
SQL> INSERT INTO A VALUES(7566);
1 row created.
SQL> INSERT INTO B VALUES(7902);
1 row created.
SQL> INSERT INTO C VALUES(7876);
1 row created.
SQL> INSERT INTO D VALUES(7369);
1 row created.
SQL> CREATE OR REPLACE TYPE EMP_TYPE AS TABLE OF NUMBER(4);
2 /
Type created.
SQL> CREATE OR REPLACE PACKAGE PKJ_EMP
2 AS
3 PROCEDURE PKJ_EMP
4 (
5 DNAME IN SCOTT.EMP.DEPTNO%TYPE
6 );
7
8 PROCEDURE REM
9 (
10 pEMPList IN EMP_TYPE
11 );
12 END PKJ_EMP;
13 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY PKJ_EMP
2 AS
3 PROCEDURE PKJ_EMP
4 (
5 DNAME IN SCOTT.EMP.DEPTNO%TYPE
6 )
7 AS
8 pEMPList EMP_TYPE := EMP_TYPE();
9 i NUMBER := 1;
10 BEGIN
11 FOR r IN
12 (
13 SELECT EMPNO
14 FROM SCOTT.EMP
15 WHERE DEPTNO = DNAME
16 )
17 LOOP
18 pEMPList.EXTEND;
19 pEMPList(i) := r.EMPNO;
20
21 i := i + 1;
22 END LOOP;
23
24 REM(pEMPList);
25 END PKJ_EMP;
26
27 PROCEDURE REM
28 (
29 pEMPList IN EMP_TYPE
30 )
31 AS
32 BEGIN
33 DELETE FROM A WHERE ID IN (SELECT COLUMN_VALUE FROM TABLE(pEMPList));
34 DELETE FROM B WHERE ID IN (SELECT COLUMN_VALUE FROM TABLE(pEMPList));
35 DELETE FROM C WHERE ID IN (SELECT COLUMN_VALUE FROM TABLE(pEMPList));
36 DELETE FROM D WHERE ID IN (SELECT COLUMN_VALUE FROM TABLE(pEMPList));
37 END REM;
38 END PKJ_EMP;
39 /
Package body created.
SQL> EXEC PKJ_EMP.PKJ_EMP(20);
PL/SQL procedure successfully completed.
SQL> SELECT * FROM A;
no rows selected
SQL> SELECT * FROM B;
no rows selected
SQL> SELECT * FROM C;
no rows selected
SQL> SELECT * FROM D;
no rows selected
SQL> spool off;HTH! -
Adding new object type (field BKPF-AWKEY) for BAPI posting
Hi everyone,
I am posting to SAP GL using an input file to read the data and transfer it to BKPF and BSEG tables.
The problem is I have to use BAPI_ACC_DOCUMENT_POST, and it expects values for OBJ_KEY and OBJ_TYPE.. For now, OBJ_TYPE creates a problem, because if I use BKPF, it says it cannot post using this object type, as it is for SAP internal use only.
Does anyone know how to add a new object type for the customer namespace, which can be manually used for this kind of posting? I know that the new entry must be made in tables TTYP, TTYPT, and possibly TTYPV, for which the maintainence view exists: V_TTYPV.
How to add an entry here, or where can I find it in customizing?
All helpful answers will be awarded.
Thank you very much
Srdjanperform fill_internal_tables.
if check_l = 'X'.
call function 'BAPI_ACC_DOCUMENT_CHECK'
destination dest
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it.
extension2 = it_ext2
realestate = it_re.
write: / 'Result of check lines:'. "#EC NOTEXT
perform show_messages.
endif.
if check_a = 'X'.
call function 'BAPI_ACC_DOCUMENT_CHECK'
destination dest
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it.
extension2 = it_ext2
realestate = it_re.
write: / 'Result of check all:'. "#EC NOTEXT
perform show_messages.
endif.
if post = 'X'.
data: l_type like gd_documentheader-obj_type,
l_key like gd_documentheader-obj_key,
l_sys like gd_documentheader-obj_sys.
if dest = space or
dest = gd_documentheader-obj_sys.
post synchron
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
importing
obj_type = l_type
obj_key = l_key
obj_sys = l_sys
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it.
extension2 = it_ext2
realestate = it_re.
write: / 'Result of post:'. "#EC NOTEXT
perform show_messages.
else.
create Idoc
it_receivers-logsys = dest.
append it_receivers.
call function 'ALE_ACC_DOCUMENT_POST'
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
paymentcard = it_paymentcard
contractitem = it_fica_it
extension2 = it_ext2
realestate = it_re
receivers = it_receivers
COMMUNICATION_DOCUMENTS =
APPLICATION_OBJECTS =
exceptions
error_creating_idocs = 1
others = 2 .
if sy-subrc = 0.
write: / 'IDoc created'. "#EC NOTEXT
else.
write: sy-msgid.
endif.
endif.
endif.
if rev_p = 'X' or rev_c = 'X'.
data: rev like bapiacrev,
rev_key like ref_key.
rev_key = ref_key.
rev_key(1) = 'R'.
rev-obj_type = gd_documentheader-obj_type.
rev-obj_key = rev_key.
rev-obj_sys = gd_documentheader-obj_sys.
rev-obj_key_r = ref_key.
if rev_c is initial.
if dest = space or
dest = gd_documentheader-obj_sys.
call function 'BAPI_ACC_DOCUMENT_REV_POST'
exporting
reversal = rev
bus_act = gd_documentheader-bus_act
tables
return = it_return.
else.
it_receivers-logsys = dest.
append it_receivers.
call function 'ALE_ACC_DOCUMENT_REV_POST'
exporting
reversal = rev
busact = gd_documentheader-bus_act
OBJ_TYPE = 'BUS6035'
SERIAL_ID = '0'
tables
receivers = it_receivers
COMMUNICATION_DOCUMENTS =
APPLICATION_OBJECTS =
exceptions
error_creating_idocs = 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.
else.
write: / 'IDoc created'. "#EC NOTEXT
endif.
endif.
else.
call function 'BAPI_ACC_DOCUMENT_REV_CHECK'
exporting
reversal = rev
bus_act = gd_documentheader-bus_act
tables
return = it_return.
endif.
write: / 'Result of Reversal Posting:'. "#EC NOTEXT
perform show_messages.
endif.
commit work.
chk this
Give points if useful -
Can't create object types in forms 10
Hello,
I am trying to use object types in forms 10.
I have already created successfully two object types and also corresponding object views.
With one object type A everything works fine in form. But with the other object type B it doesn't.
I am calling the constructor of object B and after the constructor finshed, forms says that there is a numeric or value error.
Well, by nbow I have reduced attributes from object B so that they are identical to object A (which works). But still get the same error or if I use a different constructor I get NULL as a return value. I tested the constructors with test script in the database directly and viola - the constructor are working fine.
Only if I use the constructors in forms environment they fail.
Any ideas why this might happen?
Thank you
Matthias
Well, I fear to use the object types in my next project cause if I run into trouble if the object types are so easy with less code, what else might happen if they are filled up with much more code?Hello again,
I have tried again and still get the exception.
Now I provide the code. Perhaps someone can see, why this exceptioon occurs.
In the database I coded the following:
create or replace type GenericObject as object
-- Attributes
iVersion VARCHAR2(8),
-- Member functions and procedures
MEMBER FUNCTION toString(SELF IN OUT NOCOPY GenericObject) RETURN VARCHAR2,
FINAL MEMBER FUNCTION toString001(SELF IN OUT NOCOPY GenericObject) RETURN VARCHAR2,
NOT INSTANTIABLE MEMBER PROCEDURE log(pLogger IN OUT MyLogger)
) NOT INSTANTIABLE NOT FINAL
create or replace type body GenericObject is
-- Member procedures and functions
MEMBER FUNCTION toString(SELF IN OUT NOCOPY GenericObject) RETURN VARCHAR2 IS
BEGIN
RETURN SELF.toString001();
END;
FINAL MEMBER FUNCTION toString001(SELF IN OUT NOCOPY GenericObject) RETURN VARCHAR2 IS
BEGIN
RETURN 'GenericObject(' || SELF.iVersion || ')';
END;
end;
create or replace type MyTestA UNDER GenericObject
-- Attributes
iPk VARCHAR2(16),
iName VARCHAR2(100),
iDCN NUMBER,
-- constructor
CONSTRUCTOR FUNCTION MyTestA(pName VARCHAR2, pDummy INTEGER) RETURN SELF AS RESULT,
CONSTRUCTOR FUNCTION MyTestA(pPk VARCHAR2) RETURN SELF AS RESULT,
STATIC FUNCTION mycreate(pName VARCHAR2) RETURN MyTestA,
-- Member functions and procedures
OVERRIDING MEMBER FUNCTION toString(SELF IN OUT NOCOPY MyTestA) RETURN VARCHAR2,
FINAL MEMBER FUNCTION toString002(SELF IN OUT NOCOPY MyTestA) RETURN VARCHAR2,
OVERRIDING MEMBER PROCEDURE log(SELF IN OUT NOCOPY MyTestA, pLogger IN OUT MyLogger)
) NOT FINAL
create or replace type body MyTestA is
-- constructors
CONSTRUCTOR FUNCTION MyTestA(pName VARCHAR2, pDummy INTEGER) RETURN SELF AS RESULT IS
BEGIN
SELF.iVersion := '1.1';
SELF.iPk := 1;
SELF.iName := pName;
SELF.iDCN := 1;
RETURN;
END;
CONSTRUCTOR FUNCTION MyTestA(pPk VARCHAR2) RETURN SELF AS RESULT IS
BEGIN
SELECT VALUE(o) INTO SELF FROM v_testa o WHERE o.ipk = pPk;
RETURN;
END;
STATIC FUNCTION mycreate(pName VARCHAR2) RETURN MyTestA IS
BEGIN
RETURN MyTestA(pName, 1);
END;
-- Member procedures and functions
OVERRIDING MEMBER FUNCTION toString(SELF IN OUT NOCOPY MyTestA) RETURN VARCHAR2 IS
BEGIN
RETURN toString002();
END;
FINAL MEMBER FUNCTION toString002(SELF IN OUT NOCOPY MyTestA) RETURN VARCHAR2 IS
lvText VARCHAR2(1000);
BEGIN
lvText := SELF.toString001();
RETURN 'MyTestA(' || iPk || ', ' || iName || ', ' || 'lvHersteller.toString()' || ', ' || lvText || ')';
END;
OVERRIDING MEMBER PROCEDURE log(SELF IN OUT NOCOPY MyTestA, pLogger IN OUT MyLogger) IS
BEGIN
pLogger.log(toString());
END;
end;
CREATE OR REPLACE VIEW v_testa OF MyTesta
WITH OBJECT IDENTIFIER (iPk) AS
SELECT
'1.0' iVersion
,g.pk iPk, g.NAME iName, g.ora_rowscn iDCN FROM o_geraete g
DROP TABLE o_geraete;
CREATE TABLE
o_geraete
pk VARCHAR2(16)
, name VARCHAR2(100)
, hersteller_FK VARCHAR2(16)
, zaehlernummer VARCHAR2(20)
, dummy VARCHAR2(10)
INSERT INTO o_geraete
VALUES(
'100', 'Stromzähler', '1', 'AB-56', 'dumb'
INSERT INTO o_geraete
VALUES(
'200', 'Wasserzähler', '2', 'WS-09', 'dumb'
In forms I created a form from the view and coded into the on-insert-trigger:
declare
lvtest mytesta;
begin
message('1');
lvtest := new mytesta(:blk_testa.iname, 1);
message('2');
message('3' || lvtest.tostring());
exception
when others then
message('Exception: ' || sqlerrm);
end;
And in that forms block I got the exception.
Perhaps someone has ANY idea...
Thanx a lot
Matthias
Message was edited by:
user522343
Message was edited by:
user522343 -
How can I obtain an object-type variable in Forms 6i?
i create an object-type in oracle 8i database like this:
TYPE OBJ_TYPE_NUMBER AS OBJECT
FIELD1 NUMBER,
MEMBER PROCEDURE INIT, ...
i create a variable of this object-type in a stored procedure in Oracle 8i:
v_Number OBJ_TYPE_NUMBER(10);
and then call it's method:
v_Number.INIT;
it work's!
But when I try to compile a previous variable declaration
(v_Number OBJ_TYPE_NUMBER;) in Oracle Forms 6i I see only an error message.
So my question is How can I declare and use an object-type variable in Forms 6i?Hi,
the release after Forms 6i is Forms9i. Forms9i does have the PLSQL engine of Oracle 9.0.0.2 database which means that it should knwo how to handle object types in PLSQL.
Frank -
How to return object type from external c procedure ?
Hello all,
I'm trying for the first time to return an object type as the return value of an external stored procedure (in C ).
I don't have any issue to use an object type parameter for the function but not to return one to the caller.
each time I try I get "ORA-03113: end-of-file on communication channel" and the connection is dropped.
Thanks for any help,
Roye Avidor
here is the code :
=> object type
SQL>create or replace type address as object ( age number, salary float );
=> address typ file
CASE=SAME
TYPE address as address
=> building the dependences structures.
$>ott userid=scott/tiger intype=address.type code=c hfile=address.h
=> the package description
create or replace package userTypeDefined_PKG
is
function getAddr( addr address ) return address;
end;
create or replace package body userTypeDefined_PKG
is
function getAddr( addr address ) return address
AS LANGUAGE C
NAME "addr"
LIBRARY userTypeDefinedLib
WITH CONTEXT
PARAMETERS
( CONTEXT,
addr,
addr INDICATOR STRUCT ,
return address,
return INDICATOR STRUCT
end;
=> The C code for the library in
address* addr(OCIExtProcContext ctx, address address_obj, address_ind address_obj_ind, address_ind ret_ind){
unsigned int tt;
OCIEnv *envh;
OCIError *errh;
OCISvcCtx *svch;
sword err;
address* ret = NULL;
int inum = 69;
float fnum = 12.34;
/* get OCI Environment */
err = OCIExtProcGetEnv(ctx, &envh, &svch, &errh) ;
/* allocate space for return sturcture*/
ret = (address *)OCIExtProcAllocCallMemory(ctx, sizeof(address));
/* set the AGE value */
if ( OCINumberFromInt ( errh, &inum, sizeof(inum), OCI_NUMBER_SIGNED, &(ret->AGE) ) == OCI_ERROR )
OCIExtProcRaiseExcp(ctx,(int)1476); // raise 1476 is fail
/* set the SALARY value */
if ( OCINumberFromReal ( errh, &fnum, sizeof(fnum), &(ret->SALARY) ) == OCI_ERROR )
OCIExtProcRaiseExcp(ctx,(int)1477);// raise 1477 is fail
// set the indicators for the structure as not null
ret_ind->atomic = OCIIND_NOTNULL;
ret_ind->AGE = OCI_IND_NOTNULL;
ret_ind->SALARY = OCI_IND_NOTNULL;
return (ret);
}The return indicator should be declared as double pointer, and need to be allocated in the function body.
-
How to trigging a object event which the object type has two key fields
Hi,kind guys
I use the object type QMSM about qualification notification task,it has two key fiedls,qualification notification number and task number (can display by t-code -QM03), I want to trigging the event 'create' in BOR 'QMSM ' by function SWE_EVENT_CREATE(or SAP_WAPI_event_create), but it only has one object key ,
example:
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
OBJTYPE = OBJTYPE
OBJKEY = OBJKEY " only one key
EVENT = EVENT
but the BOR object 'QMSM' has two keys,so it cann't be trigged rightly.
thanks for any help.You have to Concatenate the Business object keys and pass it in one variable OBJKEY.
Thanks
Arghadip -
Smart Synchronization Without calling BAPI wrapper
Hi All,
I am very new to SAP MI development...
I wanted to know that
is it possible to call BAPI directly not calling with use of BAPI Wrapper?
is there any other way to do Smart Synchronization where BAPI wrappern not required?
Thanks,Hi Maulik,
if u directly want to call the BAPI u will need to call the underlying RFC related to that BAPI.
This is done through Generic Synchronization.
Please refer to documents on help.sap.com and MDK for further help.
cheers
Anand
Maybe you are looking for
-
When I try to play music on my iPod touch it immediately returns to the artists screen. Can anyone help?
-
How to restrict the view in a application?
hello colleagues, need your help to find the best solution. There are two restriction which I need to implement: 1. different view for single field groups 2. different view for a complete application Additional Point 3) multiple view assignment to a
-
CMS Tracks - best practice?
Hi, we are developing our product with CVS right now and want to move over to DTR. The basic concepts are clear and I did a test migration yet which is successful. But I am unclear on the chamge management piece: Let's say we develop a version 1.0 No
-
I just recently installed the new Office MAC 2008 (my problems seems to happen with any application) and decided to use the new Entourage as my default email client. When I'm in any application and go to Print>mail PDF a file my non-default (original
-
I have an e50 and a week ago I updated the software of the phone from the Nokia web site. The current version is 06.41.3.0. I am not sure but since then my phone does not open zip files anymore. When opening them from an email attachment it says the