/scripts/ahub.form.attachments.js
0

Summing up data from a table not joined in SQ02

Feb 17, 2017 at 10:42 AM

61

avatar image

Hi, I am rather new to ABAP, but have programmed in several other languages.

I have created a lot of reports in SQ02, but now i want to make one that shows just "Frame agreements" (EKPO - Contracts), on a top level (one line) and I am struggeling to get the “delivered value”.

I have calculated the lines of the contract as comparison to the contract value in the head. I have also added the value to all commitments (PO-lines, EKPO that have reference to the contract.

Now I want to calculate what’s delivered (Find EKPO where EKPO-KONNR = EKKO-EBELN and then sum up postings in EKBE where EKBE-EBELN = EKPO-EBELN and EKBE-EBELP = EKPO-EBELP)

I tried (which is obviously wrong) the code below, but I do not get any value in the delivery variable, even thou I know it has a delivered value:

DATA: i_EKPO TYPE TABLE OF EKPO,

i_EBELN TYPE EBELN,

i_EBELP TYPE EBELP,
i_KONNR TYPE KONNR.

SELECT * FROM EKPO INTO TABLE i_EKPOWHERE KONNR = EKKO-EBELN.

LOOP AT i_EKPO INTO i_EBELN.SELECT SINGLE SUM( WRBTR ) AS LINETOTALFROM EKBE INTO DVALUEDCP

WHERE EBELN = I_EBELN

AND EBELP = I_EBELP

AND BEWTP = 'E'

AND SHKZG = 'S'.ENDLOOP.

Can anyone help me get started?

B.R. Solve

bilde.png (13.5 kB)
SQL
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Solve Schau Mar 13, 2017 at 03:05 PM
0

Found the answer myself.

Share
10 |10000 characters needed characters left characters exceeded
Skip to Content