2015 Jul 18 10:37 AM
Hi,
Could anyone let me know how to achieve below functionality,
Select Node1, (Node2 * 10) into table lt_node from Ztable.
Note: Here Ztable has more than 30K records and I need to select all the records.
Regards,
Raghu.
Hi,
Could anyone let me know how to achieve below functionality,
Select Node1, (Node2 * 10) into table lt_node from Ztable.
Note: Here Ztable has more than 30K records and I need to select all the records.
Regards,
Raghu.
2015 Jul 18 1:19 PM
Hi Raghu,
You have to use native sql to achieve your requirement.
It is better you process the internal table as per your requirement and avoid native sql.
2015 Jul 18 1:30 PM
Hello Raheem,
For of all Eid Mubarak !!!
Thanks for your reply. I have been trying native SQL but am getting dump saying 102 error. Will the native SQL depend on DB of my server, we use Oracle DB..
Regards
Raghu
2015 Jul 18 2:15 PM
Hello Raghu, Raheem,
I wish you Eid Mubarak .
Could you post your code please.
Regards
Ibrahim
2015 Jul 18 5:44 PM
Hi,
You can check this sample code for native Oracle Sql for Multiply
TYPES: BEGIN OF ty,
id TYPE N,
description TYPE C LENGTH 50,
amount type i,
END OF TY.
DATA: WA type TY,
itab type STANDARD TABLE OF ty.
EXEC SQL.
CONNECT TO 'MYCONNECTION'
ENDEXEC.
EXEC SQL.
OPEN C FOR
SELECT ID, DESCRIPTION, NVL(AMOUNT,0) * 10
FROM TEST
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT C INTO :wa
ENDEXEC.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND wa TO itab.
ENDDO.
EXEC SQL.
CLOSE C
ENDEXEC.
EXEC SQL.
DISCONNECT :'MYCONNECTION'
ENDEXEC.
LOOP AT ITAB INTO WA.
WRITE: / WA-ID, WA-DESCRIPTION, WA-AMOUNT.
ENDLOOP.
2015 Jul 18 6:08 PM
Hi Abdul,
could you please provide another example with loop , just to avoid native sql?
2015 Jul 18 6:15 PM
hi Ibrahim,
I don't think there is any other method to multiply field.
In Open SQL it is not possible and therefore you have to process internal table only.
In Native SQL only it is possible as per above demo code.
If you find any other method then please share.
thanks.
2015 Jul 20 8:39 AM
Could you please give me another example with actual SAP table and fields
Regards
Raghu
2015 Jul 20 3:03 PM
Hi Raghu,
This is another example using SAP table Mara.
Only connection with the schema SAPSR3 is important.
TYPES: BEGIN OF ty,
MATNR TYPE MATNR,
BRGEW TYPE BRGEW,
END OF TY.
DATA: WA type TY,
itab type STANDARD TABLE OF ty.
EXEC SQL.
CONNECT TO 'MYCONN2'
ENDEXEC.
EXEC SQL.
OPEN C FOR
SELECT MATNR, NVL(BRGEW,0) * 1000
FROM MARA
WHERE ROWNUM <= 20
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT C INTO :wa
ENDEXEC.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND wa TO itab.
ENDDO.
EXEC SQL.
CLOSE C
ENDEXEC.
EXEC SQL.
DISCONNECT :'MYCONN2'
ENDEXEC.
LOOP AT ITAB INTO WA.
WRITE: / WA-MATNR, WA-BRGEW.
ENDLOOP.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |