Please provide the abap code for this requirement

note : if the below mentioned user exit is not suitable please find the suitable user exit and provide the code for this requirement.
•     The User-exit MEFLD004 is only to be used at PO level (ME21N/ME22N).
•     When PO is create or changed (ekko-ebeln) user exit MEFLD004 is triggered which check for the business requirement of the PO check for PO doc types (ekko-bsart) :z4,z6,z11,z12 from the table ekko and Account Assignment Category (knttp) is either N or K then stock process follows.  
•     When an PO is cancelled, all entries will have to be reversed
•     The Buffer table for the PO will have the following fields:
Purchase order Number                     EKKO-EBELN
Line item number of the PO               EKPO-EBELP
Vendor Number                                  EKKO-LIFNR
PO Quantity                                        EKPO-MENGE
PO Nett Price                                     EKPO-NETPR
Base Unit of Measure                  EKPO-LMEIN
Account Assignment Category          EKPO-KNTTP
PO Doc type                       EKPO-BSART     
Plant                            EKPO-WERKS     
Purchase Org                                  EKKO-EKORG
Purchase Group                    EKKO-EKGRP     
Company code                                EKPO-WAERS
Item category                     EKPO-PSTYP
PO Doc Date                      EKKO-BEDAT
•     No duplications are allowed for any created, changed or cancelled purchase orders. If such a case occurs, the record will be updated with the latest update time stamp. This custom table will be keyed by purchase order number.

Cross-post: http://forum.java.sun.com/thread.jspa?threadID=763485

