WBS Requested budget and Approved Budget - abap

I need some help with WBS,
I must to display TOTAL REQUEST and APPROVED BUDGET for WBS Element, but I don't find the needed fields in DB tables, but I know that this values can be updated in transaction CJ30, CJ32 or CJ40. Somebody know which fields in which tables store this information?

Please have a look at the table BPGE (total values for budget), it should contain the information you are looking for. You can get the key field OBJNR for your WBS element from table PRPS.

Related

How to create a relationship where all columns have many details

I am working in a small personal project about capital expenses. There is one part I can't figure it out.
The tables i have are the following:
capex_form
capex_cashflow
When I create a capex_form I am able to request money and divide this money however I want in 13 months including this month (to show how I I will pay it in the next year). this will reflect in capex_cashflow who has 13 columns with either an amount or 0.
The problem comes here:
I need to be able to add many descriptions for each payment. For example:
in July 2019 I will spend 200 ( this is done), I need to enter a breakdown of this 200 dollars and a description. 50 dollars on one thing and 150 on another thing.
I added 3 columns per month which works, But then it will only let me add one description per month.
I was thinking I might be able to create another table for description, but how this is going to related to a specific column(month). As far as my brain gives, you relate one table with another table not column.
I also was thinking to create 13 tables for 13 months, but I think there should be something I am missing to avoid to create 13 unnecessary tables.
I appreciate any kind of help or guidance
This is pretty straightforward and a common thing.
Put an index column in the "header" table. The header table is a summary of the information, so in your case may you create a table that just takes the capex_income.
CAPEX_FORM
Capex_id
Capex_Amount
Then create a payment table, the payment table can have a month column (only 1) and a capex_Id column, along with a description or whatever else you need
CAPEX_PAYMENT
Capex_payment_id
Capex_id
Payment_Amount
Month (1-13)
Description
Now because you have the Capex_id in this table, it will be related to the CAPEX table and you will be able to query all the payments that are associated like so
select payment_amount, month, description from capex_payment p join capex_form f on p.capex_id = f.capex_id

Window function for unique rows in SQL Server

I have a table like below
The main idea is to get the amount of each channel for each orderID.
If the channel is repeating for Id, it should take the amount only once and rest would be null.
The result should look like below
I want to do the same logic for country and source as well. If I do the pivot it should only give unique amount value for each ID on Channel, Source and Country basis and repeated value should be NULL.I have a very big data set and tough to do it in Excel
How can I do this in SQL Server? Is there any window function? Can anyone please help me?
Thanks in advance

Count Distinct Records and

I have a very large database and I need to extract information from 3 columns:
I am trying to determine how many unique customers the user is processing.
Username. This is unique name.
CustomerNumber. A customer number will appear on many lines, as they could have ordered many products and each product is a line.
Date Range. I need to be able to define a date range.
The code I am tried and searched is counting the customer numbers, but not just the distinct customer number.
I have not tried the date range as yet.
I have attached 2 images to show an example of the database and the end result. We used a pivot table to produce this result, but the data changes all the time and we dont want to create a pivot table the whole time.
Image of Sample Data in Excel:
Image of Required Final Result
SELECT `'All data$'`.Username, Count(`'All data$'`.CustomerNumber)
FROM `C:\Users\rhynto\Desktop\Darren Qwix\QWIX_PICKED.xlsx`.`'All data$'` `'All data$'`
GROUP BY `'All data$'`.Username
I will appreciate any advice on this please.

How do I show a field count in another table?

I am new to SQL and trying to learn by doing some beginner exercises. I'm working in Visual Studio.
I have one table with some Theater shows including Receipt ID, SeatRow and SeatNumbers.
I have another table consisting of Phone Numbers, Receipt IDs and TheatherShow IDs.
Now I want to make a third table showing how many seats are tied to each Receipt ID.
I've been trying to do this:
Update Table_Seat_Count
set Seat_Count = Count(Seat_Number) FROM Plads
WHERE ReceiptID = ReceiptID
Setting the Seat_Count equal to the number of seats where the ReceiptID is the same within the two tables.
Hope you can help me, thanks in advance.
You need a sub-select:
Update Table_Seat_Count
set Seat_Count = (select Count(Seat_Number) FROM Plads
WHERE Plads.ReceiptID = Table_Seat_Count.ReceiptID)
But in general it's a good idea to never store computed values. (If Plads is updated, and Table_Seat_Count isn't you've got inconsistent data...) Views are great, with them you'll always have consistent data!

Creating a trigger to count the total price of a bill

I have these tables in my restaurant database:
PRODUCT, ORDER, AND BILL(you may find them in the attached picture)
i want to create a trigger to count the total amount of the bill(i can count it by selecting sum(O_Quantity * P_Price)).
Actually i want it after inserting the ORDER's data(the order table should be empty, but i entered some data to help in understanding the question)
I do appreciate your help
thx