2009 Jun 05 7:27 AM
Hi Experts !!
In SAP QUERY I am getting the PO with all delivey dates & deliveried Qty but I have to select only single PO with latest delivery date & qty. If there r more than one record for latest delivery date than deliveried QTY must be sum of all QTY (for the latest delivery date). for example :
this is coming
Po delivery date qty
10001 30.06.2009 4
10001 30.06.2009 5
10001 01.05.2009 4
we want
Po delivery date qty
10001 30.06.2009 9
Thanks in advance.
Thanks & Regards
Navneet Singhal
2009 Jun 05 7:42 AM
Open the transaction SQ02, give the infoset name and click on change button.
click on the EXTRAS button, and under the CODE tab select the event and write your logic in the down.
Thanks,
Srinivas
Open the transaction SQ02, give the infoset name and click on change button.
click on the EXTRAS button, and under the CODE tab select the event and write your logic in the down.
Thanks,
Srinivas
2009 Jun 05 7:37 AM
Hi Navneeth,
Selection depends on your where clause,
so please can you post your query to help u out,,
Here is a sample method,
DATA : P_WADAT TYPE LIKP-WADAT.
SELECT MAX(WADAT) INTO P_WADAT FROM LIKP.
SELECT VBELN WADAT LFIMG INTO (VBELN, DATE, QTY) WHERE WADAT EQ P_WADAT AND VBELN EQ VBELN.
IT_FINAL-QTY = IT_FINAL-QTY + QTY .
IT_FINAL-VBELN = VBELN.
IT_FINAL-DATE = DATE.
CLEAR : VBELN, DATE, QTY.
ENDSELECT.
2009 Jun 05 7:42 AM
Open the transaction SQ02, give the infoset name and click on change button.
click on the EXTRAS button, and under the CODE tab select the event and write your logic in the down.
Thanks,
Srinivas
2009 Jun 05 8:01 AM
Thanks Srinivas !
There is an internal table %G00 in query generated program (AQCSZPCWMM======Z_PCW_ORDER_V2) when I use this table in Code section (END-OF-SELECTION ) system thro msg %G00 is not defined . if I define this table in DATA section than run the query , It gives the DUMP with error %G00 is already decleared.
How can I use %G00 internal table in my code section.
Kindly suggest.
Thanks & Regards
Navneet Singhal
2009 Jul 21 1:41 PM
hi Navneet,
did you got answer to your question (%g00 defined in query code....), if yes then could you please share with me.
thanks & regards,
Hari Krishna.K
2009 Aug 25 2:52 PM
>
> There is an internal table %G00 in query generated program (AQCSZPCWMM======Z_PCW_ORDER_V2) when I use this table in Code section (END-OF-SELECTION ) system thro msg %G00 is not defined . if I define this table in DATA section than run the query , It gives the DUMP with error %G00 is already decleared.
>
> How can I use %G00 internal table in my code section.
I have the same problem as the OP. I need to get rid of the duplicates and have all sumarized in just one row. I was thinking about this same solution, but when I add code to the END-OF-SELECTION event, this doesn't appears anywhere (but if I add code to any calculated field, yes).
And the problem of the quoted message. I tried using field-symbols but I have errors saying that it's nos a valid table, etc...
Any ideas???
Thanks!!!
2009 Jun 05 10:11 AM
Hi,
The folowing code will help you.
TABLES: EKPO.
DATA : P_WADAT TYPE EKPO-AEDAT ,
P_EBELN TYPE EKPO-EBELN VALUE '3000000004',
X LIKE EKPO-AEDAT,
Y LIKE EKPO-EBELN,
Z LIKE EKPO-MENGE,
M LIKE EKPO-AEDAT.
SELECT MAX( AEDAT ) INTO EKPO-AEDAT FROM EKPO WHERE EBELN = P_EBELN.
M = EKPO-AEDAT.
SELECT SUM( MENGE ) EBELN AEDAT INTO (Z, Y, X) FROM EKPO WHERE AEDAT EQ M AND EBELN EQ P_EBELN GROUP BY MENGE EBELN AEDAT.
ENDSELECT.
Z gives the sum of quantity.
Aswarth
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |