Exception writing binary data to the output stream to client -Broken pipe

Hi,
I am trying to use the drag & drop feature using Contributor mode of Webcenter sites. Single Image Page Attribute is working properly where as Multiple Image Page Attribute throws the following error:
[ERROR] [.kernel.Default (self-tuning)'] [logging.cs.satellite.request] Exception writing binary data to the output stream to client 10.191.117.106
java.net.SocketException: Broken pipe
     at java.net.SocketOutputStream.socketWrite0(Native Method)
     at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
     at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
     at weblogic.servlet.internal.ChunkOutput.writeChunkTransfer(ChunkOutput.java:568)
     at weblogic.servlet.internal.ChunkOutput.writeChunks(ChunkOutput.java:539)
     at weblogic.servlet.internal.ChunkOutput.flush(ChunkOutput.java:427)
     at weblogic.servlet.internal.ChunkOutput$2.checkForFlush(ChunkOutput.java:648)
     at weblogic.servlet.internal.ChunkOutput.write(ChunkOutput.java:333)
     at weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:148)
     at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:148)
     at COM.FutureTense.Servlet.ServletRequest$OutputOutputStream.write(ServletRequest.java:80)
     at COM.FutureTense.Servlet.ServletRequest.write(ServletRequest.java:1633)
     at com.openmarket.Satellite.RequestContext.write(RequestContext.java:1123)
     at com.openmarket.Satellite.BytePiece.stream(DataPiece.java:253)
     at com.openmarket.Satellite.CacheObjectImpl.stream(CacheObjectImpl.java:651)
     at com.openmarket.Satellite.Http11Responder.respondForWrapper(Http11Responder.java:142)
     at com.openmarket.Satellite.WrapperAwareResponder.respond(WrapperAwareResponder.java:36)
     at com.openmarket.Satellite.SatelliteServer.execute(SatelliteServer.java:85)
     at com.openmarket.Satellite.servlet.BaseServlet.doGet(BaseServlet.java:118)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
     at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
     at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
     at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
     at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at com.fatwire.wem.sso.cas.filter.CASFilter.doFilter(CASFilter.java:557)
     at com.fatwire.wem.sso.SSOFilter.doFilter(SSOFilter.java:51)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
     at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
     at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
     at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
     at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Thanks
KarthiK

Thank u very much,
     FileOutputStream opGif = new FileOutputStream(destFile, false);
I have changed above line with the following line:
     PrintWriter opGif = new PrintWriter ( new FileWriter(destFile, false));
and now this code is working very fine.
Thanks once again...

