2013 Jul 17 5:24 AM
hi guru
i have a problem, I explain the situation:
I created a query with this additional field (see coding below), the query is based on customer orders, in this field is calculated, the sum of qty shipped, for each position of sales order (from tables LIPS), for this purpose it's all right.
Now, I would like to add in the code, the ability to select only the qty shipped, For this reason, I would like to include in the filter field LIKP-WADAT_IST, how can I do?
I can not add in the current code, a header field of the table LIKP ... help, thanks in advance
TABLES LIPS.
CLEAR QTASPE.
SELECT * FROM LIPS
WHERE VGBEL = VBAP-VBELN
AND VGPOS = VBAP-POSNR.
IF ( sy-dbcnt NE '0').
ADD LIPS-LFIMG TO QTASPE.
ELSE.
MOVE '' TO QTASPE.
ENDIF.
ENDSELECT.
2013 Jul 17 7:27 AM
Why dont you use join? also instead of selcting all fields,select only required field. Try the following code:
SELECT LIPS~LFIMG FROM LIPS INNER JOIN LIKP
on LIPS~VBELN = LIKP~VBELN
WHERE VGBEL = VBAP-VBELN
AND VGPOS = VBAP-POSNR and LIKP~WADAT_IST ne '00000000'..
IF sy-subrc = 0.
ADD LIPS-LFIMG TO QTASPE.
ENDIF.
ENDSELECT.
2013 Jul 17 1:21 PM
hi
I'm sorry, but it gives me this error:
"Field list without INTO clause is not allowed"
2013 Jul 17 3:19 PM
Checking sy-subrc within a SELECT... ENDSELECT loop doesn't do anything. If your in the loop, sy-subrc is always zero.
2013 Jul 17 3:18 PM
You are using the TABLES statement to define a work area. You are also using an obsolete form of the SELECT statement. Thirdly, since you check sy-dbcnt within the loop, it will never be zero if the loop executes, so your ELSE clause will never run.
Far better to use:
DATA: s_lips TYPE lips.
SELECT * INTO s_lips FROM lips...
2013 Jul 18 7:22 AM
unfortunately I can not solve, please show me the code in detail.
thanks so much