--- mail2sap.pl 2002/11/19 09:03:22 1.3 +++ mail2sap.pl 2002/11/19 09:24:55 1.4 @@ -29,24 +29,8 @@ open(LOG,">> $log") || warn "open log $log: $!"; local $SIG{__DIE__} = sub { print LOG $_[0] ; die $_[0] }; -# init SAP rfc -# -my $rfc = new SAP::Rfc( - 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: $!"; - - -# no user editable content beyond this point - umask 022; # world readable -$rfc->is_connected || die "SAP rfc: not connected"; #------------------------------------------------------------ # dump_entity - dump an entity's file info @@ -82,6 +66,20 @@ # now, call SAP rfc + # init SAP rfc + # + my $rfc = new SAP::Rfc( + 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 "SAP rfc: not connected"; + my $it = $rfc->discover("Z_ZDMM0123_SIGMA_RFC") || die "discover: $!"; $it->FILEPATH( "ZSIGMA" ); @@ -89,11 +87,12 @@ $it->PORT( "ZIDOC" ); $rfc->callrfc( $it ); + + $rfc->close(); } } } -$rfc->close(); #------------------------------------------------------------ # main