PRODUCTION ISSUE - Receivemail java procedure

Hi guys
I have this java program below, this program receives mail from a user general mailbox and displays it as in a Java Front End System as a request. Users are able to attach any type of attachments and even embedded emails.
My java program works for all attachments types except if the attachment is an email, it does not move it over or even recognize it. I thought it was because I was checking for attachments only for multipart emails but I tried checking for attachment for singlepart emails but I didn't get any desired results. Please help me guys as this is a production issue and I am on the line.
Here is the code:
DROP JAVA SOURCE CQ.RECEIVEMAIL;
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED CQ.RECEIVEMAIL as import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
import java.sql.*;
import sqlj.runtime.*;
import oracle.sql.BLOB;
public class ReceiveMail
static void getAttachments(Message message, int incidentNo)
throws MessagingException, IOException, SQLException {
//String attachments = "";
Object content = message.getContent();
if (content instanceof Multipart)
// -- Multi part message which may contain attachment
Multipart multipart = (Multipart)message.getContent();
// -- Loop through all parts of the message
for (int i=0, n=multipart.getCount(); i<n; i++) {
Part part = multipart.getBodyPart(i);
String disposition = part.getDisposition();
//--if (Part.ATTACHMENT.equals(disposition)) {
if ((disposition != null) && (disposition.equals(Part.ATTACHMENT) || disposition.equals(Part.INLINE))) {
//-- This part is a file attachment
// --String fileName = incidentNo+"_"+part.getFileName().replace(' ','_');
String fileName = part.getFileName().replaceAll(" ","");
System.out.println("FILE: " + fileName);
String contentType = part.getContentType();
String mimeType = contentType.substring(0,contentType.indexOf(";"));
System.out.println("FILETYPE: " + mimeType);
InputStream is = part.getInputStream();
// -- To work with a BLOB column you have to insert a record
// -- with an emptly BLOB first.
#sql { insert into cq_incoming_attachments(att_seq, att_in_seq, att_file, att_attachment)
values (:incidentNo, :incidentNo||'_'||:i, :fileName, empty_blob()) };
// -- Retrieve the BLOB
BLOB attachment = null;
#sql { select att_attachment
into :attachment
from cq_incoming_attachments
where att_file = :fileName
and att_seq = :incidentNo
and att_in_seq = :incidentNo||'_'||:i };
// -- Fill the BLOB
OutputStream os = attachment.getBinaryOutputStream();
int j;
while ((j = is.read()) != -1) {
os.write(j);
is.close();
os.close();
// -- Set the BLOB by updating the record
#sql { update cq_incoming_attachments
set att_attachment = :attachment
where att_file = :fileName
and att_seq = :incidentNo };
#sql { update mail_inbox set attachment = 'Y', att_name = trim(att_name||' '||:fileName)
where att_seq = :incidentNo };
static String getPlainTextBody(Message message)
throws MessagingException, IOException
Object content = message.getContent();
//--if (message.isMimeType("text/plain")) {
if (message.isMimeType("text/plain")) {
// -- Message has plain text body only
System.out.println("SIMPLE TEXT");
return (String) content;
} else if (message.isMimeType("multipart/*")) {
// -- Message is multipart. Loop through the message parts to retrieve
// -- the body.
Multipart mp = (Multipart) message.getContent();
int numParts = mp.getCount();
System.out.println("MULTIPART: "+numParts);
for (int i = 0; i < numParts; ++i) {
System.out.println("PART: "+mp.getBodyPart(i).getContentType());
if (mp.getBodyPart(i).isMimeType("text/plain")) {
// -- Return the plain text body
return (String) mp.getBodyPart(i).getContent();
} else if (mp.getBodyPart(i).isMimeType("multipart/*")) {
// -- Body is also multipart (both plain text and html).
// -- Loop through the body parts to retrieve plain text part.
MimeMultipart mmp = (MimeMultipart) mp.getBodyPart(i).getContent();
int numBodyParts = mmp.getCount();
System.out.println("MULTIBODYPART: "+numBodyParts);
for (int j = 0; j < numBodyParts; ++j) {
System.out.println("BODYPART: "+mmp.getBodyPart(j).getContentType());
if (mmp.getBodyPart(j).isMimeType("text/plain")) {
// -- Return the plain text body
//--return (String) mmp.getBodyPart(j).getContent();
return (String) mmp.getBodyPart(j).getContent();
return "";
} else {
System.out.println("UNKNOWN: "+message.getContentType());
return "";
static void saveMessage(Message message, String insystem)
throws MessagingException, IOException, SQLException
//String body = "";
int incidentNo;
// -- Get a new incident number
#sql { select seq_incident.nextval into :incidentNo from dual };
// -- Get the from address information
String from;
if(message.getFrom() != null){
from = ((InternetAddress)message.getFrom()[0]).getAddress();
}else{
from = " ";
// -- Get the reply address information
String reply;
if(message.getReplyTo() != null){
reply = ((InternetAddress)message.getReplyTo()[0]).getAddress();
}else{
reply = " ";
// --String reply = ((InternetAddress)message.getReplyTo()[0]).getAddress();
// -- Get the to address information
String to = InternetAddress.toString(message.getRecipients(Message.RecipientType.TO));
// -- Get the cc address information
String cc = InternetAddress.toString(message.getRecipients(Message.RecipientType.CC));
// -- Get the bcc address information
String bcc = InternetAddress.toString(message.getRecipients(Message.RecipientType.BCC));
// -- Get the sent and receive date
java.util.Date receive = message.getSentDate();
java.sql.Date sent = new java.sql.Date(receive.getTime());
// -- Get the message subject information
String subject = message.getSubject();
// -- Retrieve the plain text body
String body = getPlainTextBody(message);
// --Check string lengths before insert into mail_inbox
if (body.length() > 3999) {
body = body.substring(0,3999);
// -- Store the message in the email table
#sql { insert into mail_inbox (from_address, reply_address, to_address, cc_address, bcc_address, sent_time, received_time, subject,
mail_body,in_system, proc_ind, attachment, att_name, att_seq)
values (substr(:from,1,200),
substr(:reply,1,200),
nvl(substr(:to,1,200),' '),
substr(:cc,1,500),
substr(:bcc,1,500),
:sent,
:sent,
substr(nvl(:subject,'NO SUBJECT'),1,200),
substr(nvl(:body,'NO MAIL BODY'),1,4000),
substr(:insystem,1,100), 'N', 'N', null,
:incidentNo) };
// --mail_body,
// --nvl(substr(:body,1,4000),'null'),
// -- Retrieve the attachments
getAttachments(message, incidentNo);
#sql { commit };
public static String Receive(String POP3Server, String usr, String pwd, String insystem)
Store store = null;
Folder folder = null;
Folder dfolder = null;
try
// -- Get hold of the default session --
Properties props = System.getProperties();
props.put("mail.pop3.connectiontimeout", "60000");
Session session = Session.getDefaultInstance(props, null);
// -- Get hold of a POP3 message store, and connect to it --
// --store = session.getStore("pop3");
store = session.getStore("imap");
store.connect(POP3Server, usr, pwd);
System.out.println("Connected");
// -- Try to get hold of the default folder --
folder = store.getDefaultFolder();
if (folder == null) throw new Exception("No default folder");
// -- ...and its INBOX --
folder = folder.getFolder("INBOX");
if (folder == null) throw new Exception("No IMAP INBOX");
// -- Open the folder for read_write (to be able to delete message) --
folder.open(Folder.READ_WRITE);
dfolder = folder.getFolder("READ_ITEMS");
// -- Get the message wrappers and process them --
Message[] msgs = folder.getMessages();
for (int msgNum = 0; msgNum < msgs.length; msgNum++){
try
saveMessage(msgs[msgNum], insystem);
catch (Exception ex){
msgs[msgNum].setFlag(Flags.Flag.DELETED, true);
// -- Copy message from INBOX to READ_ITEMS
// --folder.copyMessages(msgs, dfolder);
// -- Delete message in inbox
// --msgs[msgNum].setFlag(Flags.Flag.DELETED, true);
folder.copyMessages(msgs, dfolder);
Message[] msgs1 = folder.getMessages();
for (int msgNum1 = 0; msgNum1 < msgs1.length; msgNum1++){
// -- Delete message in inbox
msgs1[msgNum1].setFlag(Flags.Flag.DELETED, true);
System.out.println("No more messages");
return ("SUCCESS");
catch (Exception ex){
ex.printStackTrace();
return ex.toString();
finally{
// -- Close down nicely --
try{
// close(true), to expunge deleted messages
if (folder!=null) folder.close(true);
if (store!=null) store.close();
catch (Exception ex){
//ex.printStackTrace();
return ex.toString();
Edited by: Gizo on 2010/06/10 12:53 AM

If your application use a lot of native code in same
process with jvm, errors in native part can easily
cause jvm fatal crashes. Some of such errors
reproduced only in stress condition (e.g. on
production server). -Xcheck:jni can help you in most
basic cases.
You can also try running some bounds checkers to
dinamicly verify you native code for pointer safety.Thanks for the quick response, zhmur.
Do you have any pointers to documentation regarding "-Xcheck:jni"? I searched this site and nothing was returned.
Also, is there a way to initiate a thread dump when the process terminates? This would at least identify patterns when the process terminates.

Similar Messages

  • PRODUCTION ISSUE - Java process terminates unexpectedly

    Hello,
    I realize this is a BEA forum, however, we are perplexed by this issue and perhaps someone here has experienced something similar. Apologies if this topic is out of context to BEA.
    We are trying to troubleshoot a production issue where the JAVA process terminates without any debugging information available to try and understand the cause. This is a Windows 2K3 Server running JAVA 1.4.2_04 using native C++. (We are **NOT** running Weblogic on this server)
    Can anyone provide insight into how to debug this problem? Specifically, do any management beans exist to where we can track the crashing process or perhaps any tools? This is occurring frequently and we have no means of debugging this issue all while this is occurring on a PRODUCTION server.
    Any help would be greatly appreciated!
    Regards,
    -Nader

    what heap size are you providing while running your app ?

  • Error 03113 while executing java procedure with pl.sql

    Hi All,
    I am using oracle 10g on linux server. Client machine is on xp. I hava a java procedure which executes the sqlldr on server. Earlier it was working fine, but after reinstalling the oracle 10g on server. It started giving "end of Communication channel error". I am not aware that what paramete has to set. Can some body put light on this error.
    Bye
    Sachin

    According to the documentation:
    ORA-01555: snapshot too old: rollback segment number string with name "string" too small
    Cause: Rollback records needed by a reader for consistent read are overwritten by other writers.
    Action: If in Automatic Undo Management mode, increase the setting of UNDO_RETENTION. Otherwise, use larger rollback segments.
    Error: ORA-01555: snapshot too old (rollback segment too small)
    Cause: This error can be caused by one of the problems, as described below.
    Action: The options to resolve this Oracle error are:
    This error can be the result of there being insufficient rollback segments.
    A query may not be able to create the snapshot because the rollback data is not available. This can happen when there are many transactions that are modifying data, and performing commits and rollbacks. Rollback data is overwritten when the rollback segments are too small for the size and number of changes that are being performed.
    To correct this problem, make more larger rollback segments available. Your rollback data for completed transactions will be kept longer.
    This error can be the result of programs not closing cursors after repeated FETCH and UPDATE statements.
    To correct this problem, make sure that you are closing cursors when you no longer require them.
    This error can occur if a FETCH is executed after a COMMIT is issued.
    The number of rollback records created since the last CLOSE of your cursor will fill the rollback segments and you will begin overwriting earlier records.

  • Production issue; Please HELP !!! ...weired error while starting WLS8.1 server

    Hi All/Rob,
    Iam running WLS8.1+SP2 and i have 4 clusters each of these clusters contains 4
    managed servers.
    Now, iam getting a weired error when starting each of the instances ......this
    is the Exception that iam getting:
    PLEASE HELP AS THIS IS OUR PRODUCTION ISSUES ........
    <Feb 25, 2004 11:42:29 AM EST> <Notice> <Security> <BEA-090082> <Security initializing
    using security realm myrealm.>
    <Feb 25, 2004 11:42:30 AM EST> <Notice> <WebLogicServer> <BEA-000328> <Starting
    WebLogic Managed Server "rsa_nova1t_s1" for domain "Mah-sub">
    Failed setting Group
    <Feb 25, 2004 11:42:39 AM EST> <Error> <Security> <BEA-090031> <Failed to Switch
    to Group rsaadmin.>
    Failed setting user
    <Feb 25, 2004 11:42:39 AM EST> <Error> <Security> <BEA-090033> <Failed to Switch
    to User rsaadmin.>
    <Feb 25, 2004 11:42:39 AM EST> <Notice> <Cluster> <BEA-000138> <Listening for
    announcements from cluster RSA on 237.0.3.11:8001.>
    <Feb 25, 2004 11:42:39 AM EST> <Notice> <Cluster> <BEA-000133> <Waiting to synchronize
    with other running members of RSA.>
    <Feb 25, 2004 11:43:21 AM EST> <Warning> <HTTP> <BEA-101247> <admingui.war: Public
    ID references the old version of the Servlet DTD. You must change the public ID
    in web.xml file to "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN".>
    <Feb 25, 2004 11:47:33 AM EST> <Notice> <WebLogicServer> <BEA-000355> <Thread
    "ListenThread.Default" listening on port 8020, ip address 153.2.252.189>
    <Feb 25, 2004 11:47:33 AM EST> <Notice> <Cluster> <BEA-000102> <Joining cluster
    RSA on 237.0.3.11:8001>
    <Feb 25, 2004 11:47:33 AM EST> <Notice> <WebLogicServer> <BEA-000330> <Started
    WebLogic Managed Server "rsa_nova1t_s1" for domain "Mah-sub" running in Production
    Mode>
    <Feb 25, 2004 11:47:33 AM EST> <Notice> <WebLogicServer> <BEA-000360> <Server
    started in RUNNING mode>
    <Feb 25, 2004 12:02:23 PM EST> <Error> <Cluster> <BEA-000110> <Multicast socket
    receive error: java.io.StreamCorruptedException
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2350)
    at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2383)
    at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2455)
    at java.io.DataInputStream.readInt(DataInputStream.java:392)
    at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2660)
    at java.io.ObjectInputStream.readInt(ObjectInputStream.java:900)
    at weblogic.cluster.MulticastManager.execute(MulticastManager.java:379)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    >
    <Feb 25, 2004 12:03:38 PM EST> <Error> <Cluster> <BEA-000110> <Multicast socket
    receive error: java.io.StreamCorruptedException
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2350)
    at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2383)
    at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2455)
    at java.io.DataInputStream.readInt(DataInputStream.java:392)
    at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2660)
    at java.io.ObjectInputStream.readInt(ObjectInputStream.java:900)
    at weblogic.cluster.MulticastManager.execute(MulticastManager.java:379)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    >
    <Feb 25, 2004 12:09:11 PM EST> <Error> <Cluster> <BEA-000139> <There are two clusters
    in the network that are possibly running different versions of WebLogic Server.
    These two clusters probably name the same RSA and they are using same address
    237.0.3.11 and port 8001.>
    <Feb 25, 2004 12:09:37 PM EST> <Error> <Cluster> <BEA-000110> <Multicast socket
    receive error: java.io.StreamCorruptedException
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2350)
    at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2383)
    at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2455)
    at java.io.DataInputStream.readInt(DataInputStream.java:392)
    at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2660)
    at java.io.ObjectInputStream.readInt(ObjectInputStream.java:900)
    at weblogic.cluster.MulticastManager.execute(MulticastManager.java:379)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    >
    <Feb 25, 2004 12:09:59 PM EST> <Error> <Cluster> <BEA-000139> <There are two clusters
    in the network that are possibly running different versions of WebLogic Server.
    These two clusters probably name the same RSA and they are using same address
    237.0.3.11 and port 8001.>
    <Feb 25, 2004 12:10:09 PM EST> <Error> <Cluster> <BEA-000110> <Multicast socket
    receive error: java.io.StreamCorruptedException
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2350)
    at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2383)
    at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2455)
    at java.io.DataInputStream.readInt(DataInputStream.java:392)
    at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2660)
    at java.io.ObjectInputStream.readInt(ObjectInputStream.java:900)
    at weblogic.cluster.MulticastManager.execute(MulticastManager.java:379)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    >
    <Feb 25, 2004 12:12:43 PM EST> <Error> <Cluster> <BEA-000139> <There are two clusters
    in the network that are possibly running different versions of WebLogic Server.
    These two clusters probably name the same RSA and they are using same address
    237.0.3.11 and port 8001.>
    <Feb 25, 2004 12:13:31 PM EST> <Error> <Cluster> <BEA-000139> <There are two clusters
    in the network that are possibly running different versions of WebLogic Server.
    These two clusters probably name the same RSA and they are using same address
    237.0.3.11 and port 8001.>

    Rob,
    Each cluster uses UNIQUE IP address ......but here is the information that iam
    getting .....if that is in any way related to this problem ....i ran this command
    bash-2.03# java -cp /xx/bea/weblogic81/server/lib/weblogic.jar utils.MulticastTest
    -A 237.0.3.11
    ***** WARNING ***** WARNING ***** WARNING *****
    Do NOT use the same multicast address as a running WLS cluster.
    Starting test. Hit any key to abort
    Using multicast address 237.0.3.11:7001
    Will send messages under the name 1077733276 every 2 seconds
    Will print warning every 600 seconds if no messages are received
    I (1077733276) sent message num 1
    I (1077733276) sent message num 2
    Received message 2 from 1077733276
    I (1077733276) sent message num 3
    Received message 3 from 1077733276
    I (1077733276) sent message num 4
    Received message 4 from 1077733276
    I (1077733276) sent message num 5
    Received message 5 from 1077733276
    I (1077733276) sent message num 6
    Received message 6 from 1077733276
    I (1077733276) sent message num 7
    Received message 7 from 1077733276
    Rob Woollen <[email protected]> wrote:
    First thing to check is that each cluster has its own multicast address.
    It looks like the server is complaining that multiple clusters are using
    237.0.3.11 and port 8001
    -- Rob
    steve wrote:
    Hi All/Rob,
    Iam running WLS8.1+SP2 and i have 4 clusters each of these clusterscontains 4
    managed servers.
    Now, iam getting a weired error when starting each of the instances......this
    is the Exception that iam getting:
    PLEASE HELP AS THIS IS OUR PRODUCTION ISSUES ........
    <Feb 25, 2004 11:42:29 AM EST> <Notice> <Security> <BEA-090082> <Securityinitializing
    using security realm myrealm.>
    <Feb 25, 2004 11:42:30 AM EST> <Notice> <WebLogicServer> <BEA-000328><Starting
    WebLogic Managed Server "rsa_nova1t_s1" for domain "Mah-sub">
    Failed setting Group
    <Feb 25, 2004 11:42:39 AM EST> <Error> <Security> <BEA-090031> <Failedto Switch
    to Group rsaadmin.>
    Failed setting user
    <Feb 25, 2004 11:42:39 AM EST> <Error> <Security> <BEA-090033> <Failedto Switch
    to User rsaadmin.>
    <Feb 25, 2004 11:42:39 AM EST> <Notice> <Cluster> <BEA-000138> <Listeningfor
    announcements from cluster RSA on 237.0.3.11:8001.>
    <Feb 25, 2004 11:42:39 AM EST> <Notice> <Cluster> <BEA-000133> <Waitingto synchronize
    with other running members of RSA.>
    <Feb 25, 2004 11:43:21 AM EST> <Warning> <HTTP> <BEA-101247> <admingui.war:Public
    ID references the old version of the Servlet DTD. You must change thepublic ID
    in web.xml file to "-//Sun Microsystems, Inc.//DTD Web Application2.3//EN".>
    <Feb 25, 2004 11:47:33 AM EST> <Notice> <WebLogicServer> <BEA-000355><Thread
    "ListenThread.Default" listening on port 8020, ip address 153.2.252.189>
    <Feb 25, 2004 11:47:33 AM EST> <Notice> <Cluster> <BEA-000102> <Joiningcluster
    RSA on 237.0.3.11:8001>
    <Feb 25, 2004 11:47:33 AM EST> <Notice> <WebLogicServer> <BEA-000330><Started
    WebLogic Managed Server "rsa_nova1t_s1" for domain "Mah-sub" runningin Production
    Mode>
    <Feb 25, 2004 11:47:33 AM EST> <Notice> <WebLogicServer> <BEA-000360><Server
    started in RUNNING mode>
    <Feb 25, 2004 12:02:23 PM EST> <Error> <Cluster> <BEA-000110> <Multicastsocket
    receive error: java.io.StreamCorruptedException
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2350)
    at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2383)
    at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2455)
    at java.io.DataInputStream.readInt(DataInputStream.java:392)
    at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2660)
    at java.io.ObjectInputStream.readInt(ObjectInputStream.java:900)
    at weblogic.cluster.MulticastManager.execute(MulticastManager.java:379)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    <Feb 25, 2004 12:03:38 PM EST> <Error> <Cluster> <BEA-000110> <Multicastsocket
    receive error: java.io.StreamCorruptedException
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2350)
    at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2383)
    at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2455)
    at java.io.DataInputStream.readInt(DataInputStream.java:392)
    at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2660)
    at java.io.ObjectInputStream.readInt(ObjectInputStream.java:900)
    at weblogic.cluster.MulticastManager.execute(MulticastManager.java:379)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    <Feb 25, 2004 12:09:11 PM EST> <Error> <Cluster> <BEA-000139> <Thereare two clusters
    in the network that are possibly running different versions of WebLogicServer.
    These two clusters probably name the same RSA and they are using sameaddress
    237.0.3.11 and port 8001.>
    <Feb 25, 2004 12:09:37 PM EST> <Error> <Cluster> <BEA-000110> <Multicastsocket
    receive error: java.io.StreamCorruptedException
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2350)
    at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2383)
    at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2455)
    at java.io.DataInputStream.readInt(DataInputStream.java:392)
    at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2660)
    at java.io.ObjectInputStream.readInt(ObjectInputStream.java:900)
    at weblogic.cluster.MulticastManager.execute(MulticastManager.java:379)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    <Feb 25, 2004 12:09:59 PM EST> <Error> <Cluster> <BEA-000139> <Thereare two clusters
    in the network that are possibly running different versions of WebLogicServer.
    These two clusters probably name the same RSA and they are using sameaddress
    237.0.3.11 and port 8001.>
    <Feb 25, 2004 12:10:09 PM EST> <Error> <Cluster> <BEA-000110> <Multicastsocket
    receive error: java.io.StreamCorruptedException
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2350)
    at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2383)
    at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2455)
    at java.io.DataInputStream.readInt(DataInputStream.java:392)
    at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2660)
    at java.io.ObjectInputStream.readInt(ObjectInputStream.java:900)
    at weblogic.cluster.MulticastManager.execute(MulticastManager.java:379)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    <Feb 25, 2004 12:12:43 PM EST> <Error> <Cluster> <BEA-000139> <Thereare two clusters
    in the network that are possibly running different versions of WebLogicServer.
    These two clusters probably name the same RSA and they are using sameaddress
    237.0.3.11 and port 8001.>
    <Feb 25, 2004 12:13:31 PM EST> <Error> <Cluster> <BEA-000139> <Thereare two clusters
    in the network that are possibly running different versions of WebLogicServer.
    These two clusters probably name the same RSA and they are using sameaddress
    237.0.3.11 and port 8001.>

  • Call RFC  using java procedure

    Hi
    How can I to use java procedure and call RFC for to access tables of SAP ?
    Thank You

    RFC? That term in the IT environment usually means "+Request For Comments+" and refers to Internet protocol and usage standards.
    Do you perhaps means RPC (Remote Process/Procedure Calls)? Or something else?
    Also, SAP is a company. Not a product. SAP has a product called R3. This runs inside a database.
    Connecting from Java to a database typically requires nothing more than a JDBC driver. So why can't you use a JDBC driver and need to call the database (and access tables) using another method?

  • OS Commands not executing through published java procedure... :(

    Hello all :)
    Im trying to get a PL/SQL block to delete a file out in the OS. Theres plenty of examples out there and the one I got came from burleson consulting, and incorporates a java method and a call to java wrapped in PL/SQL.. after all suggested grants, using the procedure yields no result. Here is the source code
    -- java procedure used to execute OS command
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
    import java.io.*;
    public class Host {
    public static void executeCommand(String command) {
    try {
    String[] finalCommand;
    if (isWindows()) {
    finalCommand = new String[4];
    finalCommand[0] = "C:\\WINDOWS\\system32\\cmd.exe";
    finalCommand[1] = "/y";
    finalCommand[2] = "/c";
    finalCommand[3] = command;
    else {
    finalCommand = new String[3];
    finalCommand[0] = "/bin/sh";
    finalCommand[1] = "-c";
    finalCommand[2] = command;
    final Process pr = Runtime.getRuntime().exec(finalCommand);
    new Thread(new Runnable() {
    public void run() {
    try {
    BufferedReader br_in = new BufferedReader(new
    InputStreamReader(pr.getInputStream()));
    String buff = null;
    while ((buff = br_in.readLine()) != null) {
    System.out.println(buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    br_in.close();
    catch (IOException ioe) {
    System.out.println("Exception caught printing process output.");
    ioe.printStackTrace();
    }).start();
    new Thread(new Runnable() {
    public void run() {
    try {
    BufferedReader br_err = new BufferedReader(new
    InputStreamReader(pr.getErrorStream()));
    String buff = null;
    while ((buff = br_err.readLine()) != null) {
    System.out.println(buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    br_err.close();
    catch (IOException ioe) {
    System.out.println("Exception caught printing process error.");
    ioe.printStackTrace();
    }).start();
    catch (Exception ex) {
    System.out.println(ex.getLocalizedMessage());
    public static boolean isWindows() {
    if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
    return true;
    else
    return false;
    -- PL/SQL wrapper to publish java method.
    CREATE OR REPLACE PROCEDURE host_command (p_command IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Host.executeCommand (java.lang.String)';
    these are the grants I am issuing on install:
    BEGIN
    DBMS_JAVA.grant_permission ('LOANADMIN', 'java.io.FilePermission',
    '<>', 'read ,write, execute, delete');
    DBMS_JAVA.grant_permission ('LOANADMIN', 'SYS:java.lang.RuntimePermission',
    'writeFileDescriptor', '');
    DBMS_JAVA.grant_permission ('LOANADMIN', 'SYS:java.lang.RuntimePermission',
    'readFileDescriptor', '');
    END;
    -- and this is the block I am using to execute the OS command..
    1 BEGIN
    2 host_command (p_command => 'DEL C:\PRETEND.TXT');
    3* END;
    SQL> /
    PL/SQL procedure successfully completed.
    Everything returns as successfully completed. But the file is not deleted from the server. I know im missing some kind of privilege. Can anyone help me? Thanks
    Mo

    Burleson consulting...
    Says it all. Exposure on the Net doesn't mean quality.
    Burleson code usually has not been tested, is not robust, and quite often doesn't work.
    Why didn't you implement run_cmd, as suggested earlier?
    THAT works!
    Sybrand Bakker
    Senior Oracle DBA

  • Ora-03113 with Java Procedure On 10g Enterprise Edition Release 10.1.0.3.1

    Hi All,
    I am getting Ora-03113 (End-of-Communication) while executing Java Stored procedure. Java Stored Procedure executes Sqlldr on server. Server OS is Linux 86x.
    Database is -- Oracle with Infrastructure.
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.1 - Prod
    PL/SQL Release 10.1.0.3.1 - Production
    CORE 10.1.0.3.0 Production
    TNS for Linux: Version 10.1.0.3.0 - Production
    NLSRTL Version 10.1.0.3.0 - Production
    Same java procedure was working properly when database was 10.1.0.2.1. Any suggestion
    SKM

    Check in Ur programs -Application Tool bar, Whether your have two oracle or not.
    You can unintall the OLD version from your PC using the Oracle Unistaller

  • Java procedure equivalent in Oralce 7.3.4 ??

    Hi,
    Oracle 8i supports Java procedures, is
    there any workaround way of calling
    Java functions or Java programmes from
    PL/SQL in Oralce 7.3.4 (Solaris).
    Thanks in advance,
    -Sudarshan
    [email protected]

    Are there any trace files created on the server?
    Did you see if they have any more information?
    Generally, these types of errors suggest contacting Oracle support to resolve the issue, but with the Oracle version you are using being already desupported, it would be an issue.
    Alternatively, you could search metalink to see if there is any support note on this type of error.

  • PRODUCTION ISSUE- Autoconfig fail on database server

    Hi,
    I need urgent help on the production issue.
    We have 11.5.10.2 apps on HP-unix and 10.2.0.4 database on solaris.
    Upgraded java 1.4 and applied patch 9535311 Patch( TXK AUTOCONFIG and TEMPLATE ROLLUP PATCH)
    successfully, and copy the appsutil.zip to database tier and unzip and ran adautoconfig.sh on database server.
    ./adautocfg.sh
    Enter the APPS user password:
    The log file for this session is located at: /10g/app/oracle/product/10.2.0/lasrp/appsutil/log/lasrp_hcs431oracpd002/01161723/adconfig.log
    AutoConfig is configuring the Database environment...
    AutoConfig will consider the custom templates if present.
    Using ORACLE_HOME location : /10g/app/oracle/product/10.2.0/lasrp
    Classpath : /10g/app/oracle/product/10.2.0/lasrp/jre/1.4.2/lib/rt.jar:/10g/app/oracle/product/10.2.0/lasrp/jdbc/lib/ojdbc14.jar:/10g/app/oracle/product/10.2.0/lasrp/appsutil/java/xmlparserv2.zip:/10g/app/oracle/product/10.2.0/lasrp/appsutil/java:/10g/app/oracle/product/10.2.0/lasrp/jlib/netcfg.jar:/10g/app/oracle/product/10.2.0/lasrp/jlib/ldapjclnt10.jar
    Using Context file : /10g/app/oracle/product/10.2.0/lasrp/appsutil/lasrp_hcs431oracpd002.xml
    Context Value Management will now update the Context file
    Updating Context file...COMPLETED
    Attempting upload of Context file and templates to database...COMPLETED
    Updating rdbms version in Context file to db102
    Updating rdbms type in Context file to 64 bits
    Configuring templates from ORACLE_HOME ...
    AutoConfig completed with errors.
    Checked the Log file :
    ===========================================================================
    Config Tool CVMHelper started at Sun Jan 16 17:23:41 EST 2011
    ===========================================================================
    Updating local context file variables for Database Tier
    Could not retrieve listener name from listener.ora : AC-00039: Could not parse the file: /10g/app/oracle/product/10.2.0/l
    asrp/network/admin/lasrp_hcs431oracpd002/listener.ora
    Raised by oracle.apps.ad.tools.configuration.CVMHelper
    Making database connection using DBUtil
    Please suggest what to do with this.
    Thanks

    Yes, i can able to connect database and i bounced and db and the listener.
    All the application services are started successfully, but now the application services are down.
    So far no proper help from ORACLE yet nor i don't beleive going in right direction.
    I beleive something to do with listener.ora and tnsnames.ora file. But don't know what is the exact issue.
    listener.ora
    # Net8 definition for Database listener
    =
    (ADDRESS_LIST =
    (ADDRESS= (PROTOCOL= IPC)(KEY= EXTPROCLASRP))
    (ADDRESS= (PROTOCOL= TCP)(Host= hcs431oracpd002.mfia.state.mi.us )(Port= 1524))
    SID_LIST_ =
    (SID_LIST =
    (SID_DESC =
    (ORACLE_HOME= /10g/app/oracle/product/10.2.0/lasrp)
    (SID_NAME = LASRP)
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /10g/app/oracle/product/10.2.0/lasrp)
    (PROGRAM = extproc)
    STARTUP_WAIT_TIME_ = 0
    CONNECT_TIMEOUT_ = 10
    TRACE_LEVEL_ = OFF
    LOG_DIRECTORY_ = /10g/app/oracle/product/10.2.0/lasrp/network/admin
    LOG_FILE_ =
    TRACE_DIRECTORY_ = /10g/app/oracle/product/10.2.0/lasrp/network/admin
    TRACE_FILE_ =
    ADMIN_RESTRICTIONS_ = OFF
    IFILE=/10g/app/oracle/product/10.2.0/lasrp/network/admin/listener_ifile.ora
    tnsnames.ora
    LASRP=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=HCS431ORACPD002.mfia.state.mi.us)(PORT=1524))
    (CONNECT_DATA=
    (SERVICE_NAME=LASRP)
    (INSTANCE_NAME=LASRP)
    LASRP_806_BALANCE=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=HCS431ORACPD002.mfia.state.mi.us)(PORT=1524))
    (CONNECT_DATA=
    (SERVICE_NAME=LASRP)
    (INSTANCE_NAME=LASRP)
    LASRP_FO=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=HCS431ORACPD002.mfia.state.mi.us)(PORT=1524))
    (CONNECT_DATA=
    (SERVICE_NAME=LASRP)
    (INSTANCE_NAME=LASRP)
    LASRP_LOCAL=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=HCS431ORACPD002.mfia.state.mi.us)(PORT=1524))
    LASRP_BALANCE=
    (DESCRIPTION=
    (LOAD_BALANCE=YES)
    (FAILOVER=YES)
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST=HCS431ORACPD002.mfia.state.mi.us)(PORT=1524))
    (CONNECT_DATA=

  • End Of communication Error while executing java procedure (Urgent)

    Hi All,
    I am using oracle 10g on linux server. Client machine is on xp. I hava a java procedure which executes the sqlldr on server. Earlier it was working fine, but after reinstalling the oracle 10g on server. It started giving "end of Communication channel error". I am not aware that what paramete has to set. Can some body put light on this error.
    Bye
    Sachin

    This is the most frequently asked question from Oracle developers.. Never mind putting some light on this error, I want to put it alight! ;-)
    First thing. It is not The Error. It is a sympton of an error.
    This message does not come from the database. It comes from the client OCI (of JDBC) drivers - which suddenly discovered that the Oracle connection (usually a TCP socket connection) has been torn down at the server side. It attempts to write to that socket, only to find that the other party has hung up.
    Why has the other party hung up? That party is either a Dedicated Server Process or a Dispatcher Process. If a dedicated server dies (crashes), it will take its socket handles with it to The Great Recycle Bin In The Sky. If you was serviced by a shared server and it died, the Dispatcher (who handles the TCP comms for it), will automatically close that shared server's connection.
    Usually when a process dies on the Oracle server, it leaves behind an error in the alert log, and trace files. That is where you will find the inklings of what The Error was that caused your client to get the EOF on comms channel message.

  • Using mysql-connector-java-5.0.5 from oracle's java procedure.

    I need to write the java procedure in Oracle, which will get connection to mySQL server and put some data into it. I am using official mysql-connector-java-5.0.5 driver for this job. Java class for this job work well outside the Oracle. The problem is:
    When I try to import jar file of mysql connectior it fail son resolving inside the Oracle db. How can I get access to mysql from Oracle?

    Thanks for this quick reply!!
    --When adding a connection and clicking 'Test' in the end of the wizard or when right-click on the connection and click 'connect'.
    Also, I've just noticed this: when I start IDE using jdev.exe I'm getting:
    java.lang.NullPointerException at oracle.jdevimpl.cm.dt.DatabaseAddin._registerIDEObjects(DatabaseAddin.java:353)
    at oracle.jdevimpl.cm.dt.DatabaseAddin.initialize(DatabaseAddin.java:155
    at oracle.ideimpl.extension.AddinManagerImpl.initializeAddin(AddinManage
    rImpl.java:425)
    at oracle.ideimpl.extension.AddinManagerImpl.initializeAddins(AddinManag
    erImpl.java:240)
    at oracle.ideimpl.extension.AddinManagerImpl.initProductAndUserAddins(Ad
    dinManagerImpl.java:154)
    at oracle.ide.IdeCore.initProductAndUserAddins(IdeCore.java:1431)
    at oracle.ide.IdeCore.startupImpl(IdeCore.java:1196)
    at oracle.ide.Ide.startup(Ide.java:674)
    at oracle.ideimpl.Main.start(Main.java:49)
    at oracle.ideimpl.Main.main(Main.java:25)
    Does not look right to me.
    I've never tried to add a DB connection under this IDE installation earlier.
    Just yeasterday I've created a project with some DB related (mySQL and Hibernate) libraries, although it compiled fine.

  • Production issue

    Hi all,
    I have a production issue and my report takes around 4 to 5 hours for  its execution and i've finded out that the 2nd from first query has a corresponding tale with it and when i modified it to below one its displaying the output and when i check it in ST05 i have no i_bsad and i_bsid table query times mentioned in it.Where in when i have the corresponding tale included i get  the above both queries time interval and this table works fine.(i have to have this select statements included for my business scenario logic).But because of the inclusion of this this both table are eating lot of time.Need to include them and reduce the time comsumption of the both the tables.
    SELECT vbeln fkart vbtyp knumv fkdat  gjahr kdgrp rfbsk zterm bukrs
    netwr kunrg kunag                                    
               bstnk_vf xblnr mwsbk rfbsk
               INTO  TABLE i_vbrk
                        FROM vbrk WHERE
                         vbeln  IN zvbeln AND
                         vbtyp IN zvbtyp AND
                         fkdat  IN zfkdat AND
                         bukrs  IN zbukrs AND
                         kunag  IN zkunag AND
                         bstnk_vf IN zbstnkvf AND
                         xblnr  IN zxblnr AND
                         fksto NE 'X' .
      SELECT vbeln fkart vbtyp knumv fkdat bukrs gjahr kdgrp zterm netwr
        kunrg kunag
                  bstnk_vf xblnr mwsbk rfbsk
                  INTO CORRESPONDING FIELDS OF TABLE i_vbrk
                           FROM vbrk WHERE
                            vbeln  IN zvbeln AND
                            kunag  IN zkunag AND
                            fkdat  IN zfkdat AND
                            xblnr  IN zxblnr AND
                            bstnk_vf IN zbstnkvf AND
                            vbtyp IN zvbtyp AND
                            fksto NE 'X' AND
                            bukrs  IN zbukrs .
    This are the both table which has to be included ,
    SELECT belnr buzei dmbtr shkzg APPENDING TABLE i_bsad
            FROM bsad
            FOR ALL ENTRIES IN l_tab_temp
            WHERE
                bukrs EQ l_tab_temp-bukrs AND
                gjahr EQ l_tab_temp-gjahr AND
                belnr EQ l_tab_temp-vbeln.
      SELECT  belnr buzei shkzg dmbtr rebzg FROM bsid                              APPENDING CORRESPONDING FIELDS OF TABLE i_bsid
                              FOR ALL ENTRIES IN l_tab_temp
                              WHERE bukrs EQ l_tab_temp-bukrs
                              "PRA927038 "PRA927150  vbeln pick
                             AND   NOT AUGBL = SPACE 
    *AND  BELNR = L_TAB_TEMP-VBELN  
                             AND  gjahr = l_tab_temp-gjahr  
                               AND  gjahr IN zgjahr.      
                               AND  vbeln = l_tab_temp-vbeln .
                                 AND rebzg = l_tab_temp-vbeln
                                 AND rebzj = l_tab_temp-gjahr.
    Can any one help me in tuning this if u guys still have questions please ask me.And for your understanding this my coding please go through it
    *& Report  ZAR_REC001                                                  *
    REPORT  zar_rec001    NO STANDARD PAGE HEADING
                          LINE-SIZE 355
                          LINE-COUNT 60
                          MESSAGE-ID zuserm.
    TYPE-POOLS : slis.
    TABLES :  vbrk,
              vbrp,
              bsid,
              bsad,
              kna1,
              lfa1,
              knvv,
              zar1_detail,
              zar1_struc1,
              vbak,
              vbap,
              zcustomfields,
              konv,
              zvlxxsr,
              mara,
              t023t,
              sscrfields,
              konp,
              tvarv,
              tvkgr,
              tvgrt.                                            "IMR928046
    TYPES : BEGIN OF t_tvkgr,
            vkgrp TYPE vbrp-vkgrp,
            END OF t_tvkgr.
    TYPES : BEGIN OF ty_vbrp,                                   "IMR928046
            vkgrp TYPE vkgrp,
            END OF ty_vbrp.
    DATA : BEGIN OF i_zgjahr OCCURS 0,
           zgjahr LIKE bsid-gjahr,
          END OF i_zgjahr.
    DATA : BEGIN OF i_vbrk OCCURS 0,
            vbeln LIKE vbrk-vbeln,
            fkart LIKE vbrk-fkart,
            vbtyp LIKE vbrk-vbtyp,
            knumv LIKE vbrk-knumv,
            fkdat LIKE vbrk-fkdat,
            gjahr LIKE vbrk-gjahr,   "KRISHNA
            kdgrp LIKE vbrk-kdgrp,
            zterm LIKE vbrk-zterm,
            bukrs LIKE vbrk-bukrs,   "krishna
            rfbsk    LIKE vbrk-rfbsk,                           " KYH25882
            netwr LIKE vbrk-netwr,
            kunrg LIKE vbrk-kunrg,
            kunag LIKE vbrk-kunag,
            bstnk_vf LIKE vbrk-bstnk_vf,
            xblnr LIKE vbrk-xblnr,
            mwsbk LIKE vbrk-mwsbk,
            name1 LIKE kna1-name1,
            vkgrp LIKE knvv-vkgrp,
            bezei LIKE tvgrt-bezei,                             "IMR928046
            partialpmt LIKE vbrk-netwr,
            opendmbtr LIKE vbrk-netwr,
            gmdpercent LIKE vbrp-netwr,
            gmdnetwr LIKE vbrp-netwr,
            aubel    LIKE vbrp-aubel,
            aupos    LIKE vbrp-aupos,
            ihrez LIKE vbak-ihrez,
            kdmat  LIKE vbap-kdmat,
            mwsbp    LIKE vbrp-mwsbp,
            kzwi5    LIKE vbrp-kzwi5,
            due1     LIKE vbrp-netwr,
            due2     LIKE vbrp-netwr,
            due3     LIKE vbrp-netwr,
            due4     LIKE vbrp-netwr,
            due5     LIKE vbrp-netwr,
            due6     LIKE vbrp-netwr.
    DATA:  END OF i_vbrk.
    DATA : BEGIN OF i_vbrp OCCURS 0.
            INCLUDE STRUCTURE zar1_struc1.
    DATA:   zzp_mfrnr LIKE vbrp-zzp_mfrnr,
            vgbel     LIKE vbrp-vgbel,
            vgpos     LIKE vbrp-vgpos.
    DATA : END OF i_vbrp.
    DATA : d_vbrp LIKE i_vbrp OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF d1_vbrp OCCURS 0.
            INCLUDE STRUCTURE  zar1_detail.
    DATA : END OF d1_vbrp.
    DATA : BEGIN OF i_bsad OCCURS 0,
            belnr LIKE bsad-belnr,   "krishna
            buzei LIKE bsad-buzei,   "Vijay
            dmbtr LIKE bsad-dmbtr,   "krishna
            shkzg.                                              "ppo924471
    DATA : END OF i_bsad.
    *--- begin of ppo924396
    DATA : BEGIN OF i_bsid OCCURS 0,
           augbl like bsad-augbl,                              "PRA927038
          vbeln LIKE bsid-vbeln,                               "vma928512
            rebzg LIKE bsid-rebzg,                              "vma928512
            belnr LIKE bsid-belnr,
            buzei LIKE bsid-buzei,
            shkzg LIKE bsad-shkzg,                              "ppo924471
            dmbtr LIKE bsad-dmbtr.
    DATA : END OF i_bsid.
    DATA : l_partialpmt LIKE bsad-dmbtr.
    *--- end of ppo924396
    DATA : BEGIN OF i_kunag OCCURS 0,
           kunag LIKE vbrk-kunag.
    DATA : END OF i_kunag.
    DATA : BEGIN OF i_knumv OCCURS 0,
           knumv LIKE vbrk-knumv.
    DATA : END OF i_knumv.
    DATA: BEGIN OF i_konv OCCURS 0,
          knumv    LIKE konv-knumv,
          kposn    LIKE konv-kposn,
          kschl    LIKE konv-kschl,
          knumh    LIKE konv-knumh,
          kbetr    LIKE konv-kbetr,
          kwert    LIKE konv-kwert,
          kopos    LIKE konv-kopos,
         END   OF i_konv.
    DATA : BEGIN OF i_kna1 OCCURS 0,
            kunnr LIKE kna1-kunnr,
            name1 LIKE kna1-name1,
            name2 LIKE kna1-name2,
            name3 LIKE kna1-name3,
            stras LIKE kna1-stras,
            ort01 LIKE kna1-ort01,
            regio LIKE kna1-regio,
            pstlz LIKE kna1-pstlz,
            adrnr LIKE kna1-adrnr.
    DATA : END OF i_kna1.
    *DATA : I_KNA1  TYPE HASHED TABLE OF T_KNA1 WITH UNIQUE KEY KUNNR.
    *DATA : L_WA_KNA1 TYPE   T_KNA1.
    TYPES : BEGIN OF t_t023t,
             matkl     LIKE t023t-matkl,
             wgbez     LIKE t023t-wgbez.
    TYPES : END OF t_t023t.
    DATA : i_t023t  TYPE HASHED TABLE OF t_t023t WITH UNIQUE KEY matkl.
    DATA : l_wa_t023t TYPE   t_t023t.
    DATA : BEGIN OF i_t179t OCCURS 0,
             prodh LIKE t179t-prodh,
             vtext LIKE t179t-vtext.
    DATA : END OF i_t179t.
    TYPES : BEGIN OF t_mara,
            matnr     LIKE  mara-matnr,
            mfrpn     LIKE  mara-mfrpn.
    TYPES : END OF t_mara.
    DATA : i_mara  TYPE HASHED TABLE OF t_mara WITH UNIQUE KEY matnr.
    DATA : l_wa_mara TYPE   t_mara.
    DATA : BEGIN OF i_vbak OCCURS 0,
            vbeln      LIKE  vbak-vbeln,
            bname      LIKE  vbak-bname,
            zz_ccenter LIKE vbak-zz_ccenter,
            zz_dept    LIKE vbak-zz_dept,
            ihrez      LIKE vbak-ihrez.
    DATA : END OF i_vbak.
    DATA: BEGIN OF i_vbap  OCCURS 0,
          vbeln     LIKE  vbap-vbeln,
          posnr     LIKE  vbap-posnr,
          erdat     LIKE  vbap-erdat,
          prodh     LIKE  vbap-prodh,
          ihrez     LIKE  vbak-ihrez,
          kdmat     LIKE  vbap-kdmat,
          posex     LIKE  vbap-posex,
          END OF i_vbap.
    DATA : BEGIN OF i_zcustomfields OCCURS 0,
            vbeln   LIKE zcustomfields-vbeln,
            posnr   LIKE zcustomfields-posnr,
            valueid LIKE zcustomfields-valueid,
            value   LIKE zcustomfields-value.
    DATA : END OF i_zcustomfields.
    DATA : BEGIN OF i_vbpa OCCURS 0,
            vbeln     LIKE vbpa-vbeln,
            kunnr     LIKE vbpa-kunnr,
            adrnr     LIKE vbpa-adrnr.
    DATA : END OF i_vbpa.
    DATA d_vbpa LIKE i_vbpa OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF i_zvlxxsr OCCURS 0.
            INCLUDE STRUCTURE zvlxxsr.
    DATA : END OF i_zvlxxsr.
    TYPES: BEGIN OF t_lfa1,
           lifnr LIKE lfa1-lifnr,
           name1 LIKE lfa1-name1.
    TYPES: END OF t_lfa1.
    DATA : i_lfa1  TYPE HASHED TABLE OF t_lfa1 WITH UNIQUE KEY lifnr.
    DATA : l_wa_lfa1 TYPE   t_lfa1.
    DATA : i_tvkgr TYPE STANDARD TABLE OF t_tvkgr.
    DATA : l_tvkgr TYPE t_tvkgr.
    DATA : g_date_diff TYPE p.
    DATA:  fieldcat_sno  TYPE slis_t_fieldcat_alv,
             g_append_d_vbrp,
             tcode LIKE sy-tcode,
            fkimg_tot LIKE vbrp-fkimg,
    Begin     DEVK926013  KYH26013
           NETPR_TOT LIKE I_VBRP-NETPR,
           NETWR_TOT LIKE I_VBRP-NETPR,
           KBETR_TOT LIKE I_VBRP-NETPR,
           KBETRQTY_TOT LIKE I_VBRP-NETPR,
           GMDPERCENT_TOT LIKE I_VBRP-NETPR,
           GMDNETWR_TOT LIKE I_VBRP-NETPR,
            netpr_tot LIKE vbrp-netwr,
            netwr_tot LIKE vbrp-netwr,
            kbetr_tot LIKE vbrp-netwr,
            kbetrqty_tot LIKE vbrp-netwr,
            gmdpercent_tot LIKE vbrp-netwr,
            gmdnetwr_tot LIKE vbrp-netwr,
    End     DEVK926013  KYH26013
            auth_failure.
    DATA:  objnum LIKE vbrk-knumv.
    DATA: auth(3) TYPE c.
    DATA: authcnt TYPE i VALUE 0.
    DATA: cntserno TYPE i.
    DATA: l_from TYPE i,
          l_to   TYPE i,
          l_lines TYPE i,
          l_rows(9) TYPE p DECIMALS 5,
          l_loop TYPE i.
    *--- begin of ppo924234
    DATA: BEGIN OF down_sum OCCURS 0,
          vbeln LIKE vbrk-vbeln,
          fkart LIKE vbrk-fkart,
          fkdat(8),
          kunrg LIKE vbrk-kunrg,
          kunag LIKE vbrk-kunag,
          name1 LIKE kna1-name1,
          vkgrp LIKE knvv-vkgrp,
          bezei LIKE tvgrt-bezei,                               "IMR928046
          zterm LIKE vbrk-zterm,
          bstnk_vf LIKE vbrk-bstnk_vf,
          xblnr LIKE vbrk-xblnr,
          netwr(15),
          partialpmt(15),
          due1(15),
          due2(15),
          due3(15),
          due4(15),
          due5(15),
          due6(15),
          kdgrp LIKE vbrk-kdgrp,
          END OF down_sum.
    DATA: BEGIN OF down_sum_get OCCURS 0,
          line(255),
          END OF down_sum_get.
    DATA: BEGIN OF down_det OCCURS 0,
          zzid TYPE zchar8,
          zcount(10),
          vbeln TYPE zvbeln,
          posnr(6),
          fkdat(8),
          bstnk_vf TYPE bstnk,
          fkimg(13),
          name1_mfg TYPE zmfg_zar1,
          matnr TYPE matnr,
          arktx TYPE arktx,
          netpr(11),
          kzwi5(13),
          netwr(15),
          kbetr(11),
          kbetrqty(11),
          mwsbp(13),
          gmdpercent(15),
          gmdnetwr(15),
          name1 TYPE zsold_zar1,
          name1_sh TYPE zship_zar1,
          name2_sh TYPE zship2_zar1,
          name3_sh TYPE zship3_zar1,
          stras_sh TYPE stras,
          ort01_sh TYPE ort01,
          regio_sh TYPE regio,
          pstlz_sh TYPE pstlz,
          bname TYPE zbname_zar1,
          vkgrp TYPE vkgrp,
          aubel TYPE vbeln_va ,
          aupos(6),
          audat(8),
          sernr TYPE gernr,
          prodh TYPE prodh_d,
          wgbez TYPE wgbez,
          vtext TYPE bezei20,
          asstg TYPE zasstg,
          matkl TYPE matkl,
          fkart TYPE fkart,
          kunag TYPE kunag,
          vbtyp TYPE vbtyp,
          ihrez TYPE ihrez,
          kdmat TYPE matnr_ku,
          posex TYPE posex,
          zz_ccenter TYPE zv_ccenter,
          zz_dept TYPE      zv_dept,
          zz_cap_exp_code TYPE zv_cap_exp_code,
          zz_cap_exp_id TYPE zv_cap_exp_id,
          zz_project TYPE zv_project,
          zz_aprvd_by TYPE zv_aprvd_by,
          kdgrp_auft TYPE kdgrp_auft,
          END OF down_det.
    *--- end of ppo924234
    *--- begin of ppo924471
    DATA: BEGIN OF i_tvfk OCCURS 0,
          fkart TYPE fkart,
          END OF i_tvfk.
    *--- end of ppo924471
      begin of KYH
    DATA: fiscal_yr_begn(8) TYPE c,
           fiscal_yr_end(8) TYPE c,
           fiscal_yr LIKE bsid-gjahr,
           fnyear(4) TYPE c,
           fnyear_pre(4) TYPE c.
      END of KYH
    DATA : v_gjahr LIKE bsid-gjahr.                             " KYH25882
    TYPES : BEGIN OF t_konp,
           knumh  LIKE konp-knumh,
          kopos  LIKE konp-kopos,
         KBETR LIKE  KONP-KBETR.  " KYH26013
           kbetr LIKE  vbrk-netwr.                              " KYH26013
    TYPES : END OF t_konp.
    DATA :i_konp TYPE HASHED TABLE OF t_konp WITH UNIQUE KEY knumh kopos.
    DATA : l_wa_konp TYPE t_konp.
    DATA : l_e_fyv TYPE periv VALUE 10,
           l_i_fyear LIKE  t009b-bdatj,
           l_bsid_index TYPE sy-tabix VALUE 1,
           l_bsad_index TYPE sy-tabix VALUE 1.
    CLASS cl_abap_char_utilities DEFINITION LOAD.               "IMR928770
    CONSTANTS:
        c_tab  TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
        c_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
    CONSTANTS c_index TYPE i VALUE 2000.                        "KYH25969
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME.
    SELECT-OPTIONS : zkunag  FOR vbrk-kunag MATCHCODE OBJECT debi,
                     zvbeln FOR vbrk-vbeln MATCHCODE OBJECT vmcf,
                     zfkdat  FOR vbrk-fkdat OBLIGATORY,
                     zvkbur  FOR knvv-vkbur,
                     zvkgrp FOR knvv-vkgrp OBLIGATORY,
                     zbukrs  FOR bsid-bukrs OBLIGATORY,
                     zgjahr  FOR bsid-gjahr OBLIGATORY,
                     zvbtyp  FOR vbrk-vbtyp NO-DISPLAY,
                     zbstnkvf FOR vbrk-bstnk_vf,
                     zxblnr FOR vbrk-xblnr.
    SELECTION-SCREEN : END OF BLOCK blk1.
    SELECTION-SCREEN : BEGIN OF BLOCK blk2 WITH FRAME.
    PARAMETER : zopeninv  RADIOBUTTON GROUP inv,
                zallinv  RADIOBUTTON GROUP inv DEFAULT 'X'.
    SELECTION-SCREEN : END OF BLOCK blk2.
    SELECTION-SCREEN : BEGIN OF BLOCK blk3 WITH FRAME.
    PARAMETER : zinvoice AS CHECKBOX,
                zdebit AS CHECKBOX,
                zcredit AS CHECKBOX.
    SELECTION-SCREEN : END OF BLOCK blk3.
    SELECTION-SCREEN : BEGIN OF BLOCK blk4 WITH FRAME.
    PARAMETER : zsumrep RADIOBUTTON GROUP rep DEFAULT 'X',
                zdetrep RADIOBUTTON GROUP rep.
    SELECT-OPTIONS : zmfrnr FOR vbrp-zzp_mfrnr MATCHCODE OBJECT kred.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN PUSHBUTTON /1(42) prun_det USER-COMMAND prun.
    PARAMETERS: zid LIKE zar1_detail-zzid.
    SELECTION-SCREEN : END OF BLOCK blk4.
    *--- begin of ppo924234
    SELECTION-SCREEN BEGIN OF BLOCK blk5 WITH FRAME TITLE text-001.
    PARAMETERS: p_appfil RADIOBUTTON GROUP file DEFAULT 'X',
                p_prsfil RADIOBUTTON GROUP file.
    PARAMETERS: filepath LIKE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK blk5.
    *--- end of ppo924234
    INITIALIZATION.
      MOVE : 'Detail Report results of the previous run' TO prun_det.
      zid = sy-uname(8).
      tcode = sy-tcode.
      IF NOT tcode IS INITIAL.
        tvarv-name = 'ZTCODE_ZAR_INVOICE'.
        tvarv-type = 'P'.
        tvarv-low  = tcode.
        MODIFY tvarv.
      ENDIF.
      IF tcode NE 'ZAR2'.
        NEW-PAGE LINE-SIZE 255.
      ELSE.
        NEW-PAGE LINE-SIZE 170.
      ENDIF.
    AT SELECTION-SCREEN.
      IF sscrfields-ucomm = 'PRUN'.
        PERFORM call_ze16.
        EXIT.
      ENDIF.
    *--- begin of ppo924234
    AT SELECTION-SCREEN ON BLOCK blk5.
      IF p_prsfil = 'X' AND filepath IS INITIAL.
        MESSAGE e001(00) WITH 'Enter the File Name'.
      ENDIF.
    *--- end of ppo924234
    START-OF-SELECTION.
      PERFORM check_tcode.
      PERFORM check_authorization.
      IF auth_failure = 'X'.
        EXIT.
      ENDIF.
      PERFORM get_sd_doc_category.
      PERFORM get_invoice_data.
      IF NOT  i_vbrk[] IS  INITIAL.                             "KYH25969
        PERFORM get_accounting_data.
        PERFORM get_other_data.
      ENDIF.                                                    "KYH25969
    END-OF-SELECTION.
      IF NOT  i_vbrk[] IS  INITIAL.                             " KYH25969
        PERFORM process_data.
        IF NOT zsumrep IS INITIAL.
    *--- begin of ppo924234
          IF NOT filepath IS INITIAL.
            CLEAR down_sum.
            REFRESH down_sum.
            MOVE: 'Invoice No'              TO down_sum-vbeln,
                  'ITyp'                    TO down_sum-fkart,
                  'Bill Dt'                 TO down_sum-fkdat,
                  'Bill-to#'                TO down_sum-kunrg,
                  'Customer#'               TO down_sum-kunag,
                  'Name'                    TO down_sum-name1,
                  'SPN'                     TO down_sum-vkgrp,
                  'Spn Name'                TO down_sum-bezei,  "IMR928046
                  'PayT'                    TO down_sum-zterm,
                  'PO No'                   TO down_sum-bstnk_vf,
                  'Ref Doc'                 TO down_sum-xblnr,
                  'Invoice Total'           TO down_sum-netwr,
                  'Payments'                TO down_sum-partialpmt,
                  'Due(00-29 Days)'         TO down_sum-due1,
                  'Due(30-44 Days)'         TO down_sum-due2,
                  'Due(45-59 Days)'         TO down_sum-due3,
                  'Due(60-74 Days)'         TO down_sum-due4,
                  'Due(75-89 Days)'         TO down_sum-due5,
                  'Due(Ovr 90Days)'       TO down_sum-due6,
                  'CGrp'                    TO down_sum-kdgrp.
            APPEND down_sum.
            LOOP AT i_vbrk.
              MOVE-CORRESPONDING i_vbrk TO down_sum.
              APPEND down_sum.
              CLEAR down_sum.
            ENDLOOP.
            PERFORM download_file TABLES down_sum USING down_sum.
          ENDIF.
    *--- end of ppo924234
          PERFORM display_summary_output.
        ELSE.
        for Detail report
          IF NOT  i_vbrk[] IS  INITIAL.                         " KYH26282
            PERFORM get_data_for_detail_report.
            PERFORM process_data_for_detail_report.
            PERFORM display_detail_report.
          ELSE.
            MESSAGE i001(00) WITH 'No data exists for the given selection'.
                                                                " KYH26282
          ENDIF.                                                "KYH26282
        ENDIF.
      ELSE.
        MESSAGE i001(00) WITH 'No data exists for the given selection'.
                                                                "KYH25969
      ENDIF.                                                    " KYH25969
    *&      Form  GET_INVOICE_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM get_invoice_data .
      TYPES : BEGIN OF t1_vbrp,
              vbeln TYPE vbeln,
              gmdnetwr LIKE zar1_struc1-gmdnetwr,
              gmdpercent LIKE zar1_struc1-gmdpercent,
              vkgrp TYPE vkgrp.
      TYPES END OF t1_vbrp.
      DATA : v_end_flag(1) TYPE c.
      DATA : l_tab_vbrp TYPE STANDARD TABLE OF t1_vbrp. "KYH
      DATA:  l_wa_vbrp  LIKE LINE OF i_vbrp.
      DATA : l1_vbrp TYPE t1_vbrp.
      DATA : l_tab_temp LIKE STANDARD TABLE OF i_vbrk.
      DATA : l_sy_tabix LIKE sy-tabix,
             gmdnetwr LIKE i_vbrp-gmdnetwr,
             gmdpercent LIKE i_vbrp-gmdpercent,
             l_count LIKE sy-tabix,
             l_tabix TYPE sy-tabix.
      CLEAR: l_sy_tabix, l_tabix.
    SELECT vbeln fkart vbtyp knumv fkdat  gjahr kdgrp rfbsk zterm bukrs
    netwr kunrg kunag                                     "IMR928882
               bstnk_vf xblnr mwsbk rfbsk
               INTO  TABLE i_vbrk
                        FROM vbrk WHERE
                         vbeln  IN zvbeln AND
                         vbtyp IN zvbtyp AND
                         fkdat  IN zfkdat AND
                         bukrs  IN zbukrs AND
                         kunag  IN zkunag AND
                         bstnk_vf IN zbstnkvf AND
                         xblnr  IN zxblnr AND
                         fksto NE 'X' .
      IF sy-dbcnt NE 0.
        IF NOT zsumrep IS INITIAL.
          IF NOT i_vbrk[] IS INITIAL.
            PERFORM fiscal_year_check.                          " KYH25882
            IF NOT i_vbrk[] IS INITIAL.                         " KYH25882
              REFRESH: l_tab_temp.
              CLEAR: l_from,
                     l_to,
                     l_lines,
                     l_rows,
                     l_loop.
              DESCRIBE TABLE i_vbrk LINES l_lines.
              l_from = 1.
              l_to = c_index.
              l_rows = l_lines / c_index.
              l_loop = CEIL( l_rows ).
              IF l_loop = 0.
                l_loop = 1.
              ENDIF.
              DO l_loop TIMES.
                APPEND LINES OF i_vbrk FROM l_from TO l_to TO l_tab_temp.
                SELECT  vbeln posnr vkgrp  mwsbp kzwi5 aubel aupos
                kdgrp_auft
               APPENDING CORRESPONDING FIELDS OF  TABLE i_vbrp
                                   FROM  vbrp  FOR ALL ENTRIES IN l_tab_temp
                                   WHERE
                                                 vbeln  = l_tab_temp-vbeln
                                                 AND
                                                 vkbur IN zvkbur AND
                                                 vkgrp IN zvkgrp.
                REFRESH l_tab_temp.
                l_from = l_to + 1.
                l_to = l_to + c_index.
              ENDDO.
            ENDIF.
    *Remove entries from VBRK checkinf for SPN on selection screen
            PERFORM check_spn.                                  " KRI926835
          ENDIF.
        ELSE.
          IF NOT i_vbrk[] IS INITIAL.
            PERFORM fiscal_year_check.                          " KYH25882
            IF NOT i_vbrk[] IS INITIAL.                         " KYH25882
              REFRESH: l_tab_temp.
              CLEAR: l_from,
                     l_to,
                     l_lines,
                     l_rows,
                     l_loop.
              DESCRIBE TABLE i_vbrk LINES l_lines.
              l_from = 1.
              l_to = c_index.
              l_rows = l_lines / c_index.
              l_loop = CEIL( l_rows ).
              IF l_loop = 0.
                l_loop = 1.
              ENDIF.
              DO l_loop TIMES.
                APPEND LINES OF i_vbrk FROM l_from TO l_to TO l_tab_temp.
               SELECT vbeln posnr fkimg matnr arktx netwr vkgrp aubel aupos
               sernr
                zzp_mfrnr vgbel vgpos aupos matkl mwsbp kzwi5 kdgrp_auft
                  APPENDING CORRESPONDING FIELDS OF  TABLE i_vbrp
                   FROM  vbrp  FOR ALL ENTRIES IN l_tab_temp WHERE
                                 vbeln  = l_tab_temp-vbeln AND
                                 vkbur IN zvkbur AND
                                 vkgrp IN zvkgrp AND
                                 zzp_mfrnr IN zmfrnr.
                REFRESH l_tab_temp.
                l_from = l_to + 1.
                l_to = l_to + c_index.
              ENDDO.
            ENDIF.                                              " KYH25882
          ENDIF.
        ENDIF.
        IF NOT i_vbrk[] IS INITIAL.                             "KYH25882
          SORT i_vbrk BY vbeln.                                 "KYH25882
          SORT i_vbrp BY vbeln posnr.                           "KYH25882
          LOOP AT i_vbrk.
            MOVE  i_vbrk-kunag TO i_kunag-kunag.
            APPEND i_kunag.
            MOVE i_vbrk-knumv TO i_knumv-knumv.
            APPEND i_knumv.
          ENDLOOP.
        ENDIF.                                                  " KYH25882
    ENDFORM.                    " GET_INVOICE_DATA
    *&      Form  GET_ACCOUNTING_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM get_accounting_data .
      DATA : l_tab_vbrp LIKE STANDARD TABLE OF i_vbrp. "KYH
      DATA: l_tab_temp LIKE STANDARD TABLE OF i_vbrk.
      CONSTANTS c_index TYPE i VALUE 4000.
      IF NOT i_vbrk[] IS INITIAL.
        REFRESH: l_tab_temp.
        CLEAR: l_from,
                l_to,
                l_lines,
                l_rows,
                l_loop.
        DESCRIBE TABLE i_vbrk LINES l_lines.
        l_from = 1.
        l_to = c_index.
        l_rows = l_lines / c_index.
        l_loop = CEIL( l_rows ).
        IF l_loop = 0.
          l_loop = 1.
        ENDIF.
        DO l_loop TIMES.
          APPEND LINES OF i_vbrk FROM l_from TO l_to TO l_tab_temp.
          DELETE l_tab_temp WHERE rfbsk <> 'C'.                 " KYH25882
          IF NOT l_tab_temp[] IS INITIAL .                      " KYH25882
            SELECT belnr buzei dmbtr shkzg APPENDING TABLE i_bsad
            FROM bsad
            FOR ALL ENTRIES IN l_tab_temp
            WHERE
                bukrs EQ l_tab_temp-bukrs AND
                gjahr EQ l_tab_temp-gjahr AND
                belnr EQ l_tab_temp-vbeln.
          ENDIF.                                                " KYH25882
          REFRESH l_tab_temp.
          l_from = l_to + 1.
          l_to = l_to + c_index.
        ENDDO.
    *--- begin of ppo924396
        REFRESH: l_tab_temp.
        CLEAR: l_from,
               l_to,
               l_lines,
               l_rows,
               l_loop.
        DESCRIBE TABLE i_vbrk LINES l_lines.
        l_from = 1.
        l_to = c_index.
        l_rows = l_lines / c_index.
        l_loop = CEIL( l_rows ).
        IF l_loop = 0.
          l_loop = 1.
        ENDIF.
        DO l_loop TIMES.
          APPEND LINES OF i_vbrk FROM l_from TO l_to TO l_tab_temp.
          DELETE l_tab_temp WHERE rfbsk <> 'C'.                 " KYH25882
          IF NOT l_tab_temp[] IS INITIAL .                      " KYH25882
            SELECT  belnr buzei shkzg dmbtr rebzg FROM bsid     "vma928512
                              APPENDING CORRESPONDING FIELDS OF TABLE i_bsid
                              FOR ALL ENTRIES IN l_tab_temp
                              WHERE bukrs EQ l_tab_temp-bukrs
                              "PRA927038 "PRA927150  vbeln pick
          ENDIF.                                                " KYH25882
          REFRESH l_tab_temp.
          l_from = l_to + 1.
          l_to = l_to + c_index.
        ENDDO.
        SELECT fkart FROM tvfk INTO TABLE i_tvfk WHERE vbtyp = 'O'.
                                                                "ppo924471
       delete i_bsid where augbl = space.  " PRA927093
      ENDIF.                                                    " KYH25882
    ENDFORM.                    " GET_ACCOUNTING_DATA
    *&      Form  GET_SD_DOC_CATEGORY
          text
    -->  p1        text
    <--  p2        text
    FORM get_sd_doc_category .
    Exclude SD Doc Category N and S
      zvbtyp-sign = 'E'.
      zvbtyp-option = 'EQ'.
      zvbtyp-low = 'N'.
      APPEND zvbtyp.
      zvbtyp-sign = 'E'.
      zvbtyp-option = 'EQ'.
      zvbtyp-low = 'S'.
      APPEND zvbtyp.
    Get only Invoices
      IF NOT zinvoice IS INITIAL.
        zvbtyp-sign = 'I'.
        zvbtyp-option = 'EQ'.
        zvbtyp-low = 'M'.
        APPEND zvbtyp.
      ENDIF.
    Get only Credit Memos
      IF NOT zcredit IS INITIAL.
        zvbtyp-sign = 'I'.
        zvbtyp-option = 'EQ'.
        zvbtyp-low = 'O'.
        APPEND zvbtyp.
      ENDIF.
    Get only Debit Memos
      IF NOT zdebit IS INITIAL.
        zvbtyp-sign = 'I'.
        zvbtyp-option = 'EQ'.
        zvbtyp-low = 'P'.
        APPEND zvbtyp.
      ENDIF.
    GET Fiscal year.
      IF NOT zgjahr IS INITIAL.
        zgjahr-sign = 'I'.
        zgjahr-option = 'EQ'.
       APPEND i_zgjahr.
        APPEND zgjahr.                                          "IMR928882
      ENDIF.
    ENDFORM.                    " GET_SD_DOC_CATEGORY
    *&      Form  GET_OTHER_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM get_other_data .
      IF NOT i_kunag[] IS INITIAL.                              " KYH25882
        SORT i_kunag BY kunag.
        DELETE ADJACENT DUPLICATES FROM i_kunag COMPARING kunag.
        SELECT kunnr name1 name2 name3 stras ort01 regio pstlz adrnr FROM
        kna1      INTO CORRESPONDING FIELDS OF TABLE i_kna1 FOR ALL ENTRIES
                  IN i_kunag WHERE kunnr = i_kunag-kunag.
       SELECT kunnr name1 name2 name3 stras ort01 regio pstlz adrnr FROM
    kna1 INTO TABLE i_kna1 FOR ALL ENTRIES                     "IMR928882
                    IN i_kunag WHERE kunnr = i_kunag-kunag.
       IF NOT I_KNUMV[] IS INITIAL.          " KYH25882
         SORT I_KNUMV BY KNUMV.
         DELETE ADJACENT DUPLICATES FROM I_KNUMV COMPARING KNUMV.
      ENDIF.                    "  KYH25882
      ENDIF.                                                    "  KYH25882
    ENDFORM.                    " GET_OTHER_DATA
    *&      Form  PROCESS_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM process_data .
      IF NOT i_vbrk[] IS INITIAL.                               " KYH25882
        DATA: l_sy_tabix LIKE sy-tabix.
        CLEAR l_sy_tabix.
        SORT i_kna1 BY kunnr.
        SORT i_bsad BY belnr.
        SORT i_bsid BY belnr.
        LOOP AT i_vbrk.
          l_sy_tabix = sy-tabix.
          PERFORM invoice_total_get.                            "ppo924692
          PERFORM payments_get.
          IF NOT zopeninv IS INITIAL AND  i_vbrk-opendmbtr = 0.
          IF NOT zopeninv IS INITIAL.
         start pradeep
         perform openinvoices.
            DELETE i_vbrk.
            CONTINUE.
          ENDIF.
          PERFORM customer_name_get. "krishna
          PERFORM return_cal_sum.                               "ppo925435
          PERFORM dues_data_get.                                "ppo925435
          PERFORM spn_get.                                      "IMR928046
          MODIFY i_vbrk INDEX l_sy_tabix.
          CLEAR i_vbrk.
        ENDLOOP.
      ENDIF.                                                    " KYH25882
    ENDFORM.                    " PROCESS_DATA
    *&      Form  DISPLAY_SUMMARY_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM display_summary_output .
      IF i_vbrk[] IS INITIAL.
        MESSAGE i001(00) WITH 'No data exists for the given selection'.
        EXIT.
      ENDIF.
      PERFORM build_field_cat.
      PERFORM call_alv.
    ENDFORM.                    " DISPLAY_SUMMARY_OUTPUT
    *&      Form  BUILD_FIELD_CAT
          text
    -->  p1        text
    <--  p2        text
    FORM build_field_cat .
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'VBELN'.
    ls_fieldcat-ref_tabname  = 'VBRK'.
      ls_fieldcat-ref_tabname  = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Invoice No'.
      ls_fieldcat-key          = 'X'.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'FKART'.
    ls_fieldcat-ref_tabname  = 'VBRK'.
      ls_fieldcat-ref_tabname  = 'I_VBRK'.                      "IMR928770
      ls_fieldcat-reptext_ddic = 'ITyp'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'FKDAT'.
    ls_fieldcat-ref_tabname  = 'VBRK'.
      ls_fieldcat-ref_tabname  = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Bill Dt'.                     "IMR928770
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'KUNRG'.
    ls_fieldcat-ref_tabname  = 'VBRK'.
      ls_fieldcat-ref_tabname  = 'I_VBRK'.                      "IMR928770
      ls_fieldcat-reptext_ddic = 'Bill To #'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'KUNAG'.
      ls_fieldcat-ref_tabname  = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Customer #'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'NAME1'.
    ls_fieldcat-ref_tabname  = 'KNA1'.           "IMR928770
      ls_fieldcat-ref_tabname  = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Name'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'VKGRP'.
    ls_fieldcat-ref_tabname  = 'VBRP'.                       "IMR928770
      ls_fieldcat-ref_tabname  = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Spn'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.                                        "IMR928046
      ls_fieldcat-fieldname    = 'BEZEI'.
    ls_fieldcat-ref_tabname  = 'TVGRT'.
      ls_fieldcat-ref_tabname  = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Spn Name'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'ZTERM'.
    ls_fieldcat-ref_tabname  = 'VBRK'.                        "IMR928770
      ls_fieldcat-ref_tabname  = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'PayT'.                        "IMR928770
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BSTNK_VF'.
    ls_fieldcat-ref_tabname  = 'VBRK'.           "IMR928770
      ls_fieldcat-reptext_ddic = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Client PO'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'XBLNR'.
    ls_fieldcat-ref_tabname  = 'VBRK'.           "IMR928770
      ls_fieldcat-reptext_ddic = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Ref Doc'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'NETWR'.
    ls_fieldcat-ref_tabname  = 'VBRP'.            "IMR928770
      ls_fieldcat-reptext_ddic = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Invoice Total'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'PARTIALPMT'.
      ls_fieldcat-ref_tabname  = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Payment'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'DUE1'.
      ls_fieldcat-ref_tabname  = 'I_VBRK'.
      ls_fieldcat-reptext_ddic = 'Due ( 0 - 29)'.
      ls_fieldcat-key          = ' '.
      APPEND ls_fieldcat TO fieldcat_sno.

    Hi
    1. Avoid NE in the select(below)
    SELECT vbeln fkart vbtyp knumv fkdat bukrs gjahr kdgrp zterm netwr
    kunrg kunag
    bstnk_vf xblnr mwsbk rfbsk
    INTO CORRESPONDING FIELDS OF TABLE i_vbrk
    FROM vbrk WHERE
    vbeln IN zvbeln AND
    kunag IN zkunag AND
    fkdat IN zfkdat AND
    xblnr IN zxblnr AND
    bstnk_vf IN zbstnkvf AND
    vbtyp IN zvbtyp AND
    <b>fksto NE 'X'</b> AND
    bukrs IN zbukrs .
    Instead delete the entries from the table after u fetch the data into i_vbrk.
    2. Avoid using INTO CORRESPONDING FIELDS.
    3. before using FOR ALL ENTRIES IN l_tab_temp
    sort the internal table withrequired keys.
    delete the duplicate entries with those fields.
    4. this select APPENDING CORRESPONDING FIELDS OF TABLE i_vbrp
    is in the DO-ENDDO. if possible move it out of the loop.
    use WHILE-ENDWHILE instead of DO-ENDDO.
    5. APPENDING CORRESPONDING FIELDS OF TABLE i_vbrp
    avoid APPENDING clause. u can create temporary internal table and append the entries accordingly.
    6. Avoid Move-corresponding.
    7. you have used DELETE statement in Loops. try to avoid that.
    hope this helps.
    **reward if helpful
    regards,
    madhu

  • Problem: Use an ODI variable in a Java Procedure

    Hi and thanks in advance,
    i need to use a project variable in a java procedure i've written. In particular i should read a file (and manage it...), but its name is stored in avariable called #fileName that i refresh each time.
    writing something like:
    <% FileInputStream fis = new FileInputStream(C:\\"+"#filename");
    etc.
    etc.
    %>
    doesn't work...
    How can i use the value of my ODI variable inside the Java code?
    Please, help me if you can...
    Thank you very much.

    Any Idea? Please, this question is blocking me...

  • Production issue - Sender File adapter not picking up the files from folder

    Hi Guys,
    Ever since the upgrade from XI 3.0 to PI 7.1, we have come acrossinstances of weird error.
    Thsi time again - now the 3rd time - tandom basis, in our production PI server, we have teh file slying in the source directory folder in the server.
    I can see the files lying there in AL11.
    However, it looks like that the file polling has just stopped and the channel is going blank in channel monitoring.
    I have checked in SXMB_MONI and there are no messages since the morning.
    I have tried craeting a replica of the current channel but it is not working.
    This is teh production server and thsi has alraedy created production issues.
    I ahve checked in the SDN forum but am not able to find the details.
    Plaese help me.
    I am anyway going to raise the issue with SAP now.
    Regards,
    Archana
    <REMOVED BY MODERATOR>
    Edited by: Prateek Raj Srivastava on Jun 8, 2010 4:50 PM

    Hi Prateek,
    I have trying all sorts since the morning and then just checked teh file permissions.
    The file permissions were incorrect as compared ot the other files that were processed successfully today.
    Somehow the permissions were changed on the server and the interface channel was not able to poll the files.
    I got teh permissions changed back to 666 and all the files were pikced up in a minute.
    I got the folder checked and it seems like that the permissions were changed somewhere very early in the morning and we are trying to find out how it happened and who did that.
    However, another question i had - this sender file adapter was polling the source directory and deleting the files from there.
    I would have expected that if the channel had issues with the file permission because of which it was not able to access the file, it would have thrown an error something like the file permissions error.
    But there was not a single error in the channel monitoring.
    How can we configure it in a beter way so that we at least soem kind of error indication?
    Please advice.
    Regards,
    Archana

  • Plz help production issue(smartform)

    hi experts plz help its a production issue
    i have a box in my smartform in which in one line i can only show 50 characters .and i have a text of 70 characters but i only have to show 50 characters from 70 characters .
    now wat i did i stored 70 characters variable into 50 char variable abd displaying it .
    but the issue is
    if i want to print .
    hi this is sdn and here u can get all the information about sap .
    now lets say
    i of information is the 46th character of my line
    now what is happening it is coming like
    hi this is sdn and here u can get all the
    infor
    its showing 50 character only but if word is not completed it is printing it in next line.
    it should print like
    hi this is sdn and here u can get all the infor
    plz help how to do it
    thanx in advance .

    code i am using is ::::::::::::::::::::::::::::::::::::::::::::::::
    data : TEXT_3I56(50) type c .
    move is_bil_invoice-hd_gen-bil_number TO textname.
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    CLIENT                         = SY-MANDT
    id                            = '0002'
    language                      = is_nast-spras
    name                          = textname
    object                        = 'VBBK'
      ARCHIVE_HANDLE                = 0
      LOCAL_CAT                     = ' '
    IMPORTING
      HEADER                        =
    tables
    lines                         = t_lines_3156
    EXCEPTIONS
    ID                            = 1
    LANGUAGE                      = 2
    NAME                          = 3
    NOT_FOUND                     = 4
    OBJECT                        = 5
    REFERENCE_CHECK               = 6
    WRONG_ACCESS_TO_ARCHIVE       = 7
    OTHERS                        = 8.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *describe table t_lines lines n.
    *if not n is initial.
    *bank_note = 'X'.
    *endif.
    READ TABLE T_LINES_3156 INDEX 1 .
    IF SY-SUBRC = 0 .
    TEXT_3I56 = T_LINES_3156-TDLINE .
    ENDIF.

Maybe you are looking for

  • How to connect Macbook Air to OLD tv (w/o HDMI)?

    Hi, I have a macbook air 11"  LATE 2010. I want to connect my Macbook Air to OLD TV, via VGA cable. It's its old tv, but it has a big screen, anyways, it does NOT have HDMI. I can't find the right cables I need. I tried amazon, but it gave me the wro

  • Problem in Queries SQ01

    Hi to all, I am working on SQ01 Queries, I need to change the priority of the feilds. let say example material number will dispay last on the bottom of theb screen. it needs to display in top of the screen. How we will change the priority of the inpu

  • PSE 6 & 8 for Macintosh launching problem with licence

    Hi, I have big problem with launch PSE under OSX 10.6. I exchange the HD drive in my MacBookPro and reinstalled system for 10.6 Snow Leopard. Some files I restored with Time Machine but PSE reinstalled with CD. At first I try with my hard copy of PSE

  • Ever since updating to ios6, itunes constantly crashes - I can't even stay in it long enough to search or purchase anything!

    I have an ipod touch (4th generation) & an iPhone 4s, both are acting similarly when attempting to search for music and/or purchase anything. it will do the loading "spinning wheel thing) at the top & if I search a song name, it will start to populat

  • Audition CS6: Comment s'enregistrer ?

    Salut à tous ! Je viens d'obtenir Adobe Audition CS6 et j'aimerai pouvoir enregistrer ma basse avec. Le problème c'est que je sais pas du tout comment faire... J'ai cherché des tutos sur le net mais rien de concluant à part des trucs payant bien sûr.