--- mail2sap.pl 2002/11/19 09:03:22 1.3 +++ mail2sap.pl 2002/11/19 12:16:02 1.6 @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/suidperl -w # read e-mail from stdit (pipe from /etc/aliases) and call SAP rfc function # @@ -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,18 +66,33 @@ # now, call SAP rfc - my $it = $rfc->discover("Z_ZDMM0123_SIGMA_RFC") || die "discover: $!"; + # 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: $!"; - $it->FILEPATH( "ZSIGMA" ); + $rfc->is_connected || die "SAP rfc: not connected"; + + my $it = $rfc->discover($config->{sap}->{discover}) || die "discover: $!"; + + $it->FILEPATH( $config->{sap}->{filepath} ); $it->FILENAME( $new ); - $it->PORT( "ZIDOC" ); + $it->PORT( $config->{sap}->{port} ); $rfc->callrfc( $it ); + + $rfc->close(); } } } -$rfc->close(); #------------------------------------------------------------ # main