on 09-09-2009 12:00 PM
Hi,
I'm facing a weird issue while trying to access BAPI_XMI_LOGON via RFC (i'm using the sapnwrfc-lib for perl).
This is the code I'm using to invoke the function (checked this with various documentations from SAP and also many examples here in the forum.
If I execute this code:
my $rd = $conn->function_lookup("BAPI_XMI_LOGON");
my $rx = $rd->create_function_call;
$rx->EXTPRODUCT("testproduct");
$rx->EXTCOMPANY("testcompany");
$rx->INTERFACE("XAL");
$rx->VERSION("1.0");
$rx->invoke;
I get "Invalid parameters" as error-message.
I then removed one parameter after the other and figured out that it's the "INTERFACE"-parameter it doesn't like.
Once I removed the parameter entirely and executed this code:
my $rd = $conn->function_lookup("BAPI_XMI_LOGON");
my $rx = $rd->create_function_call;
$rx->EXTPRODUCT("testproduct");
$rx->EXTCOMPANY("testcompany");
$rx->VERSION("1.0");
$rx->invoke;
I get the error message that I requested version "1.0" but only version "0.3" would be available. That actually makes sense since I have no idea to which interface the Version-parameter now relates since I did not specify a Interface.
So I removed the "VERSION"-parameter as well and now the login works and I get a SessionID back.
But I need the XAL-interface for subsequent calls.
So my question is: Is there anything that needs to be enabled/configured/etc. for the XAL-interface to be exposed via RFC?
Unhappily the error message "Invalid paramters" (or "ungültige Parameter" in german) is not documented, or I didn't find it.
thanks,
chris
You may have gotten a session id, but when you try to call an XAL function module, it will check to see that you've logged on to the XAL interface, which you haven't. Version is a reserved word, so you have to do it like this:
my $rd = $conn->function_lookup("BAPI_XMI_LOGON");
my $rx = $rd->create_function_call;
$rx->EXTPRODUCT("testproduct");
$rx->EXTCOMPANY("testcompany");
$rx->INTERFACE("XAL");
$rx->parameter('VERSION')->value('0.3');
$rx->invoke;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FYI - this script will tell you what interfaces are available, and their versions:
#!/usr/bin/perl -w
use strict;
use sapnwrfc;
my $interface = shift;
SAPNW::Rfc->load_config;
my $rfc = SAPNW::Rfc->rfc_connect;
my $rcb = $rfc->function_lookup("SXMI_VERSIONS_GET");
my $tsl = $rcb->create_function_call;
if (defined $interface && length($interface)> 0) {
$tsl->INTERFACE($interface);
}
$tsl->invoke;
print "SXMI interfaces and versions\n";
foreach my $row (@{$tsl->VERSIONS}) {
print $row->{'INTERFACE'}, ' ', $row->{'VERSION'}, "\n";
}
$rfc->disconnect();
~ $ ./sxmi_get_versions.pl
SXMI interfaces and versions
XBP 3.0
XMB 0.1
XOM 0.1
XAL 1.0
(h/t to Mingzuo)
You can see details in my blogs here:
Hi,
the tip with SXMI_VERSIONS_GET was a really good one - hadn't tried that yet.
Unhappily, the result is:
SXMI interfaces and versions
XBP 3.0
XMB 0.1
XOM 0.1
XAL 1.0
So, XAL should be available in version 1.0 - just the way it should be.
So I'm basically back to my original question: Why does it return "invalid parameters" if I specify:
$rx->INTERFACE('XAL');
Has anybody used the SAPNWRFC lib to run BAPI_XMI_LOGON successfully?
thanks for your help,
chris
Did you try the code I suggested for passing the version number?
Did you check the links I referenced for my blogs on interfacing to an SAP system with perl?
Yes, I've used BAPI_XMI_LOGON many times with much success. Here's an example:
https://wiki.sdn.sap.com/wiki/display/EmTech/Howtoalertoncanceledbackgroundjobswithsapnwrfcandperl
Cheers,
David.
Hi David,
apologies - forgot that when I posted my reply.
Yes, I had checked out your blog indeed and also copied your logon-code but it didn't make any difference.
I will now try and see if supplying "XAL" with the correct syntax for the VERSION-attribute will make any difference.
thanks for your help,
chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.