Sum the value of look up table based on two filter criteria
Hello Everyone
I am new to Powerpivot and would appreciate if someone could help me on the following problem.
You can download the example of this excel file form the following DropBox link:
Dropbox Link
The first table is tOrders
Week number
Work center
order number
Production time in minutes
2
a
111
60
2
a
112
70
2
b
113
60
3
b
114
50
3
a
115
40
3
b
116
60
4
a
117
90
4
b
118
40
The second is dLookupList
Week number
Work center
mantenace in minutes per week
Break dows in minutes per week
2
a
10
10
2
b
20
5
3
a
15
12
3
b
30
10
4
a
20
10
4
b
10
10
I’m trying to create Pivot that has filter on Week number to show the number of orders, Sum of Production time in minutes and the total of the values form the lookup table dLookupList that matches the work center and the selected week
numbers. So that I can calculate the total time for each work center. Filter criteria is Week number and Work center.
For example if someone select all weeks numbers the result sould look like this
Week number
(All)
Work center
Count of order number
Sum of Production time in minutes
mantenace in minutes per week
Break dows in minutes per week
Total time
a
4
260
45
32
337
b
4
210
60
25
295
Grand Total
8
470
Result for week 2
Week number
2
Work center
Count of order number
Sum of Production time in minutes
mantenace in minutes per week
Break dows in minutes per week
Total time
a
2
130
10
10
150
b
1
60
20
5
85
Grand Total
3
190
How can I relate these two tables to get the above result?
Any help is highly appreciated.
Regards
Priyan
Hi Recio
Thank you very much for the swift response. I was able to get it work.
I got two questions:
How do you add a total time column to the pivot table like you did? Because there are no calculated field in power pivot.
I prefer that the filter is based on the Orders table. So that if you select all Week numbers in the filter, that pivot will show result for all orders and relevant sums from the lookup list.
Link download the example file
For example: I add Week number 5 to the work center “a”
Week number
Work center
WNandWC
mantenace in minutes per week
Break dows in minutes per week
2
a
WN2WCa
10
10
2
b
WN2WCb
20
5
3
a
WN3WCa
15
12
3
b
WN3WCb
30
10
4
a
WN4WCa
20
10
4
b
WN4WCb
10
10
5
a
WN5WCa
1
1
In the orders table there are no records for week number 5
Week number
Work center
WNandWC
order number
Production time in minutes
2
a
WN2WCa
111
60
2
a
WN2WCa
112
70
2
b
WN2WCb
113
60
3
b
WN3WCb
114
50
3
a
WN3WCa
115
40
3
b
WN3WCb
116
60
4
a
WN4WCa
117
90
4
b
WN4WCb
118
40
4
a
WN4WCa
119
50
But the pivot sums up the week number 5 also.
Do you have any idea how to solve it?
Thank you very much.
Regards
Priyan
Similar Messages
-
ABAP Code Problem in Start Routine to Fill the value from Look-up Table ???
Hi all,
I am trying to fill the values of DOC_NUMBER & PLANT from look-up table /BIC/AZSD_O0700 (Billing Item ODS) for each BILL_NUM in Start Routine for Update Rules of Billing Header ODS and modify the data_package.
What is wrong with the below ABAP code, PLEASE ???
data: it_data type standard table of data_package_structure
with header line
with non-unique default key initial size 0.
types: begin of billing_item_type,
BILL_NUM like /BIC/AZSD_O0700-BILL_NUM,
DOC_NUMBER like /BIC/AZSD_O0700-DOC_NUMBER,
PLANT like /BIC/AZSD_O0700-PLANT,
end of billing_item_type.
refresh it_data.
clear it_data.
it_data[] = DATA_PACKAGE[].
refresh DATA_PACKAGE.
clear DATA_PACKAGE.
loop at it_data.
select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
from /BIC/AZSD_O0700
where BILL_NUM = it_data-BILL_NUM
and FISCVARNT = it_data-fiscvarnt.
endselect.
if sy-subrc = 0.
move-corresponding it_data to DATA_PACKAGE.
endif.
endloop.
modify DATA_PACKAGE.
Thanks,
Venkat.Hi Venkat,
Two things -One is the performance and the other ... there is no Append within the loop.
Try moving the select statement ousdie the loop to improve performance and move the modify statement into the loop ... change modify to append. Code below.
Let me know if you need more help.
Best regards,
Kazmi
data: it_data type standard table of data_package_structure
with header line
with non-unique default key initial size 0.
types: begin of billing_item_type,
BILL_NUM like /BIC/AZSD_O0700-BILL_NUM,
DOC_NUMBER like /BIC/AZSD_O0700-DOC_NUMBER,
PLANT like /BIC/AZSD_O0700-PLANT,
end of billing_item_type.
refresh it_data.
clear it_data.
it_data] = DATA_PACKAGE[.
refresh DATA_PACKAGE.
clear DATA_PACKAGE.
loop at it_data.
select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
from /BIC/AZSD_O0700
where BILL_NUM = it_data-BILL_NUM
and FISCVARNT = it_data-fiscvarnt.
endselect.
if sy-subrc = 0.
move-corresponding it_data to DATA_PACKAGE.
Append DATA_PACKAGE.
endif.
endloop. -
Problem in Summing the value in one internal table. Its very urgent.
Hi Experts,
I have 10 fields in one internal table and based on the 8th field changing, I have to sum the 3rd field.
I am unable to use AT END OF <FIELD8>, because any of the fields from 1 to 7 are changing, then this control break statement triggering.
Could any body tell me, how I have to do this.
Thanks,
bsv.Hi,
I think it could be as simple as below.
DATA: l_field8 TYPE bla bla.
READ TABLE itab
INTO wa_itab
INDEX 1.
l_field8 = wa_itab-field8.
LOOP AT itab INTO wa_itab.
IF l_field8 NE wa_itab-field8.
"Do the sum here
ENDIF.
ENDLOOP.
Regards,
Teddy
Edited by: Teddy Kurniawan on Jan 25, 2008 8:38 AM -
How can I sum the values in a given column on sheet 1 i.e. A1:A50 based on the adjacent columns specific value i.e. B1:B50 = “Dinning Room” on sheet 2
For Example:
SHEET 1
A
B
$50
Dinning Room
$800
Dinning Room
$300
Kitchen
$1,000
Master Bedroom
$100
Dinning Room
SHEET 2
Display the total SUM amount of each Project based on Sheet 1
Project Name
Total Cost
Dinning Room
$950
Kitchen
$300Would be a good idea to open iWork Formulas and Functions User Guide and search for the description of the function named SUMIF
The Guide is available for every user thru the Help menu.
Yvan KOENIG (VALLAURIS, France) jeudi 19 mai 2011 17:32:42
Please :
Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer ! -
How to sum the value of "N/A"
I am new to javascripting and am trying to solve a problem with little success. Can anyone help. This is the situation:
I am using Acrobat Pro 11 and I have created a form. I have 36 dropdown fields that for example have the following choices N/A, 5, 0 - I want to sum the value of all the N/A choices. The value of each N/A is the largest number in the field. In my example it would be 5. I can assign a value to each N/A or the formula could look for the largest number in that dropdown field and add them together.
Thank you in advance for any help you can provide.It's not possible. However, I can think of a couple of
workaraounds:
- Insert the value from the GLOBAL into the table that the
trigger is on
- Create a server-side package, declaring a variable in the
package header. Assign the GLOBAL to the package variable before
doing the commit on the Form. -
Sum the values of a text field in a tabular form using JavaScript
Hi Folks.
OK, I put my hands up. I don't know Java script but I'm picking up the basics and I WANT to learn.
Here's my situation.
I have a tabular form which has lots of Standard Report Columns and ONE text field.
I want to sum the values entered in the text field, real time, using Java Script without the need to have a round trip to the database.
I'm guessing this will involve some kind of loop. Once I have that SUM figure I will store it in a hidden item and it will be used for validation when the user submits the form.
If anyone can give me a simple Java Script to do this, or point me in the direction of one, I'd be very grateful.
Many thanks.
Dogfighter.Hi Arie.
Thanks for the link.
That's a great start,
What I've got working so far is the following...
<script type="text/javascript">
function f_calculate_delta(p_this,p_rownum)
var amt = $x(p_this).value;
alert (amt);
var display_item_to_set = 'f08_'+ p_rownum
$x(display_item_to_set).innerHTML = amt
</script>
This is working fine.
Where I'm stuck at the moment is how I can 'get' the value of another cell in the same row. They have all been set up using the APEX_ITEM API with their own unique IDs.
I will continue looking but if you could give me a steer, that would be great.
Many thanks
Simon
PS. APEX 3.1
PPS. Trying to get the value of another row using...
var display_item_to_get = 'f04_'+ p_rownum
var expected_amt = $x(display_item_to_get).value
PPPS. Also tried...
var display_item_to_get = 'f04_'+ p_rownum
var expected_amt = $v(display_item_to_get)
and
var display_item_to_get = 'f04_'+ p_rownum
var expected_amt = $v(display_item_to_get).value
None of which are working at the moment.
Message was edited by:
Dogfighter -
Limiting the values in a lookup table
Hello everyone.
I was wondering if it is possible to limit the selectable values in a lookup table based on certain criteria, foremost the content of a separate field.
Example:
A product has a measurement key that determines which sizes are valid for a given product.
Is it possible for MDM to read this key and filter the values of the table holding all the values for all keys?
Hope that was somewhat clear what I'm trying to do.
Best regards,
AndersHello Andres:
I believe that what you should do is to place all the products types into Categories. There, you can give different attributes to each product and therefore, limit what the user can choose as its values.
For instance, you have two products A and B. Each one would have a separate "Measure" field.
Create Categories:
Cat_A
Cat_B
with separate attributes:
Cat_A
|____ Measure_A
Cat_B
|____ Measure_B
And in each Measure <b>Attribute</b> (not field) you can specify the correct values for each category (i.e Product type)
When the user chooses Cat_A as the product type, the Measure_A will appear, with its values. The same will happend for Cat_B
I hope that helps
Regards
Alejandro -
When the combobox is rendered all the values displayed look like [object Object].
I wasn't sure where to post this so please forgive me.
I am trying to populate a combobox with a series of values
returned from a Coldfusion method that retrives a resault froma
database. Basically all the data from a table of staff.
<cffunction name="getUsers" access="remote"
returntype="array">
<cfquery name="q" datasource="#datasource#">
SELECT *
FROM STAFF_CHARTS_STAFF_TEMP
</cfquery>
<cfset aRecordset= querytoarray(q)>
<cfset flash.result=aRecordset>
<cfreturn flash.result>
</cffunction>
<cffunction name="querytoarray" returntype="array"
output="No">
<cfargument name="q" required="Yes" type="query">
<cfset var aTmp = arraynew(1)>
<cfif q.recordcount>
<cfloop query="q">
<cfset stTmp = structNew()>
<cfloop list="#lcase(q.columnlist)#" index="col">
<cfset stTmp[col] = q[col][currentRow]>
</cfloop>
<cfset arrayAppend(aTmp,stTmp)>
</cfloop>
<cfelse>
<cfset stTmp = structNew()>
<cfloop list="#lcase(q.columnlist)#" index="col">
<cfset stTmp[col] = "">
</cfloop>
<cfset arrayAppend(aTmp,stTmp)>
</cfif>
<cfreturn aTmp>
</cffunction>
The result from a call of CF method getUsers is set as the
data provider to ComboBox with id = "cb"
<mx:RemoteObject
id="myService"
destination="ColdFusion"
source="staff_ratings.staff_Ratings-debug.staff"
showBusyCursor="true">
<mx:method name="getUsers" result="handleResult(event)"
fault="Alert.show(event.fault.message)"/>
</mx:RemoteObject>
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
[Bindable]
public var sResult:Array;
public function handleResult(event:ResultEvent):void{
sResult=event.result as Array;
cb.dataProvider=sResult;
]]>
</mx:Script>
However when the combobox is rendered all the values
displayed look like [object Object].
I think the problem is that the result is a array of arrays
so I need to find away to ectract a particular colun of data into
the combobox
How do I fix this?This is what I did for a single field.
If you were wanting the to have muliple fields in the
dropdown, I would concatenate them in the query.
something like
select fname + ' ' + lname + ' ' + anotherfield as tech from
dbo.table
<cffunction name="getTech" output="no" access="remote"
returntype="query">
<cfset var qTech="">
<cfquery name="qTech" datasource="datasource">
select tech
from dbo.table
group by tech
order by tech
</cfquery>
<cfreturn qTech>
</cffunction>
<mx:RemoteObject
id="dataManager"
showBusyCursor="true"
destination="ColdFusion"
source="cust.components.cfgenerated.Records">
<mx:method name="getMasterQuery"
result="getMasterQuery_result(event)" fault="server_fault(event)"
/>
<mx:method name="deleteItem"
result="deleteItem_result(event)" fault="server_fault(event)" />
</mx:RemoteObject>
<mx:ComboBox id="TECH"
dataProvider="{dataManager.getTech.lastResult}" labelField="tech"
/> -
How to retrieve the values from PL/SQL table types.
Hi Every one,
I have the following procedure:
DECLARE
TYPE t1 IS TABLE OF emp%ROWTYPE
INDEX BY BINARY_INTEGER;
t t1;
BEGIN
SELECT *
BULK COLLECT INTO t
FROM emp;
END;
This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
Can anybody help me please!!!!!
Thanks
Ahmed.You mean, you can't add this
for i in t.first..t.last loop
dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
end loop;or you can't add this
set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
You see, not able like very similar it is not working - both are too vague...
Best regards
Maxim -
Querying a table based on a selection criteria
Hi Gurus,
Could you please help me in creating a function module that picks records from the table based on certain selection criteria.For eg, If contract number(a primary field) is an import parameter and I want the Function module to export all the records with contract number starting with 1 or may be ending with 303.How could I query this??
Thanks,
AshwiniHello,
Creation of Function Module
Goto TCode SE37
Click on the Menu Goto->Create Function Group
Create Z (ZPTP) function group and Activate Function Group even if the error occurs
Create Function module Namely Z (ZTEST) assign to the function group (ZPTP)
Go to the Import parameters (EBLEN TYPE EKKO-EBELN)
Go to the Tables ( itab type ekpo)
Goto the Source code
tables ekpo.
Select * from ekpo into table itab
where ebeln eq ebeln.
Activate the function module and run the function
regards
suresh nair -
I'm a first timer on this (or any) help site. I just installed Time Capsule. The first backup looks like it will take two days at the present speed. Can I close MacBook Pro and have first back up continue, and can I unplug tomorrow and plug in at work without affecting the backup?
Hi Oneinspirit,
Time Machine backups can be paused by choosing "Stop Backing Up" from the Time Machine icon on the right hand side of your menu bar ( ). Once you're ready to resume the backup, you can choose "Back Up Now" from the same icon.
Start a backup: Click the Time Machine icon in the menu bar, then choose Back Up Now.
Pause a backup: Click the Time Machine icon in the menu bar, then choose Stop Backing Up.
OS X Yosemite: Start, pause, and resume a Time Machine backup
http://support.apple.com/kb/PH18851
All my best,
Allen -
I have a problem thats needs a sulution. I have a Spreadsheet with multiple sheets and tables. The (Truck ) Sheets each represent a "Site" and the tables within from 1-31 show inventory counts for each day of the month.
Shown below are Edited example's of a "Site" sheet and the Day tables contained within it.
The Spreadsheet expands as a new "Site" (Truck ) is added regularly. Currently there are 30 "Sites" (Trucks).
Also within the spreadsheet is a sheet (Checkpoint) which contains tables used to show summary data for each "Site" sheet. There is one table used to review one site, so currently there are 30 tables identical in format and structure reviewing 30 sites.
An edited example of the summary table for Truck 1 is shown below.
The table's in CP reference data within cells from other sheets. A LEN INDIRECT formula
=IF(LEN(INDIRECT("Truck 1::Day "&COLUMN(cell)−3&"::K53",addr-style))<1,"",INDIRECT("Truck 1::Day "&COLUMN(cell)−3&"::k53",addr-style))
was used to retrieve the values within certain cells. This formula works perfectly because when I add another "Site" I simply need to Dupicate a "Site" Template Sheet and then Copy Paste the LEN INDIRECT formula in to the newly created Summary table.
There is another sheet (Command Central) which contains a Master summary table. The Master Summary sheet is identical in structure to the CP Summary Tables. Its purpose is to show the combined data from the tables within Checkpoint (Truck 1-30). for instance MS::D5=Checkpoint::Truck 1:Truck 30::D5. I realize that Numbers cannot calculate cells within a range of table so I am hoping for a workaround.
Could someone please help me with a formula something like the LEN INDIRECT formula mentioned above or possible a something else that could work beside
D5=Truck 1::D5,Truck 2::D5,Truck 3::D5...?
When I use that formula type I will have to edit the formula every time I add a new site.
Anothe issue Im having is getting D3:AH3 to show the correct count of names. I am using the following formula:
D3=SUM(COUNTA(Truck 1::D3,Truck 2::D3,Truck 3::D3,Truck 4::D3))−SUM(COUNT(UNION.RANGES(Truck 1::D3,Truck 2::D3,Truck 3::D3,Truck 4::D3)))
The cells it is counting are either blank (the refenced cell contains a LEN INDIRECT formula that places "" if needed) or contain a name. This formula works when I and addressing cells without the LEN INDIRECT formula. What am I doing wrong?Hello Wayne,
Here are screenshots of the tables in question. The first on is the Master summary table.
Cell D5 shows the value pulled from Checkpoint::Truck 1::D5
Cell E5 shows the value pulled from Checkpoint::Truck 2::D5
Cell F5 shows the value pulled from Checkpoint::Truck 3::D5
Cell G5 shows the value pulled from Checkpoint::Truck 4::D5 -
How set the values programatically in custom tables ?
Hi Guru's,
Please help me where i did mistake....
My scenario is i have 4 columns that 4 columns are look up based on row i need save the "XX_hr_Vacancies_CompTab"
4 columns look like....
column1(15 questions ) column2(message choice) column3(message choice) column4(free text)
(1-15)question manually select (1-10) manually select (1-10) comments
this vo purpose i am using this query
SELECT ROWNUM,
xhv.VACANCY_ID
, xhv.RFP_NO
, hl.lookup_code
, hl.meaning
, XJCT.BUHR_RATING
, XJCT.COMBEN_RATING
, XJCT.RATIONALE
FROM hr_lookups hl ,
xx_hr_vacancies xhv,
XX_JOBEVAL_COMP_TAB XJCT
WHERE lookup_type = 'XX_JE_QUESTIONAIRE'
AND xhv.RFP_NO = 'IRC616'
AND XJCT.VACANCY_ID(+) = XHV.VACANCY_ID
ORDER BY ROWNUM
I am using sample code is for one column inserting.....please help where i am doing mistake.
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("createjobVacancy1");
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
if (pageContext.getParameter("Save") != null)
OAApplicationModule am = pageContext.getApplicationModule(webBean);
OAViewObject vacncyVO = (OAViewObject)am.findViewObject("XXTableLookupVO1");
int fetchedrowcount = vacncyVO.getRowCount();
RowSetIterator multiIter;
multiIter = vacncyVO.createRowSetIterator("VacancyId");//Attribite of the select box
multiIter.setRangeStart(0);
multiIter.setRangeSize(fetchedrowcount);
System.out.println("no before for loop condition rows"+fetchedrowcount);
for(int i=0;i<fetchedrowcount;i++)
am.invokeMethod("createjobVacancy1");
OAViewObject vacncyVO1 =
(OAViewObject)am.findViewObject("XX_hr_Vacancies_CompTab_EOVO1");
Object vacancy = vacncyVO.getRowAtRangeIndex(i).getAttribute("VacancyId"); */*63 Line code is this one*/*
System.out.println("vacancy number is in table region current row is "+vacancy);
System.out.println("no or rows"+fetchedrowcount);
if(vacancy != null && !"".equals("vacancy"))
vacncyVO1.getCurrentRow().setAttribute("VacancyId",vacancy);
System.out.println("set create vacancy number is in table region current row is "+vacancy);
}else{
vacncyVO1.getCurrentRow().setAttribute("VacancyId",null);
am.invokeMethod("apply1");
System.out.println("out of for loop :"+fetchedrowcount);
Sop:
13/01/10 06:55:28 no before for loop condition rows15
13/01/10 06:55:29 Header is =725
13/01/10 06:55:30 vacancy number is in table region current row is 616
13/01/10 06:55:30 no or rows15
13/01/10 06:55:30 set create vacancy number is in table region current row is 616
13/01/10 06:55:30 Header is =726
Error:
## Detail 0 ##
java.lang.NullPointerException
at xxsup.oracle.apps.per.jobevaluation.webui.MainCO.processFormRequest(MainCO.java:63)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
Regards,
SrinivasThanks Keerthi,
i am getting values but i unable to set the values, once i am setting values i am facing null pointer exception ..
java.lang.NullPointerException
at xxsup.oracle.apps.per.jobevaluation.webui.MainCO.processFormRequest(MainCO.java:86)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
i am using below coding in PFR
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
if (pageContext.getParameter("Save") != null)
OAApplicationModule am = pageContext.getApplicationModule(webBean);
OAViewObject oaviewobject =(OAViewObject)am.findViewObject("XXTableLookupVO1");
if(oaviewobject!=null)
pageContext.writeDiagnostics(this,"View Object is exists",OAFwkConstants.STATEMENT);
int rowcountValue = oaviewobject.getRowCount();
pageContext.writeDiagnostics(this,"Row returned by the View Object"+rowcountValue,OAFwkConstants.STATEMENT);
System.out.println("before for loop geting values = "+rowcountValue);
Row rowAdv= oaviewobject.first();
RowSetIterator iterator = oaviewobject.createRowSetIterator("iterator");
iterator.setRangeStart(0);
iterator.setRangeSize(oaviewobject.getRowCount());
for(int i=0; i<iterator.getRowCount(); i++)
pageContext.writeDiagnostics(this,"Inside For loop ",OAFwkConstants.STATEMENT);
rowAdv =iterator.getRowAtRangeIndex(i);
if(rowAdv != null)
pageContext.writeDiagnostics(this,"flag not null",OAFwkConstants.STATEMENT);
pageContext.writeDiagnostics(this,"Flag Value Checked as Y",OAFwkConstants.STATEMENT);
OAViewObject vacncyVO1 =
(OAViewObject)am.findViewObject("XX_hr_Vacancies_CompTab_EOVO1");
if(rowAdv.getAttribute("VacancyId")!=null)
Object vacancyname = rowAdv.getAttribute("VacancyId").toString();
vacncyVO1.getCurrentRow().setAttribute("VacancyId",vacancyname); This is the 86 line
System.out.println("Vacancy ID IS = "+vacancyname);
System.out.println("Vacancy ID IS = "+rowAdv);
am.invokeMethod("apply1");
// System.out.println("out of for loop :"+iterator);
please help me where i am doing mistake...
Regards,
Srinivas -
I have a table in sql with employee_num and I need to create a list and link that list to this table to make changes to table based on values user enter or selects.
Hi,
In addition, you could refer to one similar thread for related information:
http://social.technet.microsoft.com/Forums/sharepoint/en-US/8ee8a7b2-ddfc-4654-b84e-b062aeb527ae/how-to-create-exernal-list-in-sharepoint-which-fetch-data-from-multiple-sql-table?forum=sharepointgeneral
Regards,
Rebecca Tu
TechNet Community Support -
Script- problem in printing the values in from internal table
Hi all,
I have a requiremnt that i for a particular document no there are number of invoices are there. i.e for a single document no there are 20 invoices in that. i shoudl display the invoice number , invoice date, invoice amount , number of days of intrest , start date of interest, end date of interest and intrest amount.
The problem is i should take the invoice number, invoice date, number of days from TABLE <b>BSEG</b> and inovice amount and start date, end date from table<b> INTITIT</b>. for a particular document number there are diffent invoce numbers in both the table.
i can display everthing but the prob is with invoice amount. it is repating only one values is displying in the ouput. The invoice number in INTITIT Is not changing. I have to write the syntax for that .Please help me The value in Bseg is chaing as per given syntax shown below.
data: begin of hbseg occurs 10.
include structure hsortp.
include structure bseg.
data: end of hbseg.
data: begin of hsortp,
sortp1 like sortp1,
sortp2 like sortp2,
sortp3 like sortp3,
sortp4 like sortp4,
sortp5 like sortp5,
EKVBD LIKE KNB1-EKVBD,
end of hsortp.
loop at hbseg.
WHERE BUKRS = SAVE_BUKRS.
save_bukrs = hbseg-bukrs.
if ( hbseg-kunnr = save_kunnr
and not save_kunnr is initial )
or ( hbseg-lifnr = save_lifnr
and not save_lifnr is initial ).
clear bseg.
move-corresponding hbseg to bseg.
*bseg = bseg.
if bkpf-waers ne *bkpf-waers.
perform curr_document_convert_bseg
using
bkpf-budat
*bkpf-waers
*bkpf-hwaer
bkpf-waers
changing
bseg.
if not bseg-pycur is initial.
alw_waers = bseg-pycur.
perform currency_get_subsequent
using
save_repid
bkpf-budat
bkpf-bukrs
changing
alw_waers.
if alw_waers ne bseg-pycur.
bseg-pycur = alw_waers.
perform convert_foreign_to_foreign_cur
using
bkpf-budat
*bkpf-waers
*bkpf-hwaer
bseg-pycur
changing
bseg-pyamt.
endif.
endif.
endif.
perform fill_waehrungsfelder_bseg.
perform fill_waehrungsfelder_bseg_2.
if bseg-sgtxt(1) ne '*'.
bseg-sgtxt = space.
else.
bseg-sgtxt = bseg-sgtxt+1.
endif.
clear save_bschl.
clear save_umskz.
clear tbslt.
save_bschl = bseg-bschl.
save_umskz = bseg-umskz.
perform read_tbslt.
ADDING VARIBLE V_GSALDF BY SUNIL 5.11.07******
v_gsaldf = rf140-gsaldf + rf140-wrshb.
rf140-gsaldf = v_gsaldf.
clear v_gsaldf.
SUNIL *********************
*rf140-gsaldf = *rf140-gsaldf + *rf140-wrshb.
if xmultk is initial
and xactiv is initial
and linecnt = '1'
and not xumsst is initial
and not save_xumstn is initial.
if bkpf-bstat = 'V'.
perform read_vbset.
else.
perform read_bset.
endif.
describe table hbset lines linecnt.
if linecnt = '1'.
loop at hbset.
move-corresponding hbset to bset.
*bset = bset.
if bkpf-waers ne *bkpf-waers.
perform curr_document_convert_bset
using
bkpf-budat
*bkpf-waers
*bkpf-hwaer
bkpf-waers
changing
bset.
endif.
clear rf140-msatz.
clear rf140-vtext.
save_ktosl = bset-ktosl.
perform read_t687t.
rf140-msatz = bset-kbetr / 10.
*rf140-msatz = rf140-msatz.
rf140-vtext = save_vtext.
*rf140-vtext = rf140-vtext.
if bset-shkzg = 'H'.
rf140-mwshb = bset-fwste.
*rf140-mwshb = *bset-fwste.
rf140-mdshb = bset-hwste.
*rf140-mdshb = *bset-hwste.
else.
rf140-mwshb = 0 - bset-fwste.
*rf140-mwshb = 0 - *bset-fwste.
rf140-mdshb = 0 - bset-hwste.
*rf140-mdshb = 0 - *bset-hwste.
endif.
exit.
endloop.
rf140-wrshb = rf140-wrshb - rf140-mwshb.
*rf140-wrshb = *rf140-wrshb - *rf140-mwshb.
rf140-dmshb = rf140-dmshb - rf140-mdshb.
*rf140-dmshb = *rf140-dmshb - *rf140-mdshb.
endif.
endif.
*****************Begin of Change by Karthikeyan J********************
i_count = i_count + 1.
clear rf140-element.
clear: it_bseg, i_wrbtr,i_totday,i_tempday,i_day,i_bday.
comparing with fields belnr AND SELECT * FROM INTITIT added by sunil 3.11.07*********
select single * from bseg into
corresponding fields of it_bseg where belnr = bseg-rebzg anD GJAHR = BSEG-GJAHR.
select single * from intitit into corresponding fields of it_intitit where gjahr = bseg-gjahr and belnr_to = bseg-belnr and buzei = '2' OR BELNR = INTITIT-BELNR .
added by Jayshree on 09/01/2007
MOVE ' ' TO it_kna1-name1.
SELECT SINGLE name1
INTO CORRESPONDING FIELDS OF it_kna1
FROM ( vbpa AS a INNER JOIN kna1 AS b ON akunnr = bkunnr )
WHERE a~vbeln = it_bseg-vbeln
AND a~parvw = 'zd'.
SELECT SINGLE fkdat
INTO CORRESPONDING FIELDS OF it_kna1
FROM vbrk
WHERE vbrk~vbeln = it_bseg-vbeln.
added by Jayshree on 01/02/2007
CONCATENATE it_kna1-fkdat6(2) it_kna1-fkdat4(2) it_kna1-fkdat+2(2)
INTO vfkdat SEPARATED BY '.'.
CONCATENATE it_bseg-augdt6(2) it_bseg-augdt4(2) it_bseg-augdt+2(2)
INTO vaugdt SEPARATED BY '.'.
i_wrbtr = i_wrbtr + it_bseg-wrbtr.
added as on 29.06.2007 by jayshree again transport on 21.07.2007
tot_wrbtr = tot_wrbtr + i_wrbtr.
i_totday = it_bseg-zbd1t + it_bseg-zbd2t + it_bseg-zbd3t.
CALL FUNCTION 'fima_date_create'
EXPORTING
i_date = it_bseg-zfbdt
I_FLG_END_OF_MONTH = ' '
I_YEARS = 0
I_MONTHS = 0
i_days = i_totday
I_CALENDAR_DAYS = 0
I_SET_LAST_DAY_OF_MONTH = ' '
IMPORTING
e_date = i_bday
E_FLG_END_OF_MONTH =
E_DAYS_OF_I_DATE =
added by JAYSHREE 01.02.2007
CONCATENATE i_bday6(2) i_bday4(2) i_bday+2(2)
INTO vbday SEPARATED BY '.'.
i_day = it_bseg-augdt - i_bday.
CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
EXPORTING
date1 = it_bseg-zfbdt
date2 = it_bseg-augdt
OUTPUT_FORMAT = '01'
IMPORTING
YEARS =
MONTHS =
DAYS = i_day
EXCEPTIONS
INVALID_DATES_SPECIFIED = 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.
ENDIF.
*added by sunil 5.11.07 ***********
*read table it_intitit with key BELNR_TO = BSEG-BELNR .
*LOOP AT IT_INTITIT.
rf140-element = '521'.
CALL FUNCTION 'write_form'
EXPORTING
window = 'main'
element = '521'
EXCEPTIONS
window = 1
element = 2.
IF sy-subrc = 1.
window = 'main'.
PERFORM message_window.
ENDIF.
IF sy-subrc = 2.
window = 'main'.
ereignis = '521'.
PERFORM message_element.
ENDIF.
IF save_xumstn IS INITIAL.
*-------Umsatzsteuer -
IF xactiv IS INITIAL.
save_waers = rf140-waers.
PERFORM tax_data.
CLEAR taxlines.
DESCRIBE TABLE atax LINES taxlines.
IF NOT taxlines IS INITIAL.
LOOP AT atax.
CLEAR ereignis.
CLEAR rf140-msatz.
CLEAR rf140-vtext.
rf140-msatz = atax-msatz.
*rf140-msatz = atax-msatz.
rf140-vtext = atax-vtext.
*rf140-vtext = atax-vtext.
*******begin of change by karthikeyan on 10.03.06*********************
IF sy-tabix = '1'.
ereignis = '522'.
v_stax = rf140-msatz * rf140-gsaldf / 100.
ELSE.
ereignis = '523'.
v_ecs = rf140-msatz * v_stax / 100.
v_total = rf140-gsaldf + v_stax + v_ecs.
ENDIF.
CALL FUNCTION 'hr_in_chg_inr_wrds'
EXPORTING
amt_in_num = v_total
IMPORTING
amt_in_words = v_spell
EXCEPTIONS
DATA_TYPE_MISMATCH = 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.
ENDIF.
***************************end of change******************************
CLEAR rf140-element.
rf140-element = ereignis.
IF NOT ereignis IS INITIAL.
CALL FUNCTION 'write_form'
EXPORTING
window = 'main'
element = ereignis
EXCEPTIONS
window = 1
element = 2.
IF sy-subrc = 1.
window = 'main'.
PERFORM message_window.
ENDIF.
IF sy-subrc = 2.
window = 'main'.
PERFORM message_element.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
'521' is the element name in the main window where i should display the values. before select qurey the values are coming in the bseg but not in table INTITIT. Belnr is the document no with ref to that
there are number of invoices nos. so in both the tables it is selecting single value and displaying but in bseg the invoice number is getting refreshed and new number is coming in that place i.e in field bseg-rebzg but in INTITIT in belnr only it is taking single value it is not getting refreshed.
move-corresponding hbseg to bseg.
*bseg = bseg.
if bkpf-waers ne *bkpf-waers.
this is the syntax whr the values in bseg are getting refresh and new invoice number is selecting.
How to write the syntax for INTITIT? As per invoice number it is giving new values.
The invoice number in Bseg is different campare to in table INTITIT. in output is shoud show the fields as follows
it_besg-rebzg(invoice number of besg) it_besg-zuonr(invoice date) INTITIT-INT_BASAMT(base amount) i_day (no of days ) INTITIT-INT_BEGIN (INTREST START DATE) INTITIT-INT_end(INTREST END DATE) rf140-wrshb(INTREST AMOUNT).
THE VALUE OF IT_BESG-REBZG IS CHANGING BUT THE VALUE IN INTITIT-BELNR ( INVOICE NUMBER) IS NOT CHANGING THAT IS WHY IT IS SHOWING
ONLY SINGLE RECORD.
for both the table documet no is same. in besg-belnr is the document no. in intitit-BELNR_TO is the document no.
here in bseg-rebzg is chaning but in INTITIT-BELNR IS not changing.
If i take loop at INTITIT. ALL the values are repating so i am unable to take loop. so i want to write
a syntax such that intitit-belnr should be refreshed and also for every loop it shoud take new invoice no.
Please help me out it is very urgent.
<b>USEFUL ANSWERS WILL BE REWARDED.</b>
regards,
Sunil kumar.assumption: some mistake in ur posting that, How belnr and date r same for both header records, so i guess, either one is different.
try with AT NEW - ENDAT.
AT NEW belnr.
here use looping, READing of ur itabs.---> so, u need to build couple of itabs to move forth and back.
ENDAT.
pls. note that, when u use this AT NEW all the CHAR fileds of itab wuld show as STARS **.....so, this is the necessity behind building new itabs.
thanq
Edited by: SAP ABAPer on Dec 30, 2008 6:24 PM
Maybe you are looking for
-
IMac loses connection to network when waking from sleep
Hi There, We are a small mixed environment of Macs and PCs running on a Windows 2008 domain. One of 2 iMacs that now run Mountain Lion 10.8.5 is having problems when waking from sleep. One of our designers will go for lunch and the machine will sleep
-
Please help: my website does not display properly in firefox
(note) everything works fine clientside I'm totally new here but I really really need help debugging my website. The problem is I have a flash file the loads an xml file to display pictures. Basicallly a gallery. It works in IE but not Firefox and I
-
Photo keeps showing up in different locations
Among the glitches that I am finding, the one and only photo on my home page will not stay where it is supposed to be. My husband can apparently see it just fine in Internet Explorer, but here at home both Safari and Firefox show the photo at the bot
-
In report program, how can i get the default screen values as current month's low and high values as sy-datum will only give current date. i. e. suppose today it is dec 30 then, default low value should show dec 01 and high should show dec 31. please
-
Java.lang.OutOfMemoryError when click on the "performance" tab in dbconsol
THis is 10.2.0.3 DB on Oracle-Linux Rel5. I got the error "java.lang.OutOfMemoryError" in "emoms.log" whenever I click on the "performance" Tab in DBCONSOLE. The rest of the dbconsole features is working fine. Please help... Thanks!