33 |
my $outfile = $config_file; |
my $outfile = $config_file; |
34 |
$outfile =~ s/\.xml//i; |
$outfile =~ s/\.xml//i; |
35 |
$outfile =~ s/^.*\/([^\/]+)/$1/i; # basename |
$outfile =~ s/^.*\/([^\/]+)/$1/i; # basename |
36 |
$outfile .= "_${yy}-${mm}-${dd}_${hh}:${mm}:${ss}_$$"; |
$outfile .= sprintf("_%04d-%02d-%02d_%02d:%02d:%02d_%d",$yy,$mm,$dd,$hh,$mm,$ss,$$); |
37 |
|
|
38 |
my $rfc = new SAP::Rfc( |
my $rfc = new SAP::Rfc( |
39 |
ASHOST => $config->{sap}->{ashost}, |
ASHOST => $config->{sap}->{ashost}, |
62 |
|
|
63 |
my @data; # array for order |
my @data; # array for order |
64 |
my $lines; # number of lines in order |
my $lines; # number of lines in order |
65 |
|
my $nr; # order number |
66 |
|
|
67 |
my $first = <STDIN>; |
my $first = <STDIN>; |
68 |
push @data,$first; |
push @data,$first; |
69 |
chomp $first; |
chomp $first; |
70 |
$first=~s/
//g; |
$first=~s/
//g; |
71 |
if ($first =~ m/\s+(\d+)\s+(\d+)\w+\s*$/) { |
if ($first =~ m/\s+(\d+)\s+(\d+)\w+\s*$/) { |
72 |
my ($nr,$lines) = ($1,$2); |
($nr,$lines) = ($1,$2); |
73 |
print "Processing $lines lines order no. $nr\n"; |
print "Processing $lines lines order no. $nr\n"; |
74 |
} else { |
} else { |
75 |
die "FATAL: can't find number of lines in first line ($first) of input file."; |
die "FATAL: can't find number of lines in first line ($first) of input file."; |
84 |
if ($#data != $lines) { |
if ($#data != $lines) { |
85 |
print "FATAL: file integrity check failed: "; |
print "FATAL: file integrity check failed: "; |
86 |
if ($#data > $lines) { |
if ($#data > $lines) { |
87 |
print "too many"; |
print "too many ($#data > $lines)"; |
88 |
} else { |
} else { |
89 |
print "too few"; |
print "too few ($#data < $lines)"; |
90 |
} |
} |
91 |
print " lines ($#data)...\n"; |
print " lines...\n"; |
92 |
} else { |
} else { |
93 |
print "File integrity checked, saving file...\n"; |
print "File integrity checked, saving file...\n"; |
94 |
open(OUT, "> $outdir/$outfile") || die "FATAL: can't open '$outdir/$outfile': $!"; |
open(OUT, "> $outdir/$outfile") || die "FATAL: can't open '$outdir/$outfile': $!"; |
98 |
close(OUT); |
close(OUT); |
99 |
|
|
100 |
# cludge filename to nark.0004 |
# cludge filename to nark.0004 |
101 |
rename "$outdir/$outfile", "$outdir/nark.0004"; |
#rename "$outdir/$outfile", "$outdir/nark.0004"; |
102 |
$it->FILENAME("nark.0004"); |
#$it->FILENAME("nark.0004"); |
103 |
|
|
104 |
# call SAP R/3 |
# call SAP R/3 |
105 |
$rfc->callrfc( $it ); |
$rfc->callrfc( $it ); |