Trouble writing Query for Pivoting data from a table
I am having a little trouble writing a query for converting the below table data into a pivot data. I am trying to write a query for which if I give a single valid report_week date as input it should give me the data for that week and also provide two extra columns, one which gives the data of last week for the same countries and the second column which gives the difference of numbers in both the columns(i.e. COUNT - COUNT_LAST_WEEK).
REPORT_WEEK DIVISION COUNT
9/26/2009 country1 81
9/26/2009 country2 97
9/26/2009 country3 12
9/26/2009 country4 26
9/26/2009 country5 101
10/3/2009 country1 85
10/3/2009 country2 98
10/3/2009 country3 10
10/3/2009 country4 24
10/3/2009 country5 101
10/10/2009 country1 84
10/10/2009 country2 98
10/10/2009 country3 10
10/10/2009 country4 25
10/10/2009 country5 102
For example, if I give input as 10/10/2009, the output should be as give below.
REPORT_WEEK DIVISION COUNT COUNT_LAST_WEEK DIFFERENCE
10/10/2009 country1 84 85 -1
10/10/2009 country2 98 98 0
10/10/2009 country3 10 10 0
10/10/2009 country4 25 24 1
10/10/2009 country5 102 101 1
For example, if I give input as 10/3/2009, the output should be as give below.
REPORT_WEEK DIVISION COUNT COUNT_LAST_WEEK DIFFERENCE
10/3/2009 country1 85 81 4
10/3/2009 country2 98 97 1
10/3/2009 country3 10 12 -2
10/3/2009 country4 24 26 -2
10/3/2009 country5 101 101 0
Can anyone please shed some light on Query building for the above scenarios.
Thank you
SKP
Edited by: user11343284 on Oct 10, 2009 7:53 AM
Edited by: user11343284 on Oct 10, 2009 8:28 AM
I assume there is no gap in report weeks. If so:
SQL> variable report_week varchar2(10)
SQL> exec :report_week := '10/10/2009'
PL/SQL procedure successfully completed.
with t as (
select to_date('9/26/2009','mm/dd/yyyy') report_week,'country1' division,81 cnt from dual union all
select to_date('9/26/2009','mm/dd/yyyy'),'country2',97 from dual union all
select to_date('9/26/2009','mm/dd/yyyy'),'country3',12 from dual union all
select to_date('9/26/2009','mm/dd/yyyy'),'country4',26 from dual union all
select to_date('9/26/2009','mm/dd/yyyy'),'country5',101 from dual union all
select to_date('10/3/2009','mm/dd/yyyy'),'country1',85 from dual union all
select to_date('10/3/2009','mm/dd/yyyy'),'country2',98 from dual union all
select to_date('10/3/2009','mm/dd/yyyy'),'country3',10 from dual union all
select to_date('10/3/2009','mm/dd/yyyy'),'country4',24 from dual union all
select to_date('10/3/2009','mm/dd/yyyy'),'country5',101 from dual union all
select to_date('10/10/2009','mm/dd/yyyy'),'country1',84 from dual union all
select to_date('10/10/2009','mm/dd/yyyy'),'country2',98 from dual union all
select to_date('10/10/2009','mm/dd/yyyy'),'country3',10 from dual union all
select to_date('10/10/2009','mm/dd/yyyy'),'country4',25 from dual union all
select to_date('10/10/2009','mm/dd/yyyy'),'country5',102 from dual
select max(report_week) report_week,
division,
max(cnt) keep(dense_rank last order by report_week) cnt_this_week,
max(cnt) keep(dense_rank first order by report_week) cnt_last_week,
max(cnt) keep(dense_rank last order by report_week) - max(cnt) keep(dense_rank first order by report_week) difference
from t
where report_week in (to_date(:report_week,'mm/dd/yyyy'),to_date(:report_week,'mm/dd/yyyy') - 7)
group by division
order by division
REPORT_WE DIVISION CNT_THIS_WEEK CNT_LAST_WEEK DIFFERENCE
10-OCT-09 country1 84 85 -1
10-OCT-09 country2 98 98 0
10-OCT-09 country3 10 10 0
10-OCT-09 country4 25 24 1
10-OCT-09 country5 102 101 1
SQL> exec :report_week := '10/3/2009'
PL/SQL procedure successfully completed.
SQL> /
REPORT_WE DIVISION CNT_THIS_WEEK CNT_LAST_WEEK DIFFERENCE
03-OCT-09 country1 85 81 4
03-OCT-09 country2 98 97 1
03-OCT-09 country3 10 12 -2
03-OCT-09 country4 24 26 -2
03-OCT-09 country5 101 101 0
SQL> SY.
Similar Messages
-
Query for inserting data from OAF page to database table
I need to insert a row into a table by getting parameters from pageContext. The fields in this page are from multiple view objects and the data in these fields should be inserted into a table. If anyone can provide solution in this regard will be very much helpful.
Hi Rma,
My Understanding is...
Say you want to display information of 10 customers. Hence there will be 10 rows to display.
Say number 5 customer has maximum accounts 15 (In case there is variable number of accounts for each customer). Hence there will be max 15 columns.If the above under standing is correct, then a question...is there an upper limit on number of accounts for a customer?
If yes then I may say...
Create a custom table with that many columns as of max number of alloweed accounts.
Write a plsql api to insert column of existing table as row in the custom table.
Now base your EOs and VOs on that custom table. That may show columns in term of rows on your screen.
The logic is, instead of converting column data to row in oaf, do it in plsql.
Now again if it has to be updated by user, create a reverse api to put data from custom table to existing table.
However, this approach can lack automatic features on existing seeded table(like validations), provided by EO. Hence you must explore PL/SQL Entity objects in Dev guide before going with this approach (both are near same but you may be able to better judge which one will be more suitable for your need.
Another insant approach which strike in mind is just modifying logic in controller to modify bean hierarchy (adding columns at run time) or by create VO dynamically.
However, possibly that can put other complexities of personalization and maintainance of code etc.
Hence the suggestion is...Evaluate all three and judge which one is most suitable for you over all needs (First try with PL/SQL Base EOs Or with the above approach or pure java manipulation)
Seems too complex approaches all. Other users must pour there thoughts.
Abdul Wahid -
FM code for extracting data from 10 tables
Hi All,
I have a requirement, where i need to extract the data from 10 tables using FM which is further used to create a data source in SAP R3.
The fields are almost similar in all the tables but yet i have to fetch the data from all the tables.
My approach:
1. I have created a structure with all the fields in it from all the tables that comes to 35 fields.
2. create a structure of each table and loop it into an internal table and work area.
3. writing a read statement based on a key value from all the work areas and populate the same into my final structure.
Note: there is a key field that need to be considered when updating the data into final stucture.
All help on the code / logic would be appreciated.
Thanks
Moderator message : Spec/requirements dumping not allowed, show the work you have already done. Thread locked.
Edited by: Vinod Kumar on Feb 28, 2012 8:35 PMHi All,
I have a requirement, where i need to extract the data from 10 tables using FM which is further used to create a data source in SAP R3.
The fields are almost similar in all the tables but yet i have to fetch the data from all the tables.
My approach:
1. I have created a structure with all the fields in it from all the tables that comes to 35 fields.
2. create a structure of each table and loop it into an internal table and work area.
3. writing a read statement based on a key value from all the work areas and populate the same into my final structure.
Note: there is a key field that need to be considered when updating the data into final stucture.
All help on the code / logic would be appreciated.
Thanks
Moderator message : Spec/requirements dumping not allowed, show the work you have already done. Thread locked.
Edited by: Vinod Kumar on Feb 28, 2012 8:35 PM -
How to write sql query for counting pairs from below table??
Below is my SQL table structure.
user_id | Name | join_side | left_leg | right_leg | Parent_id
100001 Tinku Left 100002 100003 0
100002 Harish Left 100004 100005 100001
100003 Gorav Right 100006 100007 100001
100004 Prince Left 100008 NULL 100002
100005 Ajay Right NULL NULL 100002
100006 Simran Left NULL NULL 100003
100007 Raman Right NULL NULL 100003
100008 Vijay Left NULL NULL 100004
It is a binary table structure.. Every user has to add two per id under him, one is left_leg and second is right_leg... Parent_id is under which user current user is added.. Hope you will be understand..
I have to write sql query for counting pairs under id "100001". i know there will be important role of parent_id for counting pairs. * what is pair( suppose if any user contains both left_leg and right_leg id, then it is called pair.)
I know there are three pairs under id "100001" :-
1. 100002 and 100003
2. 100004 and 100005
3. 100006 and 100007
100008 will not be counted as pair because it does not have right leg..
But i dont know how to write sql query for this... Any help will be appreciated... This is my college project... And tommorow is the last date of submission.... Hope anyone will help me...
Suppose i have to count pair for id '100002'. Then there is only one pair under id '100002'. i.e 100004 and 100005Sounds like this to me
DECLARE @ID int
SET @ID = 100001--your passed value
SELECT left_leg,right_leg
FROM table
WHERE (user_id = @ID
OR parent_id = @ID)
AND left_leg IS NOT NULL
AND right_leg IS NOT NULL
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Help needed writing trigger for deleting records from multipul tables
i am trying to write a trigger which would help me delete the record from 3 different tables
lets say i have table a , b and c
i an trying to write a trigger which would help me delete the same record from table a and c.
drop trigger az_zzz_trigger;
create trigger az_zzz_trigger
before INSERT or UPDATE or DELETE ON az_employ
FOR EACH ROW
BEGIN
IF DELETING then
delete from za_payroll
delete from az_salary_audit
end if;
end;
while executing this trigger all data of table za_payroll is delete.
what should i do so that only the record which i delete from az_employ gets deleted from az_payroll and az_salary_audit872959 wrote:
i am trying to write a trigger which would help me delete the record from 3 different tables
lets say i have table a , b and c
i an trying to write a trigger which would help me delete the same record from table a and c.
drop trigger az_zzz_trigger;
create trigger az_zzz_trigger
before INSERT or UPDATE or DELETE ON az_employ
FOR EACH ROW
BEGIN
IF DELETING then
delete from za_payroll
delete from az_salary_audit
end if;
end;
while executing this trigger all data of table za_payroll is delete.
what should i do so that only the record which i delete from az_employ gets deleted from az_payroll and az_salary_auditutilize appropriate WHERE clause -
Taking more time for retreving data from nested table
Hi
we have two databases db1 and db2,in database db2 we have number of nested tables were there.
Now the problem is we had link between two databases,whenever u firing the any query in db1 internally it's going to acces nested tables in db2.
For feching records it's going to take much more time even records are less in table . what would be the reason.
plz help me daliy we are facing the problem regarding the samePlease avoid duplicate thread :
quaries taking more time
Nicolas.
+< mod. action : thread locked>+ -
Need some logic for displaying data from Internal Table
Hi Guys,
I have a Internal Table with multiple entries.
My ITAB looks like below.
PN VBELN MATNR MATKX
1 111 P-101 XXX
2 121 P-102 XYZ
2 112 P-103 ABC
3 134 P-104 DEF
3 124 P-105 EFG
Now my requirement is I need to display the out put as follows through ALV or normal display.
<Header> <Date>
<Time>
PN = 1
VBELN MATNR MATKX
111 P-101 XXX
<Footer>
Some gap (May be a line to differentiate)
<Header > <Date>
<Time>
PN = 2
VBELN MATNR MATKX
121 P-102 XYZ
112 P-102 ABC
<Footer>
Some gap (May be a line to differentiate)
<Header > <Date>
<Time>
PN = 3
VBELN MATNR MATKX
134 P-104 DEF
124 P-105 EFG
<Footer>
Thanks in Advance.
Prasad.HI,
Use:
Data: W_PNlike PN.
LOOP AT ITAB.
If Itab-PN ne W_PN.
<Header> <Date>
<Time>
PN = 1.
VBELN MATNR MATKX >>>>>>>>>>>>>>>First Line enter
ELSE.
VBELN MATNR MATKX > line Next entry
ENDIF.
W_PN = ITAB-PN.
AT-END PN.
<Footer>
ENDAT.
ENDLOOP.
Hope this resolve your issue.
Regards,
Gurpreet -
Select query taking too much time to fetch data from pool table a005
Dear all,
I am using 2 pool table a005 and a006 in my program. I am using select query to fetch data from these table. i.e. example is mentioned below.
select * from a005 into table t_a005 for all entries in it_itab
where vkorg in s_vkorg
and matnr in s_matnr
and aplp in s_aplp
and kmunh = it_itab-kmunh.
here i can't create index also as tables are pool table...If there is any solutions , than please help me for same..
Thanks ,it would be helpful to know what other fields are in the internal table you are using for the FOR ALL ENTRIES.
In general, you should code the order of your fields in the select in the same order as they appear in the database. If you do not have the top key field, then the entire database is read. If it's large then it's going to take a lot of time. The more key fields from the beginning of the structure that you can supply at faster the retrieval.
Regards,
Brent -
Display data from diferent tables
My requirement is to display data from diferent tables supose tables likeVBAK and VBAP.it will allow for all entries concept oops abap?.
how to write code for display data from diferent tables .
method WDDOINIT.
data:
node_sflight type ref to if_wd_context_node,
Itab_sflight type standard table of SFLIGHT.
select * from SFLIGHT into table Itab_sflight.
node_sflight = wd_context->get_child_node( name = 'SFLIGHT_NODE' ).
node_sflight->bind_table( itab_sflight ).
endmethod.
Thanks,
RamaHI,
IS IT CORRECT WAY OF DONIG CODING?
IF I AM WORNG PLEASE SUGEST ME.
method WDDOINIT.
data:
node_sflight type ref to if_wd_context_node,
final type standard table of vbap.
types: begin of t_vbak,
vbeln type vbak-vbeln,
end of t_vbak.
endmethod.
data wa_vbak type t_vbak.
data i_vbak type standard table of t_vbak.
types: begin of t_vbap,
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
end of t_vbap.
data wa_vbap type t_vbap.
data i_vbap type standard table of t_vbap.
select vbeln from vbak into table I_vbak.
select vbeln posnr matnr from vbap into table I_vbap
for all entries in I_vbak
where vbeln = i_vbak-vbeln.
loop at I_vbak.
read table i_vbap with key vbeln = I_vbak-vbeln.
final-vbeln = I_vbap-vbeln.
final-posnr = I_vbap-posnr .
final-matnr = I_vbap-matnr .
append final.
clear final.
endloop.
node_sflight = wd_context->get_child_node( name = 'NODE_VBAP' ).
node_sflight->bind_table( final ).
endmethod.
Thanks,
rama -
Hi,
I am working on a report where I have to retrieve data from 3 tables(marc,mara,makt).For this I have used 3 select statements for retriving data from 3 tables.There r some fields which r not present in marc table where as present in mara and makt tables.So added thos fields in marc internal table t_marc.I have looped at marc table and used the read statement to read the data from mara table using the key field matnr from both the tables.This read statement is giving the sy-subrc value as 4.Could u pls tell me why this is happening?I am sending my code.
SELECT matnr
werks
pstat
lvorm
FROM marc
INTO TABLE t_marc
PACKAGE SIZE 500
WHERE matnr IN s_matnr
AND werks IN s_werks.
IF NOT t_marc[] IS INITIAL.
SELECT matnr
ersda
laeda
meins
FROM mara
INTO TABLE t_mara
FOR ALL ENTRIES IN t_marc
WHERE matnr = t_marc-matnr
AND ersda IN s_ersda
AND laeda IN s_laeda.
IF NOT t_mara[] IS INITIAL.
SELECT matnr
maktx
FROM makt
INTO TABLE t_makt
FOR ALL ENTRIES IN t_mara
WHERE matnr = t_mara-matnr.
LOOP AT t_marc INTO wa_marc.
READ TABLE t_mara INTO wa_mara WITH KEY matnr = t_marc-matnr.
IF sy-subrc IS INITIAL.
wa_marc-meins = wa_mara-meins.
MODIFY t_marc.
APPEND wa_marc TO t_output.
ENDIF.
READ TABLE t_makt INTO wa_makt WITH KEY matnr = t_marc-matnr.
IF sy-subrc IS INITIAL.
wa_marc-maktx = wa_makt-maktx.
MODIFY t_marc.
APPEND wa_marc TO t_output.
ENDIF.
ENDLOOP.hi hema,
Dont use three select stements for this scenario.
Just use innerjoin and join all the three tables.
Three tables should contain MATNR (material number).
By using that retrieve data from 3 tables by using a single select statement.
Eg:
SELECT DISTINCT a~matnr "MATERIAL NUMBER
a~ersda "CREATED ON
a~mtart "MATERIAL TYPE
a~meins "BASE UNIT OF MEASURE
a~bstme "ORDER UNIT
b~maktx "MATERIAL DESCRIPTION
c~bwkey "VALUATION AREA
c~lbkum "TOTAL VALUED STOCK
c~salk3 "VALUE OF TOTAL VALUED STOCK
c~stprs "STANDARD PRICE
c~peinh "PRICE UNIT
c~bklas "VALUATION CLASS
INTO TABLE it_matdetails
FROM mara AS a INNER JOIN makt AS b ON a~matnr = b~matnr
INNER JOIN mbew AS c ON a~matnr = c~matnr
INNER JOIN marc AS d ON a~matnr = d~matnr
INNER JOIN mard AS e ON a~matnr = e~matnr
WHERE b~spras = sy-langu AND a~matnr IN matnr AND d~werks IN werks AND e~lgort IN lgort.
pls reward if helpful. -
How to fetch data from cluster tables
hi
i need to know how to fetch data from cluster tables please update me if any
i know that we cannot use joins in cluster table we use view etc
but i need detailed inforation on methods for fetching data from cluster tables
regards
NishantHi,
Check the following links
http://fuller.mit.edu/hr/cluster_tables.html
The specified item was not found.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33 -
BPEL or OSB for reading data from db and then writing to another db
Hi All,
I have a requirement of reading the data from a table in one database and then writing into the table in another databas.I dont need any transformation on the data.
I understand that i can do this by creating a BPEL process with DB adapters.
Is there any better way of implementing this.I am new to OSB and If need to use OSB, then how can we do this in OSB and what are the advantages of using OSB over BPEL in implementing this.
Thanks,
ashokprobably it would be much easier to develop everything in JDeveloper using DBAdapter.
You can run it inside SOA Suite, but you don't even need BPEL, just use Mediator.
Otherwise you can export all the JCA and WSDL and XSD paraphernalia from JDeveloper and import into OSB, it should run smoothly.
How do you trigger the transfer? Polling the DB to look for new rows? -
Issue for retrive data from ITAB
Case:HOW CAN WE FETCH DATA FROM TRANSPARENT TABLE
scenario:calculating net price for material on sales order
(on the basis of material number,sales organization,distribution channel,division,sale to partY ,sales office)
For this 5 prices are calculated :
a)zmrp
b)zlbj
c)zmlb
d)zdij
e)mwst
A bapi is developed through which all these data are fetched using joins on transparent and pooled tables.
Bapi is properly working in Sap Environment.But when fetching data from non sap environment(.NET) only pooled tables are returning data.
Transparent tables are returning blank data.
And also if in query of transprent table if in " where Clause " all parameters are hard codded then transparent table also return data in non sap envirnment.
for eg...
instead of writing ---
select data from tranparent table where matnr= (matnr variable made in bapi entered by user) and vkorg=(sales org variable made in bapi) ....same with all conditions
if we write(returing data)----
select data from tranparent table where matnr='5476665987' and vkorg='1400' ....same with all conditions
FUNCTION ZBAPI_BAR3.
""Local Interface:
*" IMPORTING
*" VALUE(MATNR) TYPE ZBAPI_IMPORT2-MATNR
*" VALUE(VKORG) TYPE ZBAPI_IMPORT2-VKORG
*" VALUE(VTWEG) TYPE ZBAPI_IMPORT2-VTWEG
*" VALUE(KUNNR) TYPE ZBAPI_IMPORT2-KUNNR
*" VALUE(SPART) TYPE ZBAPI_IMPORT2-SPART
*" VALUE(AUART) TYPE ZBAPI_IMPORT2-AUART
*" VALUE(VKBUR) TYPE ZBAPI_IMPORT2-VKBUR
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRETURN
*" TABLES
*" ITAB STRUCTURE ZBAPI_TABLE3
DATA: LAND1 LIKE KNA1-LAND1 ,
REGIO LIKE KNA1-REGIO ,
WERKS LIKE VBAP-WERKS ,
KNUMH LIKE A004-KNUMH ,
KNUMH LIKE ZBAPI_TABLE3-Knumh ,
KBETR LIKE COND_KONW-Kbetr ,
LIKE ZBAPI_TABLE3-KBETR ,
KNUMH1(10) TYPE C ,
KNUMH2(10) TYPE C ,
KNUMH3(6) TYPE C ,
KNUMH2 LIKE ZBAPI_TABLE3-KNUMH ,
KNUMH3 LIKE ZBAPI_TABLE3-KNUMH ,
KNUMV LIKE ZBAPI_TABLE3-KNUMV ,
KDGRP LIKE KNVV-KDGRP ,
TAXKD LIKE KNVI-TAXKD ,
TAXM1 LIKE MLAN-TAXM1 ,
ADRNR LIKE TVBUR-ADRNR ,
REGION LIKE ADRC-REGION ,
DATE TYPE A503-DATAB .
SELECT SINGLE KDGRP FROM KNVV INTO KDGRP WHERE KUNNR = KUNNR AND VKORG = VKORG AND VTWEG = VTWEG AND SPART = SPART .
SELECT SINGLE LAND1 REGIO FROM KNA1 INTO (LAND1,REGIO) WHERE KUNNR = KUNNR .
SELECT SINGLE WERKS FROM VBAP INNER JOIN VBAK ON VBAPVBELN = VBAKVBELN INTO WERKS WHERE AUART = AUART .
SELECT SINGLE TAXKD FROM KNVI INTO TAXKD WHERE KUNNR = KUNNR AND ALAND = LAND1 AND TATYP = 'MWST' .
SELECT SINGLE TAXM1 FROM MLAN INTO TAXM1 WHERE MATNR = MATNR AND ALAND = LAND1 .
SELECT SINGLE ADRNR FROM TVBUR INTO ADRNR WHERE VKBUR = VKBUR .
SELECT SINGLE REGION FROM ADRC INTO REGION WHERE ADDRNUMBER = ADRNR .
DATE = SY-DATUM .
SELECT SINGLE KNUMH FROM A931 INTO KNUMH1 WHERE KAPPL = 'V' AND KSCHL = 'ZMRP' AND VKORG = VKORG AND VTWEG = VTWEG AND WERKS = '1410' AND KUNNR = KUNNR AND MATNR = MATNR AND KFRST = SPACE AND DATAB LE DATE AND DATBI GE DATE .
SELECT SINGLE KNUMH FROM A931 INTO KNUMH1 WHERE KAPPL = 'V' AND KSCHL = 'ZMRP' AND VKORG = '1400' AND VTWEG = '10' AND WERKS = '1410' AND KUNNR = '0000100163' AND MATNR = 'A10AN027PNSL' AND KFRST = SPACE AND DATAB LE DATE AND DATBI GE DATE .
SELECT SINGLE zkarigar FROM zkari INTO KNUMH1 WHERE erdat = '20070410' .
SELECT SINGLE KNUMH FROM A004 INTO KNUMH1 WHERE KAPPL = 'V' AND KSCHL = 'ZMRP' AND VKORG = VKORG AND VTWEG = VTWEG AND MATNR = MATNR AND DATAB LE DATE AND DATBI GE DATE .
*'0000280050'
CLEAR KNUMH .
CLEAR KBETR .
SELECT SINGLE KNUMH FROM A503 INTO KNUMH1 WHERE KAPPL = 'V' AND KSCHL = 'MWST' AND ALAND = LAND1 AND WKREG = REGION AND REGIO = REGIO
AND TAXK1 = TAXKD AND TAXM1 = TAXM1 AND KFRST = SPACE AND DATAB LE DATE AND DATBI GE DATE and knumh = '0000279708'.
concatenate '0000' KNUMH into knumh1 .
**KNUMH1 = KNUMH .
**select single kbetr from konp into kbetr where knumh = knumh1 .
**knumh3 = knumh1+4(6) .
***itab-kbetr = kbetr .
**concatenate '0000' knumh3 into knumh2 .
**write:/ knumh2 .
ITAB-KNUMH1 = KNUMH2 .
ITAB-KNUMH1 = KNUMH1 .
APPEND ITAB .
*loop at itab .
*write:/ itab-knumh1 .
*endloop .
CLEAR KNUMH .
CLEAR KBETR .
SELECT SINGLE KNUMH FROM A940 INTO KNUMH WHERE KAPPL = 'V' AND KSCHL = 'ZDIJ' AND VKORG = VKORG AND VTWEG = VTWEG AND KDGRP = KDGRP AND MATNR = MATNR AND KFRST = SPACE AND DATAB LE DATE AND DATBI GE DATE .
SELECT SINGLE KNUMH FROM A931 INTO KNUMH WHERE KAPPL = 'V' AND KSCHL = 'ZDIJ' AND VKORG = VKORG AND VTWEG = VTWEG AND WERKS = WERKS AND KUNNR = KUNNR AND MATNR = MATNR AND KFRST = SPACE AND DATAB LE DATE AND DATBI GE DATE .
ITAB-KNUMH = KNUMH.
APPEND ITAB .
CLEAR KNUMH .
CLEAR KBETR .
ITAB-KNUMH = KNUMH .
APPEND ITAB .
COMMIT WORK AND WAIT.
ENDFUNCTION.
Thanks & Regards
AmrishHi,
Please Check this => The specified item was not found.
How to post code in SCN, and some things NOT to do...
Faisal -
POWER QUERY Get External Data From File From Folder (Excel 2013)
Hi,
Beginner's question :
What could be the use of the query on a folder : we just get a list of files with their path. What can we do with that?
ThanksHi,
Do you want to combine data from multiple Excel Files in the same folder path into one table? If I understand correct, we can add a custom column to import the data.
After we getting a list of files with their path, the Query Editor window will activate to show you a table containing a record for each file in the chosen directory. These will provide our function with the needed FilePath and FileName parameters.
Function sample: File name([Folder path],[Field name]
For more detailed steps, please see the article:
http://datapigtechnologies.com/blog/index.php/using-power-query-to-combine-data-from-multiple-excel-files-into-one-table/
Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Select query to read data from a view
Hi friends,
We have been using a query to read data from a custom view which used to work perfectly. Now the program sits at that select query forever. We are able to extract same data from se16. Not sure what could be the problem.
Thanks in advance.Dev
Have a look at the Table Index for the tables involved in the View... I think there is some change in the Indexes.. (Add / Remove / Change)
Thanks
Amol Lohade
Maybe you are looking for
-
Does not effect any other websites I've tried to open.
-
Long time taken to fetch data from Database Table
Moved to correct forum by moderator. I had a requirement where i need to fetch records from table A912 for the matching entries in an internal table and satisfying some conditions. The Internal Table(it_out) has 1,206 entries, while Databse table(A91
-
Could anybody tell me what does the event( AT SELECTION-SCREEN ) only do ? I am asking only about AT SELECTION-SCREEN Regards, SAURAV LAHIR
-
Mass Printing of Delivery Notes
Hello SCN, Is there a way to reprint all delivery notes printed for a specific period? Transaction or Report? Let's say for example all DN printed last month by a specific user? Please help me solve this problem. Thank you in advance. Jayson.
-
Why can't I always concat to the ITunesstore
Why can't I make a FaceTime call