Skip to Content
0

Select trouble in SQ02

Feb 19, 2017 at 10:15 AM

58

avatar image
Former Member

Hi, I am struggeling with some code in SQ02.

I have made a report showing all Frame Agreements (EKKO). I have calculated the line value and the committed value (PO's created to agreement - EKPO).

Now i want to calculate what's delivered of the committed value (EKBE).

My code do not return any value from EKBE, even thou i now there is a value. I found that

Here is my code :

Check EKKO-BSTYP = 'K'.
Check EKKO-LOEKZ = ''.

CLEAR TVALUEDC.
CLEAR TVALUELC.
CLEAR LVALUEDC.
CLEAR LVALUELC.
CLEAR CVALUEDC.
CLEAR CVALUELC.
CLEAR DVALUEDC.
CLEAR DVALUELC.

SELECT SINGLE SUM( EFFWR ) AS LINETOTAL
FROM EKPO INTO LVALUEDC
WHERE EBELN = EKKO-EBELN AND
LOEKZ = ''.

DATA: I_EKPO TYPE STANDARD TABLE OF EKPO WITH HEADER LINE,
I_EKBE TYPE STANDARD TABLE OF EKBE WITH HEADER LINE.

SELECT * FROM EKPO INTO TABLE I_EKPO
WHERE KONNR = EKKO-EBELN
AND LOEKZ = ''.

LOOP AT I_EKPO.
CVALUEDC = CVALUEDC + I_EKPO-EFFWR.
ENDLOOP.

LOOP AT I_EKPO.
SELECT * FROM EKBE INTO TABLE I_EKBE
WHERE EBELN = I_EKPO-EBELN AND
EBELP = I_EKPO-EBELP AND
BEWTP = 'E'.
ENDLOOP.

LOOP AT I_EKBE.
IF I_EKBE-SHKZG = 'S'.
DVALUEDC = DVALUEDC + I_EKBE-WRBTR.
DVALUELC = DVALUELC + I_EKBE-DMBTR.
ELSE.
DVALUEDC = DVALUEDC - I_EKBE-WRBTR.
DVALUELC = DVALUELC - I_EKBE-DMBTR.
ENDIF.
ENDLOOP.

TVALUEDC = EKKO-KTWRT.
TVALUELC = TVALUEDC * EKKO-WKURS.
LVALUELC = LVALUEDC * EKKO-WKURS.
CVALUELC = CVALUEDC * EKKO-WKURS.

Anyone who can help me?

Solve

SQL
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Mar 13, 2017 at 03:05 PM
0

Solved by myself

Share
10 |10000 characters needed characters left characters exceeded