--- call_rfc.pl 2002/11/18 13:40:02 1.1.1.1 +++ call_rfc.pl 2002/11/19 18:16:58 1.3 @@ -1,34 +1,38 @@ #!/usr/bin/perl -use lib '../lib'; +use strict; use SAP::Rfc; use Data::Dumper; +use XML::Simple; + +if ($#ARGV < 0) { + print "usage: call_rfc.pl config.xml\n"; + exit 1; +} $|++; -# get a list of report names from table TRDIR and -# then get the source code of each +my $config = XMLin(@ARGV[0]); my $rfc = new SAP::Rfc( - ASHOST => 'cipkg', - USER => 'rfctest', - PASSWD => 'dinamo', - LANG => 'HR', - CLIENT => '200', - SYSNR => '20', - TRACE => '0' + ASHOST => $config->{sap}->{ashost}, + USER => $config->{sap}->{user}, + PASSWD => $config->{sap}->{passwd}, + LANG => $config->{sap}->{lang}, + CLIENT => $config->{sap}->{client}, + SYSNR => $config->{sap}->{sysnr}, + TRACE => $config->{sap}->{trace} ) || die "new: $!"; $rfc->is_connected || die "not connected"; -my $it = $rfc->discover("Z_ZDMM0123_SIGMA_RFC") || die "discover: $!"; - -#%info = $rfc->sapinfo(); -#map { print "key: $_ = ", $info{$_}, "\n" } sort keys %info; +my $it = $rfc->discover($config->{sap}->{discover}) || die "discover: $!"; -$it->FILEPATH( "ZSIGMA" ); -#$it->FILENAME( "LC_Orders.edi" ); -$it->FILENAME( "orders2.edi" ); -$it->PORT( "ZIDOC" ); +foreach my $p ($config->{sap}->{params}) { + foreach my $p_name (keys %{$p}) { + print "$p_name --> ",$p->{$p_name},"\n"; + $it->$p_name($p->{$p_name}); + } +} $rfc->callrfc( $it );