Powerbuilder word OLE: Run time error 35 while setformresult - ole

I am using powerbuilder 12.5 to add data to word templates using bookmarks.When I use objword.setformresult(bookmarkname,value) I get run time error 35
"error calling external object function setformresult"
Info: We have recently migrated powerbuilder 6.5 to 12.5 but still we use Office 2003

This is how I do it:
lole_word = CREATE OLEObject
lole_word.ConnectToNewObject ("word.application")
lole_Document = lole_word.Documents.Open (is_infile,FALSE,TRUE,FALSE)
lole_range = lole_document.Bookmarks.item(ls_bookmark).Range
lole_range.Text = ls_newText
Always put code like this a Try..Catch block and catch OleRuntimeError and RuntimeError. Note that replacing the text will remove the bookmark. If you need the bookmark you have to remember where it is (for example lole_document.Bookmarks.item(ls_bookmark).Start) and add the bookmark to the document again.

Related

Report in AX 2012 does not open;List of errors

I have created a report in AX 2012 and Visual Studio properly but once I try to open it the following list of erors appears:
Thank you
Error executing code: FormRun (data source) has no valid runable code in method 'new'.
Stack trace
(C)\Classes\FormRun\new
(C)\Classes\SysSetupFormRun\new - line 4
(C)\Classes\ClassFactory\formRunClassOnClient - line 10
(C)\Classes\ClassFactory\formRunClass - line 24
(C)\Classes\DialogForm\doInit - line 12
(C)\Classes\Dialog\doInit - line 12
(C)\Classes\Dialog\doRun - line 24
(C)\Classes\SysOperationDialog\run - line 12
(C)\Classes\SysOperationController\dialogShow - line 6
(C)\Classes\SysOperationController\dialogRun - line 40
(C)\Classes\SysOperationController\prompt - line 9
(C)\Classes\SrsReportRunController\runToScreen - line 26
(C)\Classes\SrsReportRunController\runReport - line 68
(C)\Classes\SrsReportRunController\run - line 27
(C)\Classes\SysOperationController\startOperation - line 10
(C)\Classes\SrsReportRunController\startOperation - line 12
To me, this is mostly base code, so it's a compile or CIL-compile issue most likely.
Have you compiled your CIL or performed an incremental CIL compile?
Refresh your report caches (Tools>Caches>Refresh Report Server).
Are the WCF settings in the AXC used for the report server refreshed?
Is the report server using a specific AXC that may not be refreshed? (https://technet.microsoft.com/en-us/library/hh389774.aspx)
You can find that the issue is with form (as the infolog suggest). The name of the form can be found out if you debug the code in classes.
Try putting debugger on DialogForm.doInit(). In this method, you can find the name of the form in the object variable, "form", used inside this method in a call to args.object(form).
You have to compile this form; Restore it and report does get generated.
Remember, DialogForm.doInit() gets called 2 times, Once, launching input UI form and another when trying to launch report viewer. So if the input/contract form is getting opened and the error comes before showing the report output, its the second time when you are interested to find the name of the form.
In my case, culprit forms were, SysOperationTemplateForm and SRSReportViewer form.

libxively C API frequently does nothing

I'm trying to use libxively to update my feed, but it frequently seems to do nothing. I've got a basic call:
{
xi_datastream_t& ds = mXIFeed.datastreams[2];
::xi_str_copy_untiln(ds.datastream_id, sizeof (ds.datastream_id), "cc-output-power", '\0');
xi_datapoint_t& dp = ds.datapoints[0];
ds.datapoint_count = 1;
::xi_set_value_f32(&dp, mChargeController->outputPower());
}
const xi_context_t* ctx = ::xi_nob_feed_update(mXIContext, &mXIFeed);
it logs the following:
[io/posix/posix_io_layer.c:182 (posix_io_layer_init)] [posix_io_layer_init]
[io/posix/posix_io_layer.c:191 (posix_io_layer_init)] Creating socket...
[io/posix/posix_io_layer.c:202 (posix_io_layer_init)] Socket creation [ok]
Once or twice I saw my Xively developer page show a GET feed, but otherwise, nothing seems to get written. Any suggestions on what I should look at?
I tried to rebuild the library using blocking calls (would be nice if nob didn't mean no blocking calls), but I couldn't figure out how to build it.
Thanks!
EDIT:
I was able to build a synchronous version of the library, and that seems to work. Can anyone verify that the async version works? Is there more to it than simply calling xi_nob_feed_update()?
EDIT 2:
I tried running the async example, but I'm doing something wrong, as it always complains of no data received:
$ bin/asynch_feed_update <my key> <my feed ID> example 1 example 4 example 20 example 58 example 11 example 17
example: 1 7
example: 4 7
example: 20 7
example: 58 7
example: 11 7
example: 17 7
[io/posix_asynch/posix_asynch_io_layer.c:165 (posix_asynch_io_layer_init)] [posix_io_layer_init]
[io/posix_asynch/posix_asynch_io_layer.c:174 (posix_asynch_io_layer_init)] Creating socket...
[io/posix_asynch/posix_asynch_io_layer.c:185 (posix_asynch_io_layer_init)] Setting socket non blocking behaviour...
[io/posix_asynch/posix_asynch_io_layer.c:203 (posix_asynch_io_layer_init)] Socket creation [ok]
No data within five seconds.
The asynchronous version should work. The xi_nob_feed_update() is the right function to make a feed update request.
You have to call process_xively_nob_step() in a loop just after select().
In general, you should follow the asynchronous example.

Laravel error on merge collection later to upgrate from 4.0 to 4.1

Later to upgrade Laravel version i found that the Collection::merge method isn't working well.
Not sure if it is my problem, i can't find an error. Lets see some information:
print_r($ecb->count());
print_r($boc->count());
// merge both
$cubes = $ecb->merge($boc);
print_r($cubes->count());
dd();
output:
36 27 1
the merge should to give like output 36 + 27 (there isn't duplicate element on the collection)
More debug information:
print_r($ecb->toArray());
print_r($boc->toArray());
// merge both
$cubes = $ecb->merge($boc);
print_r($cubes->toArray());
dd();
output (is a bit long): http://laravel.io/bin/PdVj1#7
Any idea?
Thanks
Yes - it appears to have changed between 4 and 4.1
See this Github issue: https://github.com/laravel/framework/issues/3445
In essence Eloquent collections, upon merging, remove models with duplicate primary keys.
I'm running Laravel 4.1.29 - and I get a different output to you with count() - but in essence it just removes duplicate ids.
I see that in Laravel 4.1 merge delete element with same ids ( https://github.com/laravel/framework/issues/3445 )
To have the same behavior i should to change the code like it:
$boc->each(function($cube) use ($ecb)
{
$ecb->push($cube);
});
The merge function uses Model#getKey() to differentiate different models - do the models you are using have a primary key specified properly? I notice they don't have the standard id field.

ABAP OLE - Open excel password protected workbook

I'm trying to open a password protected excel file using SAP ABAP OLE OBJECT as follows:
DATA: lt_excel_line(4096) OCCURS 10 WITH HEADER LINE.
DATA: app TYPE ole2_object,
workbook TYPE ole2_object,
worksheet TYPE ole2_object.
CREATE OBJECT app 'EXCEL.APPLICATION'.
SET PROPERTY OF app 'VISIBLE' = 0.
CALL METHOD OF app 'WORKBOOKS' = workbook.
CALL METHOD OF workbook 'OPEN'
EXPORTING
#1 = '<filename>'
#5 = '<password>'.
The filename and password are definitely correct and the following VBA code opens the file as required no problem:
Dim wb1 As Workbook
Set wb1 = Workbooks.Open Filename:="<filename>", Password:="<password>")
But the ABAP code always returns sy-subrc = 2. Anyone know what could be going on? Or what else I can try? Grateful for any help.
I think the problem is with the parameters being positional only (just a guess), as the SAP GUI automation does not support parameter names. There are 3 parameters between Filename and Password, so you numbered them correctly, but I guess the SAP GUI automation controller does not see it that way.
I replicated your problem and got it working as follows:
CALL METHOD OF workbook 'OPEN' = document
EXPORTING
#1 = '<filename>'
#2 = 0 "UpdateLinks
#3 = 0 "ReadOnly
#4 = 1 "Format
#5 = '<password>'.
Here I am explicitly passing the parameters UpdateLinks, ReadOnly and Format.
I tested it first in VBA. It seems Format (#4) must be set to true. I don't know what that does.
Remember to set the document handle as a return from this call as I do here, otherwise you don't have a reference to it!

How to set (unix) permissions when creating a file in SAP ABAP?

you would think this would be obvious, but searching through documentation, SAP forums, Googling, etc., I've been spectacularly unsuccessful. I'm creating a file in ABAP on a solaris filesystem using the following code:
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
the resulting file is owned and grouped according to a pre-defined admin user, which is fine, but the sticky wicket is that the permissions are set to 660/rw-rw----, meaning I can't examine the results. is there a way (possibly using that vaguely defined TYPE addition?) I can specify the resulting permissions on the new file?
thanks!
Go to SM69, create a logical system command, you could call it ZCHMOD.
Map that command to chmod, then call with the proper parameter
(man chmod on the command line is your friend).
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZCHMOD'
additional_parameters = l_par
operatingsystem = l_os
TABLES
exec_protocol = it_log
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
Obviously, that would be a 2 step process, but it works.
this works in 4.6B:
CONCATENATE 'chmod ugo=rw ' lc_filename
INTO lc_chmod SEPARATED BY space.
CALL 'SYSTEM' ID 'COMMAND' FIELD lc_chmod.
Hope this helps.
Cheers,
Heiko
In RZ10 add parameter install/umask.
Default value is 007, you can change it: 000, 002...
So, the files created will be -rw-rw-rw-, -rw-rw-r--...

Resources