The following tables exist:
Passerine_Survey_Observation
Species_Codes
I'm trying to set the common name in Passerine_Survey_Observation with that of Species_Codes:
UPDATE Passerine_Survey_Observation
INNER JOIN Species_Codes ON Passerine_Survey_Observation.SPEC_FK = Species_Codes.SPEC
SET Passerine_Survey_Observation.Species_Common_Name = Species_Codes.COMMONNAME;
It says an update will occur; however, nothing changes in Passerine_Survey_Observation.
Supposed update warning
If I do this an update does occur as expected:
SET Passerine_Survey_Observation.Species_Common_Name = 'test'
#Knox was onto something...
This behavior occurred because the target field (Passerine_Survey_Observation.Species_Common_Name) - in Design View - was a List Box (under the Properties > Lookup tab). Setting that to Display Control = Text Box resolved the problem. Oops.
Final code:
UPDATE Passerine_Survey_Observation
INNER JOIN Species_Codes ON Passerine_Survey_Observation.[SPEC_FK] = Species_Codes.[SPEC]
SET Passerine_Survey_Observation.Species_Common_Name = Species_Codes.[COMMONNAME]
WHERE Passerine_Survey_Observation.Species_Common_Name IS NULL;
Related
Running the following query in MySql workbench as \ is an escape character.
UPDATE midshared.SETUP
SET DATAVALUE = 'C:\Documents and Settings\ADMINISTRATOR\Desktop\'
WHERE CODE = 'SAGEPATH'
manually changing to this does work.
UPDATE midshared.SETUP
SET DATAVALUE = 'C:\\Documents and Settings\\ADMINISTRATOR\\Desktop\\'
WHERE CODE = 'SAGEPATH'
However trying these methods that I've found on Stack Overflow don't work either -
UPDATE midshared.SETUP
SET DATAVALUE = REPLACE('C:\Settings\ADMINISTRATOR\Desktop\','\','\\')
WHERE CODE = 'SAGEPATH'
or
UPDATE midshared.SETUP
SET DATAVALUE = QUOTE('C:\Documents and Settings\ADMINISTRATOR\Desktop\')
WHERE CODE = 'SAGEPATH'
Can anyone point me in the right direction to fix it please?
Thanks
A
I tried the queries listed above
You can use double quotes safely and escape slashes as follows:
UPDATE midshared.SETUP
SET DATAVALUE = "'C:\\Documents and Settings\\ADMINISTRATOR\\Desktop\\'"
WHERE CODE_ = 'SAGEPATH'
Check the demo here.
I need to update two information on one object: the quantity (PLAF-gsmng) and refresh the planned order via the module function 'MD_SET_ACTION_PLAF'.
I successfully find a way to update each data separately. But when I execute the both solutions the second modification is not saved on the database.
Do you know how I can change the quantity & set the action on PLAF (Planned order) table ?
Do you know other module function to update only the quantity ?
Maybe a parameter missing ?
It's like if the second object is locked (sm12 empty, no sy-subrc = locked) ... and the modification is not committed.
I tried to:
change the order of the algorithm (refresh and after, change PLAF)
add, remove, move the COMMIT WORK & COMMIT WORK AND WAIT
add DEQUEUE_ALL or DEQUEUE_EMPLAFE
This is the current code:
1) Read the data
lv_plannedorder = '00000000001'
"Read PLAF data
SELECT SINGLE * FROM PLAF INTO ls_plaf WHERE plnum = lv_plannedorder.
2) Update Quantity data
" Standard configuration for FM MD_PLANNED_ORDER_CHANGE
CLEAR ls_610.
ls_610-nodia = 'X'. " No dialog display
ls_610-bapco = space. " BAPI type. Do not use mode 2 -> Action PLAF-MDACC will be autmatically set up to APCH by the FM
ls_610-bapix = 'X'. " Run BAPI
ls_610-unlox = 'X'. " Update PLAF
" Customize values
MOVE p_gsmng TO ls_plaf-gsmng. " Change quantity value
MOVE sy-datlo TO ls_plaf-mdacd. " Change by/datetime, because ls_610-bapco <> 2.
MOVE sy-uzeit TO ls_plaf-mdact.
CALL FUNCTION 'MD_PLANNED_ORDER_CHANGE'
EXPORTING
ecm61o = ls_610
eplaf = ls_plaf
EXCEPTIONS
locked = 1
locking_error = 2
OTHERS = 3.
" Already committed on the module function
" sy-subrc = 0
If I go on the PLAF table, I can see that the quantity is edited. It's working :)
3) Refresh BOM & change Action (MDACC) and others fields
CLEAR ls_imdcd.
ls_imdcd-pafxl = 'X'.
CALL FUNCTION 'MD_SET_ACTION_PLAF'
EXPORTING
iplnum = lv_plannedorder
iaccto = 'BOME'
iaenkz = 'X'
imdcd = ls_imdcd
EXCEPTIONS
illegal_interface = 1
system_failure = 2
error_message = 3
OTHERS = 4.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
If I go on the table, no modification (only the modif. of the part 2. can be found on it).
Any idea ?
Maybe because the ls_610-bapco = space ?
It should be possible to update planned order quantity with MD_SET_ACTION_PLAF too, at least SAP Help tells us so. Why don't you use it like that?
Its call for changing the quantity should possibly look like this:
DATA: lt_acct LIKE TABLE OF MDACCTO,
ls_acct LIKE LINE OF lt_acct.
ls_acct-accto = 'BOME'.
APPEND lt_acct.
ls_acct-accto = 'CPOD'.
APPEND lt_acct.
is_mdcd-GSMNG = 'value' "updated quantity value
CALL FUNCTION 'MD_SET_ACTION_PLAF'
EXPORTING
iplnum = iv_plnum
iaenkz = 'X'
IVBKZ = 'X'
imdcd = is_mdcd "filled with your BOME-related data + new quantity
TABLES
TMDACCTO = lt_accto
EXCEPTIONS
illegal_interface = 1
system_failure = 2
error_message = 3.
So there is no more need for separate call of MD_PLANNED_ORDER_CHANGE anymore and no more problems with update.
I used word possibly because I didn't find any example of this FM call in the Web (and SAP docu is quite ambiguous), so I propose this solution just as is, without verification.
P.S. Possible actions are listed in T46AS table, and possible impact of imdcd fields on order can be checked in MDAC transaction. It is somewhat GUI equivalent of this FM for single order.
I try update recordset by update argument and code run good but a updating record is still same.
Code:
With mMails
.LEVEL1 = cTagLevel1
.MAIN_TAG = cTagLevel2
.DETAILED_TAG = cTagLevel3
.FIELD_TAG = cTagField
.INSIGHT = cTagInsight
.BRANCH = cTagBranch
.DataSource.Commit
End With
And Commit Sub:
Public Sub Commit()
mRst.Update
End Sub
And Connection:
Set mRst = New ADODB.Recordset
Set mRst.SOURCE = pCmd
mRst.CursorLocation = adUseClient
mRst.CursorType = adOpenStatic
mRst.LockType = adLockBatchOptimistic
mRst.Open
If Not (pAccessMode = AccessMode_ReadOnly) Then
Set mCn = pCmd.ActiveConnection
End If
Set mRst.ActiveConnection = Nothing
All values with mMails are correct but update doesn't work. What I doing wrong? When I tried use UpdateBatch the update want change whole row and not only selected...
Sry for my English :) and thanks a lot for any help!
I see you use a static cursor: "A static copy of a set of records that you can use to find data or generate reports. Additions, changes, or deletions by other users are not visible."
I think you should use a dynamic cursor: "Additions, changes, and deletions by other users are visible, and all types of movement through the Recordset are allowed."
Note the word "copy" in the description of the static cursor: you are making changes to a copy, but the copy is not saved in the database.
You also may need to change the CursorLocation property to adUseServer: "If the CursorLocation property is set to adUseClient, the only valid setting for the CursorType property is adOpenStatic".
See also: http://www.w3schools.com/asp/ado_ref_recordset.asp
I am new user with MySQL 5.6 and trying to UPDATE a table using NAVICAT
I trying to condition the SET statement with a WHERE. It seems I have taken the wrong approach. Can someone point me in the right direction?
UPDATE vacation_watch
INNER JOIN property_names
ON vacation_watch.Mstrfromproperty = property_names.MstrLink
INNER JOIN property_names_subnames
ON property_names_subnames.NameLink = property_names.NameLink
SET vacation_watch.Watch_Requester_Last = property_names.Name_Last,
vacation_watch.Watch_Requester_First = property_names.Name_First,
vacation_watch.Watch_Requester_Phone = property_names.Name_Phone,
vacation_watch.Emergency_Contact_Name = property_names_subnames.Sub_Name_Last WHERE property_names_subnames.Sub_Name_Type = "KEYHOLDER"
vacation_watch.Emergency_Contact_Phone = property_names_subnames.Sub_Name_Phone WHERE property_names_subnames.Sub_Name_Type = "EMERGENCY"
You are using two WHERE clauses and in the wrong way.
What you are looking for is actual conditional SQL. There is already an answer on SO that could help you achieving what you want to do here.
Furthermore, there can only be only one WHERE clause that applies on the global level, not at field level.
Something like:
UPDATE vacation_watch
INNER JOIN property_names
ON vacation_watch.Mstrfromproperty = property_names.MstrLink
INNER JOIN property_names_subnames
ON property_names_subnames.NameLink = property_names.NameLink
SET vacation_watch.Watch_Requester_Last = property_names.Name_Last,
vacation_watch.Watch_Requester_First = property_names.Name_First,
vacation_watch.Watch_Requester_Phone = property_names.Name_Phone,
vacation_watch.Emergency_Contact_Name =
CASE WHEN property_names_subnames.Sub_Name_Type = "KEYHOLDER"
THEN property_names_subnames.Sub_Name_Last
END
vacation_watch.Emergency_Contact_Phone =
CASE WHEN property_names_subnames.Sub_Name_Type = "EMERGENCY"
THEN property_names_subnames.Sub_Name_Phone
END
could work. I hope I got what you wanted to do correctly and my syntax is correct as I just wrote it in a text editor and didn't test it.
i have a code right here this is for saving records to databse:
If mstrMaintMode = "ADD" Then
lngIDField = GetNextCustID()
strSPName = "InsertCustomer"
Set objNewListItem = mylistview.ListItems.Add(, , txtname.Text)
PopulateListItem objNewListItem
With objNewListItem
**.SubItems(mlngCUST_ID_IDX) = CStr(lngIDField)**
.EnsureVisible
End With
Set mylistview.SelectedItem = objNewListItem
Set objNewListItem = Nothing
Else
lngIDField = CLng(mylistview.SelectedItem.SubItems(mlngCUST_ID_IDX))
strSPName = "UpdateCustomer"
mylistview.SelectedItem.Text = txtname.Text
PopulateListItem mylistview.SelectedItem
End If
the error is: invalid property value in the line with asterisks. ive tried using this code to another database and it works, but for the other it's not.ive checked the stored procedure, it's right, the table fields, also right but im still getting this error.ive spent 3 hrs to find the answer but i culdn't figure it out.
The line you have highlighted will fail with "Invalid property value" when you specify a sub item index that is out of bounds given the number of columns in the listview.
As the index is 1 based but starting from the second column, with your index of 7, you need at least 8 columns added.