Similar Messages

  • Writing binary data to a file without carriage returns every 512 bytes

    Is there a VI for writing binary data to a file without carriage returns being inserted every 512 bytes?
    Thanks

    Hi Momolxg,
    I could be way off on this. I tried to simulate what you've done by
    making a for loop that would run a set number of times. For my example I
    used 1025. I wired the iteration terminal to a 'Write to SGL File.vi'
    outside the loop with indexing enabled. It wrote the SGL data from 0 to
    1024 to the file. I then read the file with a 'Read Characters from
    File.vi' and searched the output for a carriage return (0D hex). It was
    found five times. The reason why was the SGL number it was reading had a
    13 (0D hex) in it. Perhaps you're running into a similar problem?
    I tried it again, this time using the 'Write to I16 File.vi'. The
    carriage return was found five times: the 28th character the first time
    then on the 512th character four consecutive time
    s after that. I suppose
    that makes sense that you'd find a 0D in the numbers at equal spacings if
    they're incrementing this way... In this case the carriage returns you're
    seeing are actually numbers from your data.
    One big difference is that I'm using a set pattern of numbers. This
    doesn't appear to be your case. Is there a better way we can duplicate
    your problem? It sounds interesting. Again my simulation could be way
    off. (I'm also running this on LV60 for Linux so my results could be
    different)
    - Kevin
    In article <[email protected]>,
    "momolxg" wrote:
    > Is there a VI for writing binary data to a file without carriage returns
    > being inserted every 512 bytes? Thanks

  • Sending Data Through a Output Stream...

    Hello,
    I am writing a program that works on a network...a server is running and client will connect to the server and send specific data for the server to complete transactions on.
    The transactions that are mainly seen are SQL SELECT statements and as you can imagine a statement could bring back many records.
    At present I have been able to send specific data through streams and have turned this into parameters on the server side and performed SQL. What I need help with or suggestions on is how to get the data back to the client. In some cases it may need to be displayed on screen or just used for further processing?
    Please let me know if this is not 100% clear.
    Thanks,
    P

    If you are able to send data over a network, then I assume that you know how to do network programming in Java, as well as knowing SQL.
    Java has JDBC - Java DataBase Connectivity API that supports your requirements in full.
    If you require a custom solution, then you need to be able to read data back from the server - when the server returns the ResultSet back to the client.
    A Socket object has both input and output streams. Seems that you know about the output stream, do you not know about the input stream?
    If the server is setup to send data back to the client over the same socket, then you should simply be able to read the results back from the socket's input stream.

  • JSPs writing binary data

    Hi,
    I'm trying to develop a JSP that returns binary data in the form of a jpeg image.
    I found this on google where one of the replies correctly states that to be compliant I need to use XML JSPs:
    http://www.caucho.com/quercus/faq/question.xtp?question_id=1005
    This is what I am now doing but I am getting exceptions about:
    "java.lang.IllegalStateException: getOutputStream() has already been called for this response"
    I have traced this to be on the very last line of the blah_jsp.java file created by tomcat:
    "if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);".
    My code looks like this:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
    <jsp:directive.page contentType="image/jpeg" />
    <jsp:declaration><![CDATA[ .... ]]></jsp:declaration>
    <jsp:scriptlet><![CDATA[
    try {
    updateImage();
    response.getOutputStream().write( apodImageData );
    } catch (Exception e) {
    out.println( e.toString() );
    StringWriter sr = new StringWriter();
    e.printStackTrace( new PrintWriter( sr ) );
    out.println( sr.toString() );
    ]]></jsp:scriptlet>
    </jsp:root>
    Any ideas? Is there a way to stop the container produced java file from tampering with out? Obviously my code is working but the final line of the container produced code is failing because I've manually been using result.getOutputStream().
    Any ideas?

    Have just found this after many hours of searching:
    http://www.mooreds.com/weblog/archives/000018.html
    The upshot is that TC4 is non compliant in this area, TC5 is fixed..

  • Challenge: Controlling the output stream of includes within iterative tags

    Problem:
    How can you control the output stream of an iterative tag that is making an include on each iteration (either by using the jsp include tag or by a custom tag that does an pageContext.include(). Example of the first of such a case could be:
    <wf:iterator name="...">
    <div>
    <jsp:include page="test.jsp" flush="true"/>
    </div>
    <wf:iterator>
    I now want to see the following output:
    <div>
    ..content of jsp file 1
    </div>
    <div>
    ...content of jsp file 2
    </div>
    etc....
    However what I AM seeing is that the jsp content is flushed to the output stream before the divs like this:
    ...content of jsp file 1
    ...content of jsp file 2
    <div>
    </div>
    <div>
    </div>
    See!? How is that and what can I do to control the output stream??
    Thanks
    Alf Johannessen
    Ariol

    This is a stab in the dark, but have you tried writing your div tags out using the JSP directive:
    out.println("<div>");
    or
    <%="<div>"%>
    It looks like a bug in the iterator. I'd suggest you try setting flush to be false, but I know that's not supported yet (unless you've updated your libraries) ...

  • Error flushing the output stream in Sun One server

    Hi All,
    I was running my servlet code in iPlanet 6.0 version and it was working fine. I upgraded my web server to new Sun One server (Oracle-iPlanet-Web-Server-7.0.9). With the new web server almost 90% of my application works fine, but there is a features in my application to download an Excel sheet by clicking a button. This feature is failing in new Sun One web server.
    Below are my piece of code and the error log I m getting. Can anyone tell me how I can fix this error, I mean is there any web server specific change or configuration parameter need to be set.
    Please ask for any information regarding my server configuration settings if needed for finding a solution for this
    Code:
    byte abyte0[] = new byte[1024];
    BufferedInputStream bufferedinputstream=null;
    BufferedOutputStream bufferedoutputstream=null;
    java.io.InputStream inputstream = httpurlconnection.getInputStream();
    bufferedinputstream = new BufferedInputStream(inputstream);
    bufferedoutputstream = new BufferedOutputStream(httpservletresponse.getOutputStream());
    int j;
    long byteCount=0;
    while((j = bufferedinputstream.read(abyte0, 0, 1024)) != -1)
    byteCount=byteCount+j;
    if(logger != null && logger.traceOn())
    logger.log("total"+byteCount);
    logger.log("Read bytes:"+j);
    bufferedoutputstream.write(abyte0, 0, j);
    if(logger != null && logger.traceOn())
    logger.log("Wrote bytes:"+j);
    bufferedoutputstream.flush(); // <<<<<< ERROR POINT >>>>>>
    Error Log :
    ClientAbortException: java.io.IOException: WEB8004: Error flushing the output stream
    at org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:343)
    at org.apache.coyote.tomcat5.OutputBuffer.flush(OutputBuffer.java:313)
    at org.apache.coyote.tomcat5.CoyoteOutputStream.flush(CoyoteOutputStream.java:147)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
    at com.reuters.bdec.as.ASRequestHandler.processResponse(ASRequestHandler.java:285)
    at com.reuters.bdec.as.ASRequestHandler.initiateGetRequest(ASRequestHandler.java:89)
    at com.reuters.bdec.as.ASRequestHandler.proceedToDestination(ASRequestHandler.java:220)
    at com.reuters.bdec.as.ASExtension.authorisationCheck(ASExtension.java:84)
    at com.reuters.bdec.as.ASExtension.doGet(ASExtension.java:114)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:794)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:915)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:398)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:255)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
    at com.sun.webserver.connector.nsapi.NSAPIProcessor.service(NSAPIProcessor.java:160)
    Caused by: java.io.IOException: WEB8004: Error flushing the output stream
    at com.sun.webserver.connector.nsapi.NSAPIProcessor.action(NSAPIProcessor.java:243)
    at org.apache.coyote.Response.action(Response.java:197)
    at org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:339)
    ... 20 more

    Don't flush it yourself. The servlet container will automatically flush for you once its send buffer is full. You can change the size of the send buffer though.

  • How to send binary data in the message body

    How can we send binary data in the message body that is base64 encoded? below are the requirements
    Mime Header.
    Mime-version: 1.0
    Content-Type: application/octet_stream; name=test
    Content-Transfer-Encoding: Base64
    Submission must be named "test.sub" (lowercase)
    Submission must be base64 mime-encoded
    Submission must be sent in the body of the message (not as an attachment)
    Only one submission per mail message
    No other comments should be put in the body of the mail message (other than the submission)
    I highly appreciate your help. If you can provide few examples, that will be very helpfull.
    Thanks,
    Madan

    Use Message.setContent to set the content, or use Message.setDataHandler with
    a DataHandler constructed with a ByteArrayDataSource. If the content is not
    "naturally" encoded in base64, you can enforce it by setting the Content-Transfer-Encoding
    header to "base64". Any reasonable mail reader won't care what encoding you use, as
    long as the decoded data is correct.

  • Compress the output stream..

    Hello every body..
    I have aproject that use the java applet to transmit a vedio and audio over the internet network to do a video conference application with other applet at another computer at the network..
    I want to support the application so that the user that enter the conference can select the bandwidth of the internet he/she use and then accordin to choice i control the quality of the stream transmitted..
    So i want any one can help me with any way can be used to reduce the quality( or resolution) of the output stream so the user can be comfortable with the output..
    please any one can help me reply to me as fast as can..
    I there is no method can be used also reply and say this..
    Thanks...

    Hi,
    For audio use GSM codec. It just takes 12kbps of your bandwidth.
    For video, if you need "ok" quality with low bandwidth, use H.263 codec and for good quality, but higher bandwidth use JPEG codec. below are complete functions on how to reduce qualities for both codecs (or at least try to). But before you have to create a video Processor (see AVTransmit3.java and AVReceive3.java examples on the net).
    private void setReducedJPEGQuality(Processor videoProcessor) {
       Control cs[] = videoProcessor.getControls();
       QualityControl qc = null;
       VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);
       // Loop through the controls to find the Quality control for
       // the JPEG encoder.
       for (int i = 0; i < cs.length; i++) {
          if (cs[i] instanceof QualityControl && cs[i] instanceof Owned) {
             Object owner = ((Owned)cs).getOwner();
    // Check to see if the owner is a Codec.
    // Then check for the output format.
    if (owner instanceof Codec) {
    Format fmts[] = ((Codec)owner).getSupportedOutputFormats(null);
    for (int j = 0; j < fmts.length; j++) {                    
    if (fmts[j].matches(jpegFmt)) {               
    qc = (QualityControl)cs[i];          
    qc.setQuality(0.5f);               
    break;
    if (qc != null) {
    break;
    This will reduce your JPEG bandwith to an average of 150kbps, with still a good quality.
               private void setReducedH263Quality(Processor videoProcessor) {
             Control cs[] = videoProcessor.getControls();
              QualityControl qc = null;
              BitRateControl brc = null;
              FrameRateControl frc = null;
              boolean done = false;
              //try with bit rate first
              for (int i = 0; i < cs.length; i++) {
                  if(cs[i] instanceof Owned) {
                      if(cs[i] instanceof BitRateControl) {
                           brc = (BitRateControl)cs;
                   if(brc.getBitRate()>0) {
                        brc.setBitRate(30000);               done = true;
                   brc = null;
              if(done) {
                   return ;
              //then look for quality control
              for (int i = 0; i < cs.length; i++) {
              if(cs[i] instanceof Owned) {
              if(cs[i] instanceof QualityControl) {
                   qc = (QualityControl)cs[i];
                   if(qc.getQuality()>0.0f) {
                        qc.setQuality(0.5f);
                        done = true;
                   qc = null;
              if(done) {
                   return ;
              //if that did not work, try setting frame rate
              for (int i = 0; i < cs.length; i++) {
              if(cs[i] instanceof Owned) {
              if(cs[i] instanceof FrameRateControl) {
                   frc = (FrameRateControl)cs[i];
                   frc.setFrameRate(6.0f);
                   frc = null;
    This will reduce your H.263 codec's bit rate to 80kbps. You cannot set less than that. I tried with many webcams and that's the least I could go.
    Good luck.

  • Best practice for putting binary data on the NMR

    Hi,
    We're creating a component that will consume messages off the NMR, encode them, and subsequently put them back on the NMR. What's the best practice for sending binary data over the NMR?
    1. setContent()?
    2. addAttachment()?
    3. setProperty()?
    If NormailzedMessage.setContent() is the desired approach, then how can you accomplish that?
    Thanks,
    Bruce

    setContent() is used only for XML messages. The recommended way to accommodate binary data is to use addAttachment().

  • "Failed to update binary data in the database".

    Hi,
    we will get this message ("Failed to update binary data in the database".) when one of our customers want to install our add-on in one specific server.
    they got a copy of their database and put in another computer and could install add-on. but they can not install add-on on their main server.
    please advice me.

    Hi Senthil,
    Thanks for your consideration,
    They checked and they don’t have any record in SARI table related to R1. they have one record for XLR only.
    This problem is only on one specific server.
    Do you have any other idea? Please help us.
    Regards,
    Neda

  • The "alsa audio output error: cannot write: Broken pipe" problem

    [Solved]
    (No place for this word in the Subject field, so I put it here.)
    Hi Arch community!
    I noticed I have this problem and not sure when in started. Several months ago I bought and installed new videocard "GeForce GT 630". Right after installation I lost sound in the system. Having internal sound card (in mainboard) and SB Audigy2 (PCI), I searched for solution and found I had to disable "snd_hda_intel" module to restore sound to work through PCI sound card. Did it.
    echo "blacklist snd_hda_intel" >> /etc/modprobe.d/no-nvidia-sound.conf
    After that sound was working as it should. And I noticed recently that during playing of any sound file the sound interrupts. If run VLC from CLI I get "alsa audio output error: cannot write: Broken pipe" message. And my system hasn't been upgraded since I don't know when. I still ran Firefox 26. So googled again and found it's a bug in a kernel or somewhere else.
    ==========================================
    https://bugs.freedesktop.org/show_bug.cgi?id=69942 :
    2013-10-01 01:39:40 UTC
    I ran a system update last night, and this issue appears to have been corrected.
    ==========================================
    And so I thought upgrade would fix my problem since mainstream bug is fixed. After upgrade sound interrupts again, maybe even more often.
    Do you guys have this issue and does anyone have a solution?
    Last edited by Mr. Alex (2014-06-26 18:55:59)

    Not particularly wise to blacklist the module, since it probably is also used by the integrated sound card. With vid and pid you could just disable the nvidia card alone using parameter enable=0. Unless you do not mind having both disabled.
    Where do I need to input "enable=0"? When I was searching for solution to make my Creative card work with new nVidia card I installed, the only way I found was blacklisting the module.
    dmesg says:
    [ 20.448086] nvidia 0000:02:00.0: irq 42 for MSI/MSI-X
    [ 21.112331] NVRM: Your system is not currently configured to drive a VGA console
    [ 21.112340] NVRM: on the primary VGA device. The NVIDIA Linux graphics driver
    [ 21.112345] NVRM: requires the use of a text-mode VGA console. Use of other console
    [ 21.112349] NVRM: drivers including, but not limited to, vesafb, may result in
    [ 21.112352] NVRM: corruption and stability problems, and is not supported.
    Then:
    lsmod | grep 'snd'
    snd_ca0106 36242 0
    snd_ac97_codec 114896 1 snd_ca0106
    ac97_bus 1270 1 snd_ac97_codec
    snd_rawmidi 20278 1 snd_ca0106
    snd_seq_device 5244 1 snd_rawmidi
    snd_pcm 83207 2 snd_ac97_codec,snd_ca0106
    snd_timer 19294 1 snd_pcm
    snd 60780 6 snd_ac97_codec,snd_timer,snd_pcm,snd_rawmidi,snd_seq_device,snd_ca0106
    soundcore 5551 1 snd
    I guess my card is "snd_ca0106". If yes,
    # systool -v -m snd_ca0106
    Module = "snd_ca0106"
    Attributes:
    coresize = "36242"
    initsize = "0"
    initstate = "live"
    refcnt = "0"
    taint = ""
    uevent = <store method only>
    Parameters:
    enable = "Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y"
    id = "(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)"
    index = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
    subsystem = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
    Sections:
    .bss = "0xffffffffa0814780"
    .data = "0xffffffffa0813300"
    .exit.text = "0xffffffffa0811a1e"
    .gnu.linkonce.this_module= "0xffffffffa0814500"
    .init.text = "0xffffffffa0817000"
    .note.gnu.build-id = "0xffffffffa0811a30"
    .rodata = "0xffffffffa0811a80"
    .rodata.str1.1 = "0xffffffffa08123dc"
    .rodata.str1.8 = "0xffffffffa0812130"
    .strtab = "0xffffffffa0818c10"
    .symtab = "0xffffffffa0817020"
    .text = "0xffffffffa080d000"
    __mcount_loc = "0xffffffffa0812f98"
    __param = "0xffffffffa0812f18"
    __verbose = "0xffffffffa0814460"
    Where would I look for "max_buffer_size" parameter?

  • Transfer data in the Ztable from one client to another client in a same ser

    Hi all,
    How can i transfer or move data in the Ztable from one client to another client in a same server .
    Thanks
    Ajay

    hi,
    create a transport request (Workbench type) and add the following line into the transport request:
    R3TR TABU name_of_table
    save and doubleclick this line and enter the table keys for the required entries (if you need all antries: client and an asterisk will do).
    When it is done save again, release the transport and ask basis to import into target client (or you can do on your own in SCC1 transaction)
    hope this helps
    ec

  • Writing binary data to ASP file from applet through URLConnection

    Hi Everybody,
    I am facing a proble with HttpURLConnection.I want to write some binary data from applet to an ASP file.The other end ASP file read this binary data and process , Here problem is I have opened URLConnection to the page and Created OutputStream and writing byte by Write() method But other end we are not getting bytes...we are not getting error too at java side..can any body help me..do we need to set any property to URLConnection...here I am giving sample code...
    OutputStream os;
    URL uConnect2;
    HttpURLConnection hucConnect2;
    uConnect2= new URL("http://webserver/vnc/sendtoserver.asp?"); hucConnect2=(HttpURLConnection)uConnect2.openConnection();
    hucConnect2.setDoOutput(true);
    hucConnect2.setRequestMethod("POST")
    os=new DataOutputStream(hucConnect2.getOutputStream());
    os.writeBytes("Hello");
    Thanks in Advance
    Madhav

    Do you remember to flush() and close() the stream?

  • Getting the Output Stream of  a Process without exec()ing it first.

    Hi there,
    I am writing a java application which needs to open another application "gnuplot". Now my operating system is windows and I open pgnuplot .
    Also I want to send input to the above gnuplot (say plot sin(x) ) via the outputStream. The following is what I do :-
         String gnuplot_cmd = "plot sin(x)\n" ;
              Process p = Runtime.getRuntime().exec("C:/gnuplot/gnuplot4/bin/pgnuplot.exe");
              PrintWriter gp = new PrintWriter(p.getOutputStream());
              gp.print(gnuplot_cmd);
              gp.close();
    But the above doesn't work fully , in that only the blank wgnuplot terminal window pops up however I am unable to direct input to the gnuplot application.
    The reason being that , pgnuplot checks for
    its stdin being redirected the moment it's started. If, at that time,
    the "PrintWriter" is not yet connected to the OutputStream of the
    process, that check will fail, and pgnuplot will revert to just executing
    wgnuplot, without any command line redirection.
    I am facing a problem of how to attach a OutputStream to the process, without getting exec()ing the process.
    Is there anyway at all, i can get a process without starting it, so that I can attach an output Stream to it before it gets executed?
    I am open to work arounds, anything that will automate the process of writing to the gnuplot terminal.
    thanks!
    nandita.

    The reason being that , pgnuplot checks for
    its stdin being redirected the moment it's started.
    If, at that time,
    the "PrintWriter" is not yet connected to the
    OutputStream of the
    process, that check will fail, and pgnuplot will
    revert to just executing
    wgnuplot, without any command line redirection. I'm not convinced this analysis is correct. gnuplot doesn't need to know that there's a PrintWriter there, and it probably can't know. It just needs to know whether its standard input is coming from console or not. The Java library code that can invoke processes probably handles the redirect right away, and that's why there's the OutputStream available even before you create the PrintWriter.
    exec can be tricky. I think the problem may be that you're not dealing with standard output or standard error. Read this:
    When Runtime Exec Won't
    If that still doesn't help, there may be options to gnuplot to tell it exactly where its input is coming from.

  • Delivery date field has no data in the output

    Hii
    I have a program like this, when I try to execute it i found no data in the Delivery date colum. Can anyone correct the code.
    Thanks
    SP
    Global data declaration
    TYPE-POOLS: slis.
    TABLES: vbap, vbrk, vbfa, vbak, vbrp, konv, kna1, bkpf, bsad, bkpf_bsad,
    knvv, pa0002, t005u, mvke, lips, likp, vbpa.
    DATA: BEGIN OF i_list OCCURS 0,
          vbeln LIKE vbak-vbeln,
          posnr LIKE vbap-posnr,
          matnr LIKE vbap-matnr,
          erdat LIKE vbap-erdat,
          mvgr1 LIKE mvke-mvgr1,
          wadat_ist LIKE likp-wadat_ist,
          lfdat like likp-lfdat,
          days TYPE i,
          werks LIKE vbap-werks,
          lgort LIKE vbap-lgort,
          kwmeng LIKE vbap-kwmeng,"                                  CH01+
          lfimg  LIKE lips-lfimg,"                                   CH01+
          pstyv  LIKE vbap-pstyv,"                                   CH01+
          obd    LIKE lips-vbeln,"                                   CH01+
          obd_pos LIKE lips-posnr,"                                  CH01+
          soldto  LIKE vbaK-kunnr,"                                  JR+
          shipto  LIKE vbpa-kunnr,"                                  JR+
          END OF i_list.
    DATA: i_list2 LIKE i_list OCCURS 0 WITH HEADER LINE,
          i_list3 LIKE i_list OCCURS 0 WITH HEADER LINE.
    DATA: i_list4 LIKE vbap OCCURS 0 WITH HEADER LINE.
    *ALV Output Header
    DATA: gt_list_top_of_page TYPE slis_t_listheader,
          prognm     LIKE sy-repid,
          gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
          gt_events   TYPE slis_t_event,
          is_layout TYPE slis_layout_alv,
          is_variant LIKE disvariant,
          it_sort  TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    DATA:gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA:gt_outtab LIKE i_list OCCURS 0 WITH HEADER LINE.
    DATA:   g_repid LIKE sy-repid,
            g_count LIKE sy-tabix.
    SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME TITLE text-t01.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t10.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t11.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t12.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN END OF BLOCK block0.
    */ Selection and Input Parameters
    SELECTION-SCREEN BEGIN OF BLOCK blocko WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbap-vbeln, "SO
                    s_auart FOR vbak-auart DEFAULT 'KB' OBLIGATORY,
                    s_matnr FOR vbap-matnr," obligatory,
                    s_mvgr1 FOR mvke-mvgr1,
                    s_erdat FOR vbap-erdat OBLIGATORY,
                    s_werks FOR vbap-werks,
                    s_lgort FOR vbap-lgort.
    PARAMETERS:     p_vkorg LIKE vbak-vkorg DEFAULT '5010'.
    SELECTION-SCREEN SKIP 2.
    +EC1
    Addition                                                          +EC1
    +EC1
    PARAMETERS: p_vari LIKE disvariant-variant.
    +EC1
    End Addition                                                      +EC1
    +EC1
    SELECTION-SCREEN END OF BLOCK blocko.
    +EC1
    Addition                                                          +EC1
    +EC1
    DATA:   g_save(1) TYPE c,
           g_default(1) TYPE c,
            g_exit(1) TYPE c,
            gx_variant LIKE disvariant,
            g_variant LIKE disvariant.
    +EC1
    End Addition                                                      +EC1
    +EC1
    Initialization fieldcatalog
    INITIALIZATION.
    PERFORM clear_tables.
      g_repid = sy-repid.
      PERFORM fieldcat_init USING gt_fieldcat[].
    +EC1
    Addition                                                          +EC1
    +EC1
      g_save = 'A'.
      PERFORM variant_init.
    Get default variant
      gx_variant = g_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = g_save
           CHANGING
                cs_variant = gx_variant
           EXCEPTIONS
                not_found  = 2.
      IF sy-subrc = 0.
        p_vari = gx_variant-variant.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      PERFORM f4_for_variant.
    AT SELECTION-SCREEN.
      PERFORM auth_check.  "+ESC
      PERFORM pai_of_selection_screen.
    +EC1
    End Addition                                                      +EC1
    +EC1
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM alv.
    END-OF-SELECTION.
          FORM get_data                                                 *
    FORM get_data.
    *CH01 - Added kwmeng(order qty) to selection, excluded rejects
    *JR -added soldto and shipto code
      SELECT a~vbeln a~posnr a~matnr a~erdat a~werks a~lgort
             a~kwmeng a~pstyv b~kunnr"                               CH01+
      INTO
    (i_list-vbeln, i_list-posnr, i_list-matnr, i_list-erdat, i_list-werks,
    i_list-lgort,
    i_list-kwmeng , i_list-pstyv, i_list-soldto)"                   CH01+
      FROM vbap AS a INNER JOIN vbak AS b ON a~vbeln = b~vbeln
      WHERE b~vkorg = p_vkorg
      AND   a~werks IN s_werks
      AND   a~lgort IN s_lgort
      AND   b~auart IN s_auart
      AND   a~vbeln IN s_vbeln
      AND   a~erdat IN s_erdat
      AND   a~abgru = ''"                                            CH01+
      AND   a~matnr IN s_matnr.
        APPEND i_list.
      ENDSELECT.
      COMMIT WORK AND WAIT.
      LOOP AT i_list.
        SELECT SINGLE mvgr1 INTO i_list-mvgr1 FROM mvke
        WHERE matnr = i_list-matnr.
        MODIFY i_list.
        CLEAR: i_list.
      ENDLOOP.
      COMMIT WORK AND WAIT.
      LOOP AT i_list.
        IF i_list-mvgr1 IN s_mvgr1.
          CONTINUE.
        ELSE.
          DELETE i_list.
          COMMIT WORK AND WAIT.
        ENDIF.
    ENDLOOP.
    CH01 - commented these lines out and redid logic below
    LOOP AT i_list.
       select single vbeln into lips-vbeln from lips
       where vgbel = i_list-vbeln
       and   vgpos = i_list-posnr.
       select single wadat_ist into i_list-wadat_ist from likp
       where vbeln = lips-vbeln.
      SELECT single bwadat_ist blfdat INTO (i_list-wadat_ist,
    i_list-lfdat) FROM lips AS a INNER JOIN likp AS b ON avbeln = bvbeln
    WHERE avgbel = i_list-vbeln AND avgpos = i_list-posnr.
          MODIFY i_list.
          CLEAR: i_list, lips-vbeln.
       ENDSELECT.
      ENDLOOP.
    CH01 - Changed to select multiple delivery lines & del qty
    summing the total deliveries per OBD# and date
      LOOP AT i_list.
        SELECT avbeln   sum( alfimg ) b~wadat_ist
        INTO (i_list-obd , i_list-lfimg , i_list-wadat_ist)
        FROM lips AS a INNER JOIN
        likp AS b ON avbeln = bvbeln WHERE a~vgbel = i_list-vbeln
                                       AND   a~vgpos = i_list-posnr
                                       AND   a~pstyv = i_list-pstyv
          group by avbeln bwadat_ist.
          i_list2 = i_list.
          APPEND i_list2.
        ENDSELECT.
        IF sy-subrc <> 0.
          i_list2 = i_list.
          APPEND i_list2.
        ENDIF.
      ENDLOOP.
      i_list[] = i_list2[].
    *End CH01
      COMMIT WORK AND WAIT.
      LOOP AT i_list.
        IF  i_list-wadat_ist IS INITIAL.
          CONTINUE.
        ELSE.
          i_list-days = i_list-wadat_ist - i_list-erdat.
        ENDIF.
        MODIFY i_list.
        CLEAR: i_list.
        COMMIT WORK AND WAIT.
      ENDLOOP.
      COMMIT WORK AND WAIT.
      LOOP AT i_list.
        IF i_list-vbeln IS INITIAL.
          DELETE i_list.
        ENDIF.
      ENDLOOP.
      COMMIT WORK AND WAIT.
    *JR
      LOOP AT i_list.
        SELECT SINGLE KUNNR INTO i_list-shipto FROM vbpa
        WHERE vbeln = i_list-vbeln
         AND parvw = 'WE'.
        MODIFY i_list.
      ENDLOOP.
    *END JR
      gt_outtab[] = i_list[].
      COMMIT WORK AND WAIT.
    ENDFORM.
          FORM alv                                                      *
    FORM alv.
      PERFORM e03_eventtab_build USING gt_events[].             "+EC1
      PERFORM e04_comment_build  USING gt_list_top_of_page[].   "+EC1
      prognm = sy-repid.                                        "+EC1
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
               i_callback_user_command = 'USER_COMMAND'
               i_callback_program      = g_repid
               it_fieldcat             = gt_fieldcat[]
               it_events               = gt_events[]    "+ESC
               it_sort                 = it_sort[]
    +EC1
    Addition                                                          +EC1
    +EC1
               is_variant              = g_variant
               i_save                  = g_save
    +EC1
    End Addition                                                      +EC1
    +EC1
          TABLES
               t_outtab                = gt_outtab.
      COMMIT WORK AND WAIT.
    ENDFORM.
          FORM fieldcat_init                                            *
    -->  I_FIELDCAT                                                    *
    FORM fieldcat_init
          USING i_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      DATA: pos TYPE i VALUE 1.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELN'.
      ls_fieldcat-ref_tabname   = 'VBAK'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'POSNR'.
      ls_fieldcat-ref_tabname   = 'VBAP'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MATNR'.
      ls_fieldcat-ref_tabname   = 'VBAP'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MVGR1'.
      ls_fieldcat-ref_tabname   = 'MVKE'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WERKS'.
      ls_fieldcat-ref_tabname   = 'VBAP'.
    ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'LGORT'.
      ls_fieldcat-ref_tabname   = 'VBAP'.
    ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERDAT'.
      ls_fieldcat-ref_tabname   = 'VBAP'.
    ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WADAT_IST'.
      ls_fieldcat-ref_tabname   = 'LIKP'.
    ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos = pos.
      ls_fieldcat-fieldname = 'LFDAT'.
      ls_fieldcat-ref_tabname = 'LIKP'.
    ls_fieldcat-key = 'X'.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'DAYS'.
      ls_fieldcat-ref_fieldname = 'DAYS'.
      ls_fieldcat-seltext_s     = '# Of Days'.
      ls_fieldcat-seltext_m     = '# Of Days'.
      ls_fieldcat-seltext_l     = '# Of Days'.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
    *Begin CH01
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KWMENG'.
      ls_fieldcat-ref_tabname   = 'VBAP'.
      ls_fieldcat-outputlen     = 7.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'LFIMG'.
      ls_fieldcat-ref_tabname   = 'LIPS'.
      ls_fieldcat-outputlen     = 7.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'OBD'.
      ls_fieldcat-seltext_s     = 'OBD'.
      ls_fieldcat-seltext_m     = 'Outbound Del'.
      ls_fieldcat-seltext_l     = 'Outbound Delivery'.
      ls_fieldcat-outputlen     = 10.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
    ls_fieldcat-col_pos       =  pos.
    ls_fieldcat-fieldname     = 'OBD_POS'.
    ls_fieldcat-seltext_s     = 'OBD Ln'.
    ls_fieldcat-seltext_m     = 'Outbound Del Ln'.
    ls_fieldcat-seltext_l     = 'Outbound Del Line'.
    ls_fieldcat-outputlen     = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *End CH01
    *JR
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SOLDTO'.
      ls_fieldcat-ref_tabname   = 'VBAP'.
      ls_fieldcat-seltext_m     = 'Sold To'.
      ls_fieldcat-seltext_l     = 'Sold To'.
      ls_fieldcat-outputlen     = 10.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SHIPTO'.
      ls_fieldcat-ref_tabname   = 'VBPA'.
      ls_fieldcat-seltext_m     = 'Ship To'.
      ls_fieldcat-seltext_l     = 'Ship To'.
      ls_fieldcat-outputlen     = 10.
      APPEND ls_fieldcat TO i_fieldcat.
      CLEAR ls_fieldcat.
    *END JR
    *FOR ALV SORT & SUBTOTAL
      CLEAR it_sort.
      it_sort-spos = '0'.
      it_sort-fieldname = 'VBELN'.
      it_sort-tabname = 'GT_OUTTAB'.
      it_sort-up = 'X'.
    it_sort-subtot = 'X'.
      APPEND it_sort.
      CLEAR it_sort.
      it_sort-spos = '1'.
      it_sort-fieldname = 'POSNR'.
      it_sort-tabname = 'GT_OUTTAB'.
      it_sort-up = 'X'.
      it_sort-subtot = 'X'.
    it_sort-subtot = 'X'.
      APPEND it_sort.
      CLEAR it_sort.
      it_sort-spos = '2'.
      it_sort-fieldname = 'MATNR'.
      it_sort-tabname = 'GT_OUTTAB'.
      it_sort-up = 'X'.
    it_sort-subtot = 'X'.
      APPEND it_sort.
      CLEAR it_sort.
      it_sort-spos = '3'.
      it_sort-fieldname = 'MVGR1'.
      it_sort-tabname = 'GT_OUTTAB'.
      it_sort-up = 'X'.
    it_sort-subtot = 'X'.
      APPEND it_sort.
      CLEAR it_sort.
      it_sort-spos = '4'.
      it_sort-fieldname = 'ERDAT'.
      it_sort-tabname = 'GT_OUTTAB'.
      it_sort-up = 'X'.
    it_sort-subtot = 'X'.
      APPEND it_sort.
      CLEAR it_sort.
      it_sort-spos = '5'.
      it_sort-fieldname = 'WADAT_IST'.
      it_sort-tabname = 'GT_OUTTAB'.
      it_sort-down = 'X'.
    it_sort-subtot = 'X'.
      APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '6'.
    it_sort-fieldname = 'PERNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '7'.
    it_sort-fieldname = 'VORNA'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '8'.
    it_sort-fieldname = 'NACHN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '9'.
    it_sort-fieldname = 'VKGRP'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '10'.
    it_sort-fieldname = 'VBELN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '11'.
    it_sort-fieldname = 'ERDAT'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '12'.
    it_sort-fieldname = 'BEZEI'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    clear it_sort.
    it_sort-spos = '1'.
    it_sort-fieldname = 'BELNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    append it_sort.
    ENDFORM.
    +EC1
    Addition                                                          +EC1
    +EC1
    *&      Form  VARIANT_INIT
          text
    -->  p1        text
    <--  p2        text
    FORM variant_init.
      CLEAR g_variant.
      g_variant-report = g_repid.
    ENDFORM.                               " VARIANT_INIT
          FORM f4_for_variant                                           *
    FORM f4_for_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant          = g_variant
                i_save              = g_save
              it_default_fieldcat =
           IMPORTING
                e_exit              = g_exit
                es_variant          = gx_variant
           EXCEPTIONS
                not_found = 2.
      IF sy-subrc = 2.
        MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF g_exit = space.
          p_vari = gx_variant-variant.
        ENDIF.
      ENDIF.
    ENDFORM.
    *&      Form  PAI_OF_SELECTION_SCREEN
          text
    FORM pai_of_selection_screen.
      IF NOT p_vari IS INITIAL.
        MOVE g_variant TO gx_variant.
        MOVE p_vari TO gx_variant-variant.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
             EXPORTING
                  i_save     = g_save
             CHANGING
                  cs_variant = gx_variant.
        g_variant = gx_variant.
      ELSE.
        PERFORM variant_init.
      ENDIF.
    ENDFORM.                               " PAI_OF_SELECTION_SCREEN
    +EC1
    End Addition                                                      +EC1
    +EC1
          FORM e03_eventtab_build                                       *
    -->  E03_LT_EVENTS                                                 *
    FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type = 0
           IMPORTING
                et_events   = e03_lt_events.
      READ TABLE e03_lt_events WITH KEY name =  slis_ev_top_of_page
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE gc_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO e03_lt_events.
      ENDIF.
    ENDFORM.
          FORM e04_comment_build                                        *
    -->  E04_LT_TOP_OF_PAGE                                            *
    FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader.
      DATA: ls_line TYPE slis_listheader.
    *Report Title
      CLEAR ls_line.
      ls_line-typ  = 'H'.
      ls_line-info = text-007.
      APPEND ls_line TO e04_lt_top_of_page.
    **Doc Type Desc.
    clear ls_line.
    ls_line-typ  = 'S'.
    ls_line-key = text-008.
    ls_line-info = p_matnr.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ  = 'S'.
    ls_line-key  = text-009.
    ls_line-info = p_werks.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ  = 'S'.
    ls_line-key = text-010.
    ls_line-info = p_stlan.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ  = 'S'.
    ls_line-key = text-011.
    ls_line-info = p_stlal.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ  = 'S'.
    ls_line-key = text-012.
    ls_line-info = p_stlal.
    append ls_line to e04_lt_top_of_page.
    ENDFORM.
          FORM top_of_page                                              *
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = gt_list_top_of_page.
    ENDFORM.
          FORM auth_check                                               *
    FORM auth_check.
      AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
                      ID 'VKORG' FIELD p_vkorg.
      IF sy-subrc NE 0.
        MESSAGE e054 WITH p_vkorg.
      ENDIF.
    ENDFORM.                    " auth_check
    *&      Form  USER_COMMAND
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
          PERFORM display_so_order USING r_ucomm
                                        rs_selfield.
      ENDCASE.
    ENDFORM.
    *&      Form  display_sales_order
          text
         -->P_R_UCOMM  text
         -->P_RS_SELFIELD  text
    FORM display_so_order USING    r_ucomm LIKE sy-ucomm
                                             rs_selfield TYPE slis_selfield.
      CASE rs_selfield-sel_tab_field.
        WHEN '1-VBELN'.
          SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
        WHEN '1-MATNR'.
          SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
          CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
        WHEN '1-OBD'.
          SET PARAMETER ID 'VL' FIELD rs_selfield-value.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        WHEN OTHERS.
          MESSAGE i000(z1) WITH 'Please Click on the Valid Selection'.
          EXIT.
      ENDCASE.
    ENDFORM.                    " display_sales_order
          FORM EDit_table                                               *

    Hi,
      Try this..I commented the continue statement and I didn't change the SQL to add the LFDAT..If I change the SQL the calculations might change..
      CHeck this..Changes are marked in bold..
    Global data declaration
    TYPE-POOLS: slis.
    TABLES: vbap, vbrk, vbfa, vbak, vbrp, konv, kna1, bkpf, bsad, bkpf_bsad,
    knvv, pa0002, t005u, mvke, lips, likp, vbpa.
    DATA: BEGIN OF i_list OCCURS 0,
    vbeln LIKE vbak-vbeln,
    posnr LIKE vbap-posnr,
    matnr LIKE vbap-matnr,
    erdat LIKE vbap-erdat,
    mvgr1 LIKE mvke-mvgr1,
    wadat_ist LIKE likp-wadat_ist,
    lfdat like likp-lfdat,
    days TYPE i,
    werks LIKE vbap-werks,
    lgort LIKE vbap-lgort,
    kwmeng LIKE vbap-kwmeng," CH01+
    lfimg LIKE lips-lfimg," CH01+
    pstyv LIKE vbap-pstyv," CH01+
    obd LIKE lips-vbeln," CH01+
    obd_pos LIKE lips-posnr," CH01+
    soldto LIKE vbaK-kunnr," JR+
    shipto LIKE vbpa-kunnr," JR+
    END OF i_list.
    DATA: i_list2 LIKE i_list OCCURS 0 WITH HEADER LINE,
    i_list3 LIKE i_list OCCURS 0 WITH HEADER LINE.
    DATA: i_list4 LIKE vbap OCCURS 0 WITH HEADER LINE.
    *ALV Output Header
    DATA: gt_list_top_of_page TYPE slis_t_listheader,
    prognm LIKE sy-repid,
    gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
    gt_events TYPE slis_t_event,
    is_layout TYPE slis_layout_alv,
    is_variant LIKE disvariant,
    it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    DATA:gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA:gt_outtab LIKE i_list OCCURS 0 WITH HEADER LINE.
    DATA: g_repid LIKE sy-repid,
    g_count LIKE sy-tabix.
    SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME TITLE text-t01.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t10.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t11.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t12.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN END OF BLOCK block0.
    */ Selection and Input Parameters
    SELECTION-SCREEN BEGIN OF BLOCK blocko WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbap-vbeln, "SO
    s_auart FOR vbak-auart DEFAULT 'KB' OBLIGATORY,
    s_matnr FOR vbap-matnr," obligatory,
    s_mvgr1 FOR mvke-mvgr1,
    s_erdat FOR vbap-erdat OBLIGATORY,
    s_werks FOR vbap-werks,
    s_lgort FOR vbap-lgort.
    PARAMETERS: p_vkorg LIKE vbak-vkorg DEFAULT '5010'.
    SELECTION-SCREEN SKIP 2.
    +EC1
    Addition +EC1
    +EC1
    PARAMETERS: p_vari LIKE disvariant-variant.
    +EC1
    End Addition +EC1
    +EC1
    SELECTION-SCREEN END OF BLOCK blocko.
    +EC1
    Addition +EC1
    +EC1
    DATA: g_save(1) TYPE c,
    g_default(1) TYPE c,
    g_exit(1) TYPE c,
    gx_variant LIKE disvariant,
    g_variant LIKE disvariant.
    +EC1
    End Addition +EC1
    +EC1
    Initialization fieldcatalog
    INITIALIZATION.
    PERFORM clear_tables.
    g_repid = sy-repid.
    PERFORM fieldcat_init USING gt_fieldcat[].
    +EC1
    Addition +EC1
    +EC1
    g_save = 'A'.
    PERFORM variant_init.
    Get default variant
    gx_variant = g_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save = g_save
    CHANGING
    cs_variant = gx_variant
    EXCEPTIONS
    not_found = 2.
    IF sy-subrc = 0.
    p_vari = gx_variant-variant.
    ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    AT SELECTION-SCREEN.
    PERFORM auth_check. "+ESC
    PERFORM pai_of_selection_screen.
    +EC1
    End Addition +EC1
    +EC1
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM alv.
    END-OF-SELECTION.
    FORM get_data *
    FORM get_data.
    *CH01 - Added kwmeng(order qty) to selection, excluded rejects
    *JR -added soldto and shipto code
    SELECT a~vbeln a~posnr a~matnr a~erdat a~werks a~lgort
    a~kwmeng a~pstyv b~kunnr" CH01+
    INTO
    (i_list-vbeln, i_list-posnr, i_list-matnr, i_list-erdat, i_list-werks,
    i_list-lgort,
    i_list-kwmeng , i_list-pstyv, i_list-soldto)" CH01+
    FROM vbap AS a INNER JOIN vbak AS b ON a~vbeln = b~vbeln
    WHERE b~vkorg = p_vkorg
    AND a~werks IN s_werks
    AND a~lgort IN s_lgort
    AND b~auart IN s_auart
    AND a~vbeln IN s_vbeln
    AND a~erdat IN s_erdat
    AND a~abgru = ''" CH01+
    AND a~matnr IN s_matnr.
    APPEND i_list.
    ENDSELECT.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    SELECT SINGLE mvgr1 INTO i_list-mvgr1 FROM mvke
    WHERE matnr = i_list-matnr.
    MODIFY i_list.
    CLEAR: i_list.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-mvgr1 IN s_mvgr1.
    <b>* CONTINUE</b>
    ELSE.
    DELETE i_list.
    COMMIT WORK AND WAIT.
    ENDIF.
    ENDLOOP.
    CH01 - commented these lines out and redid logic below
    LOOP AT i_list.
    select single vbeln into lips-vbeln from lips
    where vgbel = i_list-vbeln
    and vgpos = i_list-posnr.
    select single wadat_ist into i_list-wadat_ist from likp
    where vbeln = lips-vbeln.
    SELECT single bwadat_ist blfdat INTO (i_list-wadat_ist,
    i_list-lfdat) FROM lips AS a INNER JOIN likp AS b ON avbeln = bvbeln
    WHERE avgbel = i_list-vbeln AND avgpos = i_list-posnr.
    MODIFY i_list.
    CLEAR: i_list, lips-vbeln.
    ENDSELECT.
    ENDLOOP.
    CH01 - Changed to select multiple delivery lines & del qty
    summing the total deliveries per OBD# and date
    LOOP AT i_list.
    SELECT avbeln sum( alfimg ) b~wadat_ist
    INTO (i_list-obd , i_list-lfimg , i_list-wadat_ist)
    FROM lips AS a INNER JOIN
    likp AS b ON avbeln = bvbeln WHERE a~vgbel = i_list-vbeln
    AND a~vgpos = i_list-posnr
    AND a~pstyv = i_list-pstyv
    group by avbeln bwadat_ist.
    i_list2 = i_list.
    APPEND i_list2.
    ENDSELECT.
    IF sy-subrc <> 0.
    i_list2 = i_list.
    APPEND i_list2.
    ENDIF.
    ENDLOOP.
    i_list[] = i_list2[].
    *End CH01
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-wadat_ist IS INITIAL.
    CONTINUE.
    ELSE.
    i_list-days = i_list-wadat_ist - i_list-erdat.
    ENDIF.
    MODIFY i_list.
    CLEAR: i_list.
    COMMIT WORK AND WAIT.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-vbeln IS INITIAL.
    DELETE i_list.
    ENDIF.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    *JR
    LOOP AT i_list.
    SELECT SINGLE KUNNR INTO i_list-shipto FROM vbpa
    WHERE vbeln = i_list-vbeln
    AND parvw = 'WE'.
    MODIFY i_list.
    ENDLOOP.
    *END JR
    gt_outtab[] = i_list[].
    COMMIT WORK AND WAIT.
    ENDFORM.
    FORM alv *
    FORM alv.
    PERFORM e03_eventtab_build USING gt_events[]. "+EC1
    PERFORM e04_comment_build USING gt_list_top_of_page[]. "+EC1
    prognm = sy-repid. "+EC1
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_user_command = 'USER_COMMAND'
    i_callback_program = g_repid
    it_fieldcat = gt_fieldcat[]
    it_events = gt_events[] "+ESC
    it_sort = it_sort[]
    +EC1
    Addition +EC1
    +EC1
    is_variant = g_variant
    i_save = g_save
    +EC1
    End Addition +EC1
    +EC1
    TABLES
    t_outtab = gt_outtab.
    COMMIT WORK AND WAIT.
    ENDFORM.
    FORM fieldcat_init *
    --> I_FIELDCAT *
    FORM fieldcat_init
    USING i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: ls_fieldcat TYPE slis_fieldcat_alv.
    DATA: pos TYPE i VALUE 1.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'VBELN'.
    ls_fieldcat-ref_tabname = 'VBAK'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'POSNR'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'MATNR'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'MVGR1'.
    ls_fieldcat-ref_tabname = 'MVKE'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'WERKS'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'LGORT'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'ERDAT'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'WADAT_IST'.
    ls_fieldcat-ref_tabname = 'LIKP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'LFDAT'.
    ls_fieldcat-ref_tabname = 'LIKP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'DAYS'.
    ls_fieldcat-ref_fieldname = 'DAYS'.
    ls_fieldcat-seltext_s = '# Of Days'.
    ls_fieldcat-seltext_m = '# Of Days'.
    ls_fieldcat-seltext_l = '# Of Days'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *Begin CH01
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'KWMENG'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-outputlen = 7.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'LFIMG'.
    ls_fieldcat-ref_tabname = 'LIPS'.
    ls_fieldcat-outputlen = 7.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'OBD'.
    ls_fieldcat-seltext_s = 'OBD'.
    ls_fieldcat-seltext_m = 'Outbound Del'.
    ls_fieldcat-seltext_l = 'Outbound Delivery'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'OBD_POS'.
    ls_fieldcat-seltext_s = 'OBD Ln'.
    ls_fieldcat-seltext_m = 'Outbound Del Ln'.
    ls_fieldcat-seltext_l = 'Outbound Del Line'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *End CH01
    *JR
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'SOLDTO'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-seltext_m = 'Sold To'.
    ls_fieldcat-seltext_l = 'Sold To'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'SHIPTO'.
    ls_fieldcat-ref_tabname = 'VBPA'.
    ls_fieldcat-seltext_m = 'Ship To'.
    ls_fieldcat-seltext_l = 'Ship To'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *END JR
    *FOR ALV SORT & SUBTOTAL
    CLEAR it_sort.
    it_sort-spos = '0'.
    it_sort-fieldname = 'VBELN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '1'.
    it_sort-fieldname = 'POSNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '2'.
    it_sort-fieldname = 'MATNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '3'.
    it_sort-fieldname = 'MVGR1'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '4'.
    it_sort-fieldname = 'ERDAT'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '5'.
    it_sort-fieldname = 'WADAT_IST'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-down = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '6'.
    it_sort-fieldname = 'PERNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '7'.
    it_sort-fieldname = 'VORNA'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '8'.
    it_sort-fieldname = 'NACHN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '9'.
    it_sort-fieldname = 'VKGRP'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '10'.
    it_sort-fieldname = 'VBELN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '11'.
    it_sort-fieldname = 'ERDAT'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '12'.
    it_sort-fieldname = 'BEZEI'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    clear it_sort.
    it_sort-spos = '1'.
    it_sort-fieldname = 'BELNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    append it_sort.
    ENDFORM.
    +EC1
    Addition +EC1
    +EC1
    *& Form VARIANT_INIT
    text
    --> p1 text
    <-- p2 text
    FORM variant_init.
    CLEAR g_variant.
    g_variant-report = g_repid.
    ENDFORM. " VARIANT_INIT
    FORM f4_for_variant *
    FORM f4_for_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
    is_variant = g_variant
    i_save = g_save
    it_default_fieldcat =
    IMPORTING
    e_exit = g_exit
    es_variant = gx_variant
    EXCEPTIONS
    not_found = 2.
    IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    IF g_exit = space.
    p_vari = gx_variant-variant.
    ENDIF.
    ENDIF.
    ENDFORM.
    *& Form PAI_OF_SELECTION_SCREEN
    text
    FORM pai_of_selection_screen.
    IF NOT p_vari IS INITIAL.
    MOVE g_variant TO gx_variant.
    MOVE p_vari TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    EXPORTING
    i_save = g_save
    CHANGING
    cs_variant = gx_variant.
    g_variant = gx_variant.
    ELSE.
    PERFORM variant_init.
    ENDIF.
    ENDFORM. " PAI_OF_SELECTION_SCREEN
    +EC1
    End Addition +EC1
    +EC1
    FORM e03_eventtab_build *
    --> E03_LT_EVENTS *
    FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
    DATA: ls_event TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    i_list_type = 0
    IMPORTING
    et_events = e03_lt_events.
    READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page
    INTO ls_event.
    IF sy-subrc = 0.
    MOVE gc_formname_top_of_page TO ls_event-form.
    APPEND ls_event TO e03_lt_events.
    ENDIF.
    ENDFORM.
    FORM e04_comment_build *
    --> E04_LT_TOP_OF_PAGE *
    FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader.
    DATA: ls_line TYPE slis_listheader.
    *Report Title
    CLEAR ls_line.
    ls_line-typ = 'H'.
    ls_line-info = text-007.
    APPEND ls_line TO e04_lt_top_of_page.
    **Doc Type Desc.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-008.
    ls_line-info = p_matnr.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-009.
    ls_line-info = p_werks.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-010.
    ls_line-info = p_stlan.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-011.
    ls_line-info = p_stlal.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-012.
    ls_line-info = p_stlal.
    append ls_line to e04_lt_top_of_page.
    ENDFORM.
    FORM top_of_page *
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = gt_list_top_of_page.
    ENDFORM.
    FORM auth_check *
    FORM auth_check.
    AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
    ID 'VKORG' FIELD p_vkorg.
    IF sy-subrc NE 0.
    *MESSAGE e054 WITH p_vkorg.
    ENDIF.
    ENDFORM. " auth_check
    *& Form USER_COMMAND
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE r_ucomm.
    WHEN '&IC1'.
    PERFORM display_so_order USING r_ucomm
    rs_selfield.
    ENDCASE.
    ENDFORM.
    *& Form display_sales_order
    text
    -->P_R_UCOMM text
    -->P_RS_SELFIELD text
    FORM display_so_order USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE rs_selfield-sel_tab_field.
    WHEN '1-VBELN'.
    SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    WHEN '1-MATNR'.
    SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    WHEN '1-OBD'.
    SET PARAMETER ID 'VL' FIELD rs_selfield-value.
    CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    WHEN OTHERS.
    MESSAGE i000(z1) WITH 'Please Click on the Valid Selection'.
    EXIT.
    ENDCASE.
    ENDFORM. " display_sales_order
    FORM EDit_table *
    Thanks,
    Naren

Maybe you are looking for