cancel
Showing results for 
Search instead for 
Did you mean: 

issues with BAPI_XMI_LOGON from perl - invalid parameters

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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;

Former Member
0 Kudos

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:

http://weblogs.sdn.sap.com/pub/u/251752730

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Check out the wiki reference also - I use BAPI_XMI_LOGON there.

What function module is it you're trying to execute with the XAL interface?

Cheers,

David.

Former Member
0 Kudos

Hi David,

you were right, the problem was indeed the wrong way to pass the VERSION-parameter.

So the error message "invalid parameters" basically meant that you're not allowed to only pass the INTERFACE- without the VERSION-parameter.

Thank you so much for helping!

cheers,

chris

Former Member
0 Kudos

Anytime, I'm glad you got it working.

Cheers,

David.

Answers (0)