Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Summing up data from a table not joined in SQ02

Former Member
0 Kudos
366
  • SAP Managed Tags:

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

1 REPLY 1

Former Member
0 Kudos
207
  • SAP Managed Tags:

Found the answer myself.