In the Screen Painter, I'm trying to add fields from table KNA1 declared globally in my program:
TABLES: VBAK, VBAP, KNA1.
What shows up in the program fields list are the fields from table VBAP assigned to table KNA1 The fields specific to KNA1 are not in the list.
In real life, there is no VBELN field in table KNA1, however there should be a KUNNR field.
How to fix this bug ?
Related
I have two tables with millions of rows in postgres. I wanted to move records from one table to another.
Table name - event
List of columns:
"id"
"url"
"parent_id"
"created"
"created_by"
"last_modified"
"last_modified_by"
"tags"
"type"
"sub_type"
"category"
"name"
"preference"
Table name - preference
List of columns:
"id" - If the entity_type is event, id column in the event table goes here
"entity_type" // event or slot.
"preference"
"created"
"created_by"
"last_modified"
"last_modified_by"
"parent_entity_id"
And these tables are already populated with millions of data. And I have added a new column named preference in the event table, which does not have any data.
Now, I wanted to move the
preference table preference column data to the event table preference column.
Condition:
Migrating the data from the preference column (In preference table) to the preference column (In event table) only when the entity_type is an event. And the insert should
happen with the corresponding row in the event table.
I tried this query, but this seems to be incorrect. And Postgres throws a syntax error.
insert into <schema_name>.event a (preference) where a.id = '<eventId goes here>' (select preference from <schema_name>.preference where entity_id = '<eventId goes here>'
and entity_type = 'event')
You should use update instead of insert, because the table is already populated with data.
update event e
set preference = (select preference from preference p where p.entity_id = e.id and entity_type = 'event')
I created a structure in SE11 with the following columns:
column name type (data element)
----------- -------------------
mandt mandt
itemdesc arktx
quantity lfimg
tweight gsgew
I created a table type ZPACK_DETAIL in SE11 whose line type is the structure above.
Then I used the code below to declare an internal table and fill it with data from the database table:
DATA : dresult TYPE zpack_detail .
SELECT arktx lfimg ntgew
FROM lips AS detail LEFT JOIN marm AS material
ON detail~matnr = material~matnr
LEFT OUTER JOIN vbak
ON detail~vgbel = vbak~vbeln
INTO TABLE dresult
WHERE detail~vbeln = '001'.
The activation reports this warning message:
The data type of the component ITEMDESC of DRESULT is not compatible with the data type of LFIMG.
Can someone give me a hint what's wrong? Is there something wrong with the way I'm declaring the internal table?
In fact there are couple of issues with your code.
You have to declare your variable as an internal table. ZPACK_DETAIL is a structure table and not a table type.
DATA: dresult TYPE STANDARD TABLE OF zpack_detail WITH EMPTY KEY.
Second of all. You should not use MANDT field as your query is not client indepentent. Remove this field from your structure or use INTO CORRESPONDING FIELDS OF TABLE and adjust your projection to SELECT arktx AS itemdesc lfimg AS quantity ntgew AS tweight.
can someone tell me how to write a statement to get all the fields of a database table instead of creating a work area with each field name of database table?
DATA gt_dd03l TYPE STANDARD TABLE OF dd03l INITIAL SIZE 0.
SELECT * FROM dd03l "Table Fields
INTO TABLE gt_dd03l
WHERE tabname = 'table name'.
You can do the following:
* define Table type of Business Partner Table BUT000
data: lt_table type table of but000 .
* Create Structure of the corresponding table type
data: ls_table like line of lt_table .
I have table named ´cities´ with 3 columns named:
state, name, pop
And a table cities1 with:
state, name
The columns state and name are common for both tables. I want the column pop alone from cities to be inserted in cities1 table.
How this can be done using postgreSQL?
First you need to add a column pop of specific type to your cities1 table, and then fill it.
ALTER TABLE cities1 ADD COLUMN pop [datatype here]
Update pop column in table cities1 with values from cities where state,name are the common columns.
UPDATE cities1
SET pop = cities.pop
FROM cities
WHERE cities1.state = cities.state
AND cities1.name = cities.name
In Oracle Apex, I created a FORM with Master Detail Form. There are two table which are "ORDER" and "ORDERLINE" table. It works fine. I can press Add Row button on ORDERLINE form for orderline details.
Problem:
I forgot to put a "TYPE" column when I created the ORDERLINE table, so the ORDERLINE table is missing a Column Field "TYPE". So I used alter command to add "TYPE" column into ORDERLINE table successful. and then I went back to Apex application, i attempted to change SQL clause on ORDERLINE form. When I pressed "Apply Change", i got below error message.
Error Message:
Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing.
ORA-00918: column ambiguously defined
Before SQL Clause:
select
"SL_ID",
"ORD_ID",
"CW_SALESLINE"."INV_ID",
"QUANTITY",
"QUANTITY" * "PRICE" AS Amount
from "#OWNER#"."CW_SALESLINE" , "#OWNER#"."CW_INVENTORY"
where "CW_SALESLINE"."INV_ID" = "CW_INVENTORY"."INV_ID" AND "ORD_ID" = :P11_ORD_ID
After SQL Clause:
select
"SL_ID",
"ORD_ID",
"CW_SALESLINE"."INV_ID",
"TYPE",
"QUANTITY",
"QUANTITY" * "PRICE" AS Amount
from "#OWNER#"."CW_SALESLINE" , "#OWNER#"."CW_INVENTORY"
where "CW_SALESLINE"."INV_ID" = "CW_INVENTORY"."INV_ID" AND "ORD_ID" = :P11_ORD_ID
I just added "TYPE" inside SQL Statement.
The ORDERLINE TABLE added TYPE column by alter command. Anything i missed to do ?
I want that when I press Add Row button, the "TYPE" field appears for orderline inputting
ORA-00918: column ambiguously defined
A column name used in a join exists in more than one table and is thus referenced ambiguously. In a join, any column name that occurs in more than one of the tables must be prefixed by its table name when referenced. The column should be referenced as TABLE.COLUMN or TABLE_ALIAS.COLUMN.
So, just a wild guess:
Can't you have a TYPE column both in CW_SALESLINE and CW_INVENTORY? Maybe have you add that column to both tables by mistake? Anyway, that would explain the "ambiguously defined" error. The solution is to prefix the column name with the correct table name/alias.
Try that:
select
"SL_ID",
"ORD_ID",
"CW_SALESLINE"."INV_ID",
"CW_SALESLINE"."TYPE", -- or "CW_INVENTORY"."TYPE" not clear from your question
-- which table was modified
"QUANTITY",
"QUANTITY" * "PRICE" AS Amount
from "#OWNER#"."CW_SALESLINE" , "#OWNER#"."CW_INVENTORY"
where "CW_SALESLINE"."INV_ID" = "CW_INVENTORY"."INV_ID" AND "ORD_ID" = :P11_ORD_ID