Updating a field from info from another table
I am trying to update a field in a table by the data from another lookup table. These tables have to be linked by two columns, not just one. It seems like I have to use a sub query to extract data from the lookup table. I am unable to get a correct syntax for the SQL statements.
Does anyone has any ideas??
UPDATE table_B t2 SET t2.col1 = (SELECT t1.col1 FROM table_A t1 WHERE t1.col2 = t2.col2 AND t1.col3 = t2.col3);
table_B is the table whose col1 needs to be updated with col1 of table_A. The join conditions are two (with col2 and col3)
Hope this is what you are looking for!!
Cheers
r@m@
Similar Messages
-
Updating a date field witha field from another table
Hi friends
I have a table called Customer_Type with following fields
Customer_type ,Active_date, Inactive_date
regular,11/01/2011
daily,11/04/2011
monthly,11/05/2011/11/11/2011
Tbale 2:Customer
Customer_name,Customer_type,Customer_Inactive_date
John,regular,
James,monthly,
Jake,daily,
Jill,monthly
What i wnat is to update the Customer_inactive_date with the Incative_date field from Customer_type
based on their Customer_type... So james and Jill would have their rows updated in this scneario ..How can i achive this in pl/Sql
Thank you in advance...Hi,
You can look at this code; it's not PL/SQL but a simple MERGE statement:
CREATE TABLE CUSTOMER_TYPE
type_code VARCHAR2(10),
active_date DATE,
inactive_date DATE
INSERT INTO customer_type VALUES('REGULAR', TO_DATE('11/01/2011', 'DD/MM/YYYY'), null);
INSERT INTO customer_type VALUES('DAILY', TO_DATE('11/04/2011', 'DD/MM/YYYY'), null);
INSERT INTO customer_type VALUES('MONTHLY', TO_DATE('11/05/2011', 'DD/MM/YYYY'), TO_DATE('11/11/2011', 'DD/MM/YYYY'));
CREATE TABLE CUSTOMERS
customer_name varchar2(10),
customer_type varchar2(10),
customer_inactive_date DATE
INSERT INTO customers VALUES('John', 'REGULAR', null);
INSERT INTO customers VALUES('James', 'MONTHLY', null);
INSERT INTO customers VALUES('Jake', 'DAILY', null);
INSERT INTO customers VALUES('Jill', 'MONTHLY', null);
MERGE INTO customers dst
USING customer_type src
ON (dst.customer_type = src.type_code)
WHEN MATCHED THEN
UPDATE set dst.customer_inactive_date = src.inactive_date;
SELECT * FROM customers;
CUSTOMER_NAME CUSTOMER_TYPE CUSTOMER_INACTIVE_DATE
John REGULAR
James MONTHLY 11-NOV-11
Jake DAILY
Jill MONTHLY 11-NOV-11 If you don't understand it, just let me know... -
Set Default Value based on Field from another table for a custom object
I'm trying to set the default value on a custom object field to the value of an account field. I have tried the syntax 50 different ways, and just am getting no where. The account field label displays as DBA, the integration tag is ltDBA_ACCT, and it shows up in reporting fx area as Account.Text_22.
The custom object field I'm triying to update is also called DBA, which was originally the "NAME" required field. Does the table name, Account, have to be included? Do I need a function in front of the field?
I have been updating the external ID using the row ID with syntex <ID> (Less than ID greater than) so I know it is possible to set the Default Value, but <DBA>, <ltDBA_ACCT>, "Account"."DBA", and so on just don't not work.
If anyone knows how to enter this I'd really appreciate the help.Ok, so if you want to default a field to the value from another object, you have to use the JoinFieldValue function. I think you understand that, based on your original post, but I want to be sure that you do.
Next, this will only work as a default if the record is created from the object that you wish to join on because a default works at record creation and the ID needs to be available for it to work properly. It will not work if you choose the related object record after the custom object record is created. You could set the value as a post-default, but that does not seem to meet your requirements.
The syntax for the Default Value would be as follows: JoinFieldValue(ref_record_type, foreign_key, field_name).
In your case, ref_record_type is '<Account>', foreign_key is [<AccountId>], and field_name is '<YourFieldName>'. The best way to determine what the field name is would be to create a new workflow for Account and use the Workflow Rule Condition expression builder to pick your field ("DBA") from the list. The value that is returned by the expression builder should be placed in the field_name variable in the JoinFieldValue function (minus the brackets and in single quotes).
Give this a shot and let me know how you do.
Thom -
UPDATING A TABLE WITH SAME INFO FROM ANOTHER TABLE ON THE SAME DB
0down votefavorite
I am trying to update a table with info from another table on the same db with same table name. I just want the info to be the same , no primary key or constraint involve just a straight replacement of records and I keep getting errors WITH THE TABLE not
being recignize. below is my query:
UPDATE
VNDFIL
SET EOBTYP
= VNDFIL.EOBTYP,
EDI_X12_835_VERSION = VNDFIL.EDI_X12_835_VERSION
FROM
AGERECOVERY
WHERE
VNDFIL.EOBTYP
= VNDFIL.EOBTYP
AND
VNDFIL
.EDI_X12_835_VERSION
= VNDFIL.EDI_X12_835_VERSIONHi rotary,
If those two same named tables are in the same database then they have to be in different schemas. If you mean they are in the same server instance, then they may be in different databases, besides the "table not being recognized" error,
anyway you should use the fully qualified table names, that is database.Schema.Table(If across instances, ServerName should be prefixed) to avoid the table unrecognized error.
Using Identifiers As Object Names
With the fully qualified names, your update statement can be like below.
UPDATE
db1.schema1.VNDFIL
SET EOBTYP = srcTbl.EOBTYP, EDI_X12_835_VERSION = srcTbl.EDI_X12_835_VERSION
FROM
db1.schema2.VNDFIL srcTbl
WHERE
db1.schema1.VNDFIL.EOBTYP = srcTbl.VNDFIL.EOBTYP AND
db1.schema1.VNDFIL.EDI_X12_835_VERSION = srcTbl.VNDFIL.EDI_X12_835_VERSION
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
Update PRODH field from table T179T
hi,
i want to update PRODH field from table T179T into table VBRP. for this we
need to take selection option also.
selection option will be :
· Sales Organization (field VBRK-VKORG)
· Billing Date Range (VBRK-FKDAT)
· Distribution Channel (Vbrk-vtweg
while i have done this for one field by using hard code but like:
TABLES: VBRP.
CLEAR VBRP.
UPDATE VBRP SET PRODH = 'PLC01' WHERE VBELN = '0008300051'.
SELECT SINGLE * FROM VBRP WHERE VBELN = '0008300051'.
WRITE: VBRP-VBELN,VBRP-PRODH.
but this is not the right way. please guide me how to solve this.TABLES: VBRP.
CLEAR VBRP.
UPDATE VBRP SET PRODH = 'PLC01' WHERE VBELN = '0008300051'.
<b>commit work.</b>
SELECT SINGLE * FROM VBRP WHERE VBELN = '0008300051'.
WRITE: VBRP-VBELN,VBRP-PRODH.
use commit work after update statement.
But this code would make vbrp-vbeln as plc01 only.
If you want to get the prodh value from t179t, then write a sleect on t179t and then update.
TABLES: VBRP.
CLEAR VBRP.
select single prodh
from t179t
where......
UPDATE VBRP SET PRODH = t179-prodh WHERE VBELN = '0008300051'.
commit work.
SELECT SINGLE * FROM VBRP WHERE VBELN = '0008300051'.
WRITE: VBRP-VBELN,VBRP-PRODH. -
UPDATE SQL string substitution from another table
Hi - I've come across a tricky situation where I would want to update a column in all the relevant rows of a table with values obtained from another table WITHIN the same column update using string concatenation. im not getting any clean way of doing this.
The goal is to achieve something like this:
UPDATE table1 set col1 =
'LANG_ID=(%s),'||
'_CHALLENGE_RESPONSE_=(%s),'||
'CRDN_NAM=(%s),'||
'CLNT_MODE=(%s),'||
'PTY_ID=(%s),'||
'CRDN_VAL=(%s),' ||
'USER_TZ_COD=(%s),' ||
'GTS_USER_ID=(%s),'||
'SP_ID=(%s),' ||
'SP_ALIAS=(%s),' ||
'ORIG_CLNT_ID=(%s)'
where table1.col1 is null
and to substitute the (%s) with data from another table2*. An example is:
update table1 set col1=
'LANG_ID=(select LANG_ID from table2* where USER_ID = (select USER_ID from table1))' ||
'_CHALLENGE_RESPONSE_=((select CHALLENGERESPONSE_ from table2* where USER_id = (select USER_ID from table1)),' ||
etc for the rest of the valuesI tried this -although the database shows that the affected rows are updated! but querying the table doesn't show the values in the column!
select col1 from table1 where col1 is null
shows back the original content (DESPITE it showing me xxx rows updated!)
UPDATE table1 t1
SET col1 = (SELECT 'LANG_ID=('||lang_id||')_CHALLENGE_RESPONSE_=('||
CHALLENGERESPONSE_|| ...*
FROM table2 t2
WHERE t1.user_id = t2.user_id)
WHERE t1.col1 is null; -
Looping delete statement where table name is coming from another table
Hi All,
We have to write code to delete records from active tables of WDSO.We have 5 DSO so inspite of writing delete statement for each table we want to put all table names into one table and then loop through it .but we are getting error when we are refering that table field which has active table name.error is :
"dictionary structure or table is either not active or does not exist "
As per my understanding in a delete /select /insert /update statement we need to put table name (whose field we are refering ) it can't be replaced by a variable .
ex: v_table = 'EMPLOYEE' .
DELETE FROMv_table WHERE EMP_NAME = 'ABDC' .
is wrong and it must be like
ex : DELETE FROM EMPLOYEE WHERE EMP_NAME = 'ABDC' .
but we want to make our code dynamic .
Can you please suggest a way so that we can read the table names from another table and delete data based on some selection fom those tables .
I tried variants ,perform etc and even searched FM for the same but not found a solution .Your help will be greatly appreciated .
Thanks in advance .
Regards,
JayaHi,
You can change your statement as follows:
DELETE FROM (v_table) WHERE EMP_NAME = 'ABDC' .
However, I would not recommend this. There is a standard function module RSAN_ODS_DATA_DELETE which allows selective deletion - that should be a safer way to do this. You can -
FETCHING VALUES IN MULTI RECORD BLOCK FROM ANOTHER TABLE USING SELECT STATEMENT.
Hi,
I have one multi record block in which i want to fetch values
(more then one record) from another table using select statement
IN KEY NEXT ITEM.I am getting following error.
ORA-01422: exact fetch returns more than requested number of rows
Thanks in advance.In your case I see no reason to use non-database block and to try to populate it from a trigger with a query, instead of using the default forms functionality where you can associate the block and the fields with table, create where clause using bind variables and simply use execute_query() build-in to populate the block. The power of the forms is to use their build-in functionality to interact with the database.
Also, you can base your block on a query, not on a table and you dynamically change this query using set_block_property() build-in. You can use any dynamic queries (based on different data sources) and you simply need to control the column's data type, the number of the columns and their aliases. Something like creating inline views as a block data source.
However, you can replace the explicit cursor with implicit one like
go_block('non_db_block_name');
first_record();
FOR v_tab IN (SELECT *
FROM tab
WHERE col_name = :variable)
LOOP
:non_db_block_name.field1 := v_tab.col1;
:non_db_block_name.field2 := v_tab.col2;
next_record();
END LOOP; -
Getting description of product from another table
Hi,
I am getting the level from the user, and based on that creating an internal table. I am getting product code (PRODH) and level (STUFE) from one table (T179), and getting product description (VTEXT) from another table (T179T). I need to create a single internal table (PVS) with all three fields.
How do I do that? This may seem like a very simple question, but I have only been teaching myslef ABAP for about one week.
Once I can prepare this table, I will use a function to display it.
Regards,
Al Lal
Code:
REPORT YABHINAV16.
program to display products at chosen level *
Tables: T179, T179t.
types: begin of hierarchy,
prodh type t179-prodh,
vtext type t179t-vtext,
stufe type t179-stufe,
end of hierarchy.
data: pvs type standard table of hierarchy initial size 0.
select-options level for t179-stufe no intervals.
Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
select vtext from t179t into corresponding fields of table pvs where prodh = pvs-prodh.
sort pvs by prodh.Hi Just change the code accordingly...
Tables: T179, T179t.
types: begin of hierarchy,
prodh type t179-prodh,
vtext type t179t-vtext,
stufe type t179-stufe,
end of hierarchy.
types: begin of text,
prodh type t179t-prodh,
vtext type t179t-vtext,
end fo text.
data: pvs type standard table of hierarchy initial size 0.
data: it_text type standard table of text,
wa_text type text.
select-options level for t179-stufe no intervals.
start-of-selection.
Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
select prodh vtext from t179t into corresponding fields of table text for all entries in pvs where prodh = pvs-prodh.
end-of-selection.
sort pvs by prodh.
sort it_text by prodh.
loop at pvs.
read table it_text into wa_text with key prodh = pvs-prodh.
if sy-subrc eq 0.
pvs-vtext = wa_text-text.
endif.
modify pvs.
endloop.
Award Points If useful -
HI ALL,
I NEED FIELDS FROM VBFA TABLE
THE FIELDS I WANT IS :
CUSTOMER-ID
CUSTOMER NAME
CONTACT NAME
PROJECTID
ORDER NO
SALES MAN ID
ORDER PROCESS DATE
INVOICE DATE
GROSS AMOUNT
NET AMOUNT POSTAL CODE.
THANKS & REGARDS,
R.VINOD.Hi Vinod..
Try this Code. I made all the modifications in your code .. It will solve ur issues..
REPORT zsdr_omvsa40.
TYPE-POOLS
TYPE-POOLS: slis.
TABLE DECLARATIONS
TABLES : vbak, vbkd,
zzvbak,
kna1, vbrk, vbrp, knvp .
INTERNALTABLE DECLARATION *
DATA: BEGIN OF i_vbak OCCURS 0,
vbelv LIKE vbfa-vbelv, " Sales Order no
vbeln like vbfa-vbeln, "Invoice No
erdat LIKE vbak-erdat, " Date on Which Record Was Created
kunnr LIKE vbak-kunnr,
ps_psp_pnr LIKE vbak-ps_psp_pnr, " Work Breakdown Structure Element
END OF i_vbak.
*DATA : BEGIN OF i_zzvbak OCCURS 0,
*vbeln LIKE zzvbak-vbeln,
*zssidc LIKE zzvbak-zssidc, "Salesman ID
*END OF i_zzvbak.
DATA : BEGIN OF i_vbrk OCCURS 0,
vbeln LIKE vbrk-vbeln,
fkdat LIKE vbrk-fkdat, "Invoice Date
END OF i_vbrk.
DATA : BEGIN OF i_kna1 OCCURS 0,
kunnr LIKE kna1-kunnr , " Customer Number 1
name1 LIKE kna1-name1, " Customer Name
pstlz LIKE kna1-pstlz , " Postal Code
END OF i_kna1.
DATA : BEGIN OF i_vbrp OCCURS 0,
vbeln LIKE vbrp-vbeln,
aubel LIKE vbrp-aubel,
netwr LIKE vbrp-netwr , " Net Value in Document Currency
kzwi1 LIKE vbrp-kzwi1, " Subtotal 1 from pricing procedure for condition
erdat LIKE vbrp-erdat, "Billing document.
END OF i_vbrp.
DATA : BEGIN OF i_knvp OCCURS 0,
parvw LIKE knvp-parvw , " Partner Function
kunnr LIKE knvp-kunnr ,
parnr LIKE knvp-parnr , " Number of contact person
END OF i_knvp .
DATA : BEGIN OF i_data OCCURS 0,
erdat LIKE vbak-erdat, " Date on Which Record Was Created
vbeln LIKE vbak-vbeln, " Sales Order no
fkdat LIKE vbrk-fkdat, " Invoice date.
kunnr LIKE kna1-kunnr , " Customer Number
ps_psp_pnr LIKE vbak-ps_psp_pnr, " Work Breakdown Structure Element
name1 LIKE kna1-name1, " Customer Name
netwr LIKE vbrp-netwr , " Net Value in Document Currency
kzwi1 LIKE vbrp-kzwi1, " Subtotal 1 from pricing procedure for condition
parvw LIKE knvp-parvw , " Partner Function
parnr LIKE knvp-parnr , " Number of contact person
*zssidc LIKE zzvbak-zssidc, "Salesman ID
pstlz LIKE kna1-pstlz , " Postal Code
END OF i_data.
ALV Declaraton
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
it_listheader TYPE slis_t_listheader,
gd_repid LIKE sy-repid.
Selection - Screen
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS creation FOR vbak-erdat . " Sales Order Date
SELECT-OPTIONS period FOR vbrk-fkdat . " Invoice Date
SELECT-OPTIONS order FOR vbak-vbeln . " Sales order no
SELECT-OPTIONS name FOR kna1-name1 . " Customer Name
SELECT-OPTIONS contact FOR knvp-parnr . " Contact Name.
*SELECT-OPTIONS ssid FOR zzvbak-zssidc . " Salesman ID
SELECT-OPTIONS project FOR vbak-ps_psp_pnr . " Work Breakdown Structure Element
SELECTION-SCREEN : END OF BLOCK b1.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM BUILD_LAYOUT.
PERFORM top_of_page.
PERFORM fill_listheader USING it_listheader.
PERFORM display_alv_report.
END-OF-SELECTION.
*TOP-OF-PAGE.
TOP-OF-PAGE.
END-OF-PAGE.
*& Form BUILD_FIELDCATALOG
text
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'KUNNR'.
fieldcatalog-seltext_m = 'Sold to Party'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NAME1'.
fieldcatalog-seltext_m = 'Hlev Customer'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PARNR'.
fieldcatalog-seltext_m = 'Contact name'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PS_PSP_PNR'.
fieldcatalog-seltext_m = 'Project ID'.
fieldcatalog-col_pos = 3.
fieldcatalog-do_sum = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'VBELN'.
fieldcatalog-seltext_m = 'Sales Document Type'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ZSSIDC'.
fieldcatalog-seltext_m = 'SSID'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ERDAT'.
fieldcatalog-seltext_m = 'so date'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'FKDAT'.
fieldcatalog-seltext_m = 'inv date'.
fieldcatalog-col_pos = 7.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'KWZI1'.
fieldcatalog-seltext_m = 'gross amt'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETWR'.
fieldcatalog-seltext_m = 'net amt'.
fieldcatalog-col_pos = 9.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PSTLZ'.
fieldcatalog-seltext_m = 'Postal code'.
fieldcatalog-col_pos = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. "BUILD_FIELDCATALOG
*& Form DATA_RETRIEVAL
text
FORM data_retrieval.
SELECT VBFAvbelv VBFAvbeln
VBAKerdat VBAKkunnr VBAK~ps_psp_pnr
INTO TABLE i_vbak
FROM VBFA
INNER JOIN vbak
ON VBFAVBELV = VBAKVBELN
WHERE VBAK~erdat IN creation
AND VBFA~vbelV IN ORDER
AND VBAK~ps_psp_pnr IN project
AND VBFA~VBTYP_N = 'M' "Subsequent doc is Invoice
AND VBFA~VBTYP_V = 'C' "Prec doc is Sales order
IF NOT i_vbak[] IS INITIAL.
**Change of ORDER in SELECTS HERE
SELECT vbeln fkdat FROM vbrk INTO TABLE i_vbrk
FOR ALL ENTRIES IN i_vbak
WHERE vbeln = i_vbak-vbeln
AND fkdat IN period.
IF NOT i_vbrk[] IS INITIAL.
SELECT vbeln aubel netwr kzwi1 FROM vbrp INTO TABLE i_vbrp
FOR ALL ENTRIES IN i_vbrk
WHERE VBELN = i_vbrk-vbeln.
endif.
SELECT kunnr name1 pstlz FROM kna1 INTO TABLE i_kna1 FOR ALL ENTRIES IN i_vbak
WHERE kunnr = i_vbak-kunnr
AND name1 IN name.
*SELECT vbeln zssidc FROM zzvbak INTO TABLE i_zzvbak FOR ALL ENTRIES IN i_vbak
*WHERE vbeln = i_vbak-vbeln
*AND zssidc IN ssid .
select netwr kzwi1 erdat from vbrp into table i_vbrp for all entries in i_vbak
where erdat = i_vbak-erdat.
SELECT kunnr parnr parvw FROM knvp INTO CORRESPONDING FIELDS OF TABLE i_knvp FOR ALL ENTRIES IN i_vbak
WHERE kunnr = i_vbak-kunnr
AND parvw = 'AP'
AND parnr IN contact.
ENDIF .
SORT I_VBAK BY VBELN .
SORT I_VBRK BY VBELN .
LOOP AT i_vbrp. "Invoice Item data
MOVE i_vbrp-netwr TO i_data-netwr .
MOVE i_vbrp-kzwi1 TO i_data-kzwi1.
READ table I_VBAK WITH KEY VBELN = I_VBRP-VBELN BINARY SEARCH. "Sales Order info
IF SY-SUBRC = 0.
MOVE I_VBAK-VBELV TO I_DATA-VBELN. "Sales Order no
MOVE I_VBAK-erdat TO I_DATA-erdat. " Date on Which Record Was Created
MOVE I_VBAK-kunnr TO I_DATA-KUNNR. "Customer No
MOVE I_VBAK-ps_psp_pnr TO I_DATA-ps_psp_pnr. " Work Breakdown Structure Element
endif.
READ TABLE I_VBRK WITH KEY VBELN = I_VBRP-VBELN BINARY SEARCH. "Invoice header info
IF SY-SUBRC = 0.
MOVE i_vbrk-fkdat TO i_data-fkdat.
endif.
READ TABLE I_KNA1 WITH KEY KUNNR = I_VBAK-KUNNR BINARY SEARCH. "Customer info
IF SY-SUBRC = 0.
MOVE i_kna1-kunnr TO i_data-kunnr.
MOVE i_kna1-name1 TO i_data-name1.
MOVE i_kna1-pstlz TO i_data-pstlz .
endif.
READ TABLE I_KNvp WITH KEY KUNNR = I_VBAK-KUNNR BINARY SEARCH. "Partner info
IF SY-SUBRC = 0.
MOVE i_knvp-parnr TO i_data-parnr.
endif.
APPEND i_data.
ENDLOOP.
ENDFORM. "DATA_RETRIEVAL
*& Form DISPLAY_ALV_REPORT
text
FORM display_alv_report.
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = i_data.
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2 .
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
ENDFORM. "DISPLAY_ALV_REPORT
FORM FOR FILLING LISTHEADER *
FORM fill_listheader USING it_listheader TYPE slis_t_listheader.
DATA : wa_listheader TYPE slis_listheader.
wa_listheader-typ = 'H'.
wa_listheader-info = 'Noel Gifts International Limited '.
APPEND wa_listheader TO it_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = 'CUSTOMER CREDIT EXCEPTION REPORT' .
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
ENDFORM. "fill_listheader
*& Form top_of_page
text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader.
ENDFORM. "top_of_page
REWARD IF HELPFUL. -
Default value from another table - sql query
I'm trying to make the default value of a text item as the result from an sql or pl/sql statement. I keep getting errors when I try to use a pl/sql statement to do this. Has anyone else done this?
OK, here is what I tried to put in. I have a form and I wanted to add a text field that is derived from another table, such as:
select question from qa_main where seq=:quest_num
So, what I want is to have a form where questions on tests are answered, and I want the text of the question to be brought over from the question table. I'm not sure if I'm using the correct syntax, but the ":quest_num" would be a reference to a question number in the answer table that is linked to the sequence number (primary key) in the questions table.
Of course if there are better ideas, please let me know. :) -
I want to create a form that inserts rows in a table'mstr';
when inserting a row I want to have a field populated with
information from another table 'dept', where the department
in 'mstr' equals the dept in 'dept' table. How?Write a database trigger to populate it.
-
Breakout table (fill table with matching data from another table)
Hi
I've been trying to study old discussions about breakout tables. I feel I'm close, but still no cigar :-)
In plain english, I'm trying to autocreate rows with data on a table, based on matching values from another table. E.g. have a table to display all rows where type = AssetX
I have attached a screenshot of my "master table" called Assets:
I'm looking to prefill Asset name, Total from this table and populate a new table called e.g. Greenhouse
Where I'd be adding more data (date, income, expense).
Any help whould be greatly appreciated.
Thanks!Hi,
Here is a Sample Query.
Update Emp A
Set Sal = (Select Sal from emp b where
a.empno = b.empno)
where empno in (select empno from emp);
Regards,
Ganesh R
null -
BAPI_OUTB_DELIVERY_CHANGE to update Z fields from LIKP
Hello,
Im using BAPI_OUTB_DELIVERY_CHANGE bapi to change some fields from LIKP/LIPS table. Now, i have to update also some Z fields from this tables.
I see that the bapi has Extension1 and Extension2 tables but i don't know how to use them. I have been looking for the forum and i have found you have to fill some structures with the Z fields, but i don't find them for deliveries. Also, i have read that you have to do it through an user exit, but i don't know what user exit and what relation it has with Extension tables.
Anybody knows how to do it?
Thx,
ManelHi,
For changing the delivery quantity through BAPI_OUTB_DELIVERY_CHANGE you need to pass the following data :
HEADER_DATA : Delivery no.
DELIVERY : Delivery no.
ITEM_DATA : Delivery no,
item no,
DLV_QTY quantity(changed),
FACT_UNIT_NOM ( default to value '1')
FACT_UNIT_DENOM ( default to value '1')
ITEM_CONTROL : Delivey no,
item no,
CHG_DELQTY ( value "X")
The import parameter Extension1 and Extension2 are available for customer enhancements. Extension1 is an unstructured data container that is available for any use.
Extension2 is a structured data container available for any use.
For more information, see the function module documentation for BAPI_OUTB_DELIVERY_CHANGE. -
How to populate a table based on a row selection from another table.
Hi, i just started to use ADF BC and Faces. Could some one help me or point me a solution on the following scenario .
By using a search component , a table is being displayed as a search result. If i select any row in the resulted table , i need to populate an another table at the bottom of the same page from another view. These two tables are related by primary key . May i know how to populate a table based on a row selection from another table. Thanks
ganeshI understand your requirement and the tutorial doesn't talk about Association between the views so that you can create a Master-Detail or in DB parlance, a Parent-Child relationship.
I will assume that we are dealing with two entities here: Department and Employees where a particular Department has many Employees and hence a Parent-Child relationship.
Firstly, you need to create an Association between the two Entities - Department and Employees. You can do that by right clicking on the model's entity and then associating the two entities with the appropriate key say, DepartmentId.
Once you have done that, you need to link the two entities in the View section with this Association that you created. Then go to AppModule and make sure that in the Available View Objects: 'EmployeesView' appears under 'DepartmentView' as "EmployeesView via <link you created>". Shuttle the 'DepartmentView' to the right, Data Model and then shuttle
"EmployeesView via <link you created>" to the right, Data Model under 'DepartmentView'.
This will then be reflected in your Data Controls. After that, you simply would have to drag this View into your page as a Master-Detail form...and then when you run this page, any row selected in the Master table, would display the data in the Detail table.
Also, refer to this link: [Master-Detail|http://baigsorcl.blogspot.com/2010/03/creating-master-detail-form-in-adf.html]
Hope this helps. -
I can't create table from another table?
Hi everyone!
I have a problem that I don't known the reason why?
I'm using Oracle version 8i and I want to create a table from another table, such as:
CREATE TABLE a_backup as SELECT * FROM a => It's OK, table a_backup is created.
But there is only a table that I can't created like that, such as:
CREATE TABLE b_backup AS SELECT * FROM b;
When I run over command, SQL Plus is not responding... and clients are can't access to DB or Executing forever
This is the first time I met this problem.
Can Anyone help me to resolved it?
Thanks in advance!xi`tin wrote:
Hi everyone!
I have a problem that I don't known the reason why?
I'm using Oracle version 8i and I want to create a table from another table, such as:You realize, of course, that 8i is completely out of support .... Is your OS and hardware just as old as your rdbms software, or is it only the rdbms that your company refuses to upgrade?
CREATE TABLE a_backup as SELECT * FROM a => It's OK, table a_backup is created.
But there is only a table that I can't created like that, such as:
CREATE TABLE b_backup AS SELECT * FROM b;
When I run over command, SQL Plus is not responding... and clients are can't access to DB or Executing forever
This is the first time I met this problem.
Can Anyone help me to resolved it?
Thanks in advance!
Maybe you are looking for
-
Error during variable selection
Hi Expert, BW server: BI 7.0 version and SP: 15. Sap Gui is 6.4 version Patch leve 24. I am in production support. User's are getting the following error, when they try to change the variable values after executing the query. Program error in class S
-
Hello, I have an NT command file with a bunch of calls to R30run32.. Almost every night the job fails to run all the commands.. but just hangs on a particular call.. with no oracle session running.. but r30run32 still running when I look at task mana
-
What storage should we buy ?
Platform: Oracle Enterprise Linux 6.3 Grid Infrastructure version: 11.2.0.3 RDBMS version : 11.2.0.3 Hardware : Not yet decided (Either Dell or HP ) ++++++++++++++++++++++++++++++++++++++++++++++++++++ We have a fairly busy retail application and we
-
I have setup a replication group with 4 nodes (1 master, 3 replica nodes). 1. When there is a failure in current master node, the election is triggered. Is it possible to specify which replica node should be selected as next master either programmati
-
What is the purpose of rootpre.sh
Why we should run rootpre.sh or root.sh while installing any version of oracel databse on any unix/linux platform. Which is not there when installing on Windows.