Similar Messages

  • Please provide the abap code for below requirement

    note: if the user exit is not suitable please provide the suitable user exit and code
    1   Business requirement
          In order to update the postings and tracking on Buffer Account postings the User Exists need to be modified and extended where possible in order to trace the Buffer postings in applicable MM and FI reports , i.e. at PO level, GR level and IR level.
    The User-exit used in the document is only for transactions at Invoice Verification level (MIRO).
    Therefore when an Invoice is created and the requirements for Buffer Account postings are met, i.e. relevant doc types and AAC, a table for Buffer Account entries and a subsequent report is required in order to trail the various Buffer entries and postings.
    The User Exit : LMR1M003.
    The Component is  EXIT_SAPLMRMP_003 . 
    The user-exit (LMR1M003) gets triggered when an Invoice is created or changed (MIRO). When an Invoice is cancelled, all entries will have to be reversed.
    The code in this user-exit will identify the invoice number (bkpf-belnr)  that has been created or changed and thus post entries in the applicable buffer accounts for this purpose.
    2.0   Buffer Table
    The Buffer Account table for the Invoice will have the following fields
    Field      DataElement      Data Type     Description                              Saptable     
    mandt     mandt          clnt          client                         key     init     bkpf
    bukrs     bukrs          char          companycode                    key     init     bkpf
    belnr     belnr_d     char          accountdocumentno               key     init     bkpf
    gjahr     gjahr          numc          fiscalyear                    key     init     bkpf
    kostl     kostl          char          cost center                    key     init     csks     
    ebeln     ebeln          char          purchasing document number     key     init     ekko     
    blart     blart          char          document type                         bkpf
    bldat     bldat          dats          document date in document                    bkpf     
    budat     budat          dats          posting date in document                    bkpf
    xblnr     xblnr1          char          reference document number                    bkpf
    bstat     bstat_d     char          Document Status                         bkpf
    xstov     xstov          char          indicator: document is flagged for reversal          bkpf
    xmwst     xmwst          char          calculate tax automatically                    bkpf
    reindat     reindat          dats          invoice receipt date                         bkpf
    werks     werks_d     char          plant                                    csks
    wrbtr     wrbtr          curr          amount in document currency               bseg     
    bsart     esart          char          po doc type                              ekko     
    ebelp     ebelp          numc          item number of purchasing document          bseg     
    nplnr     nplnr          char          network number for account assignment          bseg     
    knttp     knttp          char          account assignment category                    ekpo
    3.0   Detail Design
    3.1   Invoice Details
    •     The User-exit LMR1M003 is only to be used at Invoice level (MIRO).
    •     The user-exit (LMR1M001) gets triggered when an Invoice is created or changed (MIRO) .the field name bkpf-belnr is fetched from the table bkpf and checked whether document created or changed and triggers the user exit LMR!M003 .
    •     When an Invoice is cancelled, all entries will have to be reversed this is done by checking the value of flag indicator  bkpf-xstov fetched from the table bkpf .
    •     The code in this user-exit will identify the invoice number that has been created or changed and thus post entries in the applicable buffer accounts for this purpose.

    Cross-post: http://forum.java.sun.com/thread.jspa?threadID=763485

  • TS1559 I bought my iphone 4s in usa apple store but when i write my serial number to support center i see warning like that. What is the problem ? Our records indicate that this product has been replaced. Please provide the serial number for your replacem

    I bought my iphone 4s in usa apple store
    ihave trouble with my iphone wifi that is gray and cannot connect any wifi network.
    i want to support for this issue.
    but when i write my serial number to support center i see warning like that. What is the problem ?
    Our records indicate that this product has been replaced. Please provide the serial number for your replacement product to find the support and warranty coverage information. For more information, please contact us.

    Nobody here would know.  Contact Apple and ask them

  • HT201412 my iphone using cant buy anything from itune store and they said i have trouble from the product (Our records indicate that this product has been replaced. Please provide the serial number for your replacement product to find the support and warr

    Our records indicate that this product has been replaced. Please provide the serial number for your replacement product to find the support and warranty coverage information. For more information, please ( this is the trouble they tell us )
    can't buy anything application on appstore, i bought this iphone from my friend , and this iphone actived ( 2012-11-05)
    IMEI: ****
    <Edited By Host>

    Instead of posting your IMEI in a public forum, contact iTunes Customer Support.
    FYI, they do not want/need your IMEI number.

  • Our records indicate that this product has been replaced. Please provide the serial number for your replacement product to find the support and warranty coverage information. For more information, please contact us.

    Hi,
    i have purchased iphone 4s 16GB in india yesterday and when i m checking warranty status of my phone from https://selfsolve.apple.com/agreementWarrantyDynamic.do
    i got responce
    Our records indicate that this product has been replaced. Please provide the serial number for your replacement product to find the support and warranty coverage information. For more information, please contact us.
    Please help

    hi
    if it is from gray market is there any harm on that please let me know
    my phone is working fine and even when i connected to itunes it got registered with my id,

  • Our records indicate that this product has been replaced. Please provide the serial number for your replacement product to find the support and warranty coverage information. For more information, please contact us." how does this possible..???

    I have a horrible time with my new Iphone-4, No SIM card found issues and while i tried to contact customer care with device serial number getting a messgae of "Our records indicate that this product has been replaced. Please provide the serial number for your replacement product to find the support and warranty coverage information. For more information, please contact us."
    What step should i take next.

    Where did you get the phone?
    That phone was replaced by Apple or an AASP and was not returned to Apple as it should have been, or it was stolen from Apple or somewhere in the supply chain.
    You can not get support from Apple for that phone.
    Return it to wherever you got it and get your money back.

  • Our records indicate that this product has been replaced. Please provide the serial number for your replacement product to find the support and warranty coverage information. For more information, please

    Our records indicate that this product has been replaced. Please provide the serial number for your replacement product to find the support and warranty coverage information.

    hi
    if it is from gray market is there any harm on that please let me know
    my phone is working fine and even when i connected to itunes it got registered with my id,

  • WHY? 3 out of 4 of my vimeo videos coming up with 'oops the embed code for this video isn't valid'!

    I have inserted my showreel, its working fine, but now I have tried to embed 3 others videos, they all come up with 'oops the embed code for this video isn't working'
    I really don't understand why?
    Holly

    Hello,
    How are you trying to preview the page ? "Preview"tab in Muse or Preview Page in Browser.
    Do you have any URL for us to see ? Please share the codes that you are using to embed the video.
    Regards
    Vivek

  • Please provide the patch set for Oracle Enterprise Manager Grid Control 10

    Hi,
    please provide the patch set for Oracle Enterprise Manager Grid Control 10.2.0.1 and 10.2.0.5 for AIX 5.3
    patch set for Oracle Enterprise Manager Grid Control for 11.2.0.2 OS AIX 5.3
    Thanks,
    Vishal Hande.

    user12009184 wrote:
    Hi,
    please provide the patch set for Oracle Enterprise Manager Grid Control 10.2.0.1 and 10.2.0.5 for AIX 5.3
    patch set for Oracle Enterprise Manager Grid Control for 11.2.0.2 OS AIX 5.3
    Thanks,
    Vishal Hande.you must obtain all patches directly from
    http://support.oracle.com

  • Provide the java code for the following scenario.

    Hi Experts,
    I have tried with all the combinations for this scenario. As per my understanding i require java code for the following scenario
    so that it becomes easy........
    I require a Message mapping for this Logic.
    In the Source there are 4 fields and, the Target side, the fields should appear like this.
    Source Structure- File
    Record
    |-> Header
    Order_No
    Date
    |-> Item
    Mat_No
    Quantity
    Target Structure-IDoc
    IDoc
    |-> Header
    |-> Segment
    Delivery_Order_No
    Recv_Date
    |-> Item
    |-> Segment
    Delivery_Order_No
    Material_Num
    Recv_Quantity.
    The Logic is for every Order number an IDOC is generated.And if the Material num matches then the quantity should be added. and important note is that the material numbers are different for every order number. That means if a material number is 2 in the order number A. Then the material number can never be 2 in any of the order numbers.Here is the following with an example for the above scenario.
    For example:-
    we have
    Source Structure- File
    Order-no Date Mat_No Quantity
    1 01/02/2011 A 10
    1 01/02/2011 B 15
    1 01/02/2011 A 10
    2 01/02/2011 C 10
    2 01/02/2011 C 10
    3 01/02/2011 D 20
    3 01/02/2011 D 10
    3 01/02/2011 E 25
    Target Structure-IDoc
    Delivery_Order_No Recv_Date Material_Num Recv_Quantity
    1 01/02/2011 A 20
    1 01/02/2011 B 15
    2 01/02/2011 C 20
    3 01/02/2011 D 30
    3 01/02/2011 E 25
    So for this example total of 5-Idocs created. That means for this example if Order_No is 1 When the Mat_No is A the quantity gets added. For this Scenario 1 IDoc with four Fields 2 in Header(Delivery_Order_No, Recv_Date) and 2 in Item(Material_Num, Recv_Quantity) is generated by adding the quantity field in the Target Side. Similarly if Order_No is 1 when the Mat_No is B then separate IDoc is generated with four Fields 2 in Header(Delivery_Order_No, Recv_Date) and 2 in Item(Material_Num, Recv_Quantity) in the Target Side. Similarly, if Order_No is 2 when the Mat_No is C, an IDoc is generated with four Fields 2 in Header(Delivery_Order_No, Recv_Date) and 2 in Item(Material_Num, Recv_Quantity) by adding the quantity field in the Target Side. ike wise the process goes on upto 3.Kindly do the needy..
    Kindly provide the java code.
    Thanq very much in advance..

    what i have understood from ur example is that u want to generate an idoc for unique combination of  Order-no and Mat_No
    if yes then chk the below mapping..
    change the context of Order_No, Date, Mat_No and Quantity to Record (right click-> context)
    1)
    Order-no
    ----------------------concat[;]---sort----splitbyvalue(valuechanged)-----collapse context---IDoc
    Mat_No
    2)
    Order-no
    --------concat[;]---sort----splitbyvalue(value changed)---collapse context---UDF1--splitbyvalue(each value)--Delivery_Order_No
    Mat_No
    3)
    Order-no
    -----------concat[;]---sortbykey----------------------- \
    Mat_No                       /                            \
    Date--------------- /                                       \
    ----------------------------------------------------------FormatByExample-----collapsecontext---splitbyvalue(each value)----Recv_Date
    Order-no                                                 /
    -----------concat[;]---sort----splitbyvalue(value changed)
    Mat_No
    4)
    Order-no
    --------concat[;]---sort----splitbyvalue(value changed)---collapse context-UDF2--splitbyvalue(each value)--Material_Num
    Mat_No
    5)
    Order-no
    -----------concat[;]---sortbykey
    Mat_No                       /
    Quantity --------------- /
    ----------------------------------------------------------FormatByExample-----SUM(under statistic)----Recv_Quantity
    Order-no
    -----------concat[;]---sort----splitbyvalue(value changed)
    Mat_No
    UDF1:
    String [] temp= a.split(";");
    return temp[0];
    UDF2:
    String [] temp= a.split(";");
    return temp[1];

  • Please provide the sql query on mentioned requirement in attached image.

    Please provide query for this requirement
    1.This is my main table  data.
    FACTID DATE_DMN_KEY
    WQTY ROWID
    AVG_7_AMT
    1 100   
    1000 1
    NULL
    1 200 2000
    2 NULL
    1 300 3000
    3 NULL
    1 400 4000
    4 NULL
    1 500 5000
    5 NULL
    1 600 6000
    6 NULL
    1 700 7000
    7 NULL
    1 800 8000
    8 NULL
    1 900 9000
    9 NULL
    1 1000
    10000 10
    NULL
    2.  column rowid =10 is the latest record and COLUMN AVG_7_AMT value should be update as below
        Sum (WQTY=10000+9000+8000+7000+6000+5000+4000)/7
    3.FOR  column rowid =9 record and COLUMN AVG_7_AMT value should be update as below
       Sum (WQTY=9000+8000+7000+6000+5000+4000+3000)/7
    4. FOR  column rowid =8 record and COLUMN AVG_7_AMT value should be update as below
       Sum (WQTY=8000+7000+6000+5000+4000+3000+2000)/7
    5. . FOR  column rowid =7 record and COLUMN AVG_7_AMT value should be update as below
       Sum (WQTY=7000+6000+5000+4000+3000+2000+1000)/7
    6.  FOR  column rowid =6 record and COLUMN AVG_7_AMT value should be update as below
       Sum (WQTY=6000+5000+4000+3000+2000+1000)/6
    7. FOR  column rowid =5 record and COLUMN AVG_7_AMT value should be update as below
       Sum (WQTY=5000+4000+3000+2000+1000)/5
    How we can write sql  query for this type of requirement.

    Query is working but partially..
    if you insert  below records in same fact table then it wont work because factId=1 and factid 2 are different transaction .. how 
    Insert into fact Values
    (2, 100, 1000,   NULL),
    (2, 200, 2000,  NULL),
    (2, 300, 3000,  NULL),
    (2 ,400, 4000,  NULL),
    (2, 500 ,5000,  NULL),
    (2, 600, 6000,  NULL),
    (2, 700, 7000 , NULL),
    (2, 800, 8000,  NULL),
    (2, 900, 9000,  NULL),
    (2, 1000,  10000,   NULL )
    then result should like below.
    FACTID
    DATE_DMN_KEY
    WQTY
    ROWID
    AVG_7_AMT
    1
    100
    1000
    1
    1000
    1
    200
    2000
    2
    3000
    1
    300
    3000
    3
    6000
    1
    400
    4000
    4
    10000
    1
    500
    5000
    5
    15000
    1
    600
    6000
    6
    21000
    1
    700
    7000
    7
    28000
    1
    800
    8000
    8
    35000
    1
    900
    9000
    9
    42000
    1
    1000
    10000
    10
    49000
    2
    100
    1000
    1
    1000
    2
    200
    2000
    2
    3000
    2
    300
    3000
    3
    6000
    2
    400
    4000
    4
    10000
    2
    500
    5000
    5
    15000
    2
    600
    6000
    6
    21000
    2
    700
    7000
    7
    28000
    2
    800
    8000
    8
    35000
    2
    900
    9000
    9
    42000
    2
    1000
    10000
    10
    49000

  • How to display the source code for this friggin' file.

    Below is a rather lengthy bit of code that provides the behavior and attributes of a web server for OpenCyc. I need to know if I can enter some java to have the HTML source code displayed in a separate text file whenever this class returns some resulting webpage. If you have any ideas it will be greatly appreciated.
    -"Will code for foo."
    package org.opencyc.webserver;
    * Class WebServer is simple multithreaded HTTP server
    * with CGI limited to a Cyc connection on default port 3600.
    * <p>
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.util.jar.*;
    import java.text.*;
    import org.opencyc.util.*;
    public class WebServer extends Thread {
         * Singleton WebServer instance.
        public static WebServer current;
         * Default HTTP port.
        protected static int DEFAULT_PORT = 80;
         * Default Cyc base port.
        protected static int DEFAULT_CYC_PORT = 3600;
         * Default directory to serve files from on non-Windows OS.
        protected static String DEFAULT_DIR = "/";
         * Default directory to serve files from on Windows.
        //protected static String DEFAULT_WIN_DIR = "C:\\";
        protected static String DEFAULT_WIN_DIR = "k:\\opencyc\\run\\httpd\\htdocs";
         * File cache capacity.
        protected static final int CACHE_CAPACITY = 100;
         * File cache to improve file serving performance.
        protected static Hashtable fileCache = new Hashtable(CACHE_CAPACITY);
         * Number of files served from this web server.
        protected static long nbrFilesServed = 0;
         * Number of files served from this web server that were found in the cache.
        protected static long nbrCacheHits = 0;
         * Server socket for accepting connections.
        protected ServerSocket server;
         * Directories to serve files from.
        protected ArrayList dirs;
         * Map from String (jar root) to JarFile[] (jar class path).
        protected HashMap map;
         * Webserver HTTP port.
        protected int port;
         * Cyc HTML host.
        protected String cycHost = "localhost";
         * Cyc HTML port.
        protected int cycPort;
         * Expand jar tress.
        protected boolean trees;
         * Requests flag.
        protected boolean traceRequests;
         * Constructs a WebServer object.
         * @param port the port to use
         * @param directories the directory to serve files from
         * @param trees true if files within jar files should be served up
         * @param traceRequests true if client's request text should be logged.
         * @exception IOException if the listening socket cannot be opened, or problem opening jar files.
        public WebServer() throws IOException {
            getProperties();
            server = new ServerSocket(port);
            processDirectories();
         * Class Task processes a single HTTP request.
        protected class Task extends Thread {
             * Socket for the incoming request.
            protected Socket sock;
             * Client socket to the Cyc KB HTML server.
            protected Socket cycHtmlSocket;
             * Output tcp stream.
            protected DataOutputStream out;
             * Contains the file request path for a not-found error message.
            protected String notFoundPath;
             * Contains the first line of a request message.
            protected String methodLine;
             * Contains the body of a POST method.
            protected String bodyLine;
             * Constructs a Task object.
             * @param sock the socket assigned for this request.
            public Task(Socket sock) {
                this.sock = sock;
             * Processes the HTTP request.
            public void run() {
                if (traceRequests)
                    Log.current.println("connection accepted from " + sock.getInetAddress());
                notFoundPath = "";
                try {
                    out = new DataOutputStream(sock.getOutputStream());
                    try {
                        getBytes();
                    catch (Exception e) {
                        Log.current.println("file not found: " + notFoundPath);
                        try {
                            out.writeBytes("HTTP/1.1 404 Not Found\r\n");
                            out.writeBytes("Server: Cyc WebServer\r\n");
                            out.writeBytes("Connection: close\r\n");
                            out.writeBytes("Content-Type: text/html\r\n\r\n");
                            out.writeBytes("<HTML><HEAD>\n");
                            out.writeBytes("<TITLE>404 Not Found</TITLE>\n");
                            out.writeBytes("</HEAD><BODY>\n");
                            out.writeBytes("<H1>404 - Not Found</H1>\n");
                            out.writeBytes("</BODY></HTML>");
                            out.flush();
                        catch (SocketException se) {
                catch (Exception e) {
                    Log.current.printStackTrace(e);
                finally {
                    try {
                        sock.close();
                    catch (IOException e) {
             * Reads the HTTP request and obtains the response.
             * @exception IOException when HTTP request has an invalid format.
            private void getBytes() throws IOException {
                // Below logic is complex because web browsers do not close the
                // socket after sending the request, so must parse message to find
                // the end.
                BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
                ArrayList inBytes = new ArrayList(200);
                int ch = 0;
                boolean postMethod;
                methodLine = in.readLine();
                //if (traceRequests)
                //    Log.current.println("methodLine=" + methodLine);
                bodyLine = "";
                if (methodLine.startsWith("POST /"))
                    postMethod = true;
                else
                    postMethod = false;
                //if (traceRequests)
                //    Log.current.println("postMethod=" + postMethod);
                int ch1 = -1;
                int ch2 = -1;
                int ch3 = -1;
                int ch4 = -1;
                // Read the HTTP request headers.
                while (true) {
                    ch = in.read();
                    inBytes.add(new Integer(ch));
                    ch1 = ch2;
                    ch2 = ch3;
                    ch3 = ch4;
                    ch4 = ch;
                    if (ch1 == '\r' && ch2 == '\n' && ch3 == '\r' && ch4 == '\n')
                        break;
                    if ((! postMethod) &&
                        (! in.ready()) &&
                        ch1 == -1 &&
                        ch2 == -1 &&
                        ch3 == '\r' &&
                        ch4 == '\n') {
                        inBytes.add(new Integer('\r'));
                        inBytes.add(new Integer('\n'));
                        break;
                byte[] byteArray = new byte[inBytes.size()];
                for (int i = 0; i < inBytes.size(); i++) {
                    Integer ich = (Integer) inBytes.get(i);
                    byteArray[i] = ich.byteValue();
                String headers = new String(byteArray);
                if (postMethod) {
                    String lcHeaders = headers.toLowerCase();
                    int i = lcHeaders.indexOf("content-length: ");
                    String contentLength = lcHeaders.substring(i + 16);
                    int j = contentLength.indexOf("\r\n");
                    contentLength = contentLength.substring(0, j);
                    int bodyLen = (new Integer(contentLength)).intValue();
                    for (int k = 0; k < bodyLen; k++) {
                        bodyLine = bodyLine + (new Character((char) in.read())).toString();
                String line = methodLine + "\r\n" + headers + bodyLine;
                if (traceRequests)
                    Log.current.println(line);
                if (postMethod)
                    processHttpPost();
                else
                    if (line.startsWith("GET /"))
                        processHttpGet(line.substring(4));
                    else {
                        Log.current.println("Invalid request = " + line);
                        throw new IOException();
             * Processes an HTTP GET method.
             * @param httpGetPath the path of the file to get.
             * @exception IOException if the file is not found.
            private void processHttpGet(String httpGetPath) throws IOException {
                int i = httpGetPath.indexOf(' ');
                if (i > 0)
                    httpGetPath = httpGetPath.substring(0, i);
                Log.current.println(methodLine + " from " + sock.getInetAddress().getHostName());
                i = httpGetPath.indexOf("cg?");
                if (i > 0) {
                    cycHtmlRequest(httpGetPath.substring(i + 3));
                    return;
                notFoundPath = httpGetPath;
                i = httpGetPath.indexOf('/');
                if (i < 0 || map == null) {
                    if (map == null || httpGetPath.endsWith(".jar")) {
                        for (int j = 0; j < dirs.size(); j++) {
                            String dir = (String) dirs.get(j);
                            String nativePath = dir + httpGetPath;
                            nativePath = nativePath.replace('/', File.separatorChar);
                            if (fileCache.containsKey(nativePath)) {
                                writeDataBytes((byte[]) fileCache.get(nativePath));
                                Log.current.println("...cached");
                                nbrCacheHits++;
                                nbrFilesServed++;
                                return;
                            try {
                                File f = new File(nativePath);
                                byte[] fileBytes = getBytes(new FileInputStream(f), f.length());
                                writeDataBytes(fileBytes);
                                if (fileCache.size() >= CACHE_CAPACITY)
                                    fileCache.clear();
                                fileCache.put(nativePath, fileBytes);
                                Log.current.println("...from " + nativePath);
                                nbrFilesServed++;
                                return;
                            catch (IOException e) {
                    throw new IOException();
                String jar = httpGetPath.substring(0, i);
                httpGetPath = httpGetPath.substring(i + 1);
                JarFile[] jfs = (JarFile[]) map.get(jar);
                if (jfs == null)
                    throw new IOException();
                for (i = 0; i < jfs.length; i++) {
                    JarEntry je = jfs.getJarEntry(httpGetPath);
    if (je == null)
    continue;
    writeDataBytes(getBytes(jfs[i].getInputStream(je), je.getSize()));
    nbrFilesServed++;
    return;
    throw new IOException();
    * Processes an HTTP POST method.
    * @exception IOException if the file is not found.
    private void processHttpPost() throws IOException {
    Log.current.println("POST " + bodyLine + " from " + sock.getInetAddress().getHostName());
    cycHtmlRequest(bodyLine);
    * Reads the specified number of bytes and always close the stream.
    * @param in the file to be read for subsequent downloading.
    * @param length the number of bytes to read from the file.
    * @return An array of bytes from the file.
    * @exception IOException if an error occurs when processing the file.
    private byte[] getBytes(InputStream in, long length) throws IOException {
    DataInputStream din = new DataInputStream(in);
    byte[] bytes = new byte[ (int) length];
    try {
    din.readFully(bytes);
    finally {
    din.close();
    return bytes;
    * Sends the HTML request to Cyc.
    * @param cycPath the portion of the URL which is given to the Cyc HTML server.
    private void cycHtmlRequest(String cycPath) {
    String request = sock.getInetAddress().getHostName() + "&" + cycPath + "#";
    System.out.println("request=" + request);
    ArrayList bytes = new ArrayList(10000);
    try {
    cycHtmlSocket = new Socket(cycHost, cycPort);
    System.out.println("cycHost=" + cycHost + " cycPort=" + cycPort);
    BufferedReader cycIn = new BufferedReader(new InputStreamReader(cycHtmlSocket.getInputStream()));
    PrintWriter cycOut = new PrintWriter(cycHtmlSocket.getOutputStream(), true);
    cycOut.println(request);
    cycOut.flush();
    int ch = 0;
    while (ch >= 0) {
    ch = cycIn.read();
    bytes.add(new Integer(ch));
    catch (Exception e) {
    Log.current.printStackTrace(e);
    byte[] byteArray = new byte[bytes.size()];
    for (int i = 0; i < bytes.size() - 1; i++) {
    Integer ich = (Integer) bytes.get(i);
    byteArray[i] = ich.byteValue();
    try {
    writeTextBytes(byteArray);
    catch (Exception e) {
    Log.current.println(e.getMessage());
    * Responds to the HTTP client with data content from the requested URL.
    * @param bytes the array of bytes from the URL.
    * @exception IOException if there is an error writing to the HTTP client.
    public void writeDataBytes(byte[] bytes) throws IOException {
    out.writeBytes("HTTP/1.1 200 OK\r\n");
    out.writeBytes("Server: Cyc WebServer\r\n");
    out.writeBytes("Connection: close\r\n");
    out.writeBytes("Content-Length: " + bytes.length + "\r\n");
    String prefix = (new String(bytes)).toLowerCase();
    if (prefix.indexOf("<html>") > -1)
    out.writeBytes("Content-Type: text/html\r\n\r\n");
    else
    out.writeBytes("Content-Type: application/java\r\n\r\n");
    out.write(bytes);
    out.flush();
    * Respond to the HTTP client with text content from the requested URL.
    * @param bytes the array of bytes from the URL.
    * @exception IOException if there is an error writing to the HTTP client.
    public void writeTextBytes(byte[] bytes) throws IOException {
    out.writeBytes("HTTP/1.1 200 OK\r\n");
    out.writeBytes("Server: Cyc WebServer\r\n");
    out.writeBytes("Connection: close\r\n");
    out.writeBytes("Content-Length: " + bytes.length + "\r\n");
    out.writeBytes("Content-Type: text/html\r\n\r\n");
    out.write(bytes);
    out.flush();
    * Gets properties governing the web server's behavior.
    private void getProperties() {
    port = DEFAULT_PORT;
    String portProperty = System.getProperty("org.opencyc.webserver.port", "");
    if (! portProperty.equalsIgnoreCase(""))
    port = (new Integer(portProperty)).intValue();
    Log.current.println("Listening on port " + port);
    cycPort = DEFAULT_CYC_PORT;
    String cycPortProperty = System.getProperty("org.opencyc.webserver.cycPort", "");
    if (! cycPortProperty.equalsIgnoreCase(""))
    cycPort = (new Integer(cycPortProperty)).intValue();
    Log.current.println("Cyc connections directed to port " + cycPort);
    String dirsProperty = System.getProperty("org.opencyc.webserver.dirs", "");
    dirs = new ArrayList(3);
    StringTokenizer st = new StringTokenizer(dirsProperty, ";", false);
    while (st.hasMoreTokens()) {
    String dir = st.nextToken();
    dirs.add(dir);
    trees = false;
    String treesProperty = System.getProperty("org.opencyc.webserver.trees", "");
    if (! treesProperty.equalsIgnoreCase(""))
    trees = true;
    traceRequests = false;
    String traceRequestsProperty = System.getProperty("org.opencyc.webserver.traceRequests", "");
    if (! traceRequestsProperty.equalsIgnoreCase("")) {
    traceRequests = true;
    Log.current.println("tracing requests");
    * Adds transitive Class-Path jars to jfs.
    * @param jar the jar file
    * @param jfs the list of jar files to serve.
    * @param dir the jar file directory.
    * @exception IOException if an I/O error has occurred with the jar file.
    private void addJar(String jar, ArrayList jfs, String dir) throws IOException {
    Log.current.println("Serving jar files from: " + dir + jar);
    JarFile jf = new JarFile(dir + jar);
    jfs.add(jf);
    Manifest man = jf.getManifest();
    if (man == null)
    return;
    Attributes attrs = man.getMainAttributes();
    if (attrs == null)
    return;
    String val = attrs.getValue(Attributes.Name.CLASS_PATH);
    if (val == null)
    return;
    dir = dir + jar.substring(0, jar.lastIndexOf(File.separatorChar) + 1);
    StringTokenizer st = new StringTokenizer(val);
    while (st.hasMoreTokens()) {
    addJar(st.nextToken().replace('/', File.separatorChar), jfs, dir);
    * Administrative accessor method that obtains list of directories from which files are served.
    public ArrayList getDirs() {
    return dirs;
    * Administrative method that updates the list of directories from which files are served.
    public synchronized void setDirs(ArrayList dirs) throws IOException {
    this.dirs = dirs;
    fileCache.clear();
    processDirectories();
    * Administrative accessor method that obtains number of files served.
    * @return The number of files served.
    public long getNbrFilesServed() {
    return nbrFilesServed;
    * Administrative accessor method that obtains number of files served from cache.
    * @return The number of files served from the cache.
    public long getNbrCacheHits() {
    return nbrCacheHits;
    * Administrative method that clears the file cache.
    public synchronized void clearFileCache() {
    Log.current.println("Clearing file cache");
    fileCache.clear();
    nbrFilesServed = 0;
    nbrCacheHits = 0;
    * Processes the directories from which files are served, expanding jar trees if
    * directed.
    * @exception IOException if problem occurs while processing the jar files.
    private void processDirectories() throws IOException {
    if (dirs.size() == 0)
    if (File.separatorChar == '\\')
    dirs.add(DEFAULT_WIN_DIR);
    else
    dirs.add(DEFAULT_DIR);
    Iterator directories = dirs.iterator();
    while (directories.hasNext())
    Log.current.println("Serving from " + directories.next());
    if (trees) {
    map = new HashMap();
    for (int j = 0; j < dirs.size(); j++) {
    String dir = (String) dirs.get(j);
    String[] files = new File(dir).list();
    for (int i = 0; i < files.length; i++) {
    String jar = files[i];
    if (!jar.endsWith(".jar"))
    continue;
    ArrayList jfs = new ArrayList(1);
    addJar(jar, jfs, dir);
    map.put(jar.substring(0, jar.length() - 4), jfs.toArray(new JarFile[jfs.size()]));
    * Provides the command line interface for creating an HTTP server.
    * The properties are:
    * <pre>
    * org.opencyc.webserver.port=<HTTP listening port>
    * </pre>
    * which defaults to 80.
    * <pre>
    * org.opencyc.webserver.cycPort=<Cyc connection port>
    * </pre>
    * which defaults to 3600.
    * <pre>
    * org.opencyc.webserver.dirs=<path>;<path> ... ;<path>
    * </pre>
    * with the argument enclosed in quotes if any path contains an
    * embedded space.
    * The default directory on Windows is C:
    * and the default on other systems is / the default
    * can be overridden with this property. By default, all files
    * under this directory (including all subdirectories) are served
    * up via HTTP. If the pathname of a file is <var>path</var> relative
    * to the top-level directory, then the file can be downloaded using
    * the URL
    * <pre>
    * http://<var>host</var>:<var>port</var>/<var>path</var>
    * </pre>
    * Caching of file contents is performed.
    * <pre>
    * org.opencyc.util.log=all
    * </pre>
    * If the all value is given, then all attempts to download files
    * are output.
    * <pre>
    * org.opencyc.webserver.traceRequests
    * </pre>
    * If this property has any value, then the client HTTP requests are
    * output.<p>
    * <pre>
    * org.opencyc.webserver.trees
    * </pre>
    * This property can be used to serve up individual files stored
    * within jar files in addition to the files that are served up by
    * default. If the property has any value, the server finds all jar files
    * in the top-level directory (not in subdirectories). For each
    * jar file, if the name of the jar file is <var>name</var>.jar, then any
    * individual file named <var>file</var> within that jar file (or within
    * the jar or zip files referenced transitively in the Class-Path manifest
    * attribute, can be downloaded using a URL of the form:
    * <pre>
    * http://<var>host</var>:<var>port</var>/<var>name</var>/<var>file</var>
    * </pre>
    * When this property has any value, an open file descriptor and cached
    * information are held for each jar file, for the life of the process.
    * @param args an unused array of command line arguments.
    public static void main(String[] args) {
    Log.makeLog();
    System.out.println("OpenCyc Web Server");
    try {
    // Launch thread to accept HTTP connections.
    current = new WebServer();
    current.start();
    catch (IOException e) {
    e.printStackTrace();
    * Just keep looping, spawning a new thread for each incoming request.
    public void run() {
    try {
    while (true) {
    // Launch thread to process one HTTP request.
    new Task(server.accept()).start();
    catch (IOException e) {
    e.printStackTrace();

    JLundan,
    I want to thank you for responding to the thread I started on the forum at java.sun.com. Your solution to my problem of needing to print the code of the html pages that the file I included generates was just what I was looking for. However, I have some further questions to ask, if you don't mind. To clarify my task I should say that your rephrasing of the problem is accurate: "You wan't to display the contents of the HTML file that the web server produces in response of client's request?"
    Yes, this is what I need to do, but also it needs to display the source code of that html file that the server produces in response to the client's request. Also, in this case, I am the client requesting that the server return some html file, and I'm not sure where the server is. But the webserver.java file that I shared on the forum is on my local machine. I was wondering if I could modify this webserver.java file at my home so that any html file the server returns to me would automatically display the source code. This is a school project of mine and I am stuck on this one thing here.
    Further, where would I put the "foo.html" file so it can be written to?
    FileOuputStream fos = new FileOutputStream("foo.html");
    fos.write(bytes);
    fos.close();
    Thanks so much for your help. I look forward to your response, at your convenience.
    Regards

  • How to write the ABAP code for Datasource Enhancment

    Hi Team,
                  Can you please help me how to write the code for the enhancement i have made to the standard datasource
    i have added the fields ZZPayer and ZZPayer_access.
    I just wanted to know how to write the ABAP code to populate the data for these fields.
    Regards,
    Pradeep P.

    Hi
    From a performance point of view would like to suggest a few changes :
    WHEN '<DS name>'.
      select zzfields from <table> into itab
      for all entries in c_t_data where <condition>.
      If sy_subrc = 0.
    loop at c_t_data assiging f_c_t_data.
    read itab into wa_itab where key = f_c_t_data-key.
    f_c_t_data-zzfield = wa-itab-zzfield.
    endloop.
    refresh itab.
    regards,
    aparna
    endif.

  • Plz provide the permanent fix for this issue

    Hi Gurus,
    We are getting Issue in smq2 of target system ecc.
    "Object was locked by user jobschedular" so when we Resetting the Queue from smq2 entries are moving from that Queue but this is happening very frequently can any body tell me the permanenent fix for this ,how to fix this .As a pi consultant how can we fix this from our side or we need to contact Basis people for this.
    As we are in Prduction support .
    Reply plz.
    Regards
    Madhu

    Hi Vila-Thanks for your reply im  getting the issue is here is Object is Locked by the user in
    smq2 of ecc system when we are resetting the queue the entries are getting clearing from the
    queue so instead of doing manually is there q way to do automated process for this thats what i want
    the issue is not in PI side.
    I just want to bring some points to ur notice is
    Message is successfully reached to target system in Target system the entries got stuck in smq2 with the queue name XBTR(Target people side people sayijng that queue name starts with X It belongs ot pi ) so the target people simply assigning that there is a problem on pi side but there is no problem on PI SIDE .
    we are unable to find the issue on target side.
    Quick reply plz
    Regards
    Madhu

  • What is the transaction code for this Report

    Is there a report in SAP that shows unrealized foreign exchange cash receipts and payments posted to a G/L. if yes, what is that report. Please provide transaction code.
    If not, do we need to create ABAP query. How do we create that Query in this regard. What information are we required to give the Abap person or do we create an Query ourself. How do we create it. please explain with steps.
    It is little urgent. Please reply soon.
    Thanks
    Lakshmi

    Hi
    hi Refer
    <b>http://sapfans.com/forums/viewtopic.php?t=35498&highlight=logo+report&sid=427c40184627df2072190b9d75d87117</b>
    Use FM 'REUSE_ALV_COMMENTARY_WRITE'
    Regards,
    Sree

Maybe you are looking for

  • Is it really possible to go from $0 to $200,000 in credit in 2 years?

    I was reading a post on another forum where a member said that they went from $0 to $200k in credit in just two years. This was in the form of credit cards only; no loans. It was also implied that they started from scratch with no prior credit at all

  • Error in Database monitoring in Solution Manager Diagnostic

    Hello All, I'm facing issue in configuring Database monitoring for Java system (EP/PI) from Solution manager . It could be configured from sol man diagnostic>Diagnostic System>Managed system>Database monitoring, iei'm unable to have java system in DB

  • Problem with firewire bus

    working in final cut pro,  when i now plug drives into to frontside firewire 800 port they are running very slowly and when playing a clip fcp freezes up and i have to force quit. when i plug the drives into the backside fw port or use on my macbook

  • Dynamic change in Background Picture for Smartform

    Hi, I need to keep a background Image in smartform only in specific condition. I have done like this : I have taken one variable in the intialization and I am filling with the image name for a specific condition. This variable , I am giving it in the

  • Saving a journey details to my phone.

    I have logged in and managed to find the journey details for a particular run that I propose to make, but I cannot find out how to store the whole journey on to my phone ( a folder?) so that I can quickly access the details when I need to set off. Is