Update from multiple tables
Hi friends, need help with the following
I need to convert the following SQL Server query to Oracle Pl/sql
UPDATE
perf
SET perf.value5 = tmp.storeCount
FROM dplapro1..ix_spc_performance perf
INNER JOIN dplapro1..ix_spc_planogram plano ON plano.dbkey = perf.dbparentplanogramkey
INNER JOIN #TMP_StoreCount tmp ON plano.dbkey6 = tmp.cmkey
WHERE
perf.dbparentproductkey = tmp.productkey
I did the following:
UPDATE dplapro1.ix_spc_performance perf
SET perf.value5 =
SELECT tmp.storeCount
FROM dplapro1.ix_spc_performance perf
INNER JOIN dplapro1.ix_spc_planogram plano
ON plano.dbkey = perf.dbparentplanogramkey
INNER JOIN tt_433_storecount tmp
ON plano.dbkey6 = tmp.cmkey
WHERE perf.dbparentproductkey = tmp.productkey
which gives me error 'single row subquery returns more than one row',
Then I tried :
UPDATE dplapro1.ix_spc_performance perf
SET perf.value5 =
SELECT tmp.storeCount
FROM dplapro1.ix_spc_performance perf
INNER JOIN dplapro1.ix_spc_planogram plano
ON plano.dbkey = perf.dbparentplanogramkey
INNER JOIN tt_433_storecount tmp
ON plano.dbkey6 = tmp.cmkey
WHERE perf.dbparentproductkey = tmp.productkey
where perf.ROWID IN
SELECT perf.ROWID
FROM dplapro1.ix_spc_performance perf
INNER JOIN dplapro1.ix_spc_planogram plano
ON plano.dbkey = perf.dbparentplanogramkey
INNER JOIN tt_433_storecount tmp
ON plano.dbkey6 = tmp.cmkey
WHERE perf.dbparentproductkey = tmp.productkey
no luck with this either
Please help me with this
Thanks
I think something like this will do it for you
MERGE
INTO dplapro1.ix_spc_performance D
USING ( SELECT productkey,
storecount
FROM dplapro1.ix_spc_planogram plano
INNER JOIN tt_433_storecount tmp
ON plano.dbkey6 = tmp.cmkey
WHERE perf.dbparentproductkey = tmp.productkey ) S
ON ( D.dbparentproductkey = S.productkey )
WHEN MATCHED THEN UPDATE
SET D.value5 = s.storecount;You need to make sure that the source of the updates - USING clause - returns at most one row for each key in the destination, based on the ON clause. That is, in this case, only one productkey for each dbparentproductkey .
Similar Messages
-
Update On data from multiple Tables
How can i update data from multiple tables(Using a Join)
using a single update statement.Hii
Suppose i have following tables
create table emp_mas(empno number primary key,name varchar2(30));
create table emp_grad(empno number primary key,grade varchar2(1));
SQL> select * from emp_grad;
EMPNO G
100 A
101 A
102 B
SQL> select * from emp_mas;
EMPNO NAME
100 GREG
101 THOMAS
102 SAM
I would like to update information of employee 'GREG' Using a single update statement as
UPDATE (SELECT E.EMPNO,E.NAME,G.GRADE FROM EMP_MAS E,EMP_GRAD G WHERE E.EMPNO=G.EMPNO) J
SET J.NAME='GREG THOMAS',J.GRADE='B' WHERE EMPNO=100
Then i am getting Error message like this.
ERROR at line 2:
ORA-01776: cannot modify more than one base table through a join view
How can i achieve the result -
Update data provider queryspecification wiith columns from multiple tables
Hi
I have scenario like I need updated a queryspecificaiton with columns from multiple tables
1. Ex:
<bOQuery name="Query">
<resultObjects identifier="DS0.DO1" name="A$Application_ID"/>
<resultObjects identifier="DS0.DO2" name="A$Column_Name"/>
A$Application_ID is from Table A and A$Column_Name from table B
The query is not adding to dataprovier when I am trying to updated from REST API.
Please help me.
Thanks
KalyanHave a look at the Business Intelligence platform RESTful Web Service Developer Guide, section 3.4.7 (p. 197) - Report structure: getting and updating the structure (specifications) of a report, may be a good place to start(?). Also see KBA 1952419 - How to update the properties of a web intelligence report using RESTful web service SDK .
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter -
JDBC-XI-FILE scenario. How to extract data from multiple tables
Hi,
At this moment I didn't have the access for XI system. So here I have some silly question. Could you please clarify the same ??
If I got to extract data from single table using JDBC adapter I can put the below query in communication channel
SELECT *FROM orders WHERE new='true'.
But if I got to extract data from multiple tables, logic to be used should be like as shown below. ( from previous thread------prabhu).
SELECT <Table_2>.EID, <Table_2>.FName, <Table_2>.LName, <Table_1>.REC_DAT, <Table_1>.DESCRP
FROM <Table_1> INNER JOIN <Table_2> on
<Table_1>.CARDNO = <Table_2>.CARD
where REC_DAT = <condition>
union
SELECT <Table_2>.EID, <Table_2>.FName, <Table_2>.LName, <Table_1>.REC_DAT, <Table_1>.DESCRP
FROM <Table_1> INNER JOIN <Table_2> on
<Table_1>.CARDNO = <Table_2>.CARD
where REC_DAT = <condition>
But my query is ........how to put the above entire code in one line. (i.e in Qery place of communication channel ) ??
Thanks
KumarHi Palnati,
You either use a select query with join or a stored procedure which will contain the logic to extract the data from multiple tables. But, the limitation in case of stored procedure is u can hv only one selct query in it.
You write ur actual query provided in the parameter 'Query SQL Statement". u can also wrt a stored procedure in it. Also, u can provide a update statement in it which will update a certain flag so tht u don selct the data again.
Check the following link
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm</a>
Regards,
Akshay
Message was edited by:
Akshay Salunke -
ALV for fields from multiple tables and make them editable
Hi,
I am working on a forecasting report. We have created few custom table e.g. store forcaset detail for whole year month wise. tables are say sales data, budget data, forcast data etc.
Now i need to make a report based on monthwise based on above mention table.
eg.o/p looks like:
column name type desc monthapr monthmay .......
table forcast Qty sales 100 150
table budget/sales amt amou 20.50 130.50
table sales vs forcast amt amount 3000 50000
-Now i don't know how to display data from multiple table in single ALV list that to with different field type.
-2nd issue is i need to make only perticuler row editable so that user can chage data.
-3rd when user change data and press calulate button - it should calculate data for future month - i got formula for that and disply the calulated data.
- 4th if user like the forcast data then when press save - change data should update dbtable.
Is this all possible with simple abap FM Or need to use ABAPOO.
I will appericiate all expert help.
Many thanks in advance.
KDE.
Edited by: kde_test on Jun 4, 2010 5:44 PMHi,
Solutions :
1. You can use FM REUSE_ALV_HIERSEQ_LIST_DISPLAY as guided by Ashutosh.
You can also check out this
[http://www.sap technical.com/Tutorials/ABAP/3DGraph/demo.htm] change link to saptechnical without space
2. [How to make certain rows in ALV grid editable...;
3 & 4. Use two importing paramaters 'PF_STATUS_SET' 'USER_COMMAND' of REUSE_ALV_GRID_DISPLAY.
create two function codes 'CALC and 'SAVE' in pf-status and provide your required functionality to these function codes using User-Command.
Sorry am unable to provide you with supporting code, but you can search for it and It can solve your problem
Regards,
Rohit -
Sample PHP Service selecting from multiple tables
Hi all!
I have the following challange:
How do I properly set up my PHP-service to insert, select, update and delete values from multiple tables?
So far, the standard templates generated by Flash Builder is based on a single table.
Example: I have 2 tables: [person] and [school]
[person] has [person_id, first_name, last_name, birthdate]
[school] has [school_id, person_id, school_name, city]
One [person] can have multiple [schools]
How should I define the selectByID function in PHP to be able to have
First name: [TextInput /]
Last name: [TextInput /]
Birthdate: [DateField /]
Schools:
[TabBar: School1, School2, School3 /]
[ViewStack1]
School name: [TextInput /]
Location name: [TextInput /]
[/ViewStack1]]
[ViewStack2]
School name: [TextInput /]
Location name: [TextInput /]
[/ViewStack2]]
[ViewStack3]
School name: [TextInput /]
Location name: [TextInput /]
[/ViewStack3]]
And even more interesting: How do I update all these fields back to the database?First, the relationship between school and person is many-to-many NOT one-to-many -- you will need to add a junction table.
From the form you have given I would handle insertions like this:
loop through all the schools and see if the school already exist in the DB. If so, then store the school_id. If not, then create a new record and store the id. You should have an array collection of store_ids by the end of the loop
Check whether the student exists w/in the DB. If so, then you might consider aborting the operation or you could opt to do an update. If the student doesn't exist, then create a new student record and store the new student_id (mysql::insert_id)
Loop through the school_id array and add new student_id/school_id records into the junction table.
Retrieving records is much simpler -- it's just a join on the tables i.e. "SELECT * FROM student INNER JOIN school_student ON student.student_id = school_student.student_id INNER JOIN schools ON school_student.school_id = school.school_id WHERE student.first_name = 'John' AND student.last_name = 'Doe' (assuming there aren't more than one John Does of course!).
- e -
Does ODI has ability to extract data from multiple tables
We have requirement using ODI to extract data from multiple tables depending on certain logic and spool 100+ files.
How efficient ODI is in data extraction from several multiple tables especially when the extraction is dependent on certain business logic conditions ? Also, if anyone used Peoplesoft Application Engine process to extract volumes of data, how efficient Peoplesoft Applicaiton Engine process is as compared to ODI ? I will really appreciate if someone throws some light on this ? Thanks in advance.
RamOne more option
Create two Integration Interfaces and launch them sequentially:
1st Interface : select a IKM ... Append and activate the Distinct rows check box.
2nd Interface : select an IKM ... Incremental Update and set the UPDATE option to No.
Be aware that the update key in this Integration Interface should be composed of all the target columns mapped. Also activate the Distinct rows check box.
Thanks,
Sutirtha
Edited by: Sutirtha Roy on Jul 21, 2009 10:08 AM -
Displaying data from multiple table/column
hello ..
anybody can help me how to diplaying data from multiple table/ column in PHP. TQFollow the "How do I SELECT, INSERT, UPDATE and DELETE data from PHP?" example from http://wiki.oracle.com/page/PHP+Oracle+FAQ and change the "select ..." query to your favourite join, e.g.
select country_name, region_name from countries, regions where countries.region_id = regions.region_id; -
Updating/Inserting multiple tables
Hi,
I've been trying to figure out how to update/insert multiple fields in 2 different tables with one RowSet. im new to java and have been using Creator for about 2 weeks
basically there are 3 tables: one containing user info(USER), one containing department info (DEPT), and one table relating the two (USER_DEPT). my form lets uers update, among others, their NAME in table USER, and DEPT_NAME in table DEPT.
These are all VARCHAR types.
I used the Clips provided by Creator to initialize and do the updating. i am using updateRow() to do the updating. the fields are bound to specific database fields. the RowSet is updatable.
in my app i chose some specific fields, but for the sake of avoiding pasting very long SQL queries lets just say i chose everything. some of the queries i tried:
SELECT *
FROM USER WHERE USER.USERNAME = ?This one works.
SELECT *
FROM USER, DEPT, USER_DEPT
where USER.ID = USER_DEPT.USER_ID
and DEPT.ID = USER_DEPT.DEPT_ID AND USER.USERNAME = ?this one gives me a Conversion Error message. i have no conversion going on whatsoever. i havent even learned how to use conversion yet.
another query i tried:
SELECT * FROM USER
INNER JOIN USER_DEPT ON USER.ID = USER_DEPT.USER_ID
INNER JOIN DEPT ON DEPT.ID = USER_DEPT.DEPT_ID
WHERE USER.USERNAME=?this one gives me no error. the app works except the database doesnt get updated. i have determined that when using this query updateRow() is skipped. i dont know why. the app keeps running in that it goes to the next page as defined by the XML, but updateRow() is never called.
so can anyone please tell me how to update/insert multiple fields in multiple tables using one RowSet PLEASE?
THANKS!The only way this can be done with a single rowset is if you do your query against a view (instead of a join), and if your JDBC driver supports updates to multiple tables through a view. Otherwise, you're going to need to update the underlying tables individually.
Craig -
Deleting Multiple Rows From Multiple Tables As an APEX Process
Hi There,
I'm interesting in hearing best practice approaches for deleting multiple rows from multiple tables from a single button click in an APEX application. I'm using 3.0.1.008
On my APEX page I have a Select list displaying all the Payments made and a user can view individual payments by selecting a Payment from the Select List (individual items are displayed below using Text Field (Disabled, saves state) items with a source of Database Column).
A Payment is to be deleted by selecting a custom image (Delete Payments Button) displayed in a Vertical Images List on the same page. The Target is set as the same page and I gave the Request a name of DELETEPAY.
What I tried to implement was creating a Conditional Process On Submit - After Computations and Validations that has a source of a PL/SQL anonymous block as follows:
BEGIN
UPDATE tblDebitNotes d
SET d.Paid = 0
WHERE 1=1
AND d.DebitNoteID = :P7_DEBITNOTEID;
INSERT INTO tblDeletedPayments
( PaymentID,
DebitNoteID,
Amount,
Date_A,
SupplierRef,
Description
VALUES
( :P7_PAYMENTID,
:P7_DEBITNOTEID,
:P7_PAID,
SYSDATE,
:P7_SUPPLIERREF,
:P7_DESCRIPTION
DELETE FROM tblPayments
WHERE 1=1
AND PaymentID = :P7_PAYMENTID;
END;
The Condition Type used was Request = Expression 1 where Expression 1 had a value of DELETEPAY
However this process is not doing anything!! Any insights greatly appreciated.
Many thanks,
Gary....the "button" is using a page level Target,...
I'm not sure what that means. If the target is specified in the definition of a list item, then clicking on the image will simply redirect to that URL. You must cause the page to be submitted instead, perhaps by making the URL a reference to the javaScript doSubmit function that is part of the standard library shipped with Application Express. Take a look at a Standard Tab on a sample application and see how it submits the page using doSubmit() and emulate that.
Scott -
Generic datasource by function module to fetch data from multiple tables?
I'm writing a function module to fetch price, for generic datasource.
At first, extract test is OK. But InfoPackage never stop when loading data to PSA in BW.
And I find the example codes:
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
WHERE CARRID IN L_R_CARRID AND
CONNID IN L_R_CONNID.
ENDIF. "First data package ?
* Fetch records into interface table.
* named E_T_'Name of extract structure'.
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE S_S_IF-MAXSIZE.
IF SY-SUBRC <> 0.
CLOSE CURSOR S_CURSOR.
RAISE NO_MORE_DATA.
ENDIF.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDIF.
There using Cursor to fetch data package by package, and raise exception NO_MORE_DATA to stop the loading process.
Now I fetch data from multiple tables, I don't think I can use Cursor.
Then How can I handle this?
Thanks a lot.Thanks
IF IT_999[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A999 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_999
WHERE
* A~KNUMH = IT_999-KNUMH AND
( ( A~KSCHL = 'ZPRC' AND VKORG = 'Z000' AND VTWEG = 'Z1' ) OR
( A~KSCHL = 'ZPRD' AND VKORG = 'A000' AND VTWEG = 'Y3' ) ) AND
* A~DATBI >= SY-DATUM AND
LOEVM_KO = ''.
SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A999 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_999
WHERE
* A~KNUMH = IT_999-KNUMH AND
A~KSCHL = 'ZPR3' AND A~VKORG = 'I000' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
IF IT_997[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A997 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_997
WHERE
* A~KNUMH = IT_997-KNUMH AND
A~KSCHL = 'ZPRA' AND VTWEG = 'Y1' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
IF IT_996[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A996 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_996
WHERE
* A~KNUMH = IT_996-KNUMH AND
A~KSCHL = 'ZPRB' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
SELECT MATNR "u7269u6599u53F7u7801
MEINH "u4ED3u50A8u5355u4F4Du7684u5907u7528u8BA1u91CFu5355u4F4D
UMREZ "u57FAu672Cu8BA1u91CFu5355u4F4Du8F6Cu6362u5206u5B50
UMREN "u8F6Cu6362u4E3Au57FAu672Cu8BA1u91CFu5355u4F4Du7684u5206u6BCD
FROM MARM
INTO CORRESPONDING FIELDS OF TABLE IT_MARM
FOR ALL ENTRIES IN TP_DATA
WHERE MATNR = TP_DATA-MATNR AND MEINH = TP_DATA-KMEIN.
LOOP AT TP_DATA.
IF TP_DATA-KPEIN NE 0.
TP_DATA-KBETR = TP_DATA-KBETR / TP_DATA-KPEIN.
TP_DATA-KHETR = TP_DATA-KHETR / TP_DATA-KPEIN.
ENDIF.
IF TP_DATA-KSCHL = 'ZPRA'.
* TP_DATA-MEINH = 'ZI'.
* TP_DATA-KSCHL = 'B4'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'CT'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPRB'.
* TP_DATA-KSCHL = 'L0'.
* TP_DATA-MEINH = 'ZI'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPRC' OR TP_DATA-KSCHL = 'ZPRD'.
* TP_DATA-MEINH = 'ZI'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'WZI'.
TP_DATA-KBETR = TP_DATA-KBETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPR3'.
* TP_DATA-KSCHL = 'B2'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ENDIF.
TP_DATA-MEINH = '01'.
MODIFY TP_DATA.
E_T_DATA-MATNR = TP_DATA-MATNR.
E_T_DATA-KSCHL = TP_DATA-KSCHL.
E_T_DATA-KHETR = TP_DATA-KHETR.
E_T_DATA-KBETR = TP_DATA-KBETR.
E_T_DATA-KMEIN = TP_DATA-KMEIN.
E_T_DATA-DATAB = TP_DATA-DATAB.
E_T_DATA-DATBI = TP_DATA-DATBI.
APPEND E_T_DATA.
CLEAR WA_MARM1.
CLEAR WA_MARM2.
ENDLOOP.
Edited by: Shen Peng on Oct 20, 2010 10:09 AM -
Adding Sum Totals from Multiple Tables in A single Document
Hello All,
I'm having trouble adding sum totals from multiple tables I've created in a Pages 09 doc. I putting together a spreadsheet for cost projections for a house remodel. I created tables for each room of the house. At the bottom of the document I'd like to have another table that takes the totals from each individual room and adds them up. Problem appears to be that each table has the same x/y axis labels so row and column numbers/letters are repeated so the final table can't quantify thing correctly.
Any easy solutions? I can't find anything that's helped in my search efforts.
Thanks,
JosefisJerry,
Thanks for the feedback. I thought that might be the case. And you were correct to assume I was more comfortable in Pages. I'm halfway through converting everything to numbers. In the end it will work great too. Just some different formatting/design choices to be made as numbers doesn't appear to be as versatile in the same way pages is with design. So far it looks pretty good though.
Thanks again,
Josefis -
Move data from multiple Tables to a Single Table & Convert the list to ALV.
Hi,
My aim is to get the list of Materials with their descriptions, with MRP Controller, with Unrestriced Qty. & the Reorder Qty. So, I have to fetch the data from different tables. But finally I am not able to copy or move the fetched data from multiple tables into the single final table.
Also tell me how to convert this list into ALV.
Below is the program code.
*& Report Y_REORDER_REPORT
REPORT Y_REORDER_REPORT.
tables : marc,makt, mard.
DATA: Begin of i_final occurs 0,
matnr type marc-matnr,
maktx type makt-maktx,
DISPO type marc-DISPO,
MINBE type marc-MINBE,
LABST type mard-LABST,
end of i_final.
DATA: Begin of i_marc occurs 0,
matnr type marc-matnr,
DISPO type marc-DISPO,
MINBE type marc-MINBE,
end of i_marc.
DATA: Begin of i_makt occurs 0,
matnr type makt-matnr,
maktx type makt-maktx,
end of i_makt.
DATA: Begin of i_mard occurs 0,
matnr type mard-matnr,
LABST type mard-LABST,
LGORT TYPE MARD-LGORT,
end of i_mard.
SELECT matnr
dispo
minbe from marc
into corresponding fields of table i_marc
where dispo EQ 'STR'.
SORT I_MARC by MATNR.
WRITE: /10 'Material',
75 'MRP',
80 'Reorder Qty.'.
LOOP at i_marc.
Write: /10 i_marc-matnr,
75 i_marc-dispo,
80 i_marc-minbe.
ENDLOOP.
write: /.
SELECT matnr
MAKTX from makt
into corresponding fields of table i_makt
for all entries in i_marc
where matnr = i_marc-matnr.
LOOP at i_makt.
Write: /10 i_makt-matnr,
30 i_makt-maktx.
ENDLOOP.
SELECT matnr
LGORT
LABST from mard
into corresponding fields of table i_mard
for all entries in i_marc
where matnr = i_marc-matnr.
LOOP at i_mard.
Write: /10 i_mard-matnr,
30 I_MARD-LGORT,
40 i_mard-labst.
ENDLOOP.
move i_mard-matnr to i_final-matnr.
move i_marc-dispo to i_final-dispo.
move i_marc-minbe to i_final-minbe.
move i_makt-maktx to i_final-maktx.
move i_mard-labst to i_final-labst.
WRITE: /10 'Material',
30 'Material Desc.',
75 'MRP',
80 'Reorder Qty.',
105 'Current Stock'.
LOOP at i_final.
Write: /10 i_final-matnr,
30 i_final-maktx,
75 i_final-dispo,
80 i_final-minbe,
105 i_final-labst.
ENDLOOP.
*LOOP at i_mard.
*Write: /10 i_mard-matnr,
30 i_makt-maktx,
75 i_marc-dispo,
80 i_marc-minbe,
105 i_mard-labst.
*ENDLOOP.
Regards,
VishalChange like this,
SELECT matnr
lgort
labst FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_mard
FOR ALL ENTRIES IN i_marc
WHERE matnr = i_marc-matnr.
LOOP AT i_mard.
WRITE: /10 i_mard-matnr,
30 i_mard-lgort,
40 i_mard-labst.
ENDLOOP.
LOOP AT i_marc.
READ TABLE i_mard WITH KEY matnr = i_marc-matnr.
READ TABLE i_makt WITH KEY matnr = i_marc-matnr.
MOVE i_mard-matnr TO i_final-matnr.
MOVE i_marc-dispo TO i_final-dispo.
MOVE i_marc-minbe TO i_final-minbe.
MOVE i_makt-maktx TO i_final-maktx.
MOVE i_mard-labst TO i_final-labst.
APPEND i_final.
ENDLOOP.
WRITE: /10 'Material',
30 'Material Desc.',
75 'MRP',
80 'Reorder Qty.',
105 'Current Stock'. -
How to extract data from multiple tables (always got errors)
Dear Experts,
I have a simple mapping to extract data from multiple tables as a source (A, B, C) to a target table (X). Below is the picture:
(Sources)....(Target)
A----------------***
B----------------X
C----------------***
Sample Source Data:
Table A:
ColA1
100
200
etc
Table B:
ColB1 ColB2 ColB3
10 Y Ten
20 Y Twenty
30 Y Thirty
etc
Table C:
ColC1 ColC2
11
12
13
etc
Target table (X) should be (just has 1 group INGRP1):
ColA1 ColB1 ColB3 ColC1
100 10 Ten 11
100 10 Ten 12
100 20 Twenty 21
etc
Scenarios:
1. Directly map from A, B, C to X. Unable to map with error message: "API8003: Connection target attribute group is already connected to an incompatible data source. Use a Joiner or Set operator to join the upstream data first before connecting it into this operator."
2. Map each source to Expression Operator and then map from each Expression to target table. I am able to map all attributes successfully but got error when validating it with message: "VLD-1104: Attributes flowing into TEST.EXPR_SRC.INGRP1 have different data sources."
How can I achieve the correct mapping for this purpose?
Use Joiner? I have no key to join the sources
Use Set? The sources have different number of columns
Thanks in advance
PratThanks Nico,
I think it will results data like this:
100 10 Ten 11
200 20 Twenty 12
300 30 Thirty 13
etc
and not the expected:
100 10 Ten 11
100 10 Ten 12
100 20 Twenty 21
etc
But it inspired me to solve this by adding key expression in each source table (B & C) to be joined to table A with this formula:
100+TRUNC(INGRP1.COLB1,-2)
Regards
Prat -
It's possible to make Hierarchical Tree from multiple tables ?
the famous example for Hierarchical Tree is about employee_id and manager_id field in employees table ............ so I was wondering it's possible to make[b] Hierarchical Tree from multiple tables ? and How ??
if the answer associate with example that will be so kind of you :D
and thanks in advance.HI
use curose in when new form instance or procedure then u can got data more then one table like that
DECLARE
htree ITEM;
top_node FTREE.NODE;
new_node FTREE.NODE ;
child_node ftree.node ;
item_value VARCHAR2(30);
cursor prime_cur is select main_desc mgr_name, main_code dept
from pur_item_group_mst;
cursor child_cur(v_dept number) is select sub_desc,sub_code
from pur_item_group_dtl where main_code = v_dept ;
BEGIN
htree := Find_Item('tmp.tree4');
for dummy in prime_cur loop
new_node := Ftree.Add_Tree_Node(htree,
ftree.root_node,
Ftree.PARENT_OFFSET,
Ftree.LAST_CHILD,
Ftree.EXPANDED_NODE,
dummy.mgr_name,
'D:\ORYX_POLYBAGS\accept',
dummy.dept);
for child in child_cur(dummy.dept) loop
child_node := Ftree.Add_Tree_Node(htree,
new_node,
Ftree.PARENT_OFFSET,
Ftree.LAST_CHILD,
Ftree.EXPANDED_NODE,
child.sub_desc||' '||'('||child.sub_code||' '||')',
'D:\ORYX_POLYBAGS\next',
child.sub_code);
end loop;
end loop;
END;
Rizwan Shafiq
www.rizwanshafiq.blogspot.com
Maybe you are looking for
-
How can I fill a pdf form with Excel?
I have a pdf form and a set of Excel dates. How can I fill the form with this dates? Is there any way to transform excel dates into a fdf-File? Thank You for helping Hans
-
Rookie question I know but if I want to work at online resolution with standard def pal coming from digi what res do I need to capture at - is it the 625 25 frames 8 bit, dv-pal or another???? Many thanks
-
Problem with Logical Database - Get stmt
Hi, There is a standard LDB which is used in custom developed report. GET A GET B When there is no record fetched from B table, it moves to end-of-selection and finishes the report execution. But in some cases I dont want this to happen. Only GET
-
Is it possible to have 5.1 S/PDIF input from the pins of Audigy 2 ZS SB0350?
LIs it possible to have 5. S/PDIF input from the pins of Audigy 2 ZS SB0350? Hello, I took this sound card (Audigy 2 ZS SB0350) yesterday from a friend, just to test whether it can do what I intend to use it for. It is only the card itself without th
-
Hi friends... I got one view iny application where i have few drop down list and input fields... i hve two buttons submuit and reset... when i submit i will get the table based on the i/ps from dropdownlist..... my requirement is I have Reset button