BDC with MM01/ MM02 from MARA table
Can anybody suggest me for the following problem.
I want to construct a BDC with MM01/ MM02 from MARA table.
And I want the source file to be a notepad or Excel sheet. But i am not
getting, that how to write the data in Notepad/Excel sheet, to feed to the
master table according to the MM01/MM02 fields .
This is the sample code for creation of flatfile for MM01 this will be definetly helping you to create a flatfile.
REPORT ZBDC_FF MESSAGE-ID BCTRAIN .
TYPES: BEGIN OF STU,
MATNR LIKE RMMG1-MATNR,
MBRSH LIKE RMMG1-MBRSH,
MTART LIKE RMMG1-MTART,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE MARA-MEINS,
END OF STU.
DATA WA_ITAB TYPE STU.
DATA ITAB TYPE TABLE OF STU.
WA_ITAB-MATNR = 'T1'. "MATERIAL NUMBER"
WA_ITAB-MBRSH = 'K'. "INDUSTRY SECTOR"
WA_ITAB-MTART = 'VKHM'. "MATERIAL TYPE"
WA_ITAB-MAKTX = 'TOOLEMATERIAL'. "MATERIAL DESCRIPTION"
WA_ITAB-MEINS = 'EE'. "BASE UNIT OF MEASURE"
APPEND WA_ITAB TO ITAB.
CLEAR WA_ITAB.
*WA_ITAB-MATNR = 'TOL2'. "MATERIAL NUMBER"
*WA_ITAB-MBRSH = 'M'. "INDUSTRY SECTOR"
*WA_ITAB-MTART = 'VKHM'. "MATERIAL TYPE"
*WA_ITAB-MAKTX = 'TOOLEMATERIAL'. "MATERIAL DESCRIPTION"
*WA_ITAB-MEINS = 'EA'. "BASE UNIT OF MEASURE"
*APPEND WA_ITAB TO ITAB.
*CLEAR WA_ITAB.
*WA_ITAB-MATNR = 'TOL3'. "MATERIAL NUMBER"
*WA_ITAB-MBRSH = 'M'. "INDUSTRY SECTOR"
*WA_ITAB-MTART = 'VKHM'. "MATERIAL TYPE"
*WA_ITAB-MAKTX = 'TOOLEMATERIAL'. "MATERIAL DESCRIPTION"
*WA_ITAB-MEINS = 'EA'. "BASE UNIT OF MEASURE"
*APPEND WA_ITAB TO ITAB.
*CLEAR WA_ITAB.
*WA_ITAB-MATNR = 'TOL4'. "MATERIAL NUMBER"
*WA_ITAB-MBRSH = 'M'. "INDUSTRY SECTOR"
*WA_ITAB-MTART = 'VKHM'. "MATERIAL TYPE"
*WA_ITAB-MAKTX = 'TOOLEMATERIAL'. "MATERIAL DESCRIPTION"
*WA_ITAB-MEINS = 'EA'. "BASE UNIT OF MEASURE"
*APPEND WA_ITAB TO ITAB.
*CLEAR WA_ITAB.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\Documents and Settings\chiranjeevi\Desktop\BDC.TXT'
TABLES
DATA_TAB = ITAB
IF SY-SUBRC <> 0.
MESSAGE S999 WITH 'EXECUTED'.
ENDIF.
Cheers!!!
Similar Messages
-
Problem in BDC with ( MM01-Dynamic views )
HI
I am working with BDC on material Mater(mm01).
Now while Creating Material,there is option of selecting different views based on MaterialType.
But while recording a BDC i can record it for a particular Material Type.and can select view associated to that particular Material Type.
Is there any solution to create a bdc progarm which can accept a new material based on
any material type and having views on user's choice that are given by user in Input file.
FOr that i think i need to create dynamic views and screen elements for input associated to those views.
After scanning some sites and forums for this particular problem,i got some help on this:-----
<b>SELECTION_VIEWS_FIND</b> should be very useful in this case.
There are three FModules totally involved:
a) <b>T130M_SINGLE_READ</b>
Pass TCODE = MM01, and get T130M values
b) <b>BILDSEQUENZ_IDENTIFY</b>
Pass KZRFB = 'X',TCODE_REF=T130M-TRREF and get
BILDSEQUENZ values
c) <b>SELECTION_VIEWS_FIND</b>
Pass BILDSEQUENZ and T130M-PSTAT
Now, this function module holds the values of all the views and the next screen numbers
But i am unable to interpret the solution..Can somebody Elaborate on this.or provide me some other solution for this.
Thanks in Advance
Help Will be appreciated.Yes, I agree with Christian. You are gonna want to use the BAPI or the underlying function module. It works good and isn't really that complex. Here is sample program. Here the function module is being used to change data, it can also be used to create, you will have to change the Tcode from MM02 to MM01.
report zrich_0001.
data: i_mara type table of mara_ueb with header line.
data: i_marc type table of marc_ueb with header line.
data: i_marcx type table of marc with header line.
parameters: p_matnr type mara-matnr,
p_plifz type marc-plifz.
start-of-selection.
* Get all plants for that material
select * into corresponding fields of table i_marcx
from marc where matnr = p_matnr.
* Now maintain data for each plant
loop at i_marcx.
* Reset I_Mara to new material number
clear i_mara. refresh i_mara.
select * into corresponding fields of table i_mara
from mara where matnr = p_matnr.
read table i_mara index 1.
i_mara-tcode = 'MM02'.
i_mara-tranc = '0000000001'.
modify i_mara index 1.
* Get Plant Data
clear i_marc. refresh i_marc.
select * into corresponding fields of table i_marc
from marc where matnr = i_marcx-matnr
and werks = i_marcx-werks.
read table i_marc index 1.
i_marc-plifz = p_plifz. " Plan Del time
i_marc-tranc = '0000000001'.
modify i_marc index 1.
* Maintain material
perform MATERIAL_MAINTAIN_DARK'.
endloop.
* MATERIAL_MAINTAIN_DARK
form MATERIAL_MAINTAIN_DARK.
* Variable for "Maintain_Material_Dark" Function Module
data: numerror like tbist-numerror.
data: last_matnr type mara-matnr.
data: i_delfields type table of mfieldres with header line.
data: i_errors type table of merrdat with header line.
call function 'MATERIAL_MAINTAIN_DARK'
exporting
sperrmodus = ' '
kz_prf = 'W'
max_errors = ' '
p_kz_no_warn = 'X'
kz_verw = 'X'
kz_aend = 'X'
kz_dispo = 'X'
kz_test = ' '
flag_muss_pruefen = ' '
call_mode = 'ACT'
importing
number_errors_transaction = numerror
matnr_last = last_matnr
tables
amara_ueb = i_mara "Basic Data
* amakt_ueb = i_makt "Descriptions
amarc_ueb = i_marc "Plant
* amard_ueb = i_mard "Storage Location
* AMFHM_UEB = I_MFHM "Production Tools
* amarm_ueb = i_marm "Units of Measure
* AMEA1_UEB = I_MEA1 "Internal Mangagement - EANs
* ambew_ueb = i_mbew "Accounting/Costing
* asteu_ueb = i_steu "Tax Data
* astmm_ueb = i_steumm "Tax Data
* AMLGN_UEB = I_MLGN "Warehouse Data
* AMLGT_UEB = I_MLGT "Storage Type Data
* AMPGD_UEB = I_MPGD "Change Documents
* AMPOP_UEB = I_MPOP "Forcast Parameters
* AMVEG_UEB = I_MVEG "Total Consumption Data
* AMVEU_UEB = I_MVEU "Unplanned Consumption Data
* amvke_ueb = i_mvke "Sales Data
* altx1_ueb = i_ltx1 "Sales Text
* AMPRW_UEB = I_MPRW "Forcast Values
amfieldres = i_delfields
amerrdat = i_errors
exceptions
kstatus_empty = 01
tkstatus_empty = 02
t130m_error = 03
internal_error = 04
update_error = 05
too_many_errors = 06.
if sy-subrc <> 0.
rollback work.
call function 'DEQUEUE_ALL'.
else.
commit work and wait.
call function 'DEQUEUE_ALL'.
endif.
clear: i_mara, i_marc.
refresh: i_mara, i_marc.
endform.
Regards,
Rich Heilman -
Error While Viewing Data from MARA Table
Hi All,
After Importing SAP Tables, ex MARA and viewing Data Getting "Error Calling RFC function to get table data: <DATA_BUFFER_EXCEEDED "r . After decreasing or applying filters on fields , still not able to get data.
Able to extract data from T001 table.
Need to pull data in volumes right, so how to tackle this problem.
Thanks,
RavindraHi Ravindra ,
You can check the OSS note - 1186277 for the resolution of this issue .
Note- 1186277 is a SAP knowledge article .
You can access it from here - [Note - 1186277|https://css.wdf.sap.corp/sap(bD1lbiZjPTAwMQ==)/bc/bsp/sno/ui_entry/entry.htm?param=69765F6D6F64653D3030312669765F7361706E6F7465735F6E756D6265723D3131383632373726]
Regards,
Lokesh -
Help with listing records from two tables
Hi: I have two tables joined by the first field. The field is primary key in first table. Need help listing records from both tables with each record one line/record.
create table EVENTS (
event_key varchar2(64) primary key,
event_description varchar2(64),
create_time int
create table EVENT_UPDATES (
event_key varchar2(64) NOT NULL ,
update_description varchar2(64),
update_time int
insert into EVENTS values('Event1', 'This is event1', 1);
insert into EVENT_UPDATES values('Event1', 'Ticket created', 3);
insert into EVENT_UPDATES values('Event1', 'Event cleared', 10);
insert into EVENTS values('Event2', 'This is event2', 4);
insert into EVENT_UPDATES values('Event2', 'Ticket created', 6);
insert into EVENT_UPDATES values('Event2', 'Event cleared', 8);I want to print each record in EVENTS table as one line and corresponding records in EVENT_UPDATES as one line/record like this
Event1 1 This is event1
3 Ticket created
10 Event cleared
Event2 4 This is event2
6 Ticket created
8 Event clearedTIA
Raviselect case weight
when 1 then event_key
end key,
time_val,
description
from (
select event_key,
create_time time_val,
event_description description,
1 weight
from events
union all
select event_key,
update_time,
update_description,
2 weight
from event_updates
order by event_key,
weight
KEY TIME_VAL DESCRIPTION
Event1 1 This is event1
3 Ticket created
10 Event cleared
Event2 4 This is event2
6 Ticket created
8 Event cleared
6 rows selected.
SQL> SY. -
Count(*) , group by with multiple columns from multiple tables involved
Hi all,
I am relatively new to SQL.
Currently I have these few requirements, to display quite a number of fields from 3 tables for display of report.
In my query I need to:
1.) count(*)
2.) select quite a number of fields from table 1,2,3
However when count(*) is used, grouped by has to be used to.
How do I actually use group by with so many columns to be selected?
I have actually used the query below, but the count(*) returns 1, the correct output should be 3 instead.
select count(*), table1.col1, table1.col2, table1.col3, table2.col3, table2.col4, table2.col6, table3.col1, table3.col4, table3.col5
from table1, table2, table3
where
<conditions>........................
group by table1.col1, table1.col2, table1.col3, table2.col3, table2.col4, table2.col6, table3.col1, table3.col4, table3.col5
I know this group by statement looks very unrefined. How can I select multiple fields from different tables, and yet get the count(*) correctly?
Thank you so much for your time.Hmm yes it actually does return count as 1 for each row. But there are 3 rows returned. E.g.
ctr table1.col1 table1.col2 ..........
1 value1 value1
1 value2 value3
1 value3 value4
If I put the count(*) outside, it returns 3 , the correct output
ctr
3
select count(*) from
select table1.col1, table1.col2, table1.col3, table2.col3, table2.col4, table2.col6, table3.col1, table3.col4, table3.col5
from table1, table2, table3
where
<conditions>
group by table1.col1, table1.col2, table1.col3, table2.col3, table2.col4, table2.col6, table3.col1, table3.col4, table3.col5
Thus I was wondering if it was the group by of multiple colns that resulted in the count stucked at value 1. -
Combining DD-MON field with YYYY field from GL table
I am running into issues with GL_Cancelled_Date which is displaying the wrong 4 digit year. The GL_Encumbered_Date for these rows is correct and I am looking at ways to combine these fields to output the correct full DD-MON-YYYY date. The below code displays all of the bad rows of data and the last two coloumns display the correct DD-MON and YYYY dates. But I am unsure of how to combine the DD-MON from GL_Cancelled_Date with the YYYY from GL_Encumbered_Date.
I have written out:
SELECT
PRH.SEGMENT1,
prd.GL_ENCUMBERED_DATE,
TO_CHAR(PRD.GL_ENCUMBERED_DATE,'YYYY'),
PRD.GL_CANCELLED_DATE,
TO_CHAR(PRD.GL_CANCELLED_DATE, 'DD-MON-YYYY'),
to_char(prd.gl_cancelled_date,'YYYY'),
to_char(prd.gl_cancelled_date,'DD-MON-') as date_day_month,
to_char(prd.gl_encumbered_date,'YYYY') as date_year
FROM
PO_REQUISITION_HEADERS_ALL PRH,
PO_REQUISITION_LINES_ALL PRL,
PO_REQ_DISTRIBUTIONS_ALL PRD
WHERE
PRH.REQUISITION_HEADER_ID = PRL.REQUISITION_HEADER_ID
AND PRL.REQUISITION_LINE_ID = PRD.REQUISITION_LINE_ID
AND PRD.GL_CANCELLED_DATE IS NOT NULL
AND to_char(PRD.GL_CANCELLED_DATE,'YYYY') LIKE '00%';Hi,
Here's one way to correct the table:
UPDATE po_req_distributions_all
SET gl_cancelled_date = ADD_MONTHS ( gl_cancelled_date
, 12 * ( EXTRACT (YEAR FROM gl_encumbered_date)
- EXTRACT (YEAR FROM gl_cancelled_date)
WHERE EXTRACT (YEAR FROM gl_encumbered_date)
<> EXTRACT (YEAR FROM gl_cancelled_date)
When this finishes, gl_cancelled_date will always have the same year as gl_encumbered_date, but hte original months, days, hours, minutes and seconds of gl_cancelled_date will be unchanged. (Exception: If the original gl_cancelled_date is February 29, and gl_encumbered_date is NOT in a leap year, then the day will be changed to 28, since there is no February 29 in the correct year. If the original gl_cancelled_date is February 28, and gl_encumbered_date IS in a leap year, then the day will be changed to 29. This can be fixed if it's a problem.)
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
If you're asking about a DML statement, such as UPDATE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
Point out where the statement above is getting the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Using ME21N/ME22N with own Fields from MARA
Hallo,
i need help to insert some fields from MARA in
the Tcode ME21/2N. For example MARA-GROES or MARA-ZEINR
in the Item-List.
Can i use the exit MM06E005, and has anybody a
Codeexample?
Thanks for help
Dieter
We have a new Problem. We have to store the new Fields
in the EKPO. I use EXIT_SAPMM06E_013 with xekpo-ZZEINR
but it doesn't work correct.
Has anyone an idea?
Thanks
Regards Dieter
Message was edited by: Dieter GröhnHi Dieter,
1. Insert new field ZZ_ZEINR with component type<b> DZEINR</b> in structure CI_EKPODB via SE11. Save and activated once done.
2. Go to <b>SE51</b> (Screen Painter), enter program <b>SAPLXM06</b> and screen number <b>0111</b> and click on change and select maintain in original language.
3. Click on <b>Layout</b> button and create text field and input/output field for EKPO_CI-ZZ_ZEINR. Save and activated.
4. Go to SE37 and enter function module <b> EXIT_SAPMM06E_016</b> and click on include <b>ZXM06U41</b>. In here you can code something like this. Save and activated once done.
CLEAR: EKPO_CI-ZZ_ZEINR.
SELECT SINGLE *
FROM MARA
WHERE MATNR = I_EKPO-MATNR.
IF SY-SUBRC = 0.
EKPO_CI-ZZ_ZEINR = MARA-ZEINR.
ENDIF.
Hope this will help.
Regards,
Ferry Lianto -
UPDATING A TABLE WITH SAME INFO FROM ANOTHER TABLE ON THE SAME DB
0down votefavorite
I am trying to update a table with info from another table on the same db with same table name. I just want the info to be the same , no primary key or constraint involve just a straight replacement of records and I keep getting errors WITH THE TABLE not
being recignize. below is my query:
UPDATE
VNDFIL
SET EOBTYP
= VNDFIL.EOBTYP,
EDI_X12_835_VERSION = VNDFIL.EDI_X12_835_VERSION
FROM
AGERECOVERY
WHERE
VNDFIL.EOBTYP
= VNDFIL.EOBTYP
AND
VNDFIL
.EDI_X12_835_VERSION
= VNDFIL.EDI_X12_835_VERSIONHi rotary,
If those two same named tables are in the same database then they have to be in different schemas. If you mean they are in the same server instance, then they may be in different databases, besides the "table not being recognized" error,
anyway you should use the fully qualified table names, that is database.Schema.Table(If across instances, ServerName should be prefixed) to avoid the table unrecognized error.
Using Identifiers As Object Names
With the fully qualified names, your update statement can be like below.
UPDATE
db1.schema1.VNDFIL
SET EOBTYP = srcTbl.EOBTYP, EDI_X12_835_VERSION = srcTbl.EDI_X12_835_VERSION
FROM
db1.schema2.VNDFIL srcTbl
WHERE
db1.schema1.VNDFIL.EOBTYP = srcTbl.VNDFIL.EOBTYP AND
db1.schema1.VNDFIL.EDI_X12_835_VERSION = srcTbl.VNDFIL.EDI_X12_835_VERSION
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
Breakout table (fill table with matching data from another table)
Hi
I've been trying to study old discussions about breakout tables. I feel I'm close, but still no cigar :-)
In plain english, I'm trying to autocreate rows with data on a table, based on matching values from another table. E.g. have a table to display all rows where type = AssetX
I have attached a screenshot of my "master table" called Assets:
I'm looking to prefill Asset name, Total from this table and populate a new table called e.g. Greenhouse
Where I'd be adding more data (date, income, expense).
Any help whould be greatly appreciated.
Thanks!Hi,
Here is a Sample Query.
Update Emp A
Set Sal = (Select Sal from emp b where
a.empno = b.empno)
where empno in (select empno from emp);
Regards,
Ganesh R
null -
How to log in with user credentials from database table
Hello all.
I have a table named users_1 in my database. This table has columns named username, password, email and userid. On userid, I have put a sequence.
Now, I have manually made 1 row in this table, with in it the user credentials.
How can I edit my application so that I can use these credentials to log onto the application?
Please, a step-by-step text would make me rather happy, instead of getting a link with information that I should read. I've read most of it, and it just doesn't make any sense to me, so I prefer a guide-trough.
Thanks..Hi Magali,
You want only user from database can access your application.
follow the steps given below.
Step1 : create function to authenticate users
create or replace FUNCTION "CUSTOM_AUTHENTICATE" (p_username in VARCHAR2, p_password in VARCHAR2)
return BOOLEAN
is
l_password varchar2(4000);
l_stored_password varchar2(4000);
l_count number;
begin
select count(*) into l_count from users_1 where upper(username) = upper(p_username);
if l_count > 0 then
select upper(password) into l_stored_password from users_1 where upper(username) = upper(p_username);
l_password := upper(p_password);
if l_password = l_stored_password then
return true;
else
return false;
end if;
else
return false;
end if;
end;
Step2 : create authentication scheme for your application
Go to Application Builder->select your application->shared component->security->authentication scheme->create
a) custom scheme : Based on a pre-configured scheme from the gallery
b) give some name to your scheme like custom_scheme or something
c)scheme type : database account
d) verify function name = return CUSTOM_AUTHENTICATE
e) go to = Login Page
f) Logout url = f?p=&APP_ID.:101 // here 101 is login page no..so you can set your login page no.
step3 : make this scheme as current scheme
select your scheme and click make current
now try to login into your application from your database users..
Hope this will helps you,
Thanks,
Jitendra -
Issue with WRITE statement from Internal Table
Hi All,
I have written the below code in a infoset query, the syntax check is ok & when i run the query in debugging mode, i find the internal table being filled with the values & the write statement outputing the values as well.
But the problem is when i execute the query the output does not show all the lines, instead just displays the last record . What could be the mistake?
Is it because i have defined Y_EBELN, Y_EBELP & Y_OPENQTY as nodes in the Extras Tab of the infoset & have chosen this for display in my query? How to display the output from my internal table in my query output?
Hope my problem is clear, await clarification.
Vivek
Code
types:
Begin of itab,
wl_ebeln type eket-ebeln,
wl_ebelp type eket-ebelp,
wl_openqty type eket-menge,
End of itab.
Data: il_po type table of itab with header line.
*Display open PO for materials
SELECT EKETEBELN EKETEBELP EKETMENGE EKETWEMNG EKET~EINDT
INTO (Y_EBELN, Y_EBELP, WL_MENGE, WL_WEMNG, Y_EINDT)
FROM EKET
INNER JOIN EKPO
ON EKETEBELN = EKPOEBELN
AND EKETEBELP = EKPOEBELP
INNER JOIN MARD
ON EKPOMATNR = MARDMATNR
AND EKPOWERKS = MARDWERKS
AND EKPOLGORT = MARDLGORT
WHERE EKPO~MATNR = MARD-MATNR
AND EKPO~WERKS = MARD-WERKS
AND EKPO~LGORT = MARD-LGORT
AND EKPO~LOEKZ = SPACE
AND EKPO~ELIKZ = SPACE.
*Display only still open qty per schedule line
Y_OPENQTY = WL_MENGE - WL_WEMNG.
il_po-wl_ebeln = Y_EBELN.
il_po-wl_ebelp = Y_EBELP.
il_po-wl_openqty = Y_OPENQTY.
append il_po.
ENDSELECT.
ENDIF.
Loop at il_po.
write:/ il_po-wl_ebeln, il_po-wl_ebelp, il_po-wl_openqty.
endloop.Hi Vivek,
Try it like this.
Data: Begin of itab,
lifnr type lfa1-lifnr,
name1 type lfa1-name1,
land1 type lfa1-land1,
End of itab,
it_lfa1 like table of itab with header line,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
land1 like lfa1-land1.
select lifnr name1 land1 into (lifnr, name1, land1)
from lfa1.
it_lfa1-lifnr = lifnr.
it_lfa1-name1 = name1.
it_lfa1-land1 = land1.
append it_lfa1.
endselect.
loop at it_lfa1.
write:/ it_lfa1-lifnr, it_lfa1-name1, it_lfa1-land1.
endloop.
Note:
In place of the above select you insert your join select statement. It is working for me.
You have declared your internal table wrongly. In the internal table instead of TYPE use LIKE, it will work.
Hope this will work for you.
Thanks & Regards
Haritha. -
Auto Populate Field in One Table with Primary Key from another table.
Greetings all,
I have created two tables. One for Root Cause which will be the based description information of an analysis. Each Root cause can have many corrective actions.
My Table structure is as follows:
RCCA TABLE:
=====================================
Column Name Data Type Nullable
RCCAID NUMBER No
DESCRIPTION VARCHAR2(4000) Yes
SUMMARY VARCHAR2(4000) Yes
OWNER VARCHAR2(4000) Yes
DATEOFINCIDENT DATE Yes
STATUS VARCHAR2(4000) Yes
CORRECTIVE ACTION TABLE
=====================================
Column Name Data Type Nullable
CAID NUMBER No
RCCAID NUMBER No
CANUMBER NUMBER Yes
CACTION VARCHAR2(4000) Yes
DATEDUE DATE Yes
COMMENTS VARCHAR2(4000) Yes
So I have a form that creates the RCCA and then I have another form that I want to feed off of the first form. My thought was that when the RCCA was created, it would open a report of the RCCA and then in another region of the page I would add corrective action form. What I am looking to do is when I press the Create Corrective Action, it will automatically populate the RCCAID in the Corrective Action Table so that it is associated directly to the RCCA. I don't want to have to have someone know what the RCCAID is from teh RCA table because they are autogenerated.
There may be a better way to do this and since I am new to APEX and to Oracle Databases, I am just going with what my logic tells me. Any assistance or thoughts would be appreciated.
Assuming there would be some type of trigger?
I will have to be able to view each RCCA and CA in a report that customers will see.
Thanks in Advance
WallyHi Debasis,
Have a look on this
Quick note on IDENTITY column in SAP HANA
Regards,
Krishna Tangudu -
Spatial Query with multiple geometries from 2 tables
Hi,
I'm using Oracle 8.1.7. I am trying to do a spatial query on two tables with multiple geometries. There are two spatial tables. One made up of points and one made up of polygons. There are 829551 rows in the table of points and 1817795 rows in the table with polygons...
I want to find all polygons where one of this points is within it...
This query is pretty intensive querying two large spatial tables against each other and so I need to find the most efficient way of running this query. I've been running variations of my query for the last two week and every time it's bombed out with various errors after 12-24 hrs processing like out of memory, out of tablespace, out of processing, invalid index etc etc etc. I need to get this query run asap... Any tips would be gratefully appreciated..
For the session running the query I've allocated 16M sort area with
ALTER SESSION SET SORT_AREA_SIZE=16777216;
Below is the query I'm running... How can I improve this please? BTW PARCEL_OVERLAPS contains the points and TP$_PARCEL_AREAS the polygons.
SELECT lu.LNU_PARCEL_ID
FROM
seventy.PARCEL_OVERLAPS po,
imap_topol.TP$_PARCEL_AREAS pa,
TP$_PARCEL_CENTROID_AREA pca,
TDCR_LAND_UNIT lu
WHERE
SDO_FILTER(po.geometry, pa.area,
'querytype=WINDOW') = TRUE and
sdo_within_distance(po.geometry,pa.area,'distance=0')='TRUE' and
pa.delete_date is null and
Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
pa.AREA_ID = pca.AREA_ID and
pca.DELETE_DATE IS NULL and
pa.DELETE_DATE IS NULL;Albert,
Thanks for your reply and the tips you've given. The tp$_parcel_areas table will always be bigger so I've changed the order to sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE'. The requested counts for those queries are
12:26:29 [email protected]:SQL> select count(*)
13:46:22 2 from seventy.PARCEL_OVERLAPS;
COUNT(*)
612
13:48:12 [email protected]:SQL> select count(*)
13:48:17 2 from imap_topol.TP$_PARCEL_AREAS pa,
13:48:21 3 TP$_PARCEL_CENTROID_AREA pca
13:48:21 4 where pca.DELETE_DATE IS NULL
13:48:21 5 and pa.DELETE_DATE IS NULL
13:48:21 6 and pa.AREA_ID = pca.AREA_ID;
COUNT(*)
1310665
There was no reason for both filter and within_distance. I did try use the anyinteract but for some reason that does not return the desired results(I've added one id row as a test to make sure it returns desired results). Plus Oracle have recomended using the within distance for better performance..
so the explan plan for
14:38:37 [email protected]:SQL> EXPLAIN PLAN FOR
14:38:50 2 SELECT lu.LNU_PARCEL_ID
14:38:50 3 FROM
14:38:50 4 seventy.PARCEL_OVERLAPS po,
14:38:50 5 imap_topol.TP$_PARCEL_AREAS pa,
14:38:50 6 TP$_PARCEL_CENTROID_AREA pca,
14:38:50 7 TDCR_LAND_UNIT lu
14:38:50 8 WHERE
14:38:50 9 sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE' and
14:38:50 10 pa.delete_date is null and
14:38:50 11 Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
14:38:50 12 pa.AREA_ID = pca.AREA_ID and
14:38:50 13 pca.DELETE_DATE IS NULL and
14:38:50 14 pa.DELETE_DATE IS NULL;
is
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
| SELECT STATEMENT | | 4G|32920G| 547M| | |
| NESTED LOOPS | | 4G|32920G| 547M| | |
| MERGE JOIN | | 547M| 2029G| 230124 | | |
| SORT JOIN | | 1M| 36M| 85014 | | |
| MERGE JOIN | | 1M| 36M| 50019 | | |
| SORT JOIN | | 1M| 17M| 21650 | | |
| TABLE ACCESS FULL |TP$_PARCE | 1M| 17M| 485 | | |
| SORT JOIN | | 1M| 22M| 28369 | | |
| TABLE ACCESS FULL |TDCR_LAND | 1M| 22M| 2127 | | |
| SORT JOIN | | 42K| 160M| 145111 | | |
| TABLE ACCESS FULL |TP$_PARCE | 42K| 160M| 12697 | | |
| TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
14:43:14 [email protected]:SQL> explain plan for
14:43:23 2 SELECT pa.AREA_ID
14:43:23 3 FROM seventy.PARCEL_OVERLAPS po,
14:43:23 4 imap_topol.TP$_PARCEL_AREAS pa
14:43:23 5 WHERE SDO_RELATE(po.geometry, pa.area,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
14:43:23 6 and pa.DELETE_DATE IS NULL;
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
| SELECT STATEMENT | | 6M| 50G| 10M| | |
| NESTED LOOPS | | 6M| 50G| 10M| | |
| TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
| TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
14:45:03 [email protected]:SQL> explain plan for
14:45:04 2 SELECT pa.AREA_ID
14:45:05 3 FROM seventy.PARCEL_OVERLAPS po,
14:45:05 4 imap_topol.TP$_PARCEL_AREAS pa
14:45:05 5 WHERE SDO_RELATE(pa.area, po.geometry,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
14:45:05 6 and pa.DELETE_DATE IS NULL;
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
| SELECT STATEMENT | | 6M| 50G| 863554 | | |
| NESTED LOOPS | | 6M| 50G| 863554 | | |
| TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
| TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
-------------------------------------------------------------------------------- -
DI UI : fill matrix with a query from user table data
hello,
I create a user table.
I want to fill a matrix on a form with some aggregated data of this user table.
I do :
Public Sub SetMatrixRep()
Dim oRecordSet As SAPbobsCOM.Recordset
Dim oCentre As SAPbouiCOM.EditText
Dim oCompte As SAPbouiCOM.EditText
Dim oBudget As SAPbouiCOM.EditText
Dim oDepense As SAPbouiCOM.EditText
Dim oSolde As SAPbouiCOM.EditText
Dim i As Long
i = 0
Set oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRecordSet.DoQuery ("select * from [@CAP_OPRC_BUDGET]")
While oRecordSet.EOF = False
' filling the matrix
Set oCentre = oMatrixRep.Columns("clCentre").Cells.Item(i).Specific
oCentre.String = oRecordSet.Fields.Item(0).Value
'oMatrixRep.Columns("clCentre").Cells(1).Specific.String = oRecordSet.Fields.Item(0).Value
'SBO_Application.MessageBox (oRecordSet.Fields.Item(0).Value)
oMatrixRep.AddRow
oRecordSet.MoveNext
i = i + 1
Wend
End Sub
I've got an error : Row - Index invalid.
Could you help me please ?
Thanks.
Romeo.Hi
This is a routine that I call from my Item Event handler
Hope it can help you
Public Sub PopolaMatrice(oApplicazione As SAPbouiCOM.Application, pVal As SAPbouiCOM.IItemEvent)
Dim oForm As SAPbouiCOM.Form
Dim oMatrix As SAPbouiCOM.Matrix
Dim oDBDataSource As SAPbouiCOM.DBDataSource
Dim oConditions As New SAPbouiCOM.Conditions
Dim oCondition As SAPbouiCOM.Condition
Dim oDocNum As SAPbouiCOM.EditText
Dim lIndice As Long
Set oForm = oApplicazione.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
Set oDBDataSource = oForm.DataSources.DBDataSources.Item("MyUserTableName")
Set oMatrix = oForm.Items("MyMatrixName").Specific
oMatrix.Clear
'setting the condition object
'this is equal to the following SQL statement
'WHERE UserFieldName1 = "MyCriteria1" and UserFieldName2 = "MyCriteria2"
Set oCondition = oConditions.Add()
oCondition.BracketOpenNum = 2
oCondition.Alias = "UserFieldName1"
oCondition.Operation = co_EQUAL
oCondition.CondVal = "MyCriteria1"
oCondition.BracketCloseNum = 1
oCondition.Relationship = cr_AND
Set oCondition = oConditions.Add()
oCondition.BracketOpenNum = 1
oCondition.Alias = "UserFieldName2"
oCondition.Operation = co_EQUAL
oCondition.CondVal ="MyCriteria2"
oCondition.BracketCloseNum = 2
oDBDataSource.Query oConditions
'filling the matrix
For lIndice = 0 To oDBDataSource.Size - 1
oDBDataSource.Offset = lIndice
oMatrix.AddRow
Next lIndice
End Sub -
Matrix with Info Columns from different Table
Hi, how can i manage to have a column in a matrix that doesn't represent a value of the table the other columns are using?
For example, i have a matrix and this matrix has values of the UDT (@Table) and one column contains the projectcode. now i want one column in my matrix to show the project name of the OPRJ. how can i manage that, so that the value of this column in the matrix changes when i change the value of the other column with the project code?
best regards
PhilippHi
1) You can fill the matrix from Recordset.
For example: UDT is [@O01_USERTABLE].
PrjCode foreign key to the Projects table (OPRJ - not exposed through the DI API).
So, if you type correctly PrjCode, you can fetch description using method below.
Dim sSql As String = ""
sSql = " SELECT U.PrjCode AS PrjCode, S.PrjName As PrjName" & _
" FROM [@O01_USERTABLE] AS U, OPRJ AS S" & _
" WHERE U.PrjCode = S.PrjCode"
oRS = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRS.DoQuery(sSql)
If oRS.RecordCount > 0 Then
Dim i As Integer = 0
oRS.MoveFirst()
While oRS.EoF = False
i = i + 1
oForm.DataSources.UserDataSources.Item("uNr").Value = i ' 1" matrix column for row number
oForm.DataSources.UserDataSources.Item("uPrjCode").Value = oRS.Fields.Item("PrjCode").Value
oForm.DataSources.UserDataSources.Item("uPrjName").Value = oRS.Fields.Item("PrjName").Value
oMatrix.AddRow()
oRS.MoveNext()
End While
End If
2) On ManageDataEvent, call Matrix_FetchDescriptions(...)
Public Sub ManageDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean)
Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.Item(BusinessObjectInfo.FormUID)
If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD Then
If Not BusinessObjectInfo.BeforeAction Then
Try
oForm.Freeze(True)
Dim oMatrix As SAPbouiCOM.Matrix
oMatrix = oForm.Items.Item("mtx00").Specific
If oMatrix.RowCount > 0 Then
Call Matrix_FetchDescriptions(oForm, -1)
End If
Catch ex As Exception
Finally
oForm.Freeze(False)
oForm.Update()
End Try
End If
End If
oForm = Nothing
End Sub
' Update column Name
Private Sub Matrix_FetchDescriptions(ByRef oForm As SAPbouiCOM.Form, ByVal iRow As Integer)
Dim oMatrix As SAPbouiCOM.Matrix
Dim oColumn As SAPbouiCOM.Column
Dim oCell As SAPbouiCOM.Cell
Dim oEdit As SAPbouiCOM.EditText
Try
If SBO_Company.Connect Then
oMatrix = oForm.Items.Item("mtx00").Specific
If oMatrix Is Nothing Then Throw New Exception("ERROR: matrix object is nothing")
Dim iNrRows As Integer = oMatrix.RowCount ' iRow
If iNrRows > 0 Then
Dim i As Integer = 1
For i = 1 To iNrRows
Dim sCode As String = ""
Dim sName As String = ""
Try
' Matrix column PrjCode
oColumn = oMatrix.Columns.Item("ePrjCode")
oCell = oColumn.Cells.Item(i)
oEdit = oCell.Specific
sCode = oEdit.Value
sName = GetNameByCode(sCode)
If Not sName.Equals("") Then
' Matrix column PrjName
oColumn = oMatrix.Columns.Item("ePrjName")
oCell = oColumn.Cells.Item(i)
oEdit = oCell.Specific
oEdit.Value = sName
End If
If iRow = i Then Exit Sub
Catch ex As Exception
Finally
End Try
Next
oForm.Refresh()
End If
End If
Catch ex As Exception
' log exception
Finally
oMatrix = Nothing
oColumn = Nothing
oCell = Nothing
oEdit = Nothing
System.GC.Collect() 'Release the handle to the table
End Try
End Sub
To get Name using Code...
Private Function GetNameByCode(ByVal sCode As String) As String
If sCode.Trim.Equals("") Then Return ""
Dim sName As String = ""
Dim oRS As SAPbobsCOM.Recordset
Try
oRS = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Dim sSql As String = "SELECT PrjName FROM OPRJ WHERE PrjCode = '" & sCode.Trim & "'"
oRS.DoQuery(sSql)
oRS.MoveFirst()
While oRS.EoF = False
sName = oRS.Fields.Item("PrjName").Value()
Exit While
End While
Catch ex As Exception
Finally
If Not oRS Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS)
oRS = Nothing
End If
End Try
Return sName
End Function
Note: Matrix_FetchDescriptions() have second argument (iRow As Integer) what may be used to indicate in what row you need to update PrjName column.
May be ItemManagment event when item pressed can be used... Try
HTH
BR
Sierdna S.
Maybe you are looking for
-
Can i use an item which type is image as bind variable in the insert statement? When i pass image item of oracle form as a bind variable in the insert statement then "Bad bind variable error" occurs. Please help me. - ashraf
-
What is Reconciliation ? and how to perform step by step?
What is Reconciliation ? and how to perform step by step?
-
When I tune on icloud My iphone4 pictrue all gone,how can I retrieve my pictrue from my icloud?
-
Adding + sign before contact number
This may seem like a stupid question . I have a new iphone 4 . I have all my contacts set up no problem . I will be travelling and need to add the +1 sign before my friends cell numbers so i can text them . Is there a way on the contact page to add i
-
Hello. I'd like to get learning and become certified. What should I do and how to find the link for staring education?