I need code example for server act as client and vice versa

Hi all,
I want code example for performing both server and clients using RMI. I mean Server will act as client and client will act as server. So a single program will act as both client and server .
Please give example, it will helpful to complete my project. I am struggling in this stage. Its like peer to peer action.
Thanks & Regards
R.Ragupathi

1. The tutorial shows you how to do cleint/server.
2. Search on the topic "callback" to see how cleint and server roles can be reversed.

Similar Messages

  • Need code example for dynamicly changing UI Propertey

    Hello,
    Can someone show me a simple code example that does the following:
    A view which contains a button and a label.
    Each press on the button changes the color (or other visible property) of the label.
    But note: Don't bind the property to the Context for that, I want to do it through the doModifyView method.

    hi Roy Cohen,
    I think u r not looking for the visibility property they have mentioned.
    I think u r looking for a procedure to change the way the element looks..is it..
    The problem is if u want any change to be visible when the button is pressed u can only change the length or the width.There is no option to change the semantic color or whatever.
    To change the size u can try this code
    IWDInputField in = (IWDInputField)view.getElement("<element name>");
    in.setWidth(some value which is set when the button is pressed);
    Is this wat u r looking for?
    Jus mention it if there is something  else.
    Regards
    Bharathwaj

  • Need code example for LDAP update

    Hello,
    I know how to preform an LDAP search using the package javax.naming.directory.DirContext.
    Can someone show me how do I do an update to a certain record at the LDAP ?
    Can this update be with the search already (such as in SQL) or should I search the relevant item first and than update it? In any case, a code example will be very helpful here...

    Roy
    Personally I would use the UME APIs to update the user instead of connecting to the LDAP directly. There are many reason for this
    1) The UME will work if you decide to change your user store
    2) Connection pooling is already taken care of
    3) Its using standard product functionality instead
    I hope this helps (and sways) your decision
    Darrell

  • Need code example for StringTokenizer to hashmap...

    I am creating a rolodex with name, phone, address, city, state. The data will be saved to a delimited file. When the app begins I have to read the file to get the records into memory. My GUI will list the names. The user should be able to click on one of the names to open a dialog box in which all the fields will appear and wil be editable.
    I need some assistance with design...
    I think I should use BufferedReader and StringTokenizer for reading the file in. Then perhaps store the records in a hashmap(need help with that - Is hashmap the thing to use? Maybe arraylist instead? How do i do it?) The records should be stored sorted by name in memory and in the file. Next, I figure I can show the names using a table and hide the other columns, when a cell is clicked I can pop up the dialog box with all the goodies in it. When I save it should be to memory, how do I do that? Then when the app closes I will write out using PrintWriter.
    There are other things going on, buttons, listeners, etc. but the basic design is what I need advice on. Any ideas are welcome and appreciated!

    From the name to get the record, clearly you need a effecient lookup mechnism.
    HashMap does hash lookup, that is right, but HashMap does NOT do ordering.
    TreeMap does binary lookup, TreeMap also does ordering.
    There you go the basic design.
    --lichu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Get data from file in server to client and vice versa

    after greeting
    i really didn't know how to use socket and serversocket to get data from file in the server and display it to client.
    also read file from client and save it to server.
    really i didn't know how to do it.
    really i want the reply as soon as possible

    You REALLY need to work through the Java networking tutorials:
    http://java.sun.com/docs/books/tutorial/networking/index.html

  • Need code example for setting a label text

    Hello,
    Lets say I have a label called testLabel and I would like to put it's text at the doInit() method of my view.
    How do I do that?

    Hi Roy,
    if you want to set the label directly without setting it thru context variable then its part of the dynamic programming of WD. So u can do that only in wdDoModifyView method. Obtain the reference of the label object from the view object and set the text property of it with the desired value.. like below
    public static void wdDoModifyView(IPrivateImageAppView wdThis, IPrivateImageAppView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
        IWDLabel myLabel = (IWDLabel)view.getElement("testLabel");
        myLabel.setText("Hello this is a Label");
        //@@end
    this should solve ur problem...
    regards,
    Shubhadip

  • Need an example of server / client program with swing interface

    Hi!
    After a lot of trying i still haven't managed to create a server client program using swing components ...
    can someone write a mini application to demonstrate how this can be done?
    i would like to have a frame with a button a texField for input and a textAread for the output
    What i have in mind is the following ..
    say im the server
    i write something in the textField and then i press the button
    then the information written in the textFiled is passed to the client who shows it in his textArea
    The same thing goes on with the client (he can write something in his own textField and when he presses the button the info is passed at the
    server who puts it in his textArea) and vice versa.
    i have written many classes that trying unsuccessfully to do that ... below i show my last attempt ...
    I would appreciate if you could write a small application which it could to this.
    The whole idea is to create a turn based game ( i have implemented the game engine and graphics and i try to add the internet function)
    Here is the code ...( i would appreciate if you write a new code instead of trying to correct mine ( which i think it's impossible) in order to use it as a general example)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    @SuppressWarnings("serial")
    *  In order to have a more gereral program instead of passing strings between the server
    *  and the client a pass an MyObjext object.  The MyObject class has an integer and a String
    *  (which is always the same) field . At the textField i write an integer number and i
    *  make a new MyObject which i want to pass to the server or the client and vice versa.
    *  The textArea shows the integer value of the MyObject which was passed from the server /client
    public class MyUserInterface extends JFrame {
         MyObject returnObject;
         JTextField myTextField;
         JTextArea te ;
         ClientGame cg;
         ServerGame sg;
          * used to determine if the current instance is running as a client or host
         boolean isHost;
         //The constructor of the client
         public MyUserInterface(ClientGame cg){
              this("Client");
              this.cg = cg;
              isHost = false;
         //The constructor of the server
         public MyUserInterface(ServerGame sg){
              this("Server");
              this.sg = sg;
              isHost = true;
         //The general constructor used both by client and server ..
         // it initializes the GUi components and add an actionListenr to the button
         public MyUserInterface(String str) {
              super(str);
              myTextField = new JTextField(2);
              te = new JTextArea();
              te.setPreferredSize(new Dimension(100,100));
              JButton okButton = new JButton("Ok");
              okButton.addActionListener(new ActionListener() {
                   @Override
                   public void actionPerformed(ActionEvent e) {
                        try{
                             int a = Integer.parseInt(MyUserInterface.this.myTextField.getText());
                             System.out.println(a);   //used to control the flow of the program
                                  MyUserInterface.this.returnObject = new MyObject(a);
                             //sends the data
                             sendData();
                             //waiting for response...
                             getData();
                             catch(Exception ex){System.out.println("Error in the UI action command" +
                                                                ex.printStackTrace();}
              JPanel panel =  new JPanel(new FlowLayout());
              panel.add(okButton);
              panel.add(myTextField);
              panel.add(te);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              getContentPane().add(panel);
              pack();
              setVisible(true);
         protected MyObject getReturnObject() {
              return returnObject;
         public void sendData(){
              new Thread(new Runnable() {
                   @Override
                   public void run() { 
                        if (!isHost)cg.sentData(returnObject);    //using the Servers out and in methods
                        else sg.sentData(returnObject);                    //using the Clients out and in methods
                        System.out.println("data sending");
         public MyObject getData(){
              MyObject obj;
              System.out.println("Retrieveing Data");
              if (!isHost)obj = (MyObject)cg.getData();
              else obj = (MyObject)sg.getData();
              System.out.println(" data retrieved  = "+ obj.getInt());  //just to control how the code flows
              te.setText(obj.getInt()+"");       
              return obj;
         public static void main(String[] args) {
              *Initiating the Server
              new Thread(new Runnable() {
                   @Override
                   public void run() {
                        ServerGame sg = new ServerGame();
                        new MyUserInterface(sg);
              }).start();     
               * Initiating the Client
              new Thread(new Runnable() {
                   @Override
                   public void run() {
                        ClientGame cg = new ClientGame("192.168.178.21");   //<----in case you run my code
                                                                          //..don't forget to change to your
                        new MyUserInterface(cg);                              //ip
              }).start();
    import java.io.*;
    import java.net.*;
    public class ClientGame {
         String ipAddress;
         Socket clientSocket = null;
        ObjectOutputStream out = null;
        ObjectInputStream in = null;
         public ClientGame(String ipAddress) {
              this.ipAddress = ipAddress;
              try {
                   System.out.println("Connecting To Host");
                 clientSocket = new Socket(InetAddress.getByName(ipAddress),4444);
                System.out.println("Host Found ...Io initializaton");
                out = new ObjectOutputStream(clientSocket.getOutputStream());
                in = new ObjectInputStream(clientSocket.getInputStream());
            } catch (UnknownHostException e) {
                System.err.println("Don't know about host: taranis.");
                System.exit(1);
            } catch (IOException e) {
                System.err.println("Couldn't get I/O for the connection to: taranis.");
                System.exit(1);
         public Object getData(){
              Object fromServer = null ;
              do{
                 try {
                      fromServer = in.readObject();
                 catch(ClassNotFoundException ex){}
                  catch(IOException e){}
              }while(fromServer==null);
              return fromServer;        
         public void sentData(final Object obj){
              new Thread(new Runnable() {
                   @Override
                   public void run() {
                        try{
                             out.writeObject(obj);
                        catch(IOException e){}
              }).start();
         public void terminateConnection(){
              try{
                   out.close();
                   in.close();
                   clientSocket.close();
              catch (IOException e){}
    public class ServerGame {
         ServerSocket serverSocket;
         Socket clientSocket;
         ObjectOutputStream out = null;
        ObjectInputStream in = null;
         public ServerGame() {
              try{
                   serverSocket = new ServerSocket(4444);
                   clientSocket = serverSocket.accept();
                   out =  new ObjectOutputStream(clientSocket.getOutputStream());
                in = new ObjectInputStream(clientSocket.getInputStream());
              catch(IOException e){System.out.println("IOException in ServerGame");}
         public Object getData(){
              Object fromClient = null ;
              do{
                 try {
                      fromClient = in.readObject();
                 catch(ClassNotFoundException ex){}
                  catch(IOException e){}
              }while(fromClient==null);
             return fromClient;        
         public void sentData(final Object obj){
              new Thread(new Runnable() {
                   @Override
                   public void run() {
                        try{
                   out.writeObject(obj);
              catch(IOException e){}
              }).start();
         public void terminateConnection(){
              try{
                   out.close();
                   in.close();
                   clientSocket.close();
                   serverSocket.close();
              catch (IOException e){}
         public static void main(String[] args) {
              new ServerGame();
    import java.io.Serializable;
    * this is a test object
    * it has a String field and a value
    *  The string is always the same but the integer value is defined in the constructor
    public class MyObject implements Serializable{
         private static final long serialVersionUID = 1L;
         String str;
         int myInt;
         MyObject(int a){
              str = "A String";
              myInt = a;
         public int getInt(){
              return myInt;
    }

    Pitelk wrote:
    I believe that a good code example can teach you things ;that you would need many days of searching; in no timeSo lets write one small example.. Ill help a little, but you do most of the work.
    jverd approach is deffenetly the way to go.
    jverd wrote:
    * Write a very small, simple Swing program with an input area, an output area, and a button. When you click the button, what's in the input area gets copied over to the output area.This part is partially done.
    * Write a very small, simple client/server program without Swing. It should just send a couple of hardcoded messages back and forth.And this part is for you(Pitelk) to continue on. I cannot say that this is the best way. or that its good in any way. I do however like to write my client/server programs like this. And perhaps, and hopefully, Ill learn something new from this as well.
    This is how far I got in about 10-20min..
    package client;
    * To be added;
    * A connect method. That connects the client to the server and
    * opens up both the receive and transmit streams. After doing that
    * the an instance of the ServerListener class should be made.
    * Also an disconnect method could be usable. But thats a later part.
    public class TestClass1 {
    package utils;
    import java.io.ObjectInputStream;
    import client.TestClass1;
    * This class is meant to be listening to all responses given from
    * the server to the client. After a have received data from the
    * server. It should be forwarded to the client, in this case
    * TestClass1.
    public class ServerListener implements Runnable {
         public ServerListener(ObjectInputStream in, TestClass1 tc) {
         @Override
         public void run() {
              while(true) {
    package server;
    import java.io.ObjectOutputStream;
    import java.net.Socket;
    import java.util.ArrayList;
    import java.util.List;
    * This class should handle all data sent to the server from the clients.
    class Server implements Runnable {
         private static List<ObjectOutputStream> outStreams = new ArrayList<ObjectOutputStream>();
         private Socket client = null;
         public Server(Socket client) {
              this.client = client;
         @Override
         public void run() {
              while(true) {
    * The meaning of this class is to listen for clients trying to connect
    * to the server. Once connection is achieved a new thread for that client
    * should be made to listen for data sent by the client to the server.
    public class ChatServer implements Runnable {
         @Override
         public void run() {
              while(true) {
    package utils;
    import java.io.Serializable;
    @SuppressWarnings("serial")
    public class MyObject implements Serializable {
         private String mssg;
         private String clientID;
         private String clientName;
         public MyObject(String mssg, String clientID, String clientName) {
              this.mssg = mssg;
              this.clientID = clientID;
              this.clientName = clientName;
         //Generate getters and setters..
    }Continue on this, and when you get into problems etc post them. Also show with a small regular basis how far you have gotten with each class or it might be seen as you have lost intresst and then this thread is dead.
    EDIT: I should probably also say that Im not more than a java novice, at the verry most. So I cannot guarantee that I alone will be able to solve all the problems that might occure during this. But Im gonna try and help with the future problems that may(most likely will) occure atleast(Trying to reserve my self incase of misserable failiure from me in this attempt).
    Edited by: prigas on Jul 7, 2008 1:47 AM

  • Code example for ZXAFAU02

    i need a code example for user exit. EXIT_SAPLAFAR_002.

    *data: con_afameth_za like t090-afamet value 'ZA',
         con_afameth_zb like t090-afamet value 'ZB',
         con_afameth_zc like t090-afamet value 'ZC',
         con_afameth_zd like t090-afamet value 'ZD',
    DATA: CON_AFAMETH_ZA(2) VALUE 'ZA',
          CON_AFAMETH_ZB(2) VALUE 'ZB',
          CON_AFAMETH_ZC(2) VALUE 'ZC',
          CON_AFAMETH_ZD(2) VALUE 'ZD',
          L_AFABTR TYPE F.
    E_AKTIV = 'X'.
    E_AFABTR = 0.
    DATA: STRDATE(10) TYPE C ,
          START_PERIOD TYPE I .
    DATA: SUMDEPRE_PERIOD TYPE I ,
          BALDEPRE_PERIOD TYPE I .
    DATA: FYPLANDEPOD LIKE ANLC-NAFAP ,
          TRUEPLANDEPOD LIKE ANLC-NAFAP ,
          NETBOOKVALUE LIKE ANLC-KANSW ,
          APCVALUE LIKE ANLC-KANSW ,
          ACCMDEPR LIKE ANLC-KNAFA ,
          DEPMONTH LIKE ANLC-PSTBEG .
    TABLES: ANLC ,
            ANLA ,
            ANLB .
    DATA: FIRSTYEAR(4) TYPE C ,
          CURRENTYEAR(4) TYPE C .
    DATA: ACQYEAR(4) TYPE C ,
          ACQMONTH LIKE ANLA-ZUPER .
    CURRENTYEAR = SY-DATUM+0(4) .
    LOOP AT T_ANLC WHERE AFABE = I_AFABE .
    **Deprecation amont is : apc * n / (n+1) / all period .
    **At first phase of changeover .
    CLEAR: STRDATE , START_PERIOD , CURRENTYEAR ,
           FYPLANDEPOD , TRUEPLANDEPOD , NETBOOKVALUE .
    CLEAR: ANLC , APCVALUE .
         STRDATE = I_ANLB-AFABG .
         START_PERIOD = STRDATE+4(2) .
         FIRSTYEAR = STRDATE+0(4) .
         CURRENTYEAR = SY-DATUM+0(4) .
         SELECT SINGLE * FROM ANLC WHERE BUKRS = T_ANLC-BUKRS
                               AND ANLN1 = T_ANLC-ANLN1
                               AND ANLN2 = T_ANLC-ANLN2 .
         IF SY-SUBRC = 0 .
            APCVALUE =  ANLC-KANSW + ANLC-ANSWL .
            ACCMDEPR =  ANLC-KNAFA + ANLC-NAFAG .
            IF FIRSTYEAR = CURRENTYEAR .
               DEPMONTH =  ANLC-PSTEND - ANLC-PSTBEG .
            ELSE .
               DEPMONTH = ANLC-PSTEND - ANLC-PSTBEG + 1 .
            ENDIF.
         ENDIF .
        IF APCVALUE GT 0 .
         FYPLANDEPOD = ( APCVALUE - I_ANLB-SCHRW ) /
                     ( I_ANLB-NDJAR * 12 + I_ANLB-NDPER  ) * DEPMONTH .
           E_AFABTR = FYPLANDEPOD .
        ENDIF.
       EXIT.
    ENDLOOP.

  • Need an example for work flow based on multistep activity

    hi,
    i need an example for work flow based on multistep activity for practicing.please do the need.
    thanks

    Hi,
    Workflow document information:
    Check these links.
    http://www.sapgenie.com/workflow/index.htm
    /people/ginger.gatling/blog/2005/12/01/link-workflow-business-objects-to-your-collaboration-tasks
    http://help.sap.com/saphelp_nw04/helpdata/en/92/bc26a6ec2b11d2b4b5006094b9ea0d/content.htm
    http://help.sap.com/saphelp_bw33/helpdata/en/92/bc26a6ec2b11d2b4b5006094b9ea0d/content.htm
    http://help.sap.com/saphelp_bw31/helpdata/en/8d/25f94b454311d189430000e829fbbd/content.htm
    http://www.sap-press.com/product.cfm?account=&product=H950
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PSWFL/PSWFL.pdf
    http://www.workflowing.com/id18.htm
    http://www.e-workflow.org/
    http://www.sap-img.com/workflow/sap-workflow.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
    http://www.sap-img.com/workflow/sap-workflow.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
    &**********Reward points if helpful**************&

  • Urgent!!!Need code to fetch all sales order data and download to flat file

    urgent!!!Need code to fetch all sales order data and download to flat file

                  D A T A B A S E  T A B L E S                          *
    TABLES: vbak,                          "Sales Document: Header Data
            VBAP,                          "Sales Document: Item Data
            MARA,VAPMA,VBPA,VBLB,VBEP,
             VBKD.   "Murali Poli                         .
                  I N T E R N A L   T A B L E S                         *
    Internal table to hold the Delphi material numbers file
    DATA: BEGIN OF tbl_matnr OCCURS 0,
            matnr LIKE mara-matnr,         "Material number
          END   OF tbl_matnr.
    Internal table to hold customer cross ref data
    DATA: BEGIN OF TBL_CUST_SA OCCURS 0,
            OLD_KUNNR LIKE KNA1-KUNNR,     "Old Customer
            OLD_VKORG LIKE A004-VKORG,     "Old Sales organisation
            OLD_VTWEG LIKE A004-VTWEG,     "Old Distribution channel
            NEW_KUNNR LIKE KNA1-KUNNR,     "New Customer
            NEW_VKORG LIKE A004-VKORG,     "New Sales organisation
            NEW_VTWEG LIKE A004-VTWEG,     "New Distribution channel
            PARVW LIKE VBPA-PARVW ,         "Partner function
    END   OF TBL_CUST_SA.
    Internal table to check the material numbers of the input file
    DATA: tbl_mara LIKE tbl_matnr OCCURS 0 WITH HEADER LINE.
    Work area to hold the header record
    DATA: BEGIN OF w_sa_header,
             recordtype(1),                "Record type
             schedulingagreement(4),       "SA Type
             contractreference(10),        "Contract Reference
             salesorg(4),                  "Sales Organization
             distrchannel(2),              "Distribution channel
             division(2),                  "Sales division
             PONUMBER(35),                 "Purchase order number"gsbhondave
             soldtoparty(12),              "Sold-to party
             shiptoparty(12),              "Ship-to party
             collectivenumber(10),         "Collective number
             description(40),              "Description
             roundqty(13),                 "Rounding Qty
             pdsi(4),                                           "PDI
             correctiondeliverydate(8),    "Correction Delivery Dt
             correctionqty(13),            "Correction Qty
             cumulativereceivedqty(13),    "Cumulative Received Qty
             forecastdeliveryschedule(17), "Forecast Delivery Schedule
             forecastdelscheddate(8),      "Forecast Delivery Schedule Dt
             jitdeliveryschedule(17),      "JIT Delivery Schedule
             jitdeliveryscheduledate(8),   "JIT Delivery Schedule Dt
             materialnumber(18),           "Material number
             plant(4),                     "Plant
             item_category(4),             "Item Category
             suppliercode(15),             "Supplier code
             scac(4),                      "SCAC
             deloc(12),                    "DELOC
             pkg_id(12),                   "Packaging ID
             catno(30),                    "Ultimate Cust Part
             lgort(4),                     "Storage Location
             vstel(4),                     "Shipping point
    Adding fields by Murali Poli
             VSBED(2),                     "Shipping conditions
             INCO1(3),                     "Incoterms (part 1)
             INCO2(28),                    "Incoterms (part 2)
             ZECN(1),                      "Engineering Change Letter
    End of Adding fields by Murali Poli
           END OF w_sa_header.
    Work area to hold the forecast record
    DATA: BEGIN OF w_sa_forecast,
             recordtype(1),                "Record Type
             dateformat(1),                "Date format
             forecastdate(8),              "Forecast date
             forecastorderqty(13),         "Order Qty
           END OF w_sa_forecast.
    Work area to hold the jit record
    DATA: BEGIN OF w_sa_jit,
             recordtype(1),                "Record Type
             dateformat(1),                "Date format
             jitdate(8),                   "JIT date
             jittime(6),                   "JIT Time
             jitorderqty(13),              "Order Qty
           END OF w_sa_jit.
    Internal table to hold the Extracted data
    DATA: BEGIN OF tbl_record OCCURS 0,
            record_type,
            DATA(400), " changed from 325 to 400
           END OF tbl_record.
    Internal table to capture the errors
    DATA: BEGIN OF tbl_error OCCURS 0,
            error_text(135),
          END   OF tbl_error.
    Internal table to hold the records of VBAP_VAPMA
    DATA: BEGIN OF tbl_vbap_vapma OCCURS 0,
    VBELN LIKE VAPMA-VBELN, "Sales and distribution document number
    POSNR LIKE VAPMA-POSNR,                "Item number
    AUART LIKE VAPMA-AUART,                "SA Type
    VKORG LIKE VAPMA-VKORG,                "Sales Organization
    VTWEG LIKE VAPMA-VTWEG,                "Distribution channel
    SPART LIKE VAPMA-SPART,                "Division
    KUNNR LIKE VAPMA-KUNNR,                "Sold-to
           plavo like vbap-plavo, "PDI
    MATNR LIKE VAPMA-MATNR,                "Material number
    WERKS LIKE VAPMA-WERKS,                "Plant
    TRVOG LIKE VAPMA-TRVOG,                "Transaction group
    VBTYP LIKE VBAK-VBTYP, "SD document category "Murali Poli
    VSBED LIKE VBAK-VSBED, "Shipping conditions   "Murali Poli
    BSTNK LIKE VBAK-BSTNK,  " Purchase order number " gsbhondave
    KTEXT LIKE VBAK-KTEXT,
    VGBEL LIKE VBAP-VGBEL,                 "Reference document no
    ABLFZ LIKE VBAP-ABLFZ,                 "Rounding qty
    PSTYV LIKE VBAP-PSTYV,                 "Item category
    LGORT LIKE VBAP-LGORT,                 "Storage location
    VSTEL LIKE VBAP-VSTEL,                 "Shipping point
    END   OF TBL_VBAP_VAPMA.
    DATA: BEGIN OF TBL_VBAP OCCURS 0,
    VBELN LIKE VAPMA-VBELN,
    POSNR LIKE VAPMA-POSNR,
    VGBEL LIKE VBAP-VGBEL,
    ABLFZ LIKE VBAP-ABLFZ,
    PSTYV LIKE VBAP-PSTYV,
    LGORT LIKE VBAP-LGORT,
    VSTEL LIKE VBAP-VSTEL,
    END   OF TBL_VBAP.
    Adding by Murali Poli
    DATA:BEGIN OF TBL_VBKD OCCURS 0,
          VBELN LIKE  VBKD-VBELN,
          POSNR LIKE  VBKD-POSNR,
          INCO1 LIKE  VBKD-INCO1,
          INCO2 LIKE  VBKD-INCO2,
         END OF TBL_VBKD.
    End by Murali Poli
    Internal table to hold temporarily the records of VBAP_VAPMA
    DATA: tbl_vbap_vapma_temp LIKE tbl_vbap_vapma OCCURS 0 WITH HEADER LINE.
    Internal table to hold the records of VBPA
    DATA: BEGIN OF tbl_vbpa OCCURS 0,
            vbeln LIKE vbpa-vbeln,         "Sales and distribution
                                           "document number
            posnr LIKE vbpa-posnr,         "Item number
            parvw LIKE vbpa-parvw,         "SP Partner type
            kunnr LIKE vbpa-kunnr,         "Customer number
            lifnr LIKE vbpa-lifnr,         "SCAC code     "DN3K923909
          END   OF tbl_vbpa.
    Internal table to hold the records of VBLB (Forecast)
    DATA: BEGIN OF tbl_vblb_forecast OCCURS 0,
            vbeln  LIKE vblb-vbeln,
            posnr  LIKE vblb-posnr,
            abart  LIKE vblb-abart,        "Release type
            abefz  LIKE vblb-abefz,        "Cumulative Quantity
                                           "Received by Customer
            labnk  LIKE vblb-labnk,        "Delivery schedule
            abrdt  LIKE vblb-abrdt,        "Deivery date
            gjkun LIKE vblb-gjkun,         "Current fiscal year
            vjkun LIKE vblb-vjkun,         "Previous fiscal year
          END   OF tbl_vblb_forecast.
    Internal table to hold the records of VBLB (JIT)
    DATA: BEGIN OF tbl_vblb_jit OCCURS 0,
            vbeln  LIKE vblb-vbeln,
            posnr  LIKE vblb-posnr,
            abart  LIKE vblb-abart,        "Release type
            abefz  LIKE vblb-abefz,        "Cumulative Quantity
                                           "Received by Customer
            labnk  LIKE vblb-labnk,        "Delivery schedule
            abrdt  LIKE vblb-abrdt,        "Deivery date
            gjkun LIKE vblb-gjkun,         "Current fiscal year
            vjkun LIKE vblb-vjkun,         "Previous fiscal year
          END   OF tbl_vblb_jit.
    Internal table to hold the Forecast Schedule lines
    DATA: BEGIN OF tbl_vbep_forecast OCCURS 0,
           vbeln LIKE vbep-vbeln,          "Sales document
           posnr LIKE vbep-posnr,          "Item number
           etenr LIKE vbep-etenr,          "Schedule line
           edatu LIKE vbep-edatu,          "Schedule line date
           ezeit LIKE vbep-ezeit,          "Arrival time       "DN3K923909
           wmeng LIKE vbep-wmeng,          "Order quantity in sales units
           prgrs LIKE vbep-prgrs, "Date type (day, week, month, interval)
           abart LIKE vbep-abart,          "Release type       "DN3K923909
          END   OF tbl_vbep_forecast.
    Internal table to hold the JIT Schedule lines
    DATA: BEGIN OF tbl_vbep_jit OCCURS 0,
           vbeln LIKE vbep-vbeln,          "Sales document
           posnr LIKE vbep-posnr,          "Item number
           etenr LIKE vbep-etenr,          "Schedule line
           edatu LIKE vbep-edatu,          "Schedule line date
           ezeit LIKE vbep-ezeit,          "Arrival time
           wmeng LIKE vbep-wmeng,          "Order quantity in sales units
           prgrs LIKE vbep-prgrs, "Date type (day, week, month, interval)
           abart LIKE vbep-abart,          "Release type      "DN3K923909
          END   OF tbl_vbep_jit.
    Internal table for Long texts
    DATA: tbl_tline  LIKE tline OCCURS 0 WITH HEADER LINE.
                    V A R I A B L E S                                   *
    DATA: v_count               TYPE i,
          V_REPID               LIKE SY-REPID,
          w_eins                LIKE vbap-umvkz VALUE 1,
          v_cumulative_deli_qty LIKE vblb-abefz,
          v_text_name           LIKE thead-tdname,
          v_week                LIKE scal-week,
          v_count_h             TYPE i,    "Count of header records
          v_count_f             TYPE i,    "Count of Forecast records
          v_count_j             TYPE i,    "Count of JIT records
          v_count_t             TYPE i.    "Count of Shipping instructions
    TYPES: unixfile LIKE rlgrap-filename,
           unixdir LIKE rlgrap-filename.
    DATA: v_file1 TYPE unixfile,
          v_file2 TYPE unixfile.
    DATA: tbl_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE.
    *data  tbl_cust_sa.
          S E L E C T - O P T I O N S / P A R A M E T E R S             *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
             Valid-to date
    PARAMETER:
              p_gueen like vbak-gueen obligatory,
             Correction Delivery date
               P_DELDT LIKE VBAK-GUEEN OBLIGATORY.
    Begin of Changes - TIR-40266
                  Plant
    SELECT-OPTIONS: s_werks FOR vbap-werks.
    *SD document category
    SELECT-OPTIONS: S_VBTYP FOR VBAK-VBTYP OBLIGATORY." Murali Poli
             Sales organization
    SELECT-OPTIONS: S_VKORG FOR VBAK-VKORG OBLIGATORY.
    End   of Changes - TIR-40266
    SELECTION-SCREEN SKIP 1.
    PARAMETER:      r1  RADIOBUTTON GROUP rg1.
             Material numbers file
    PARAMETER: P_FILE1 LIKE RLGRAP-FILENAME.
    PARAMETER: P_FILE6 LIKE RLGRAP-FILENAME.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT  1(32) text-003.
    SELECTION-SCREEN POSITION 33.
             SD SA Extract file
    PARAMETER: P_FILE2 LIKE RLGRAP-FILENAME
      DEFAULT 'C:\sd_sa_extract.txt'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP 2.
    PARAMETER:      r2  RADIOBUTTON GROUP rg1.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT  1(32) text-004.
    SELECTION-SCREEN POSITION 33.
    PARAMETER: p_path1 TYPE unixdir OBLIGATORY DEFAULT '/tmp/'.
    SELECTION-SCREEN END OF LINE.
             Material numbers file
    PARAMETER: PU_FILE1 LIKE RLGRAP-FILENAME.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT  1(32) text-003.
    SELECTION-SCREEN POSITION 33.
             SD SA Extract file
    PARAMETER: PU_FILE2 LIKE RLGRAP-FILENAME.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT  1(64) text-005.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END   OF BLOCK b1.
            A T  S E L E C T I O N   S C R E E N   E V E N T S          *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      v_repid = syst-repid.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                program_name  = v_repid
           CHANGING
                file_name     = p_file1
           EXCEPTIONS
                mask_too_long = 1
                OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE e009.
      Message shown as 'Error while getting the file name'
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE6.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                program_name  = v_repid
           CHANGING
                FILE_NAME     = P_FILE6
           EXCEPTIONS
                mask_too_long = 1
                OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE e009.
      Message shown as 'Error while getting the file name'
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file2.
      v_repid = syst-repid.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                program_name  = v_repid
           CHANGING
                file_name     = p_file2
           EXCEPTIONS
                mask_too_long = 1
                OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE e009.
      Message shown as 'Error while getting the file name'
      ENDIF.
    AT SELECTION-SCREEN ON RADIOBUTTON GROUP rg1.
      IF r1 = 'X'.
        IF  p_file1 = '' OR p_file2 = ''.
          MESSAGE w000 WITH 'Please select a PC file'.
        ENDIF.
        LOOP AT SCREEN.
          IF screen-name = 'P_FILE1' OR
             screen-name = 'P_FILE2'.
            screen-input = '1'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSEIF r2 = 'X'.
        PERFORM get_value USING 'P_PATH1' CHANGING p_path1.
        PERFORM get_value USING 'PU_FILE1' CHANGING pu_file1.
        PERFORM get_value USING 'P_PATH1' CHANGING p_path1.
        PERFORM get_value USING 'PU_FILE2' CHANGING pu_file2.
        IF  pu_file1 = '' OR pu_file2 = ''.
          MESSAGE w000 WITH 'Please select a UNIX file'.
          LOOP AT SCREEN.
            IF screen-name = 'PU_FILE1' OR
               screen-name = 'PU_FILE2'.
              screen-input = '1'.
              MODIFY SCREEN.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pu_file1.
      PERFORM get_value USING 'P_PATH1' CHANGING p_path1.
      PERFORM get_value USING 'PU_FILE1' CHANGING pu_file1.
      PERFORM popup_unix_filename CHANGING p_path1 pu_file1.
      PERFORM set_value USING 'P_PATH1' p_path1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pu_file2.
      PERFORM get_value USING 'P_PATH1' CHANGING p_path1.
      PERFORM get_value USING 'PU_FILE2' CHANGING pu_file2.
      PERFORM popup_unix_filename CHANGING p_path1 pu_file2.
      PERFORM set_value USING 'P_PATH1' p_path1.
                     T O P - O F - P A G E                              *
    TOP-OF-PAGE.
    PERFORM delphi_header(z_delphi_header_footer)
         USING
         'E & S SD SCHEDULING AGREEMENTS EXTRACT DATA'(016)
          space
          sy-linsz.
               S T A R T - O F  - S E L E C T I O N                     *
    START-OF-SELECTION.
      IF r1 = 'X'.
        PERFORM upload_data_from_pc_files.
      ELSEIF r2 = 'X'.
        PERFORM upload_data_from_unix_files.
      ENDIF.
      PERFORM check_input_data.
      PERFORM get_sd_sa_data.
                   E N D - O F - S E L E C T I O N                      *
    END-OF-SELECTION.
      PERFORM process_data.
                        S U B - R O U T I N E S                          *
    *&      Form  get_value
    FORM get_value USING value(p_fieldname)
                CHANGING value(p_fieldvalue).
      IF v_repid IS INITIAL.
        v_repid = syst-repid.
      ENDIF.
      REFRESH: tbl_dynpfields.
      CLEAR: tbl_dynpfields.
      tbl_dynpfields-fieldname = p_fieldname.
      APPEND tbl_dynpfields.
      CALL FUNCTION 'DYNP_VALUES_READ'
           EXPORTING
                dyname               = v_repid
                dynumb               = '1000'
           TABLES
                dynpfields           = tbl_dynpfields
           EXCEPTIONS
                invalid_abapworkarea = 1
                invalid_dynprofield  = 2
                invalid_dynproname   = 3
                invalid_dynpronummer = 4
                invalid_request      = 5
                no_fielddescription  = 6
                invalid_parameter    = 7
                undefind_error       = 8
                double_conversion    = 9
                stepl_not_found      = 10
                OTHERS               = 11.
      IF syst-subrc = 0.
        READ TABLE tbl_dynpfields INDEX 1.
        p_fieldvalue = tbl_dynpfields-fieldvalue.
      ENDIF.
      REFRESH: tbl_dynpfields.
    ENDFORM.                               " get_value
          FORM POPUP_UNIX_FILENAME                                      *
    Pops up dialog box to explore the unix filesystem and select a file *
    -->  VALUE(P_PATH)      Path where to start exploring from         *
    -->  VALUE(P_FILENAME)  Default filename in the dialog box         *
    FORM popup_unix_filename CHANGING value(p_path) TYPE unixdir
                                      value(p_filename) TYPE unixfile.
    DATA: v_length TYPE i,
           v_filename TYPE unixfile,
           v_directory LIKE draw-filep,
           v_file LIKE draw-filep.
    IF p_filename(1) = '/'  OR
        p_path IS INITIAL.
       v_filename = p_filename.
    ELSE.
       v_length = strlen( p_path ) - 1.
       IF p_path+v_length(1) <> '/'.
         CONCATENATE p_path '/' INTO p_path.
       ENDIF.
       CONCATENATE p_path p_filename INTO v_filename.
    ENDIF.
    CALL FUNCTION 'Z_UNIX_FILENAME_GET'
          EXPORTING
               def_filename     = v_filename
               mask             = ',*.'
               mode             = 'G'
               title            = 'Get UNIX file...'
          IMPORTING
               filename         = v_filename
          EXCEPTIONS
               inv_winsys       = 1
               no_batch         = 2
               selection_cancel = 3
               selection_error  = 4
               OTHERS           = 5.
    CHECK syst-subrc = 0.
    CALL FUNCTION 'CV120_SPLIT_PATH'
          EXPORTING
               pf_path  = v_filename
          IMPORTING
               pfx_path = v_directory
               pfx_file = v_file
          EXCEPTIONS
               OTHERS   = 1.
    CHECK syst-subrc = 0.
    IF v_directory = p_path.
       p_filename = v_file.
    ELSE.
       p_filename = v_filename.
    ENDIF.
    ENDFORM.
          FORM SET_VALUE                                                *
    Sets the value of a field on the selection screen.                  *
    -->  VALUE(P_FIELDNAME)   Name of the field on the selection screen*
    -->  VALUE(P_FIELDVALUE)  Value of the field                       *
    FORM set_value USING value(p_fieldname)
                         value(p_fieldvalue).
      IF v_repid IS INITIAL.
        v_repid = syst-repid.
      ENDIF.
      CLEAR: tbl_dynpfields.
      tbl_dynpfields-fieldname = p_fieldname.
      tbl_dynpfields-fieldvalue = p_fieldvalue.
      APPEND tbl_dynpfields.
      CALL FUNCTION 'DYNP_VALUES_UPDATE'
           EXPORTING
                dyname               = v_repid
                dynumb               = '1000'
           TABLES
                dynpfields           = tbl_dynpfields
           EXCEPTIONS
                invalid_abapworkarea = 1
                invalid_dynprofield  = 2
                invalid_dynproname   = 3
                invalid_dynpronummer = 4
                invalid_request      = 5
                no_fielddescription  = 6
                undefind_error       = 7
                OTHERS               = 8.
    ENDFORM.
    *&      Form  upload_data_from_pc_files
    This subroutine is used to upload the data from input files
    FORM upload_data_from_pc_files.
      REFRESH: tbl_matnr.
      CLEAR:   tbl_matnr.
    Upload the data from Delphi Materials file
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                filename                = p_file1
                filetype                = 'DAT'
           TABLES
                data_tab                = tbl_matnr
           EXCEPTIONS
                conversion_error        = 1
                file_open_error         = 2
                file_read_error         = 3
                invalid_type            = 4
                no_batch                = 5
                unknown_error           = 6
                invalid_table_width     = 7
                gui_refuse_filetransfer = 8
                customer_error          = 9
                OTHERS                  = 10.
      IF sy-subrc <> 0.
        MESSAGE e008 WITH 'Materials file'.
      Message shown as "Error while reading Materials file"
      ENDIF.
      IF sy-subrc = 0 AND tbl_matnr[] IS INITIAL.
        MESSAGE e013 WITH 'Materials'.
      Message shown as "No records found in Materials file"
      ENDIF.
      DELETE tbl_matnr WHERE matnr = ''.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                FILENAME                = P_FILE6
                filetype                = 'DAT'
           TABLES
                DATA_TAB                = TBL_CUST_SA
           EXCEPTIONS
                conversion_error        = 1
                file_open_error         = 2
                file_read_error         = 3
                invalid_type            = 4
                no_batch                = 5
                unknown_error           = 6
                invalid_table_width     = 7
                gui_refuse_filetransfer = 8
                customer_error          = 9
                OTHERS                  = 10.
      IF sy-subrc <> 0.
        MESSAGE E008 WITH 'Customer/Sales Area Cross Reference file'.
      Message shown as "Error while reading Materials file"
      ENDIF.
    ENDFORM.                               " upload_data_from_pc_files
    *&      Form  upload_data_from_unix_files
    This subroutine is used to upload the data from UNIX files
    FORM upload_data_from_unix_files.
      REFRESH: tbl_matnr.
      CLEAR:   tbl_matnr.
    Get the complete filename for the Materials file
      PERFORM get_full_filename USING pu_file1 CHANGING v_file1.
    Open the Materials file
      PERFORM open_dataset USING v_file1 'I' 'T' 1.
      CHECK syst-subrc = 0.
    Read the materials file
      DO.
        READ DATASET v_file1 INTO tbl_matnr.
        IF syst-subrc <> 0.
          EXIT.
        ENDIF.
    Populate the read data into the internal table
        APPEND tbl_matnr.
      ENDDO.
      PERFORM close_dataset USING v_file1.
    ENDFORM.                               " upload_data_from_unix_files
          FORM GET_FULL_FILENAME                                        *
    Uses the logical path if necessary to get the full filename         *
    If the filename already has a directory specified, that itself will *
      be the full filename                                              *
    Else the logical path for Conversions will be prefixed to the given *
      filename                                                          *
    FORM get_full_filename USING value(p_file) TYPE unixfile
                        CHANGING value(p_fullfile) TYPE unixfile.
      DATA: v_length TYPE i.
    IF p_file(1) = '/'  OR
        p_path1 IS INITIAL.
       p_fullfile = p_file.
    ELSE.
       v_length = strlen( p_path1 ) - 1.
       IF p_path1+v_length(1) = '/'.
         CONCATENATE p_path1 p_file INTO p_fullfile.
       ELSE.
         CONCATENATE p_path1 '/' p_file INTO p_fullfile.
       ENDIF.
    ENDIF.
    ENDFORM.
          FORM OPEN_DATASET                                             *
    Opens dataset in the specified mode                                 *
    -->  VALUE(P_FILE)    Name of file to be opened                    *
    -->  VALUE(P_IOMODE)  'I' for Input / 'O' for Output               *
    -->  VALUE(P_BTMODE)  'T' for Text / 'B' for Binary                *
    -->  VALUE(P_LEVEL)   If set to > 1, will write error message to   *
                           list Else will supress the error message but *
                           will be available in SYST-MSGV1              *
    FORM open_dataset USING value(p_file) TYPE unixfile
                            value(p_iomode) TYPE c
                            value(p_btmode) TYPE c
                            value(p_level) TYPE i.
      DATA: v_rc LIKE syst-subrc,
            v_msg(100),
            v_listmsg(100).
      IF p_iomode = 'O'.
        IF p_btmode = 'B'.
          OPEN DATASET p_file FOR OUTPUT IN BINARY MODE MESSAGE v_msg.
        ELSE.
          OPEN DATASET p_file FOR OUTPUT IN TEXT MODE MESSAGE v_msg.
        ENDIF.
      ELSE.
        IF p_btmode = 'B'.
          OPEN DATASET p_file FOR INPUT IN BINARY MODE MESSAGE v_msg.
        ELSE.
          OPEN DATASET p_file FOR INPUT IN TEXT MODE MESSAGE v_msg.
        ENDIF.
      ENDIF.
      IF syst-subrc <> 0.
        v_rc = syst-subrc.
        syst-msgv1 = v_msg.
        IF p_level > 0.
          CONCATENATE 'Unable to open' p_file
                 INTO v_listmsg
            SEPARATED BY space.
          IF p_iomode = 'O'.
            CONCATENATE v_listmsg 'for Output'
                   INTO v_listmsg
              SEPARATED BY space.
          ELSE.
            CONCATENATE v_listmsg 'for Input'
                   INTO v_listmsg
              SEPARATED BY space.
          ENDIF.
          IF p_iomode = 'B'.
            CONCATENATE v_listmsg 'in Binary mode'
                   INTO v_listmsg
              SEPARATED BY space.
          ELSE.
            CONCATENATE v_listmsg 'in Text mode'
                   INTO v_listmsg
              SEPARATED BY space.
          ENDIF.
          WRITE: / v_listmsg.
          WRITE: /3 '--', v_msg.
          syst-subrc = v_rc.
        ENDIF.
      ENDIF.
    ENDFORM.
          FORM CLOSE_DATASET                                            *
    Closes dataset                                                      *
    -->  VALUE(P_FILE)  Name of the file to be closed                  *
    FORM close_dataset USING value(p_file) TYPE unixfile.
      CLOSE DATASET p_file.
    ENDFORM.
    *&      Form  check_input_data
    This subroutine is used to check the data from X Ref files
    FORM check_input_data.
      DESCRIBE TABLE tbl_matnr LINES v_count.
    Use the material conversion routine to pad the material numbers
    with zeroes
      LOOP AT tbl_matnr.
        CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
             EXPORTING
                  input        = tbl_matnr-matnr
             IMPORTING
                  output       = tbl_matnr-matnr
             EXCEPTIONS
                  length_error = 1
                  OTHERS       = 2.
        TRANSLATE tbl_matnr-matnr TO UPPER CASE.
        MODIFY tbl_matnr.
      ENDLOOP.
    Get the materials from SAP database using the input materials
      IF NOT tbl_matnr[] IS INITIAL.
        SORT tbl_matnr BY matnr.
        SELECT matnr FROM mara
          INTO TABLE tbl_mara
           FOR ALL ENTRIES IN tbl_matnr
         WHERE matnr = tbl_matnr-matnr.
        SORT tbl_mara BY matnr.
      ENDIF.
    Check the existence of input materials in SAP database
      LOOP AT tbl_matnr.
        READ TABLE tbl_mara WITH KEY matnr = tbl_matnr-matnr
             BINARY SEARCH.
        IF sy-subrc <> 0.
          CONCATENATE 'Material' tbl_matnr-matnr 'does not exist'
                 INTO tbl_error-error_text
            SEPARATED BY space.
          APPEND tbl_error.
          CLEAR  tbl_error.
          DELETE tbl_matnr.
        ENDIF.
      ENDLOOP.
    ENDFORM.                               " check_input_data
    *&      Form  get_sd_sa_data
    This subroutine is used to get the SD Scheduling data from database
    FORM get_sd_sa_data.
    *begin of changes - DN3K923909
      DATA: tbl_vbep LIKE tbl_vbep_forecast OCCURS 0 WITH HEADER LINE,
            tbl_vblb LIKE tbl_vblb_forecast OCCURS 0 WITH HEADER LINE.
    *end of changes - ND3K923909
      REFRESH: tbl_vbap_vapma, tbl_vbpa, tbl_vblb_forecast,
               tbl_vblb_jit, tbl_vbep_forecast, tbl_vbep_jit.
      CLEAR:   tbl_vbap_vapma, tbl_vbpa, tbl_vblb_forecast,
               tbl_vblb_jit, tbl_vbep_forecast, tbl_vbep_jit.
    Get the Scheduling Agreements
      SELECT avbeln aposnr
           a~vgbel
             AAUART avkorg avtweg aspart a~kunnr
            a~ablfz
             A~MATNR
           a~pstyv
             a~werks
           a~lgort
            a~vstel
              ATRVOG BVBTYP BVSBED  BBSTNK B~KTEXT
        FROM VAPMA AS A INNER JOIN VBAK AS B
          ON bvbeln = avbeln
        INTO TABLE tbl_vbap_vapma
         FOR ALL ENTRIES IN tbl_mara
       WHERE a~matnr = tbl_mara-matnr
    Begin of Changes - TIR-40266
         AND a~vkorg IN s_vkorg
         AND a~werks IN s_werks
    End of Changes - TIR-40266
         AND A~TRVOG = '3'
         AND B~VBTYP IN S_VBTYP.           "Murali Poli
        and a~abgru = ''
        and b~gueen >= p_gueen.
      SORT tbl_vbap_vapma BY vbeln posnr.
      IF NOT tbl_vbap_vapma[] IS INITIAL.
        SELECT VBELN POSNR VGBEL ABLFZ PSTYV LGORT VSTEL FROM VBAP
         INTO TABLE  TBL_VBAP FOR ALL ENTRIES IN TBL_VBAP_VAPMA
           WHERE VBELN = TBL_VBAP_VAPMA-VBELN
            AND POSNR = TBL_VBAP_VAPMA-POSNR.
        LOOP AT TBL_VBAP_VAPMA.
          READ TABLE TBL_VBAP WITH KEY VBELN = TBL_VBAP_VAPMA-VBELN
                                       POSNR = TBL_VBAP_VAPMA-POSNR.
          IF SY-SUBRC = 0 .
            TBL_VBAP_VAPMA-VBELN  = TBL_VBAP-VBELN.
            TBL_VBAP_VAPMA-POSNR  = TBL_VBAP-POSNR.
            TBL_VBAP_VAPMA-VGBEL  = TBL_VBAP-VGBEL.
            TBL_VBAP_VAPMA-ABLFZ  = TBL_VBAP-ABLFZ.
            TBL_VBAP_VAPMA-PSTYV  = TBL_VBAP-PSTYV.
            TBL_VBAP_VAPMA-LGORT  = TBL_VBAP-LGORT.
            TBL_VBAP_VAPMA-VSTEL  = TBL_VBAP-VSTEL.
            MODIFY TBL_VBAP_VAPMA .
          ENDIF.
        ENDLOOP.
        tbl_vbap_vapma_temp[] = tbl_vbap_vapma[].
    *--Begin of UnCommentDIR-51476-DN3K932648
    -------------- Begin of Comment -----------  CCR-50124  DN3K928457
        SORT tbl_vbap_vapma_temp BY vbeln.
        DELETE ADJACENT DUPLICATES FROM tbl_vbap_vapma COMPARING vbeln.
    -------------- End of Comment -----------  CCR-50124  DN3K928457
    *--End of UnCommentDIR-51476-DN3K932648
    *--Begin of CommentDIR-51476-DN3K932648
    -------------- Begin of Insert -----------  CCR-50124  DN3K928457
    Duplicate Line Items are being deleted.
       SORT tbl_vbap_vapma BY vbeln posnr.
    DELETE ADJACENT DUPLICATES FROM tbl_vbap_vapma COMPARING vbeln posnr.
    The field for contract in SA is being modified for uniqueness
       loop at tbl_vbap_vapma.
         clear: v_vgbel, v_posnr.
         v_vgbel = tbl_vbap_vapma-vgbel.
         v_posnr = tbl_vbap_vapma-posnr.
         if not v_vgbel is initial .
           shift v_vgbel left deleting leading v_zero.
           shift v_posnr left deleting leading v_zero.
           v_posnr = v_posnr / 10.
           condense: v_vgbel, v_posnr.
           if v_posnr le 9.
             concatenate v_vgbel '0' v_posnr into v_vgbel.
           else.
             concatenate v_vgbel v_posnr into v_vgbel.
           endif.
         endif.
         tbl_vbap_vapma-vgbel = v_vgbel.
         modify tbl_vbap_vapma.
       endloop.
    -------------- End of Insert -----------  CCR-50124  DN3K928457
    *--End of CommentDIR-51476-DN3K932648
    Get the Partner details
       select vbeln posnr parvw kunnr
    *Start of Murali Poli
        SELECT VBELN POSNR INCO1 INCO2
               INTO TABLE TBL_VBKD
               FROM VBKD
               FOR ALL ENTRIES IN TBL_VBAP_VAPMA
               WHERE VBELN = TBL_VBAP_VAPMA-VBELN.
              and posnr  = tbl_vbap_vapma-posnr.
    *End of Murali Poli
        SELECT vbeln posnr parvw kunnr lifnr                    "DN3K923909
          INTO TABLE tbl_vbpa
          FROM vbpa
           FOR ALL ENTRIES IN tbl_vbap_vapma_temp
         WHERE vbeln = tbl_vbap_vapma_temp-vbeln
           AND parvw IN ('WE', 'SP').
    *begin of changes - DN3K923909
       select vbeln posnr abart abefz labnk abrdt gjkun vjkun
         into table tbl_vblb_forecast
         from vblb
          for all entries in tbl_vbap_vapma
        where vbeln = tbl_vbap_vapma-vbeln
          and posnr = tbl_vbap_vapma-posnr
          and abrli = '0000'
          and abart = '1'.
        SELECT vbeln posnr abart abefz labnk abrdt gjkun vjkun
          INTO TABLE tbl_vblb
          FROM vblb
           FOR ALL ENTRIES IN tbl_vbap_vapma
         WHERE vbeln = tbl_vbap_vapma-vbeln
           AND posnr = tbl_vbap_vapma-posnr
           AND abrli = '0000'
           AND abart IN ('1','2').
        SELECT vbeln posnr etenr edatu ezeit wmeng prgrs abart
          INTO TABLE tbl_vbep
          FROM vbep
           FOR ALL ENTRIES IN tbl_vbap_vapma
         WHERE vbeln = tbl_vbap_vapma-vbeln
           AND posnr = tbl_vbap_vapma-posnr
           AND abart IN ('1','2').
    Get the current Forecast delivery schedule
        tbl_vblb_forecast[] = tbl_vblb[].
        DELETE tbl_vblb_forecast WHERE abart = '2'.
    Get the current Forecast Schedule lines
        tbl_vbep_forecast[] = tbl_vbep[].
        DELETE tbl_vbep_forecast WHERE abart = '2'.
    Get the current JIT delivery Schedule
       select vbeln posnr abart abefz labnk abrdt gjkun vjkun
         into table tbl_vblb_jit
         from vblb
          for all entries in tbl_vbap_vapma
        where vbeln = tbl_vbap_vapma-vbeln
          and posnr = tbl_vbap_vapma-posnr

  • Need a link for PS CS6 Extended Student and Teach

    Need a link for PS CS6 Extended Student and Teacher's Edition.  My copy fried on my laptop and I need to re-install or do a repair install.  The adobe site is trying to force me into this cloud product world.  The links here:
    http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html
    Are broken --- I won the product - just need install files again without being assimilated into a whole new cloud platform.  Why break the old links?  I  have had this about 20 months....

    Manning777 you should be able to download the software from the page you referenced.  I would recommend trying a different web browser or perhaps checking the security settings on your browser.

  • I keep putting the code in for a i tunes card and it keeps telling me the card has been redeemed but i cant see any money on my account

    i keep putting the code in for a i tunes card and it keeps telling me the card has been redeemed but i cant see any money on my account

    The receipt usually takes more time to receive. I got my receipt from about 7:00pm yesterday at about 10:00pm today.

  • Applocker for server as a client

    Hi Guys,
    I wanted to know the recommendation and Best Practice for Applocker where Windows server 2012 R2 is the Client and not windows 7 as we have windows 7 client as applocker but i want to apply applocker for server as a Client
    Please help
    Thank you
    Viraj
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Hi Viraj,
    >>I wanted to know the recommendation and Best Practice for Applocker where Windows server 2012 R2 is the Client and not windows 7 as we have windows 7 client as applocker but i want to apply applocker for server as a Client
    This depends on what we want to achieve but not if the operating system is a server or workstation. However, for Windows Server 2012/R2 or Windows 8/8.1, there are added functions for Applocker.
    In Windows Server 2008 R2 and Windows 7, we can manage four types of files: executable (.exe), Windows Installer (.msi and .msp), script (.bat, .cmd, .js, .ps1, and .vbs), and DLL (.dll and .ocx). Each of these file types is managed in
    its own rule collection.
    In Windows Server 2012 and Windows 8, in addition to the file types, we can manage .mst and .appx files with AppLocker.
    Regarding Applocker and its rule behavior, the following articles can be referred to for more information.
    AppLocker: Frequently Asked Questions
    http://technet.microsoft.com/en-us/library/ee619725(v=WS.10).aspx
    AppLocker Overview
    http://technet.microsoft.com/library/hh831440.aspx
    Understanding AppLocker Rules
    http://technet.microsoft.com/en-us/library/dd759068.aspx
    Best regards,
    Frank Shen

  • I need a refund for storage charges I bought and did not need for iCloud!

    I need a refund for storage charges I bought and did not need for iCloud!

    You only have 15 days to cancel and get a refund.
    In the UK click on this link:
    HT4874 iCloud Storage Upgrade refund

  • Can a PL/SQL code of timesten be called in oracle or vice versa

    Hi
    In IMDB cache setup with AWT cache group , the pl/sql code or procedure that is written in oracleDB can it be called in TimesTen and vice versa
    example: In a stored procedure the DML's that are performed will be updating the cache tables and log table in oracleDB.
    Will there be any performance impact.
    Regards
    Siva Kumar

    A PL/SQL procedure can exist in Oracle DB, in TimesTen, or in both. You control that by where you create the procedure. Procedures that exist in Oracle can really only be called in Oracle and can only access data in Oracle. Procedures that exist in TimesTen can only be called in TimesTen and can only access data in TimesTen. There is a limited capability, using the TimesTen PassThrough capability to call PL/SQL procedures located in Oracle, from Timesten, and for Timesten PL/SQL procedures to access data in Oracle. Using PassThrough does have some overhead.
    Chris

Maybe you are looking for