on 2016 May 04 1:11 PM
Hi all,
I'm trying to create a new field that will be calculated sum totals from table FMIOI .
please find attached script:
clear : sum_order .
select sum(fkktr)
from fmioi into sum_order
where
WRTTP = '83' .
i'm getting null's .
thanks from advance.
Roy
Hi Roy,
Can you try the following SQL statement?
For example----------
select sum(fkktr)
into table sum_order
from fmioi
where WRTTP = '83'
---------------------
SELECT statement
http://dcx.sap.com/index.html#sqla170/en/html/3be640936c5f10149013d54460eaabb0.html
INTO clause
Following are the three uses of the INTO clause:
INTO hostvar-list clause
This clause is used in Embedded SQL only. It specifies where the results of the SELECT statement go. There must be one host variable item for each item in the select-list. select-list items are put into the host variables in order. An indicator host variable is also allowed with each host variable, so the program can tell if the select-list item was NULL.
If the query results in no rows being selected, the variables are not updated, and a row not found warning appears.
INTO variable-list clause
This clause is used in procedures and triggers only. It specifies where the results of the SELECT statement go. There must be one variable for each item in the select-list. select-list items are put into the variables in order.
INTO table-name clause
This clause is used to create a table and fill it with data.
For tables to be created, the query must satisfy one of the following conditions:
-The table-name is a temporary table name or is specified as owner.table-name.
-The select-list contains a * ore more than one item.
To create a permanent table with one column, the table name must be specified as owner.table.
This statement causes a COMMIT before execution as a side effect of creating the table. No privileges are granted on the new table: the statement is a short form for CREATE TABLE followed by INSERT...SELECT.
Tables created using this clause do not have a primary key defined. You can add a primary key using ALTER TABLE. A primary key should be added before applying any updates or deletes to the table; otherwise, these operations result in all column values being logged in the transaction log for the affected rows.
INTO LOCAL TEMPORARY TABLE
This clause is used to create a local, temporary table and populate it with the results of the query. When you use this clause, it is not necessary to start the temporary table name with #.
INTO TABLE table-name
This clause always creates a table and populates it with the results of the query. The INTO TABLE clause behaves the same way as the INTO table-name clause, with the exception that the query does not need to satisfy the select-list conditions of the INTO table-name clause.
INTO VARIABLE variable-list
This clause specifies where the results of the SELECT statement go. The values returned by the query are assigned to the fields of the row variable in order.
If there is a single item in the INTO clause and multiple items in the select-list, then the single item is interpreted as a row variable and the returned column values are assigned to the fields of the row variable in order. If the INTO clause contains more than one item, then the INTO variable-list semantics are applied.
Thanks,
Atsushi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Roy,
is it FKBTR (not FKKTR) you are talking about? If so, Please do take care of the fact that it is a CURRENCY field.. so sum_order should be declared of appropriate abap datatype.
Data Types in the ABAP Dictionary - ABAP Programming (BC-ABA) - SAP Library
Hope this solves your issue.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
11 | |
10 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.