I'm using SQLite on Windows UWP (10).
This is what I am doing:
Open connection
Begin Transaction
Update row
Commit Transaction
Close connection
And yet, the value in the database is not actually written to the table. When I reload the record (after disconnecting and reconnecting, or not disconnecting) the value remains from before I called the update.
Is there something extra I need to do? In DB Browser for SQLite, there is a menu item called "Write Changes". What does that do? Just a normal commit? In the browser, the changes are only committed if I click on this menu item.
Also, I put a trace on the connection, and this is what came up:
Executing: begin transaction
Executing: UPDATE
'TaskManagement.TaskInfo'
SET
StatusKey = #StatusKey, ProbAddDttm = #ProbAddDttm, ProbCode = #ProbCode, ProbPriority = #ProbPriority, ProbGroup = #ProbGroup, ProbInsp = #ProbInsp, Activity = #Activity, UpdateDttm = #UpdateDttm, Asset = #Asset, Address = #Address, TaskStartDttm = #TaskStartDttm, MaintenanceScheduleSetup = #MaintenanceScheduleSetup, MaintenanceScheduleBatch = #MaintenanceScheduleBatch, ProbZone = #ProbZone, ProbContractor = #ProbContractor, ProbNotes = #ProbNotes, JobCompleted = #JobCompleted, Resolution = #Resolution, Result = #Result, ActType = #ActType, Complaint = #Complaint, BudgetNo = #BudgetNo, Contractor = #Contractor, MapLocCorrect = #MapLocCorrect, FollowUpWorkRequired = #FollowUpWorkRequired, Condition = #Condition, ActPriority = #ActPriority, ExpectedVersion = #ExpectedVersion, EmailProbOriginator = #EmailProbOriginator, IsBug = #IsBug, IsCompletePendingCheckIn = #IsCompletePendingCheckIn
WHERE
TaskInfoKey = #PrimaryKey
0: 63711ec4-57d0-4a23-8595-0022b757af44
1: 6
2: 2013-06-03 08:56:39:117
3: 13
4: 2
5: 17
6: 24
7:
8: 2015-11-10 04:05:09:502
9:
10:
11: 2013-06-03 08:56:39:117
12:
13:
14:
15:
16: Test this mofo!
17: 2013-08-15 12:13:24:620
18:
19:
20:
21:
22:
23: 4
24: False
25: False
26:
27:
28: 3
29: False
30: False
31: False
Executing: Commit
So, in the end, the problem was that I was not passing the parameters in to the library correctly. The connection's CreateCommand method only allows you to pass in the command text, and an array of objects. This is incorrect because that means you can't name the parameters. So, I consider this a piece of missing functionality in this particular implementation of SQLite for UWP.
Secondly, this should have errored! None of the parameter names I mentioned above were passed in to the command, and yet when I ran it, no exception was thrown. So, I consider this to be the second bug in the implementation.
I fixed it like this:
var command = _Connection.CreateCommand(commandText, new object[0]);
if (parameters != null)
{
foreach (var parameter in parameters)
{
if (parameter.ParameterValue is DateTime)
{
parameter.ParameterValue = ((DateTime)parameter.ParameterValue).ToString("yyyy-MM-dd hh:mm:ss:fff");
}
command.Bind(parameter.ParameterName, parameter.ParameterValue);
}
}
return command;
Related
I'm getting an error in this script and I'm not sure how to fix it. It's the if Range statement.
Sub ShowHideChart()
If Range("show_chart").Value = True Then To the left is the line I'm having trouble with
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveSheet.Shapes.Range(Array("Chart 2")).Visible = msoTrue
I´m dealing with the problem regarding SAP GUI automation.
I have a script shown below which is working without any problem BUT it is working only in the first window of the SAP.
When I have something open in the first window of the SAP and for example the home page of the SAP in 2nd window - I will get this error :
800A026B - The control could not be found by id.
Is there any option how to tell: If window 1 is not available try window No. 2 (Or If window No.1 is not available open a new window and perform there the script?)
Script as below:
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").resizeWorkingPane 206,40,false
session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode "F00082"
session.findById("wnd[0]/usr/ctxtDATABROWSE-TABLENAME").text = "/CASWW/LBL_DATA"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/mbar/menu[3]/menu[2]").select
session.findById("wnd[1]/usr/chk[2,13]").selected = true
session.findById("wnd[1]/usr/chk[2,13]").setFocus
session.findById("wnd[1]/usr").verticalScrollbar.position = 21
session.findById("wnd[1]/usr/chk[2,13]").selected = true
session.findById("wnd[1]/usr/chk[2,13]").setFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/usr/ctxtI1-LOW").text = "2000"
session.findById("wnd[0]/usr/ctxtI2-LOW").text = "A2C03664400"
session.findById("wnd[0]/usr/ctxtI3-LOW").text = "1.1.2021"
session.findById("wnd[0]/usr/ctxtI3-HIGH").setFocus
session.findById("wnd[0]/usr/ctxtI3-HIGH").caretPosition = 0
session.findById("wnd[0]").sendVKey 4
session.findById("wnd[1]/usr/cntlCONTAINER/shellcont/shell").focusDate = "20220104"
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/usr/ctxtLIST_BRE").text = "2500"
session.findById("wnd[0]/usr/txtMAX_SEL").text = "5000 "
session.findById("wnd[0]/usr/txtMAX_SEL").setFocus
session.findById("wnd[0]/usr/txtMAX_SEL").caretPosition = 10
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/mbar/menu[3]/menu[0]/menu[1]").select
session.findById("wnd[1]/tbar[0]/btn[14]").press
session.findById("wnd[1]/usr/chk[1,3]").selected = true
session.findById("wnd[1]/usr/chk[1,4]").selected = true
session.findById("wnd[1]/usr/chk[1,5]").selected = true
session.findById("wnd[1]/usr/chk[1,6]").selected = true
session.findById("wnd[1]/usr/chk[1,8]").selected = true
session.findById("wnd[1]/usr/chk[1,9]").selected = true
session.findById("wnd[1]/usr/chk[1,12]").selected = true
session.findById("wnd[1]/usr/chk[1,17]").selected = true
session.findById("wnd[1]/usr/chk[1,20]").selected = true
session.findById("wnd[1]/usr/chk[1,21]").selected = true
session.findById("wnd[1]/usr/chk[1,21]").setFocus
session.findById("wnd[1]/usr").verticalScrollbar.position = 19
session.findById("wnd[1]/usr/chk[1,14]").selected = true
session.findById("wnd[1]/usr/chk[1,14]").setFocus
session.findById("wnd[1]/tbar[0]/btn[6]").press
session.findById("wnd[0]/usr/lbl[173,3]").setFocus
session.findById("wnd[0]/usr/lbl[173,3]").caretPosition = 0
session.findById("wnd[0]").sendVKey 42
session.findById("wnd[0]/mbar/menu[1]/menu[5]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "D3.XLS"
session.findById("wnd[1]/usr/ctxtDY_PATH").text = "\\cw01.contiwan.com\bdyp\dida4065\Zakaznicka_kvalita\300003300023-0002-0001"
session.findById("wnd[1]/usr/ctxtDY_FILE_ENCODING").text = "0000"
session.findById("wnd[1]/usr/ctxtDY_FILE_ENCODING").setFocus
session.findById("wnd[1]/usr/ctxtDY_FILE_ENCODING").caretPosition = 4
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[0]").resizeWorkingPane 206,40,false
session.findById("wnd[0]/tbar[0]/okcd").text = "mb52"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtMATNR-LOW").text = "A2C03664400"
session.findById("wnd[0]/usr/ctxtWERKS-LOW").text = "2000"
session.findById("wnd[0]/usr/ctxtWERKS-LOW").setFocus
session.findById("wnd[0]/usr/ctxtWERKS-LOW").caretPosition = 4
session.findById("wnd[0]/tbar[1]/btn[8]").press
Thank you for any advise.
Ok, I just solve the issue so the guidance for everyone who would deal with the same problem..
If you have something open in the Window No.1 you have 2 options:
Terminate the script in Window No.1 no matter what has been open there
For the termination add /n before the name of transaction..
Open a new session and perform the script there.
For new session add /o before name of the transaction
Use Followigs:
session.findById("wnd[0]").resizeWorkingPane 159,28,false
session.findById("wnd[0]/tbar[0]/okcd").text = "/nName_of_Transaction"
session.findById("wnd[0]").sendVKey 0
So in my code it would be:
session.findById("wnd[0]").resizeWorkingPane 159,28,false
session.findById("wnd[0]/tbar[0]/okcd").text = "/nZQQN_WLQN"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/chkDY_RST").selected = true
session.findById("wnd[0]/usr/chkDY_MAB").selected = true
session.findById("wnd[0]/usr/chkDY_DEL").selected = true
etc...
Thank also Sandra for her help.
I am getting error at line no 34. I have also a table in database with column post
Line 32: Label5.Text = ds.Tables[0].Rows[0]["date_of_birth"].ToString();
Line 33:
Line 34: Label8.Text = ds.Tables[0].Rows[0]["post"].ToString();
Line 35: Label7.Text = ds.Tables[0].Rows[0]["subjects"].ToString();
Line 36: Label6.Text = ds.Tables[0].Rows[0]["Score"].ToString();
**strong text**
There's a 90% chance that you just got the capitalization wrong.
Check if your column is actually named Post and try this code:
Line 34: Label8.Text = ds.Tables[0].Rows[0]["Post"].ToString();
To avoid an exception for tables that may or may not contain this column, you can check for the presence of this column dynamically:
if(ds.Tables[0].Columns.Contains("post"))
//do something
I'm developing a program using Android Studio that runs as expected when the normal APK is run, but if I compile it for Debugging, it crashes before the 1st line of code executes, so setting a brake-point on the 1st line of my code to execute, never trips.
I have already
Completely deleted the program from the test target (nexus 7)
Power offed the tablet and then restarted tablet
Power off/rebooted the development machine
Cleaned the project
Rebuilt the project.
The program still runs as expected when compiled/run without debugging.
Crashes after loading, but before running when compiled/run in debug.
Any ideas on how to try and overcome this problem would be welcome.
Android Studio 2.1.2
compileSdkVersion 21
buildToolsVersion "21.1.2
Copy of exception variable after crash
shadow$klass = {Class#613} "class java.lang.Class"
superClass = {Class#1356} "class java.lang.Exception"
2 = {ArtMethod#3613}
17 = {ArtMethod#3628}
numReferenceStaticFields = 0
verifyErrorClass = null
iFields = {ArtField[2]#3636}
stackState = {Object[22]#3602}
3 = {ArtMethod#3614}
0 = {ArtMethod#3611}
errno = 2
classLoader = null
8 = {ArtMethod#3619}
dexCache = {DexCache#3633}
functionName = "stat"
virtualMethods = {ArtMethod[3]#3639}
shadow$monitor = -1294973706
primitiveType = 0
Exception = {ErrnoException#3590}
16 = {ArtMethod#3627}
value = {char[4]#3607}
ifTable = {Object[2]#3637}
vtable = null
4 = {ArtMethod#3615}
suppressedExceptions = {Collections$EmptyList#3604} size = 0
classSize = 468
functionName = "stat"
6 = {ArtMethod#3617}
errno = 2
hashCode = 3540564
referenceStaticOffsets = 0
1 = {ArtMethod#3612}
13 = {ArtMethod#3624}
detailMessage = null
18 = {ArtMethod#3629}
stackTrace = {StackTraceElement[0]#3603}
sFields = null
dexClassDefIndex = 4
componentType = null
15 = {ArtMethod#3626}
status = 10
10 = {ArtMethod#3621}
shadow$klass = {Class#3428} "class java.lang.String"
shadow$klass = {Class#183} "class android.system.ErrnoException"
19 = {ArtMethod#3630}
12 = {ArtMethod#3623}
5 = {ArtMethod#3616}
referenceInstanceOffsets = -1090519040
cause = {ErrnoException#3590} "android.system.ErrnoException: stat failed: ENOENT (No such file or directory)"
suppressedExceptions = {Collections$EmptyList#3604} size = 0
objectSize = 36
detailMessage = null
shadow$klass = {Class#183} "class android.system.ErrnoException"
dexCacheStrings = {String[23663]#3634}
dexTypeIndex = 6
shadow$monitor = -1665173294
offset = 0
14 = {ArtMethod#3625}
numReferenceInstanceFields = 1
Variables debug info not available
21 = {int[21]#3632}
name = "android.system.ErrnoException"
stackState = {Object[22]#3602}
clinitThreadId = 456
directMethods = {ArtMethod[2]#3635}
7 = {ArtMethod#3618}
20 = {ArtMethod#3631}
9 = {ArtMethod#3620}
11 = {ArtMethod#3622}
count = 4
shadow$monitor = -1353303322
cause = {ErrnoException#3590} "android.system.ErrnoException: stat failed:
ENOENT (No such file or directory)"
stackTrace = {StackTraceElement[0]#3603}
accessFlags = 524305
Well, I solved the problem myself. NOT in a way that I'd like to have solved it, or that in any way explained what caused the problem, but the problem was corrected. - I've been in IT long enough to know you need to do backups, and once I remembered I had them, I pulled the backup of a day before the problem surfaced, restored the entire directory tree when the project resided and PUFF, everything worked. Re-applied any code changes I made in the day after the backup (I keep pretty good paper notes on changes) and away I went.
- BUT -
This doesn't explain why the system was working one day and after a night of sleep, the system wouldn't work the next day. And I still have no idea how a person who received the error message I received would go about debugging/fixing the problem if he/she didn't have a good set of backups.
ALSO – it seems that someone downgraded my question. Maybe it did deserve to be downgraded, but I have no idea why it was downgraded. The question seemed reasonable to me. One day late in the evening the system worked, and the next day it didn't and the information the system offered was posted in the question.
I'd be very happy if anyone could explain to me how a person could extract information from the posted log, to find out what was wrong – or – at least explain why the question was improper enough to warrant a downgrade ?
any reasonable comments would be welcome.
Joe Cullity
I've just started coding ABAP for a few days and I have a task to call the report from transaction SE38 and have
the report's result shown on the screen of the WebDynPro application SE80.
The report take the user input ( e.g: Material Number, Material Type, Plant, Sale Org. ) as a condition for querying, so the WebDynPro application must allow user to key in this parameters.
In some related article they were talking about using SUBMIT rep EXPORTING LIST TO MEMORY and CALL FUNCTION 'LIST_FROM_MEMORY' but so far I really have no idea to implement it.
Any answers will be appreciated. Thanks!
You can export it to PDF. Therefore, when a user clicks on a link, you run the conversion and display the file in the browser window.
To do so, you start by creating a JOB using the following code below:
constants c_name type tbtcjob-jobname value 'YOUR_JOB_NAME'.
data v_number type tbtcjob-jobcount.
data v_print_parameters type pri_params.
call function 'JOB_OPEN'
exporting
jobname = c_name
importing
jobcount = v_number
exceptions
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
others = 4.
if sy-subrc = 0.
commit work and wait.
else.
EXIT. "// todo: err handling here
endif.
Then, you need to get the printer parameters in order to submit the report:
call function 'GET_PRINT_PARAMETERS'
exporting
destination = 'LP01'
immediately = space
new_list_id = 'X'
no_dialog = 'X'
user = sy-uname
importing
out_parameters = v_print_parameters
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
v_print_parameters-linct = 55.
v_print_parameters-linsz = 1.
v_print_parameters-paart = 'LETTER'.
Now you submit your report using the filters that apply. Do not forget to add the job parameters to it, as the code below shows:
submit your_report_name
to sap-spool
spool parameters v_print_parameters
without spool dynpro
with ...(insert all your filters here)
via job c_name number v_number
and return.
if sy-subrc = 0.
commit work and wait.
else.
EXIT. "// todo: err handling here
endif.
After that, you close the job:
call function 'JOB_CLOSE'
exporting
jobcount = v_number
jobname = c_name
strtimmed = 'X'
exceptions
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
others = 8.
if sy-subrc = 0.
commit work and wait.
else.
EXIT. "// todo: err handling here
endif.
Now the job will proceed and you'll need to wait for it to complete. Do it with a loop. Once the job is completed, you can get it's spool output and convert to PDF.
data v_rqident type tsp01-rqident.
data v_job_head type tbtcjob.
data t_job_steplist type tbtcstep occurs 0 with header line.
data t_pdf like tline occurs 0 with header line.
do 200 times.
wait up to 1 seconds.
call function 'BP_JOB_READ'
exporting
job_read_jobcount = v_number
job_read_jobname = c_name
job_read_opcode = '20'
importing
job_read_jobhead = v_job_head
tables
job_read_steplist = t_job_steplist
exceptions
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
others = 4.
read table t_job_steplist index 1.
if not t_job_steplist-listident is initial.
v_rqident = t_job_steplist-listident.
exit.
else.
clear v_job_head.
clear t_job_steplist.
clear t_job_steplist[].
endif.
enddo.
check not v_rqident is initial.
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = v_rqident
dst_device = 'LP01'
tables
pdf = t_pdf
exceptions
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
others = 12.
If you're going to send it via HTTP, you may need to convert it to BASE64 as well.
field-symbols <xchar> type x.
data v_offset(10) type n.
data v_char type c.
data v_xchar(2) type x.
data v_xstringdata_aux type xstring.
data v_xstringdata type xstring.
data v_base64data type string.
data v_base64data_aux type string.
loop at t_pdf.
do 134 times.
v_offset = sy-index - 1.
v_char = t_pdf+v_offset(1).
assign v_char to <xchar> casting type x.
concatenate v_xstringdata_aux <xchar> into v_xstringdata_aux in byte mode.
enddo.
concatenate v_xstringdata v_xstringdata_aux into v_xstringdata in byte mode.
clear v_xstringdata_aux.
endloop.
call function 'SCMS_BASE64_ENCODE_STR'
exporting
input = v_xstringdata
importing
output = v_base64data.
v_base64data_aux = v_base64data.
while strlen( v_base64data_aux ) gt 255.
clear t_base64data.
t_base64data-data = v_base64data_aux.
v_base64data_aux = v_base64data_aux+255.
append t_base64data.
endwhile.
if not v_base64data_aux is initial.
t_base64data-data = v_base64data_aux.
append t_base64data.
endif.
And you're done!
Hope it helps.
As previous speakers said, you should do extensive training before implementing such stuff in productive environment.
However, calling WebdynPro ABAP within report can be done with the help of WDY_EXECUTE_IN_PLACE function module. You should pass there Webdyn Pro application and necessary parameters.
CALL FUNCTION 'WDY_EXECUTE_IN_PLACE'
EXPORTING
* PROTOCOL =
INTERNALMODE = ' '
* SMARTCLIENT =
APPLICATION = 'Z_MY_WEBDYNPRO'
* CONTAINER_NAME =
PARAMETERS = lt_parameters
SUPPRESS_OUTPUT =
TRY_TO_USE_SAPGUI_THEME = ' '
IMPORTING
OUT_URL = ex_url
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.