on 10-21-2009 6:25 PM
Hi,
we use the perl module "sapnwrfc" together with nwrfcsdk of SAP
to read out some user details. The SAP system is installed as a
unicode system. We have a problem of setting the import parameter
USERNAME in BAPI_USER_GET_DETAIL correctly. The program
works fine for the value "TESTUSER". An error occured when we
call the bapi with german umlaut.
Here is an example:
#!/usr/bin/perl
...
use sapnwrfc;
...
$Username = "SCHRÖDER";
$Rfc = SAPNW::Rfc->rfc_connect(
ASHOST => $Hostname,
USER => $UserId,
PASSWD => $Password,
LANG => $Language,
CLIENT => $Client,
SYSNR => $SystemNr,
TRACE => '1' );
$Rcb = $Rfc->function_lookup( "BAPI_USER_GET_DETAIL" );
$Iface = $Rcb->create_function_call;
$Iface->USERNAME( $Username );
$Iface->invoke;
...
The function "invoke" never ends.
Can anybody help us?
Thanks
Helmut
Hi Helmut -
have you tried adding use utf8; to your code?
#!/usr/bin/perl
use strict;
use utf8;
use sapnwrfc;
...
Cheers,
Piers Harding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi -
I got some time to test this over the weekend - I've tried, but I can't recreate the problem. I have created a user account with "SCHRÖDER", and am able to run the following code successfilly:
#!/usr/bin/perl
use strict;
use lib '../blib/lib';
use lib '../blib/arch';
use lib './blib/lib';
use lib './blib/arch';
use utf8;
use sapnwrfc;
use Data::Dumper;
my $Username = "SCHRÖDER";
SAPNW::Rfc->load_config;
print "Testing SAPNW::Rfc-$SAPNW::Rfc::VERSION
";
my $conn = SAPNW::Rfc->rfc_connect();
my $Rcb = $conn->function_lookup( "BAPI_USER_GET_DETAIL" );
my $Iface = $Rcb->create_function_call;
$Iface->USERNAME( $Username );
$Iface->invoke;
warn Dumper($Iface);
This is Ubuntu 9.10 - amd64, Perl 5.10.0, SAP NW 2004S, sapnwrfc 0.31, and NW RFC SDK 7.11 - Patch Level 3 .
Cheers,
Piers Harding.
Hi -
what version of sapnwrfc for Perl are you using - 0.31? Also, Perl, and OS version, and NW RFC SDK info would be useful.
Cheers,
Piers Harding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
our technical support has installed the following software versions:
OS: Linux ... 2.6.16.27-0.9-smp #1 SMP Tue Feb 13 09:35:18 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux
Perl: This is perl, v5.8.8 built for x86_64-linux-thread-multi
sapnwrfc for Perl : sapnwrfc-0.31
NW RFC SDK : NWRFC_4-20004549.SAR
In article is the latest version sapnwrfc-0.30.tar.gz available, which requires perl 5.10. Have we a problem with
perl v5.8.8?
Regards
Helmut Schröder
I don't have any usernames with umlauts in them, but I certainly didn't get any errors in the process. either.
$ cat umlaut-test.pl
#!/usr/bin/perl -w
use strict;
use sapnwrfc;
use Data::Dumper;
SAPNW::Rfc->load_config('rdu.yml');
my $rfc = SAPNW::Rfc->rfc_connect;
my $rcb = $rfc->function_lookup("BAPI_USER_GET_DETAIL");
my $tsl = $rcb->create_function_call;
$tsl->USERNAME('SCHRÖDER');
$tsl->invoke;
warn Dumper($tsl->LOGONDATA);
$rfc->disconnect();
$ perl umlaut-test.pl
$VAR1 = {
'PASSCODE' => '',
'LTIME' => '000000',
'CLASS' => ' ',
'USTYP' => ' ',
'GLTGB' => '00000000',
'TZONE' => ' ',
'CODVN' => ' ',
'BCODE' => '',
'ACCNT' => ' ',
'CODVC' => ' ',
'GLTGV' => '00000000'
};
Cheers,
David.
PS: my versions:
RHEL 5, kernel 2.6.18-164
perl 5.8.8
sapnwrfc 0.24
I have added spacing for easier reading:
This is the script:
$ cat umlaut-test.pl
#!/usr/bin/perl -w
use strict;
use sapnwrfc;
use Data::Dumper;
SAPNW::Rfc->load_config('rdu.yml');
my $rfc = SAPNW::Rfc->rfc_connect;
my $rcb = $rfc->function_lookup("BAPI_USER_GET_DETAIL");
my $tsl = $rcb->create_function_call;
$tsl->USERNAME('SCHRÖDER');
$tsl->invoke;
warn Dumper($tsl->LOGONDATA);
$rfc->disconnect();
And this is the code being executed:
$ perl umlaut-test.pl
$VAR1 = {
'PASSCODE' => '',
'LTIME' => '000000',
'CLASS' => ' ',
'USTYP' => ' ',
'GLTGB' => '00000000',
'TZONE' => ' ',
'CODVN' => ' ',
'BCODE' => '',
'ACCNT' => ' ',
'CODVC' => ' ',
'GLTGV' => '00000000'
};
Hi,
let's try it to explain with following example:
#!/usr/bin/perl
...
use sapnwrfc;
...
$Username = "SCHRÖDER";
$Rfc = SAPNW::Rfc->rfc_connect(
ASHOST => $Hostname,
USER => $UserId,
PASSWD => $Password,
LANG => $Language,
CLIENT => $Client,
SYSNR => $SystemNr,
TRACE => '1' );
$Rcb = $Rfc->function_lookup( "BAPI_USER_GET_DETAIL" );
$Iface = $Rcb->create_function_call;
$Iface->USERNAME( $Username );
print "before invoke...
";
$Iface->invoke;
print "after invoke...
";
...
The output before $Iface->invoke is printed. The output
after $Iface->invoke is never displayed. The command
"Iface->invoke" loops.
We have no problems with values without german umlauts.
Regards,
Helmut Schröder
I also tried passing the username into a variable as you were doing, but this script succeeded for me as well.
#!/usr/bin/perl -w
use strict;
use sapnwrfc;
use Data::Dumper;
SAPNW::Rfc->load_config('rdu.yml');
my $username = "SCHRÖDER";
my $rfc = SAPNW::Rfc->rfc_connect;
my $rcb = $rfc->function_lookup("BAPI_USER_GET_DETAIL");
my $tsl = $rcb->create_function_call;
$tsl->USERNAME($username);
$tsl->invoke;
warn Dumper($tsl->LOGONDATA);
I also activated tracing, and see no errors in the trace file. Here is a snippet:
>> RfcInvoke
Invoking BAPI_USER_GET_DETAIL on handle 161762128
>> RfcFunction name="BAPI_USER_GET_DETAIL"
>> IMPORTING parameters
>> CACHE_RESULTS, RFCTYPE_CHAR, Length: 2, Active: false, Requested: false
Value:
<< CACHE_RESULTS
>> USERNAME, RFCTYPE_CHAR, Length: 24, Active: true, Requested: false
Value: SCHRÖDER
<< USERNAME
<< IMPORTING parameters
>> CHANGING parameters
<< CHANGING parameters
>> TABLES parameters
>> ACTIVITYGROUPS, RFCTYPE_TABLE, Length: 0, Active: true, Requested: false
Value: (empty)
<< ACTIVITYGROUPS
>> ADDCOMREM, RFCTYPE_TABLE, Length: 0, Active: true, Requested: false
Value: (empty)
<< ADDCOMREM
Hi,
trace file with username 'TEST':
...
<< RfcOptions
>> RfcConnection name="none"
Handle = 13630944 ConvID = 62464895
<< RfcConnection
<< RfcOpenConnection returned RFC_OK
>> RfcGetFunctionDesc
<< RfcGetFunctionDesc returned RFC_OK
>> RfcInvoke
Invoking BAPI_USER_GET_DETAIL on handle 13630944
>> RfcFunction name="BAPI_USER_GET_DETAIL"
>> IMPORTING parameters
>> CACHE_RESULTS, RFCTYPE_CHAR, Length: 2, Active: false, Requested: false
Value:
<< CACHE_RESULTS
>> USERNAME, RFCTYPE_CHAR, Length: 24, Active: true, Requested: false
Value: TEST
<< USERNAME
<< IMPORTING parameters
>> CHANGING parameters
<< CHANGING parameters
>> TABLES parameters
...
Trace file with username 'SCHRÖDER':
...
<< RfcOptions
>> RfcConnection name="none"
Handle = 13630944 ConvID = 62679909
<< RfcConnection
<< RfcOpenConnection returned RFC_OK
>> RfcGetFunctionDesc
<
RfcGetFunctionDesc is the last entry in the trace file.
Regards,
Helmut
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.