on 08-05-2008 8:08 PM
I get the same error with sapnwrfc-0.12 and 0.20.
I have the Java SAP GUI 7.1Rev4 installed and working.
The SAP 7.1 SDK is also installed and I can call many RFC's successfully.
The platform is Perl 5.8.8 RHEL5.
The error is:
"Can't locate auto/SAPNW/Connection/allow_start.al in @INC (@INC contains:..."
The problem is allow_start.al doesn't seem to exist anywhere and I'm doubting that it even should.
Here's the code.
#!/usr/bin/perl -w
use strict;
no warnings 'once';
use Data::Dumper;
use sapnwrfc;
my $CLIENT = '096';#$self->
my %CONNECTION = ('ashost' => '',
'sysnr' => '00',
'client' => '096',
'user' => '',
'passwd' => '',
'lcheck' => '1',
'lang' => 'EN',
'trace' => '0',
'debug' => '0',
);
#print Dumper(%CONNECTION)."\n";
my $conn = undef;
eval { $conn = SAPNW::Rfc->rfc_connect(%CONNECTION) };
if ($@) {
print STDERR "RFC Connect Failed: $@\n";
}
#print Dumper($conn);
#These are transport programs for files (required by CHECKOUTVIEWX)
$conn->allow_start_program('sapftp;saphttp;');
#$conn->allow_start_program('/opt/SAPClients/SAPGUI7.10rev4/bin/sapftp;/opt/SAPClients/SAPGUI7.10rev4/bin/saphttp');
$conn->disconnect;
Is there something I need to do to bring this to the attention of the SAP NW developers?
Is there an example of how to call allow_start_program using SAP::Rfc and the original librfc?
I assume I would download SAP::Rfc and compile it against /usr/sap/rfcsdk instead of /usr/sap/nwrfcsdk?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My objective is to download documents from the SAP DMS.
Note that I'm using the RHEL5 & Perl platform, not XP & .NET.
My understanding is that I need to use BAPI_DOCUMENT_CHECKOUTVIEWX and that that RFC won't work without the sapftp & saphttp transport programs.
So that's why I'm trying to do:
$conn->allow_start_program('sapgui;sapftp;saphttp;');
If you've got a better way I'm all ears.
Here's my beta code:
###############################################################################
sub get_Bapi_Document_Getobjectdocs {
###############################################################################
#PURPOSE: Fetches the documents associated with a given work order
#ASSUMPTIONS: Both the sapnwrfc shared object libraries are installed and the
# Perl interface to them (SAPNW::Rfc) are installed and working.
#EFFECTS:
#INPUTS:
#RETURNS: $cols: Reference to List of column names (1D)
# $rows: Reference to List of data rows (2D)
# $names: Reference to Hash of column names (1D)
###############################################################################
my ($opts) = @_;
#Mandatory Options
my $cols = (exists $opts->{'-cols'})?$opts->{'-cols'}:return([],[],{});
my $rows = (exists $opts->{'-rows'})?$opts->{'-rows'}:return([],[],{});
my $names = (exists $opts->{'-names'})?$opts->{'-names'}:return([],[],{});
#my $work_order_field = (exists $opts->{'-work_order_field'})?$opts->{'-work_ordert_field'}:'10001931';
my $text_id = (exists $opts->{'-text_id'})?$opts->{'-text_id'}:return($cols,$rows,$names);
my $text_object = (exists $opts->{'-text_object'})?$opts->{'-text_object'}:return($cols,$rows,$names);
my $text_name_components = (exists $opts->{'-text_name'})?$opts->{'-text_name'}:return($cols,$rows,$names);
#Optional Options
my $long_text_field = (exists $opts->{'-long_text_field'})?$opts->{'-long_text_field'}:'work_instructions';
my $long_text_exists_field = (exists $opts->{'-long_text_exists_field'})?$opts->{'-long_text_exists_field'}:undef;
my $debug = $opts->{'debug'} || $opts->{'-debug'} || 0;
#I've got to know where to put the long text in $rows otherwise this sub is pointless
if(! exists $names->{$long_text_field}){return($cols,$rows,$names)}
# use test server q0
my $CLIENT = '096';#$self->
my %CONNECTION = (#'ashost' => '',
'sysnr' => '00',
'client' => $CLIENT,
'user' => '',
'passwd' => '',
'lcheck' => '1',
'lang' => 'EN',
'trace' => '0',
'debug' => '0',
);
#print Dumper(%CONNECTION)."\n";
my $conn = undef;
eval { $conn = SAPNW::Rfc->rfc_connect(%CONNECTION) };
if ($@) {
print STDERR "RFC Connect Failed: $@\n";
return($cols,$rows,$names);
}
#$conn->sap-info();
#$conn->is_connected();
#$conn->discover('BAPI_DOCUMENT_GETOBJECTDOCS');
#unshift @INC, '/opt/SAPClients/SAPGUI/bin';
#unshift @INC, '/opt/SAPClients/SAPGUI7.10rev4/bin';
#unshift @INC, '/usr/sap/rfcsdk';
#unshift @INC, '/usr/sap/rfcsdk/bin';
#These are transport programs for files (required by CHECKOUTVIEWX)
$conn->allow_start_program('sapgui;sapftp;saphttp;');
#$conn->allow_start_program('/opt/SAPClients/SAPGUI7.10rev4/bin/sapftp;/opt/SAPClients/SAPGUI7.10rev4/bin/saphttp;');
#$conn->allow_start_program('');
#SAPNW::Rfc->allow_start_program('');
#SAPNW::Rfc::allow_start_program('');
my $rfc_getobjectdocs;
eval { $rfc_getobjectdocs = $conn->function_lookup('BAPI_DOCUMENT_GETOBJECTDOCS') };
if ($@) {
print STDERR "RFC Function Lookup Failed: '$@'\n";
return($cols,$rows,$names);
}
#$debug && print Dumper($rfc_getobjectdocs);
my $rfc_getdetail2;
eval { $rfc_getdetail2 = $conn->function_lookup('BAPI_DOCUMENT_GETDETAIL2') };
if ($@) {
print STDERR "RFC Function Lookup Failed: '$@'\n";
return($cols,$rows,$names);
}
#$debug && print Dumper($rfc_getdetail2);
my $rfc_checkoutviewx;
eval { $rfc_checkoutviewx = $conn->function_lookup('BAPI_DOCUMENT_CHECKOUTVIEWX') };
if ($@) {
print STDERR "RFC Function Lookup Failed: '$@'\n";
return($cols,$rows,$names);
}
#$debug && print Dumper($rfc_getdetail2);
for my $i (0..$#$rows){
my $LATEST_VERSION = 'X';
my $DATE = strftime( '%D', localtime );
#my $DOCUMENT_PREFIX = '0000000000000000000';
my $PORDER_PREFIX = '0000';
#my $MATERIAL_PREFIX = '00000000000';
my $WORK_ORDER_OBJECT_PREFIX0 = 'H0001 000000000000';
my $WORK_ORDER_OBJECT_PREFIX1 = 'H0001 000000000001';
#my $MATERIAL_KEY = 'MARA';
my $WORK_ORDER_KEY = 'PORDER';
#Construct the work_order_object_key
my $object_key = $PORDER_PREFIX . '10001931' . $WORK_ORDER_OBJECT_PREFIX0;
#Does need to be in the loop?
my $fs;
eval { $fs = $rfc_getobjectdocs->create_function_call };
if ($@) {
print STDERR "Create Function Call Failed: $@\n";
#return($cols,$rows,$names);
}
#$debug && print Dumper($fs);
#$fs->CURRENTVERSIONSONLY($LATEST_VERSION);
$fs->CURRENTVERSIONSONLY('');
$fs->DATE($DATE);
$fs->OBJECTKEY($object_key);
$fs->OBJECTTYPE($WORK_ORDER_KEY);
#$debug && print Dumper($fs);
# invoke the Function Module and then play with the results
$fs->invoke;
#my $MESSAGES = $fs->RETURN;
#$debug && print Dumper($MESSAGES);
my $DOCUMENTS = $fs->DOCUMENTLIST;
#$debug && print Dumper($DOCUMENTS);
for my $j (0..$#$DOCUMENTS){
my $type = $DOCUMENTS->[$j]->{'DOCUMENTTYPE'};
my $version = $DOCUMENTS->[$j]->{'DOCUMENTVERSION'};
my $part = $DOCUMENTS->[$j]->{'DOCUMENTPART'};
my $number = $DOCUMENTS->[$j]->{'DOCUMENTNUMBER'};
#print "$type,$version,$part,$number\n";
#Does need to be in the loop?
my $fs;
eval { $fs = $rfc_getdetail2->create_function_call };
if ($@) {
print STDERR "Create Function Call Failed: $@\n";
#return($cols,$rows,$names);
}
#$debug && print Dumper($fs);
$fs->GETDOCDESCRIPTIONS('X');#Input
#$fs->GETOBJECTLINKS();#Input
#$fs->GETSTRUCTURE();#Input
#$fs->STATUSLOG();#Input
$fs->GETACTIVEFILES('X');#Input
#$fs->GETCOMPONENTS();#Input
#$fs->HOSTNAME();#Input
$fs->GETDOCFILES('X');#Input
#$fs->GETCLASSIFICATION();#Input
#$fs->GETWHEREUSED();#Input
$fs->DOCUMENTTYPE($type);#Input
$fs->DOCUMENTVERSION($version);#Input
#$fs->GETLONGTEXTS();#Input
$fs->DOCUMENTPART($part);#Input
$fs->DOCUMENTNUMBER($number);#Input
#$debug && print Dumper($fs);
# invoke the Function Module and then play with the results
$fs->invoke;
#my $MESSAGES = $fs->RETURN;
#$debug && print Dumper($MESSAGES);
#my $DOCUMENTDATA = $fs->DOCUMENTDATA;
#$debug && print Dumper($DOCUMENTDATA);
#$debug && print Dumper($fs->COMPONENTS());#Output Table
#$debug && print Dumper($fs->CLASSALLOCATIONS());#Output Table
#$debug && print Dumper($fs->DOCUMENTDESCRIPTIONS());#Output Table...what Nick Uses
#$debug && print Dumper($fs->DOCUMENTSTRUCTURE());#Output Table
#$debug && print Dumper($fs->CHARACTERISTICVALUES());#Output Table
#$debug && print Dumper($fs->GETSTATUSLOG());#Output Table
#$debug && print Dumper($fs->OBJECTLINKS());#Output Table
#$debug && print Dumper($fs->DOCUMENTFILES());#Output Table...what Nick Uses
#$debug && print Dumper($fs->LONGTEXTS());#Output Table
#$debug && print Dumper($fs->WHEREUSEDLIST());#Output Table
my $DOCUMENTFILES = $fs->DOCUMENTFILES;
#$debug && print Dumper($DOCUMENTFILES);
for my $k (0..$#$DOCUMENTFILES){
my $application = $DOCUMENTFILES->[$k]->{'WSAPPLICATION'};
if($application eq 'EXL'){
#Does need to be in the loop?
my $fs;
eval { $fs = $rfc_checkoutviewx->create_function_call };
if ($@) {
print STDERR "Create Function Call Failed: $@\n";
#return($cols,$rows,$names);
}
#$debug && print Dumper($fs);
#print "$type,$version,$part,$number\n";
my $ARGUMENTS = [{'DOCUMENTTYPE' => $type,
'DOCUMENTVERSION' => $version,
'DOCUMENTPART' => $part,
'DOCUMENTNUMBER' => $number,
},
];
$fs->DOCUMENTS($ARGUMENTS);
$fs->GETCOMPONENTS('X');#Input
#$fs->PF_HTTP_DEST();#Input
#$fs->HOSTNAME();#Input
#$fs->PF_FTP_DEST();#Input
$fs->ORIGINALPATH('/home/jwelter');#Input
$fs->WSAPPLICATION([{'WSAPPLICATION' => $application}]);
$debug && print Dumper($fs);
# invoke the Function Module and then play with the results
$fs->invoke;
#$debug && print Dumper($fs->DOCUMENTFILES_IN());#Output table
#$debug && print Dumper($fs->DOCUMENTFILES_OUT());#Output table
#$debug && print Dumper($fs->COMPONENTS());#Output table
#$debug && print Dumper($fs->WSAPPLICATION());#Output table
#Error Messages
$debug && print Dumper($fs->RETURN());#Output
}#if($application eq 'EXL'){
}#for my $k (0..$#$DOCUMENTFILES){
}#for my $j (0..$#$DOCUMENTS){
}#for my $i (0..$#$rows){
$conn->disconnect;
# if($debug){
# #Column Names
# foreach(@{$cols}){print "$_\t"}
# print "\n";
#
# #Data
# foreach my $row ( @{$rows} ){
# foreach ( @{$row} ){
# if( defined $_ ){print "$_\t"}else{print "\t"}
# }
# print "\n";
# }
# }#if($debug){
return ($cols,$rows,$names);
}#sub get_Bapi_Document_Getobjectdocs {
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi - you are correct - allow_start_program has not been coded. What is it that you are trying to achieve?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.