cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with a perl remote server for ECC

Former Member
0 Kudos

I'm sorry, if I'm asking about something that's obvious, but I'm a begginer in SAP. I need to develop a perl application in a remote server that will receive a requisition from an abap application, send some commands  to a special local printer and return a status to the abap aplication. I'm using the module sapnwrfc. I connect to sap gateway with no errors and execute the function sapnwrfc::installFunction (no errors returned) but I can't find the transaction in sap. Anybody has some document about configurations that I need to do in sap ? Or anybody could see the code above and tell me what is wrong ?

Thanks.

[code]

#!/usr/bin/perl

use sapnwrfc;
use Data::Dumper;
use utf8;


SAPNW::Rfc->load_config;
#print "Testing SAPNW::Rfc-$SAPNW::Rfc::VERSION\n";

my $server = SAPNW::Rfc->rfc_register;


#  SAPNW::Rfc->load_config;
#  my $server = SAPNW::Rfc->rfc_register;

print "Connection attributes: ".Dumper($server->connection_attributes)."\n"; 

$funcao   = new SAPNW::RFC::FunctionDescriptor("ZTDTIMPCHEQUE");
$pipedata = new SAPNW::RFC::Type(name => 'DADOS',
                                 type => RFCTYPE_TABLE,
                               fields => [{name => 'BANCO',
                                           type => RFCTYPE_CHAR,
                                            len => 3},
                                          {name => 'FAVORECIDO',
                                           type => RFCTYPE_CHAR,
                                            len => 65},
                                          {name => 'CIDADE',
                                           type => RFCTYPE_CHAR,
                                            len => 20},
                                          {name => 'DATA',
                                           type => RFCTYPE_CHAR,
                                            len => 8},
                                          {name => 'VALOR',
                                           type => RFCTYPE_NUM,
                                            len => 14},
                                          {name => 'STATUS',
                                           type => RFCTYPE_CHAR,
                                            len => 1},
                                          {name => 'LOG',
                                           type => RFCTYPE_CHAR,
                                            len => 100},
          ]);

# A funcao Export do RFC é para especificar a estrutura de saída por onde vou devolver os dados ao SAP

$funcao->addParameter(new SAPNW::RFC::Export(name => "DADOS",
                                              len => 201,
                                             type => $pipedata));

# A funcao Import é onde vou receber os dados do SAP

$funcao->addParameter(new SAPNW::RFC::Import(name => "CHEQUE",
                                             len => 201,
                                            type => $pipedata));
$funcao->callback(\&do_remote_pipe);
$server->installFunction($funcao);
$server->accept(5, \&do_global_callback);
$server->disconnect();

exit;

sub do_remote_pipe {
    my $parametro = shift;
    print "\nBanco : " . $parametro->{'BANCO'} . "\n";
    $parametro->CHEQUE([{'LOG'=>'Executei a rotina'}]);
    $parametro->CHEQUE([{'STATUS'=>'S'}]);
    return 1;
}

sub do_global_callback {

# Esta rotina é chamada cada vez que ocorre time out no accept.
    warn "Running global callback ...\n";
    return 1;
}

Accepted Solutions (0)

Answers (1)

Answers (1)

fred_richard
Discoverer
0 Kudos

Are you able to correct the problem using the module sapnwrfc?

We are starting to use the module sapnwrfc and I was wondering if the your process was working.

Thanks

Fred