Re: creating zoom for my canvas

HI
I am trying to add zoom feature to the canvas which is the super class of the class zoom. As you can see when you run the code below. I have partially succeded in zooming in and zooming out with mouse drag. Although, the shapes dont zoom about the center of the canvas which is the my custom origin. Insted they zoom about the default origin(left top corner).
Also as I zoom in and out the thickness of the shape's border changes. I have tried to use g2.setStroke(thickness) in paint method. But it seems to have no affect.
Could any one suggest changes please.
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;
import javax.swing.JFrame;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class Zoom extends Canvas implements MouseMotionListener,MouseListener,ChangeListener{
       AffineTransform at = new AffineTransform();
    int x0, y0, x1, y1;
    double cx,cy;
    double zoom;
    Line2D.Double line;
     public Zoom(JFrame f){
         f.add(this);
         this.setBackground(Color.BLACK);
         addMouseListener(this);
         addMouseMotionListener(this);
    public void stateChanged(ChangeEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    @Override
    public void paint(Graphics g){
         super.paint(g);
         Graphics2D g2 = (Graphics2D)g;
         g2.translate(cx, cy);
         g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON);        
         g2.setPaint(Color.WHITE);
         AffineTransform orig = g2.getTransform();
       // at.translate(cx, cy);
      g2.setStroke(new BasicStroke(1));      
         g2.setTransform(at);        
         g2.drawLine(100, 200, 300, 200);
        // System.out.print("\n"+x0+"\n"+y0+"\n"+x1+"\n"+y1+"\n");
         line = new Line2D.Double(x0, y0, x1, y1);
         //g2.draw(line);     
         g2.setTransform(orig);
        // g2.translate(-cx, -cy);
     public static void main(String[] args) {
        JFrame f = new JFrame();
        Zoom z = new Zoom(f);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(400, 400);
        f.setVisible(true);       
    public void mouseDragged(MouseEvent e) {
        e.consume();
        x1 = e.getX();
        y1 = e.getY();
        cx = this.getWidth()/2;
        cy = this.getHeight()/2;
        at.setToTranslation(0,0);
        at.scale(setZoom(), setZoom());
      //  at.createTransformedShape(line);
        this.repaint();
    public void mouseMoved(MouseEvent e) {
    public void mouseClicked(MouseEvent e) {
    public void mousePressed(MouseEvent e) {
        e.consume();
        x0 = e.getX();
        y0 = e.getY();
    public void mouseReleased(MouseEvent e) {
    public void mouseEntered(MouseEvent e) {
    public void mouseExited(MouseEvent e) {
    double setZoom(){
        return(getDrag());   
    double getDrag(){       
        double max,linelen;
        max = Math.sqrt(Math.pow(this.getWidth(), 2) + Math.pow(this.getHeight(), 2));
        linelen = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2));
        return(linelen/max);
}

Here is your corrected code. It also takes care of the scaling of the stroke width problem, by applying the affine transformation to the shape and not to the canvas.
import java.awt.BasicStroke; //JV: inserted
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
import javax.swing.JFrame;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class Zoom extends Canvas implements MouseMotionListener, MouseListener, ChangeListener {
    AffineTransform atf = new AffineTransform();
    int x0, y0, x1, y1;
    double cx, cy;
    double zoom;
    static Line2D line0 = new Line2D.Double(100.0, 200.0, 300.0, 200.0); //JV: inserted
    public Zoom(JFrame f) {
        f.add(this);
        this.setBackground(Color.BLACK);
        addMouseListener(this);
        addMouseMotionListener(this);
    public void stateChanged(ChangeEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    @Override
    public void paint(Graphics g) {
        super.paint(g);
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
        g2.setPaint(Color.WHITE);
        Shape transformedLine = new Path2D.Double(line0, atf);
        g2.setStroke(new BasicStroke(1)); //Note: stroke not affected by atf
        g2.draw(transformedLine);
    public static void main(String[] args) {
        JFrame f = new JFrame();
        Zoom z = new Zoom(f);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(400, 400);
        f.setVisible(true);
    public void mouseDragged(MouseEvent e) {
        e.consume();
        x1 = e.getX();
        y1 = e.getY();
        cx = this.getWidth() / 2;
        cy = this.getHeight() / 2;
        atf.setToTranslation(cx, cy); //Reset atf
        atf.scale(setZoom(), setZoom());
        atf.translate(-cx, -cy);
        repaint();
    public void mouseMoved(MouseEvent e) {
    public void mouseClicked(MouseEvent e) {
    public void mousePressed(MouseEvent e) {
        e.consume();
        x0 = e.getX();
        y0 = e.getY();
    public void mouseReleased(MouseEvent e) {
    public void mouseEntered(MouseEvent e) {
    public void mouseExited(MouseEvent e) {
    double setZoom() {
        return (getDrag());
    double getDrag() {
        double max, linelen;
        max = Math.sqrt(Math.pow(this.getWidth(), 2) + Math.pow(this.getHeight(), 2));
        linelen = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2));
        return (linelen / max);
}

Similar Messages

  • How to create guidelines for my canvas

    Hello,
    I need to create guide lines on my canvas to aid the design of geometric shapes.
    If possible, I would like an example to understand how.
    Does anyone know how?
    Thanks!

    Are you using AWT or SWING Components?

  • I have created a newsletter in indesign cs4 how can I set zooms for each article for the user

    I have created a e-newsletter in Indesign. I have successfuly saved it as a SWF then as a PDF from acrobat.
    The problem is that when the user zooms in the resolution is not good.
    How can I let the user zoom in to read each article. Would I create buttons with zoom settings for each article. If this is the case do I do it in Indesign or Flash and can I still save it as a PDF file and it will keep the interactivity?
    I would greatly appreciate any help with this issue. It is driving me mad trying to get the information I need.
    Thank you

    Hi Bob
    Dont know what you mean by deleting my signature in the forum. Sorry its my
    first time using a forum.
    So just to confirm if I want a user to zoom in on an article I can't do it
    in Indesign or Flash.
    cheers
    PAMELA
                                                                                    BobLevine                                                    
                 <[email protected]                                            
                 >                                                          To
                                           pamela hettrick                    
                 17/08/2010 14:09          <[email protected]>  
                                                                            cc                                                                               
    Please respond to                                     Subject
                 clearspace-143433         I have created a        
                 1873-767197-2-305         newsletter in indesign cs4 how can 
                 [email protected].         I set zooms for each article for   
                     adobe.com             the user                                                                               
    You don't. There are third party solutions available for that. Sorry but I
    don't have any links handy right now.
    And please delete your signature...it's making a mess of the forum display
    of your posts.
    Bob

  • How do I create motion for still photos/pictures. I'd like to pan/scan & zoom. Please help!

    How do I create motion for still photos/pictures. I'd like to pan/scan & zoom. Please help!

    You kind of answered your own question..
    Check out Motion in the FX Control Window and learn how keyframing works..

  • When I create a 5 x7 canvas, why are my pictures getting cut off?

    So, I'm pretty new to Elements 12, but I do understand things about ratios and what not.  But I am still not understanding why when I create a 5 x 7 canvas, create something on it, then try to print, it either leaves space on the edges or if I do crop to fit, cuts off my image!  I am creating a completely new canvas and adding pieces to it, like text, clipart and so on.  Any help would be appreciated!

    krolgirl wrote:
    I do understand things about ratios and what not.
    krogirl,
    Check the following:
    Make sure that you have the latest drivers for your printer. You can do that on the manufacturer's web site.
    Make sure that the orientation of you file and the one selected in the print set-up are the same.. If you have a landscape oriented file, for example, go to File>print. In the dialog look for "Page Setup", and select landscape.
    Crop to 5x7 before sending it to the printer. For paper size, try 5x7 borderless,
    Please report back with your progress.

  • How do I set the default zoom for new sheets to 150%?

    I'm using the latest edition of Numbers and I'd like to set the default zoom for new sheets to be 150% when they are created rather than the default 100%. Does anybody know how to do this?
    Thanks,
    d.

    Try Numbers menu > Preferences > Rulers >Default Zoom.

  • How to create transaction for a maintenance view, Thank you.

    How to create transaction for a maintenance view,
    Thank you.
    deniz...

    Hi Deniz,
    Go to se93.
    Then create the new T.code.
    Under that select parameter Transaction.
    Then give the sm30 in the t.code in default values tab.
    check the checkbox skip initial screen.
    in classification tab.
    click checkbox inherit gui attributes..
    Now below..
    In the default values..
    select
    viewname and give ur table name.
    UPDATE= Xsave
    view - table name ( Should be upper case
    update X ( should be upper case).
    http://www.sap-basis-abap.com/sapbs011.htm
    Hope this helps you.
    Regards,
    Viveks

  • Can AAMEE 3.1 create pkg for CS6 Design Standard?  or just CS6 Mast Collection?

    can AAMEE 3.1 create pkg for CS6 Design Standard?  or just CS6 Mast Collection?

    ok, thanks,  just wanted to make sure. I have a volume serial no.   for CS6 Dest Stan.
    AAMEE 3.1 is for CS6 Suite,  so should be good for all CS6
    I created a pkg for CS6 Mast Coll using AAMEE 3.1 a few months ago and works fine  (.msi)

  • Google Analytics OPT-OUT Browser Add-on 0.9.6 doesn't retain OPT-OUT settings...never did really. Also JAVA now refuses to create updates for WinXP/FireFox.

    I use PaleMoon now trying to get rid of advertising sharks. I have WINXP still - need assistive-technology computer for pain so taking time on getting new computer.
    I have been severely sabotaged by advertising conglomerates selling my private information. They have no right -yet they do whatever they want. Anyhow...I've tried to OPT-OUT of EVERYTHING POSSIBLE. I've tried 5 places found. Google, NAI, DAA, & FIREFOX HELP said go to about:config was instructed to turn "from false to true" the "privacy.tracking.protection.enabled" .But I couldn't keep this setting because this also has to be set to false to use any saved log-on's to my accounts., and add-on AD BLOCK PLUS 2.6.7 when I was on Firefox & had some ticks and now it is disabled because it won't work with PaleMoon 25.2.1
    This case is about GOOGLE OPT-OUT. Starting here: http://www.google.com/settings/ads?hl=en&sig=ACi0TCgWymel0CNWxdcnEWPzWNs9wDd7cVQHxHsmtz4w30CAyHk7MqyzzZdGh3m6FpDaJsKmunTLEvJZY5LAm3h6gIdzE30L-Q
    There are 2 columns. The left one "ADS ON GOOGLE" NEVER RETAINS AFTER LOG-OFF. The right column "Google ads across the web
    " seems to retain sometimes - if I remember right it falls off after a period of time as opposed to after just LOGGING-OFF. Below the columns there are options, but I don't have a GOOGLE ACCOUNT.
    Also down there is this link: https://support.google.com/adsense/troubleshooter/1631343?hl=en ...you see the box with this: Advertising industry program participation
    Google is a participating member of groups that have developed industry privacy standards like the Ad-Choices icon for online advertising.
    Group Location
    Network Advertising Initiative United States
    Digital Advertising Alliance (DAA) United States
    European Digital Advertising Alliance Europe
    Digital Advertising Alliance of Canada Canada
    ....I clicked OPTED OUT FOR NAI on their link http://www.networkadvertising.org/
    ...I clicked OPTED OUT FOR DAA on their link http://www.aboutads.info/
    ...I clicked PROTECT MY CHOICES and downloaded the app.
    These 1st 2 links used to have the same trouble and didn't retain ANYTHING and wouldn't re OPT-OUT ANY UNTIL THEY WERE SATIATED - saying I didn't have 3rd party cookies allowed when I did - this took hours.
    I sent numerous trouble reports to them that they ignored - then I think I sent one to Firefox and it is much better but still not completely right. Today DAA retains 106 out of 122 and if I repeatedly RE-OPT-OUT successively I can get it to 121 out of 122 - never completely. (currently the one not taking is Accuen Inc. but it changes periodically - makes me think they set one up to take my info and then share it with all of them - lol )
    Same for NAI currently I started with 94 out of 96 - next re-OPTED-OUT got it to 95 out of 96 and no further and same co. Accuen Inc (accuenmedia.com ) wouldn't update.
    NOTE: I was copy/pasting the list of NON-OPT-OUT'S to them and my own document file to try and find trends/problems...now NAI programmers protected the list from being able to be COPIED AND PASTED!!! That's the opposite of being open and interested in making this work, right? Why would they want to allow us to OPT-OUT of their criminal espionage behavior...RIGHT? (lol) FYI: I recorded that the big one that was always retained before this one was...MEDIA MATH INC.
    MANY Opt-outs would drop off while on-line and ALL would drop-off once logged-off. Now it's retaining most once logged off - but it hasn't been long enough to tell if they'll fall back into their bad habits as they've done before...
    This has been going on forever for me - I've been reporting this malfunction since 2013.
    Of course I downloaded PROTECT MY CHOICES FOR FIREFOX via NAI AND DAA'S links ...http://www.aboutads.info/PMC#protect-your-choices-for-firefox ............they both go to the same place???.....PROTECT MY CHOICES http://www.aboutads.info/plugin/install/firefox....that seems odd...it's as if they are the same entity then. ABOUTADS is DAA'S WEBSITE. NAI'S IS NETWORKADVERTISING.ORG so why would NAI use DAA'S PROTECT MY CHOICES app?
    Lastely, I also requested that the COOKIES NAMES BE UNIFORMLY IDENTIFIABLE. All the OPT-OUT COOKIES that are to be forevermore retained on my computer and that I am to trust the EVERY FUNCTION OF - well they all have different COOKIE NAMES!! Most of the names you can not tell that they are OPT-OUT COOKIES!! - SO NOWWW They have created another problem.
    We can no longer just "DELETE ALL COOKIES".
    PLUS, we can no longer go through our cookies and delete individual ones that snuck through.
    Every one of the OPT-OUT COOKIES SHOULD SAY "OPT-OUT" IWITHIN THEIR NAME OF THEIR COOKIE - PERIOD. RIGHT? (LOL) For real. Why was this mess was allowed?
    REALLY IN MY OPINION THESE COMPANIES SHOULD BE BLOCKED AT THE LOCAL PHONE COMPANIES LEVEL - IN OUR SERVERS. We should not have to deal with them. Same thing with viruses, malware and such beasts. But I digress.
    In summary:
    1.)Google Analytics OPT-OUT Browser Add-on 0.9.6 doesn't retain OPT-OUT settings
    2.) JAVA refuses to create updates for WinXP/FireFox/PaleMoon.
    3.) DAA & NAI still don't retain ALL OPT-OUT settings and never completely OPT-OUT all companies.
    4.) OPT-OUT cookies should be uniformly names with the words OPT-OUT in their titles.
    5.) Ad Block Plus 25.6.7 doesn't work for Pale Moon and there is no alternative - (didn't work great in FireFox)
    Right now I'm mainly interested in #1)retaining my GOOGLE OPT-OUTS while on line AND while logged off since it is attacking my computer and steeling all the speed until it freezes my keyboard.
    Currently I am trying to remember to run through 3. OPT-OUTS every time I log on.
    Thanks so much!

    hello, palemoon's support forums are here: http://forum.palemoon.org/

  • How 2 creat report for displaying the details of a Delivery Document using

    how to create report for displaying the details of a Delivery Document using the tables LIKP, LIPS
    thank you
    regards,
    jagrut bharatkumar shukla
    points will be rewarded

    HI
    I AM GIVING YOU MY DELIVERY DOCUMENT CODE...MODIFY IT ACCORDING TO YOUR REQUIREMENT
    *& Report  ZDELIVERY                                *
    report  zdelivery  message-id z9bhu          .
    types: begin of t_likp,
               vbeln type likp-vbeln,      "Delivery
               erdat type likp-erdat,      "Date for rec creation
    *           LFDAT TYPE LIKP-LFDAT,      "Delevery Date
    *           WAERK TYPE LIKP-WAERK,      "Currency
               kunnr type likp-kunnr,      "Ship-To Party
               kunag type likp-kunag,      "Sold-to party
               traty type likp-traty,      "Means-of-Transport
           end of t_likp.
    types: begin of t_lips,
               vbeln type lips-vbeln,      "Delivery
               posnr type lips-posnr,      "Delivery item
               matnr type lips-matnr,      "Material Number
               arktx type lips-arktx,      "Short Text for Sales Order Item
               lfimg type lips-lfimg,      "Actual quantity delivered
               netpr type lips-netpr,
    *           MEINS TYPE LIPS-MEINS,      "Base Unit of Measure
               vgbel type lips-vgbel,      "Doc no of the reference document
            end of t_lips.
    types: begin of t_vbpa,
               vbeln type vbpa-vbeln,      "SD DocumenT Number
               posnr type vbpa-posnr,      "Item number
               parvw type vbpa-parvw,      "Partner function
               kunnrb type vbpa-kunnr,      "Customer Number 1
           end of t_vbpa.
    types: begin of t_kna1,
               kunnr type kna1-kunnr,      "Customer Number 1
               name1 type kna1-name1,      "Name 1
               ort01 type kna1-ort01,      "City
               adrnr type kna1-adrnr,      "Address
           end of t_kna1.
    types: begin of t_li_vbpa,
               vbeln type likp-vbeln,      "Delivery
               erdat type likp-erdat,      "Date for rec creation
    *           LFDAT TYPE LIKP-LFDAT,      "Delevery Date
    *           WAERK TYPE LIKP-WAERK,      "Currency
               kunnr type likp-kunnr,      "Ship-To Party
               kunag type likp-kunag,      "Sold-to party
               traty type likp-traty,      "Means-of-Transport
               vbeln1 type lips-vbeln,      "Delivery
               posnr type lips-posnr,      "Delivery item
               matnr type lips-matnr,      "Material Number
               arktx type lips-arktx,      "Short Text for Sales Order Item
               lfimg type lips-lfimg,      "Actual quantity delivered
               netpr type lips-netpr,      "Net Price
    *           MEINS TYPE LIPS-MEINS,      "Base Unit of Measure
               vgbel type lips-vgbel,      "Doc no of the reference document
               vbeln3 type vbpa-vbeln,     "SD DocumenT Number
               parvw type vbpa-parvw,      "Partner function
               kunnrb type vbpa-kunnr,      "Customer Number 1
           end of t_li_vbpa.
    types: begin of t_final,
               vbeln type likp-vbeln,      "Delivery
               erdat type likp-erdat,      "Date for rec creation
               kunnr type likp-kunnr,      "Ship-To Party
               kunag type likp-kunag,      "Sold-to party
               traty type likp-traty,      "Means-of-Transport
               vbeln1 type lips-vbeln,      "Delivery
               posnr type lips-posnr,      "Delivery item
               matnr type lips-matnr,      "Material Number
               arktx type lips-arktx,      "Short Text for Sales Order Item
               lfimg type lips-lfimg,      "Actual quantity delivered
               netpr type lips-netpr,      "Net Price
               vgbel type lips-vgbel,      "Doc no of the reference document
               vbeln3 type vbpa-vbeln,     "SD DocumenT Number
               parvw type vbpa-parvw,      "Partner function
               kunnrb type vbpa-kunnr,     "Customer Number 1
               name1 type kna1-name1,      "Name 1
               ort01 type kna1-ort01,      "City
               adrnr1 type kna1-adrnr,     "Address
               name2 type kna1-name1,      "Name 1
               ort02 type kna1-ort01,      "City
               adrnr2 type kna1-adrnr,     "Address
               name3 type kna1-name1,      "Name 1
               ort03 type kna1-ort01,      "City
               adrnr3 type kna1-adrnr,     "Address
           end of t_final.
    *            D A T A  D E C L A R A T I O N
    *&*********Internal Table Declaration****************&*
    data: it_likp type standard table of t_likp.
    data: it_lips type standard table of t_lips.
    data: it_vbpa type standard table of t_vbpa.
    data: it_kna1 type standard table of t_kna1.
    data: it_li_vbpa type standard table of t_li_vbpa.
    data: it_li_vbpa_temp type standard table of t_li_vbpa.
    data: it_final type standard table of t_final.
    *&*********Work Area Declaration********************&*
    data: wa_likp type t_likp.
    data: wa_lips type t_lips.
    data: wa_vbpa type t_vbpa.
    data: wa_kna1 type t_kna1.
    data: wa_li_vbpa type t_li_vbpa.
    data: wa_li_vbpa_temp type t_li_vbpa.
    data: wa_final type t_final.
    *&*********Data Declaration************************&*
    data: d_vbeln type likp-vbeln.
    data: flag type i value 0.
    *           S E L E C T I O N  S C R E E N   D E C L A R A T I O N
    selection-screen begin of block block2 with frame title text-001.
    select-options: s_vbeln for d_vbeln obligatory.    "Delivery no
    selection-screen end of block block2.
    *            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.
    *PERFORM VALIDATE_DATA.
    *            S T A R T   O F  S E L E C T I O N     E V E N T S
    start-of-selection.
    perform fetch_data.
    perform merge_data_kna1.
    *INCLUDE Z9BT_SH_***4_FORMS.
    call function 'OPEN_FORM'
    exporting
    *   APPLICATION                       = 'TX'
    *   ARCHIVE_INDEX                     =
    *   ARCHIVE_PARAMS                    =
        device                            = 'PRINTER'
    *   DIALOG                            = 'X'
    *   FORM                              = ' '
       language                          = sy-langu
    *   OPTIONS                           =
    *   MAIL_SENDER                       =
    *   MAIL_RECIPIENT                    =
    *   MAIL_APPL_OBJECT                  =
    *   RAW_DATA_INTERFACE                = '*'
    *   SPONUMIV                          =
    * IMPORTING
    *   LANGUAGE                          =
    *   NEW_ARCHIVE_PARAMS                =
    *   RESULT                            =
    exceptions
       canceled                          = 1
       device                            = 2
       form                              = 3
       options                           = 4
       unclosed                          = 5
       mail_options                      = 6
       archive_error                     = 7
       invalid_fax_number                = 8
       more_params_needed_in_batch       = 9
       spool_error                       = 10
       codepage                          = 11
       others                            = 12
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    sort it_final by vbeln.
    loop at it_final into wa_final.
    call function 'START_FORM'
    exporting
    *   ARCHIVE_INDEX          =
       form                   = 'Z9BT_DELIVERY'
       language               = sy-langu
    *   STARTPAGE              = ' '
    *   PROGRAM                = ' '
    *   MAIL_APPL_OBJECT       =
    * IMPORTING
    *   LANGUAGE               =
    exceptions
       form                   = 1
       format                 = 2
       unended                = 3
       unopened               = 4
       unused                 = 5
       spool_error            = 6
       codepage               = 7
       others                 = 8
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function 'WRITE_FORM'
    exporting
       element                        = 'ITEM_LIST'
       function                       = 'SET'
       type                           = 'BODY'
       window                         = 'MAIN'
    * IMPORTING
    *   PENDING_LINES                  =
    * EXCEPTIONS
    *   ELEMENT                        = 1
    *   FUNCTION                       = 2
    *   TYPE                           = 3
    *   UNOPENED                       = 4
    *   UNSTARTED                      = 5
    *   WINDOW                         = 6
    *   BAD_PAGEFORMAT_FOR_PRINT       = 7
    *   SPOOL_ERROR                    = 8
    *   CODEPAGE                       = 9
    *   OTHERS                         = 10
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function 'END_FORM'
    * IMPORTING
    *   RESULT                         =
    exceptions
       unopened                       = 1
       bad_pageformat_for_print       = 2
       spool_error                    = 3
       codepage                       = 4
       others                         = 5
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endloop.
    call function 'CLOSE_FORM'
    * IMPORTING
    *   RESULT                         =
    *   RDI_RESULT                     =
    * TABLES
    *   OTFDATA                        =
    exceptions
       unopened                       = 1
       bad_pageformat_for_print       = 2
       send_error                     = 3
       spool_error                    = 4
       codepage                       = 5
       others                         = 6
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    *&      Form  VALIDATE_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form validate_data .
    select single vbeln into wa_likp-vbeln
                        from likp where vbeln in s_vbeln.
    append wa_likp to it_likp.
    if sy-subrc <> 0.
    flag = 1.
    endif.
    endform.                    " VALIDATE_DATA
    *&      Form  FETCH_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form fetch_data .
    select a~vbeln
           a~erdat
           a~kunnr
           a~kunag
           a~traty
           b~vbeln
           b~posnr
           b~matnr
           b~arktx
           b~lfimg
           b~netpr
           b~vgbel
           c~vbeln
           c~parvw
           c~kunnr
             into table it_li_vbpa
                    from likp as a
                    left outer join lips as b on a~vbeln = b~vbeln
                    inner join vbpa as c on b~vgbel = c~vbeln
                    where a~vbeln in s_vbeln and
                    c~parvw = 'RE'.
    endform.                    " FETCH_DATA
    *&      Form  MERGE_DATA_KNA1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form merge_data_kna1 .
    if it_li_vbpa[] is not initial.
    it_li_vbpa_temp[] = it_li_vbpa[].
    sort it_li_vbpa_temp by kunnr.
    delete adjacent duplicates from it_li_vbpa_temp comparing kunnr.
    loop at it_li_vbpa into wa_li_vbpa.
    read table it_li_vbpa_temp into wa_li_vbpa_temp with key kunnr =
    wa_li_vbpa-kunag.
    if sy-subrc <> 0.
    wa_li_vbpa_temp = wa_li_vbpa.
    append wa_li_vbpa_temp to it_li_vbpa_temp.
    endif.
    read table it_li_vbpa_temp into wa_li_vbpa_temp with key kunnr =
    wa_li_vbpa-kunnrb.
    if sy-subrc <> 0.
    wa_li_vbpa_temp = wa_li_vbpa.
    append wa_li_vbpa_temp to it_li_vbpa_temp.
    endif.
    endloop.
    endif.
    if it_li_vbpa_temp[] is not initial.
    select  kunnr
            name1
            ort01
            adrnr into table it_kna1 from kna1
                        for all entries in it_li_vbpa_temp
                        where kunnr = it_li_vbpa_temp-kunnr.
    endif.
    loop at it_li_vbpa into wa_li_vbpa .
    wa_final-vbeln = wa_li_vbpa-vbeln.
    wa_final-erdat = wa_li_vbpa-erdat.
    *it_final-LFART = it_li_vbpa-LFART.
    wa_final-kunnr = wa_li_vbpa-kunnr.
    wa_final-kunag = wa_li_vbpa-kunag.
    *it_final-VSTEL = it_li_vbpa-VSTEL.
    wa_final-traty = wa_li_vbpa-traty.
    wa_final-vbeln1 = wa_li_vbpa-vbeln.
    wa_final-posnr = wa_li_vbpa-posnr.
    wa_final-matnr = wa_li_vbpa-matnr.
    wa_final-arktx = wa_li_vbpa-arktx.
    wa_final-lfimg = wa_li_vbpa-lfimg.
    wa_final-netpr = wa_li_vbpa-netpr.
    *wa_final-GEWEI = it_li_vbpa-GEWEI.
    *it_final-VOLUM = it_li_vbpa-VOLUM.
    *it_final-VOLEH = it_li_vbpa-VOLEH.
    wa_final-vgbel = wa_li_vbpa-vgbel.
    wa_final-vbeln3 = wa_li_vbpa-vbeln.
    *wa_final-PARVW = wa_li_vbpa-PARVW.
    wa_final-kunnrb = wa_li_vbpa-kunnrb.
    read table it_kna1 into wa_kna1 with key kunnr = wa_li_vbpa-kunnr.
    if sy-subrc = 0.
    wa_final-name1 = wa_kna1-name1.
    wa_final-ort01 = wa_kna1-ort01.
    wa_final-adrnr1 = wa_kna1-adrnr.
    endif.
    read table it_kna1 into wa_kna1 with key kunnr = wa_li_vbpa-kunag.
    if sy-subrc = 0.
    wa_final-name2 = wa_kna1-name1.
    wa_final-ort02 = wa_kna1-ort01.
    wa_final-adrnr2 = wa_kna1-adrnr.
    endif.
    read table it_kna1 into wa_kna1 with key kunnr = wa_li_vbpa-kunnrb.
    if sy-subrc = 0.
    wa_final-name3 = wa_kna1-name1.
    wa_final-ort03 = wa_kna1-ort01.
    wa_final-adrnr3 = wa_kna1-adrnr.
    endif.
    append wa_final to it_final.
    clear wa_final.
    endloop.
    endform.

  • Can i create mcx for shut down properly mac when battery is less 5 %

    Hi hello
    Can i create mcx for shut down properly mac when battery is less 5 % ?
    Thanks for your reply

    You can create a mailing list by using the "Groups" feature of Address Book. Simply select "New Group" from the File menu. Name the group, and drag the contacts you need into the group.
    In Mail, open up Preferences (under the Mail menu), and click on "Composing". Then make sure that "When sending to a group, show all member addresses" is unchecked.
    The auto reply is a feature that is better done on your mail server, as you Mac can only send an auto reply when it is on, with the Mail application open. If you use dot Mac, you can set up a vacation responder through the web, and you can leave your computer switched off.
    If you really want to leave your Mac on when you are on holiday, you can set up a mail rule (Preferences, Rules).

  • API or interface table to create releases for a blanket purchase agreement

    Hi
    I need to know if Oracle provides a standard API or interface table to create releases for a blanket purchase agreement.
    I tried using the release_num field in PO_HEADERS_INTERFACE, PO_LINES_INTERFACE. But this is not working.
    I'm able to create the blanket purchase agreement using the open interfaces, but not the releases.
    Regards,
    Alister

    Hi Alister,
    You can't create a release of a BPA through API, there is no such APIs provided by oracle.
    Where as you can create a BPA by using API. You need to dump/poplulate data in PO_headers_interface & PO_Lines_intreface table.. Then use Purchasing Documents Open Interface API to create a BPA.
    Regards,
    S.P DASH

  • Inspection lot should be created only for particular vendor

    Hi
    Can anyone please help in achieving the below scenario:
    *Material  has been assigned to the inspection type A (one time inspection) has been set as preffered and active  in the inspection set up in the material master.
    *Quality level has been created for material and vendor  such that inspection should be carried out when next stage is 1 and no inspection should carried out when next stage is 2.
    *Tasklist   has been assigned with material and vendor .
    Material can be supplied by different vendors,For this material,  inspection should be done only for one vendor  and for other vendors there should  not be any inspection to be done and no inspection lot should be created.i.e Inspection lot should be created only for one vendor say AA whereas now inspection lot is getting created when  goods receipt is done for the purchase order  with other vendor BB.
    My requirement is  the inspection lot should not be created when goods receipt is done with other vendors say BB  except AA.
    Is there any other way other than using quality info record to achieve this.
    I can try with DMR  but the thing is there should not be inspection lot created  while posting GR.
    can anyone suggest me any other way to achieve this requirement.

    There are user exits when you create an inspection lot.  One of those could be used to suppress the inspection lot.  Have you looked at these?  Have you researched any QM user exits yourself yet?  This isn't the first time this specific question has been asked over the years.
    It's not hard and there are lists of QM user exits available all over the internet.
    Please do some research.
    You can also assign vendors to inspection plans with a DMR that requires one inspection, and than after that creates all skip lot inspections which you automatically close by a batch job.  The first lot can be manually forced closed.  Thereaftter all receipts would be skipped.  Not 100% but pretty darn close.  This requires that you know which vendors to assign to which plan.  Probably as much data maintenance as maintaing the Q-info records.
    And yes.. your client needs to come up with better reasons than "I don't wanna..".  It's part of a consultants job to convince them.
    Craig

  • MRP  supplier consignment create delivery for  Scheduling Agreement

    Hello,
    We have a situation where MRP is used to calculate for a material which is subject to supplier consignment and also to scheduling agreement. When we run the MRP generates purchase requisitions for the consignment material , but it does not find the scheduling agreement for the material. We expected that it would create deliveries for the scheduling agreement.
    The question is, is it possible to obtain deliveries from the MRP for the scheduling agreement?
    Thanks a lot
    Ignasi

    Yes, it seems the problem was in Quota Arrangements which was not  well defined for consignment material.
    Thanks.

  • Excise Invoice created twice for same billing document.

    Hi All
    Excise Invoice ( J1IIN ) has been created twice for same billing document in 1 or 2 cases.
    How is this possible,if possible what is the config  to restrict the same.
    Thanks in advance
    Samson

    I dont think its possible to EI twice wrt: single billing document.
    EI created wrt: Invoice which is created wrt: Delivery document. Then there will be only one material document with movement type 601. Through which qty will get updated in Rg1 register.
    This document once utilized, cant used again.
    re-check billing document, which billing document you are using & their settings in IMG.
    Regards,
    Reazuddin MD

Maybe you are looking for

  • How do I use the WriteToMemoryXX functions in a CIN?

    I'm getting a linker error "unresolved external reference _WriteToMemory16" when I compile the C code that contains the calls to the WriteToMemory16 function. I've installed the accesshw files and am including the accesshw.h file in my C-code CIN. It

  • Desktop will not load, stuck on blue screen -- please help!

    As I can see, many other Mac users have encountered the same problem that I now have: the dreaded ‘blue screen of death’. About a week ago, any internet browser that I tried to open (Safari, Firefox) would freeze after loading its home page, and tell

  • Need to access a context_node in an another view of the same component

    Hi experts, I need to access a context_node which is not in my view but it exist in an another view of the same component. The component is ICCMP_BP_DETAIL. i need the context_node "CUSTOMER" from the view Bupadetail to view Bupacreate. so that i can

  • Problems setting up multilevel categorization in 7.0

    Hello Gurus! I used the category schema in 4.0 a couple of years ago, and now I am assigned on a 7.0 project. I am trying to set up multilevel categorization for case management (Trying to deactivate some developlments and go back to standard) but th

  • Using BLOBs in Delphi

    Hi, when i want to active a table in delphi that contains a BLOB field, it through an exception with message like 'Field Type not supported' How can I show an image saved in Oracle database with Delphi (version 7) plz add codes if u can...