Update user table from matrix
Hi I've created a matrix in a new tab on the Item Master data form. It loads data from a user table called @Test. This table has 2 udf U_Model and U_Engine. The matrix uses a datatable to query the table. Is there a way to update the table? this is my code:
// Adding a Matrix item
oNewItem = oForm.Items.Add( "Matrix1", SAPbouiCOM.BoFormItemTypes.it_MATRIX );
oNewItem.Left = 5;
oNewItem.Width = 400;
oNewItem.Top = 200;
oNewItem.Height = 150;
oNewItem.FromPane = 8;
oNewItem.ToPane = 8;
oMatrix = ( ( SAPbouiCOM.Matrix )( oNewItem.Specific ) );
oColumns = oMatrix.Columns;
// Adding Culomn items to the matrix
oColumn = oColumns.Add( "#", SAPbouiCOM.BoFormItemTypes.it_EDIT );
oColumn.TitleObject.Caption = "#";
oColumn.Width = 30;
oColumn.Editable = false;
oColumn = oColumns.Add("Code", SAPbouiCOM.BoFormItemTypes.it_EDIT);
oColumn.TitleObject.Caption = "Code";
oColumn.Width = 20;
oColumn.Editable = true;
oColumn = oColumns.Add("Name", SAPbouiCOM.BoFormItemTypes.it_EDIT);
oColumn.TitleObject.Caption = "Name";
oColumn.Width = 20;
oColumn.Editable = true;
oColumn = oColumns.Add("Model", SAPbouiCOM.BoFormItemTypes.it_EDIT);
oColumn.TitleObject.Caption = "Model";
oColumn.Width = 20;
oColumn.Editable = true;
// Add a column for Name
oColumn = oColumns.Add( "Engine", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX );
oColumn.TitleObject.Caption = "Engine";
oColumn.Width = 20;
//Add Valid Values
oColumn.ValidValues.Add("10", "");
oColumn.ValidValues.Add("12", "");
oColumn.ValidValues.Add("32", "");
oColumn.ValidValues.Add("42", "");
oColumn.ValidValues.Add("52", "");
oColumn.ValidValues.Add("62", "");
dbDatasource = (oForm.DataSources.DBDataSources.Add("@Test"));
DBTable = (oForm.DataSources.DataTables.Add("MyDataTable"));
oMatrix.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single;
oItem = oForm.Items.Item("5");
oEdit = ((SAPbouiCOM.EditText)(oItem.Specific));
string item = oEdit.Value.ToString();
oForm.DataSources.DataTables.Item( 0 ).ExecuteQuery( "SELECT Code, Name, U_Model, U_Engine from [@Test] where U_ItemCd = '" + item +"' ");
oColumn = oColumns.Item("Code");
oColumn.DataBind.Bind("MyDataTable", "Code");
oColumn = oColumns.Item("Name");
oColumn.DataBind.Bind("MyDataTable", "Name");
oColumn = oColumns.Item( "Model" );
oColumn.DataBind.Bind("MyDataTable", "U_Model");
oColumn = oColumns.Item("Engine");
oColumn.DataBind.Bind("MyDataTable", "U_Engine");
oMatrix.Clear();
oMatrix.AutoResizeColumns();
oMatrix.LoadFromDataSource();
Hi Costas,
You can use Matrix.FlushToDataSource() to save the data in the Matrix into the datasource.
But if you want to update the data in the DB, you have to use DI API.
Regards,
Jay.
Similar Messages
-
Is it possible to update internal table from database table
Hello All:
I know how to update database table from internal table in one shot (batch) but is the reverse possible? Can I update some fields in an internal table from a database table in one shot (without looping) because my internal table is huge? Could you please provide me any ideas how to acheive something like this? Thanks in advance and answers will be rewarded.
thanks.
MithunHello my friend,
You can do it MAYBE , i think you can reverse the update doing a ROLLBACK, but only after you update....not after the program finishes..
To update some fields at once use:
UPDATE DBTABLE FROM TABLE IT_TABLE
Hope this helps!!
Gabriel -
Hi, Bapi or function module to update RBCO table from an internal table.
I have a requirement to update RBCO table from an internal table. is there any Bapi or function module or any other method other than update, modify statements.
Moderator message: Welcome to SCN!
Moderator message: please do more research before asking, show what you have done yourself when asking.
[Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
[Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
Edited by: Thomas Zloch on Jul 12, 2011 12:28 PMI don't know if any FM exists for your requirement. But you may like to copy it into a custom table and modify it according to your enterprise needs.
-
HOW CAN I ADD/UPDATE/INSERT IN A USER TABLE WITH MATRIX
Hi All,
I have one User table (Defined as No Object) and what i need to do is a form with a matrix to Add/Update/Delete data in my user table.
I already create the form and the matrix that already give me the user table data. But now i have several problems to solve.
First I try to add a new row but this new row get the data of the last row in the matrix. What i needed is a blank row to add new data in the user table.
Second, when i change data in matrix and do update in the form, sap show me the message that the operation is successfully done but the data in the user table in not updated.
I am trying to do one forma like whe can find in Setup-> General -> Freight.
Can anyone help me?
Best Regards,
Luis DuarteHi,
If ur dealing with a simple form like that U can as well use the direct table form, and just provide a FMS to auto matically fill the code and name. U can directly use the form by.. Tools-->UserDefined Windows
Or
Comming to ur problem.... when ur adding a new row clear the data sources so that u'll get a blank row.
And for update the best thing to do is delete all the records in the table and again insert all the records directly from the matrix.
Hope it helps,
Vasu Natari. -
I'm a newbie and I would like any suggestions and help with my problem.
I have a view, m_jobs, that is based on the view, sys.dba_jobs. I want to add a two fields, user_id and update, to keep track of user who is adding and modifying scheduled jobs. So I decided to create a table which has the two new fields and the same fields from m_jobs. I populated my new table with the values from m_jobs, but since I created a table, the values aren't always updated. How can I update the table whenever the values in my view change? Do I create a trigger for that and how would that go? Thanks in advance.
-KristineI interpret the question differently:
A view is nothing more than a select statement on other tables. you cannot put triggers on it since it does not contain data (with the exception of 'instead of'-triggers, but they have a different meaning). What you should do is put a trigger on the underlying table(s) that dba_jobs is querying. That trigger should then populate your table.
However, this is not recommended since it might interfere with Oracle normal operation (if your trigger fails (e.g. when your table is dropped), the original insert into the underlying dba_jobs table by Oracle will also fail potentially resulting in nasty problems with Oracle.
Alternatively, you could make a job that checks for changes in the data and maintains the table. Or see if auditing can help (don't know if that is possible on Oracle internal tables).
Hope this helps,
L. -
Updating a table from tabular form using a process
Hi
I have a tabular from creating using wizard
I've a field called Last_updated_by in the table
the username is assigned to an item P2_user based on the user who logs in.
What I need is,when any row is updated, I need to update the last_updated column with value in p2_user.
Need help on this
I'm using apex 3.2 with 11g
tried the below
declare
idx number:=1;
begin
FOR i in 1 .. wwv_flow.g_f01.COUNT
LOOP
for j in idx .. wwv_flow.g_f02.count
loop
update table_name set last_updated_by=:p2_user where ID=APEX_APPLICATION.G_F02(j);
idx:=j+1;
end loop;
END LOOP;
end;
Its updating the table,but all the rows are getting updated,just not the selected rows.
Not sure what I'm doing wrong here
thanks
Archana
Edited by: Agowda on Jan 12, 2012 1:55 AMI am looking for the same... can you please share how did you got this working
thanks -
I've a scenerio where i've to updated LIKP table, when user save the HUPAST. I've created the BDC program which update the likp table using VL02N transacton. but when i'm calling the BDC from a BADI its giving a error, as i'm trying to update the same delivery number. (Delivery already updated by user).
I'm now trying using events, i've traced an event CHANGED in object type LIKP , which is fired when HUPAST is saved.
How do i update the event changed ??? and call the bdc program from the event.
pls share .
Sanjuhi,
You can do it PAI under module USER_COMMAND. and you can use standard UPDATE/MODIFY/DELETE statements to update ur database table and make sure u use a commit work after the use of ablove mentioned statements.
kindly check this.
PROCESS BEFORE OUTPUT.
MODULE status_9010.
LOOP WITH CONTROL tab_control.
MODULE move_data_to_table.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP WITH CONTROL tab_control.
MODULE move_data_from_table.
ENDLOOP.
*& Module move_data_to_table OUTPUT
This is to move the data from the internal table to the table control
MODULE move_data_to_table OUTPUT.
This is to move the data from the internal table to the table control
zmpets_mode-modecode,zmpets_range-rangeid,zmpets_servfacto-factor are column name of table control
READ TABLE int_factor INDEX tab_control-current_line.
IF sy-subrc = 0.
zmpets_mode-modecode = int_factor-modecode.
zmpets_range-rangeid = int_factor-rangeid.
zmpets_servfacto-factor = int_factor-factor.
ENDIF.
ENDMODULE. " move_data_to_table OUTPUT
*& Module move_data_from_table INPUT
Date is moved from the table control to the Internal Table
MODULE move_data_from_table INPUT.
To move the data from the table control to internal table 'INT_FACTOR'.
int_factor-modecode = zmpets_mode-modecode.
int_factor-rangeid = zmpets_range-rangeid.
int_factor-factor = zmpets_servfacto-factor.
*here if the data is there, it will modify
MODIFY int_factor INDEX tab_control-current_line.
IF sy-subrc NE 0. "data not exixting in table control . ie new data, then append it
APPEND int_factor.
CLEAR int_factor.
ENDIF.
ENDMODULE. " move_data_from_table INPUT
Also refer to this link:
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac5e35c111d1829f0000e829fbfe/content.htm
<b>Reward points if found helpful ..
Cheers,
Chandra Sekhar.</b> -
Update USR table from Java Code outside OIM
Hi,
I want to update a particular field in the USR table using the update query specifically from the java code. I dont want use updateUser api.
I have written the code which works fine for some userids. But for some user ids it gets the tcUtility object successfully but when trying to execute the update query, it throws the tcDatasetException with message as Data Access Error.
Please let me know how can i achieve this.
Also let me know the groups the userid should be member to execute a update query on OIM DB from external java code..
TIA...You are performing an unsupported process. I suggest you correctly code a connection to OIM, and perform the update correctly.
If you need to update the database directly, use jdbc java connection and run the update. You can do a google search for jdbc and java to find plenty of samples.
-Kevin -
How to increment update B table from A table on a daily basis
hi ,
i have two table in two database,
Table A:
username
status
created
table B:
username
status
created
object_count
I want to insert everything from A to B. for example, on day 1, table A has 100 rows, then 100 rows will be inserted into B. on day 2, table A has 110 rows, then only the 10 new rows will be inserted.
i want to create a PL sql procedure, and create a shell script in cron job to call this procedure to update table B every day.
thanks for the help.
thanks.thanks for the reply. i didn't state clear about my task. here is the detail of what exactly I am trying to do.
table USERACC_FOR_DOM_REP is acting a central repository table which will have all user information from all databases. I have 40+ database. of course , everyday new user will be added.
SQL> desc audadm.USERACC_FOR_DOM_REP
Name Null? Type
USERNAME NOT NULL VARCHAR2(30)
ACCOUNT_STATUS NOT NULL VARCHAR2(32)
LOCK_DATE DATE
EXPIRY_DATE DATE
CREATED NOT NULL DATE
PROFILE NOT NULL VARCHAR2(30)
TARGET_DB VARCHAR2(9)
TARGET_NODE VARCHAR2(64)
INSERT_DATE DATE
OBJECT_COUNT NUMBER
i can create shell script, loop through each database, and use below SQL to update the USERACC_FOR_DOM_REP table on the daily basis. but the problem is that duplicated entry will be created every day. I only need to insert any new users which added in dba_users table.
i guess i need a PL SQL procedure to check if a username already exist in table USERACC_FOR_DOM_REP, and that user come from the same database.
insert into USERACC_FOR_DOM_REP
select username, account_status, lock_date, expiry_date, a.created, profile,
name as target_db, host_name as target_node, sysdate as insert_date,
(select count(*) from dba_objects where OWNER=a.username) as object_count
from dba_users a, v$database, v$instance; -
How to update one table from another table?
Hi,
Please go through the case I am mentioning below and if possible try to provide with a solution.
I am working on a report to generate cash flow forecast, where in one of the fields is "Payroll", in which its being mentioned as:
In the selection screen: I am entering Project ID, profit Center and Period(in MM/YYYY format).
Selection of all entries in table COSP for selected cost elements above, value type 1, version , all periods and for all selected WBS elements and all objects underneath.
From this, update table COFP with information from COSP with value type 62 and same period.
For updation of various fields the following information is being given.
How should we update COFP?
New entries per OBJNR/PERIO and HKONT are required via using the information from COSP:
COFP-MANDT = SY-MANDT
COFP-KOKRS = if COSP-OBJNR begins with PR
Check table PRPS with COSP-OBJNR = PRPS-OBJNR and enter PRPS-PKOKR
If COSP-OBJNR begins with NV
Check table AFVC with COSP-OBJNR = AFVC-OBJNR,
go to Table AFKO with AFVC-AUFPL,
go to table AUFK with AFKO-AUFNR and enter AUFK-KOKRS
If COSP-OBJNR begins with OR
Check table AUFK with COSP-OBJNR = AUFK-OBJNR
and enter AUFK-KOKRS
COFP-BELNR = Check table NRIV, CLIENT = SY-MANDT, OBJECT = RK_BELEG,
SUBOBJECT = COFP-KOKRS, NRRANGENR = 05,
Add 1 to NRLEVEL and begin with 500000000
Use same BELNR for one update-run
COFP-BUZEI = 1 + and 1 in next entry but same update-run
COFP-TWAER = COSP-TWAER
COFP-ZHLDT = always last day of month in field COFP-PERIO
COFP-GJAHR = COSP-GJAHR
COFP-PERIO = if entry in field WKG001 à PERIO = 001
If entry in field WKG006 à PERIO = 006
COFP-WRTTP = 62
COFP-VRGNG = FIPL
COFP-POSIT = Check table SKB1 where SAKNR = COSP-KSTAR and use SKB1-FIPOS
for going to table FMCI-FIPOS and enter FMCI-POSIT
COFP-OBJNR = COSP-OBJNR
COFP-HKONT = COSP-KSTAR
COFP-WKGBTR = WKGXXX
COFP-WKGBTRO = -
COFP-WTGBTR = WTGXXX
COFP-WTGBTRO = -
COFP-WOGBTR = WTGXXX
COFP-WOGBTRO = -
COFP-BUKRS1 = -
COFP-GJAHR1 = -
COFP-BELNR1 = -
COFP-BUZEI1 = -
COFP-BUKRS2 = -
COFP-GJAHR2 = -
COFP-BELNR2 = -
COFP-BUZEI2 = -
COFP-EBELN = -
COFP-EBELP = -
COFP-ZEKKN = -
COFP-ETENRM = -
COFP-STUNR = -
COFP-LIFNR = -
COFP-KUNNR = -
COFP-GSBER = -
COFP-BUKRS = (nearly same as COFP-KOKRS!)
if COSP-OBJNR begins with PR
Check table PRPS with COSP-OBJNR = PRPS-OBJNR and enter PRPS-PBUKR
If COSP-OBJNR begins with NV
Check table AFVC with COSP-OBJNR = AFVC-OBJNR,
go to Table AFKO with AFVC-AUFPL,
go to table AUFK with AFKO-AUFNR and enter AUFK-BUKRS
If COSP-OBJNR begins with OR
Check table AUFK with COSP-OBJNR = AUFK-OBJNR
and enter AUFK-BUKRS
COFP-EINDT = -
COFP-SGTXT = -
COFP-GEBER = -
COFP-KURSF = -
COFP-KUFIX = -
COFP-GBETR = -
COFP-KURSR = -
COFP-KURSFIKRS = -
COFP-KZKRS = -
COFP-UMBKZ = -
COFP-KBLNR = -
COFP-KBLPOS = -
COFP-HI FIVOR = -
COFP-LO FIVOR = -
COFP-HI ACCOUNT = -
COFP-LO ACCOUNT = -
COFP-HI LIFNR = -
COFP-LO LIFNR = -
COFP-HI KUNNR = -
COFP-LO KUNNR = -
COFP-XDELETE = -
COFP-HI XOPVW = -
COFP-LO XOPVW = -
COFP-ZAEHK = -
COFP-CHAINBELNR = -
COFP-MWSKZ = -
COFP-LEDNR = -
COFP-BELTP = 1
COFP-VERSN = 0
COFP-OWAER = COSP-TWAER
COFP-CPUDT = SY-DATUM
COFP-CPUTM = SY-TIME
after doing updation, its again saying Selection of all entries in table COFP with value type 51 to 62, selected year, selected cost elements above and for all selected WBS elements and all objects underneath. Summarisation by period.
Now, can someone help me as how to proceed with the entire thing? An elaborate and illustrative answer would be highly appreciable.
If you require any other information....then get back to me ..asap.
Its bit urgent.
Thanks & Regards,
RaviHi
update <table> from <i_tab>
for different conditions.
loop at i_cosp.
if cosp-mandt eq sy-mandt and cosp-objnr eq 'PR'.
Read table i_PRPS with key i_PRPS-OBJNR = i_COSP-OBJNR.
if sy-subrc eq 0.
update PRPS set PKOKR = ? where objnr = i_prpr-objnr.
endif.
endif.
similarly for all the conditions
Regards
Message was edited by: Harikishore Sreenivasulu -
How to update one table from another
I am creating scripts in Oracle 10g. I have a table that has data corruption on three date fields.
I created a table with the following sql of all the affected rows:
CREATE TABLE LSU_INTER_FIX_DATE AS
select request_id,received_date,planned_start_date, actual_start_date
from lsu_inter2_requests_t
where received_date < to_date('01-JAN-1900')
OR planned_start_date < to_date('01-JAN-1900')
OR actual_start_date < to_date('01-JAN-1900')
I then repaired all of the rows with three data fixes
UPDATE LSU_INTER_FIX_DATE
SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
where received_date < to_date('01-JAN-1900')
UPDATE LSU_INTER_FIX_DATE
SET planned_start_date = TO_CHAR(planned_start_date,'YY-MON') ||'-'||(TO_CHAR(planned_start_date,'RRRR') + 2000)
where planned_start_date < to_date('01-JAN-1900')
UPDATE LSU_INTER_FIX_DATE
SET actual_start_date = TO_CHAR(actual_start_date,'YY-MON') ||'-'||(TO_CHAR(actual_start_date,'RRRR') + 2000)
where actual_start_date < to_date('01-JAN-1900')
I now want to update the original base table with the corrected data so I wrote the following SQL UPDATE command:
UPDATE lsu_inter2_requests_t aaa
SET aaa.received_date = bbb.received_date
FROM LSU_INTER_FIX_DATE bbb WHERE aaa.request_id = bbb.request_id
When I run this sql Oracle returns the error “ORA-00933 SQL command not properly ended.” How do I update multiple rows in one table from another table that share the same primary key?Comet wrote:
I am creating scripts in Oracle 10g. I have a table that has data corruption on three date fields.
I created a table with the following sql of all the affected rows:
CREATE TABLE LSU_INTER_FIX_DATE AS
select request_id,received_date,planned_start_date, actual_start_date
from lsu_inter2_requests_t
where received_date < to_date('01-JAN-1900')
OR planned_start_date < to_date('01-JAN-1900')
OR actual_start_date < to_date('01-JAN-1900')
I then repaired all of the rows with three data fixes
UPDATE LSU_INTER_FIX_DATE
SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
where received_date < to_date('01-JAN-1900')
UPDATE LSU_INTER_FIX_DATE
SET planned_start_date = TO_CHAR(planned_start_date,'YY-MON') ||'-'||(TO_CHAR(planned_start_date,'RRRR') + 2000)
where planned_start_date < to_date('01-JAN-1900')
UPDATE LSU_INTER_FIX_DATE
SET actual_start_date = TO_CHAR(actual_start_date,'YY-MON') ||'-'||(TO_CHAR(actual_start_date,'RRRR') + 2000)
where actual_start_date < to_date('01-JAN-1900')
I now want to update the original base table with the corrected data so I wrote the following SQL UPDATE command:
UPDATE lsu_inter2_requests_t aaa
SET aaa.received_date = bbb.received_date
FROM LSU_INTER_FIX_DATE bbb WHERE aaa.request_id = bbb.request_id
When I run this sql Oracle returns the error “ORA-00933 SQL command not properly ended.” How do I update multiple rows in one table from another table that share the same primary key?I am not convinced you have what you think you have
>
UPDATE LSU_INTER_FIX_DATE
SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
where received_date < to_date('01-JAN-1900')
When you want to produce a DATE datatype when starting with a string,
you must use TO_DATE() on the SET line!
(TO_CHAR(received_date,'RRRR') + 2000)since when do you do add characters (from TO_CHAR) with a constant number (2000)?
You should NEVER EVER rely on implicit datatype conversion
Edited by: sb92075 on Jul 27, 2011 7:09 PM -
Updating a table from a collection
I have some data in a collection that is meant to update a table
I have a string of colon delimited column names like
pk:age:height:weight
The table contains the PK and the data for column names as per the string above.
So,
c001=pk
c002=age
c003=height
c004=weight
How can I loop thru the table and create/execute a UPDATE statement that updates
those columns in a pre-specified table?
Of course using bind variables as much as possible?
Thanksthought you may do it easier by loop through collection in a process as ...
for c in (select c001 pk, c002 age, c003 height, c004 weight
from yur_collectioin
where c.pk = c001) loop
update yur_tbl set age = c.age ....
where pk = c.pk
end loop;
Or you may "loop thru the table" and update in a process as ...
for c in (select * from tbl) loop
for cc in (select c001 pk, c002 age, c003 height, c004 weight
from yur_collectioin
where c.pk = cc.pk) loop
update tbl set age = cc.age ....
where pk = cc.pk
end loop;
end loop;
Should not have mutation problem but I am not sure. Good luck.
DC -
Update cluster table from Web dynpro
Hi
I am trying to export data to a cluster table from web dynpro using this statement:
EXPORT zhr_sanct_st100 FROM zhr_sanct_st100 TO DATABASE zhr_clrm(ep) ID zhr_clrm-srtfd.
same piece of code work well if I include it in a report program through se38, but If I use it in Web dynpro, it doesnt update the cluster table and there is no error shown.
please reply ASAP.
Vishal kapoorThanks for your immediate reply. it worked this way:
IMPORT structure name TO structure name
FROM DATABASE cluster table name
TO wa_zhr_clrm
ID zhr_clrm-srtfd.
initially i missed to insert a work area wa_zhr_clrm, which has all the key fields of the cluster table.
Regards
Vishal Kapoor -
How to update database table from Internal Table
hi experts,
Can anyone please assist me in inserting records to a database table from an Internal Table
whose structures are identical.
Thanks in Advance,
Sudhaa............Hi Sudha,
Here are some example of update and insert:
UPDATE SFLIGHT SET PLANETYPE = 'A310'
PRICE = PRICE - '100.00'
WHERE CARRID = 'LH' AND CONNID = '0402'.
This example overwrites the contents of the PLANETYPE column with A310 and decreases the value of the PRICE column by 100 for each entry in SFLIGHT where CARRID contains u2018LHu2019 and CONNID contains u2018402u2019.
TABLES SPFLI.
DATA WA TYPE SPFLI.
MOVE 'AA' TO WA-CARRID.
MOVE '0064' TO WA-CONNID.
MOVE 'WASHINGTON' TO WA-CITYFROM.
UPDATE SPFLI FROM WA.
MOVE 'LH' TO SPFLI-CARRID.
MOVE '0017' TO SPFLI-CONNID.
MOVE 'BERLIN' TO SPFLI-CITYFROM.
UPDATE SPFLI.
CARRID and CONNID are the primary key fields of table SPFLI. All fields of those lines where the primary key fields are "AA" and "0064", or "LH" and "0017", are replaced by the values in the corresponding fields of the work area WA or the table work area SPFLI.
DATA: ITAB TYPE HASHED TABLE OF SPFLI
WITH UNIQUE KEY CARRID CONNID,
WA LIKE LINE OF ITAB.
WA-CARRID = 'UA'. WA-CONNID = '0011'. WA-CITYFROM = ...
INSERT WA INTO TABLE ITAB.
WA-CARRID = 'LH'. WA-CONNID = '1245'. WA-CITYFROM = ...
INSERT WA INTO TABLE ITAB.
WA-CARRID = 'AA'. WA-CONNID = '4574'. WA-CITYFROM = ...
INSERT WA INTO TABLE ITAB.
UPDATE SPFLI FROM TABLE ITAB.
This example fills a hashed table ITAB and then overwrites the lines in SPFLI that have the same primary key (CARRID and CONNID) as a line in the internal table.
Insert statement :
TABLES SPFLI.
DATA WA TYPE SPFLI.
WA-CARRID = 'LH'.
WA-CITYFROM = 'WASHINGTON'.
INSERT INTO SPFLI VALUES WA.
WA-CARRID = 'UA'.
WA-CITYFROM = 'LONDON'.
INSERT SPFLI FROM WA.
SPFLI-CARRID = 'LH'.
SPFLI-CITYFROM = 'BERLIN'.
INSERT SPFLI.
If the database table does not already contain a line with the same primary key as specified in the work area, the operation is completed successfully and SY-SUBRC is set to 0. Otherwise, the line is not inserted, and SY-SUBRC is set to 4.
Regards,
Premraj kaushik -
Updating user table (type document) via api
hi!
i need to update an user table that is of type document.
that table is also used as the client table in an udo.
i have tried the following code, but that of course doesn't work as the table is not a plain table but is of document type:
Dim objUserTable As SAPbobsCOM.UserTable
Set objUserTable = objCom.UserTables.Item("MP_TABLE_LINE")
If objUserTable.GetByKey(objMatrix.Columns.Item("U_MP_BEnt").Cells.Item(lngRow).Specific.Value) Then
objUserTable.UserFields.Fields.Item("U_Qty").Value = _
objUserTable.UserFields.Fields.Item("U_Qty").Value - dblDiff
If Not objUserTable.Update() <> 0 Then
Call objApp.SetStatusBarMessage(objCom.GetLastErrorDescription())
Call objApp.MessageBox(objCom.GetLastErrorDescription())
Else
objMatrix.Columns.Item("U_MP_BQty").Cells.Item(lngRow).Specific.String = _
objMatrix.Columns.Item("11").Cells.Item(lngRow).Specific.String
End If
End If
Set objUserTable = Nothing
then i tried to use a dbdatasource which i would expect to work:
Dim objDataSource As DBDataSource
Set objDataSource = objForm.DataSources.DBDataSources.Item("@MP_TABLE_LINE")
Dim objConditions As New SAPbouiCOM.Conditions
Dim objCond As SAPbouiCOM.Condition
<just setting up conditions here>
Call objDataSource.Query(objConditions)
Call objDataSource.SetValue("U_Qty", 0, objDataSource.GetValue("U_Qty", 0) - dblDiff)
but this only results in an error code "-7006", message:
"Item - The item is not a user defined item"
how can the update be done?
regards,
thomasHi Thomas,
U are using UserTabel Obejct , just try to Use UserTabelMD object
i am sending to how to create the User Table,
Hope it will help to
oUTb = mobjCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
If Not oUTb.GetByKey("SPH_FORMS") Then
oUTb.TableName = "SPH_FORMS"
oUTb.TableDescription = "Activity Forms"
oUTb.TableType = SAPbobsCOM.BoUTBTableType.bott_MasterData
If oUTb.Add <> 0 Then
mobjCompany.GetLastError(lRet, sErrMsg)
Else
oUTb = Nothing
end if
be carefull before using MD object , bcoz at a time only one MD object should be in memory else it will give to Error
Thanks
Ankush Vachher
Maybe you are looking for
-
I just got my laptop back from the shop (the logic board failed) and put my bigger hard drive back in and came to find out that the computer won't boot from that hard drive (it works fine on the other hd). I have run disk utility and it says my drive
-
MacBook and TC trouble connecting wirelessly to PC network
Linksys modem on a PC accepted my new MacBook just fine. Tried to install the TC (500GB) today. AirPort utility recognized the TC once, but when I tried to add it to the established network I apparently failed somewhere and the TC went away. Now AirP
-
I want to download WEATHERBUG to my apple air. Keep getting a 3rd party access error message. Can you help?
-
Photoshop CS2 keeps crashing after recent migration
Hi... just migrated my files to a new iMac and after a day of running fine, PS CS2 keeps crashing. It launches, but crashes quickly and randomly... sometimes allowing me to open a file and work on it for a minute and save it, other times when trying
-
Form Settings/Change of descriptions
Hi, I've amended the field descriptors on a number of BP screens to make input for users easier i.e. changed Street, Building, etc to Address1, Address2 etc. using the user [manager]. I then copied the form settings from manager to all other users. S