Using JOptionPane to exit program & Using toString method

Hello,
In my program I have to use a toString method below
public String toString(Hw1NCBEmployee[] e)
        String returnMe = String.format(getStoreName() + "\n" + getStoreAddress() + "\n" + getCityState() +  "\nYou have " + getEmpCount() + "employee(s)");
        return returnMe;
}Now, at first, when I initially tested my code, it was working just fine, printing out the right way
Point is -- now that Im practically finished with my program, and am going back and running it - calling the toString method gives me the address rather than the information . . . Can anyone help me with this issue??
Also, Im using JOptionPane to display everything, but -- at first, it worked fine, then (around the same time I started having the above problem) it stopped exiting the do-while loop:
while(go)
             int option = JOptionPane.showConfirmDialog(null, "Do you want to enter employee information?", "Welcome!", JOptionPane.YES_NO_OPTION);
                 if(option == JOptionPane.NO_OPTION)
                    go = false;  //exit loop
        

ncjb wrote:
well, for the toString - I have to print out the info inside the array -- am I right in thinking that the only way to do this is to pass in the array ??If the array is part of the class then there is no need to pass it as a parameter. If it is being passed in from outside the class then I have to question your design. Why should class X being formatting data that is not a representation of itself?
and i have 2 other files that go with this program . . . I just want to know if there is a way to make sure that when the user presses the NO option, it will exit the loop -- the piece of code you see if apart of an entire method (not long) -- do you want me to include this??You read that link I provided REAL quick!

Similar Messages

  • Exiting programs using the escape key

    My team and I are design games for autistic children. One of the problems we are having is that we do not know how to quit the application using the escape key. Our team would really appreciate it if you could tell us how this is done.

    Quick example:
    import java.awt.event.*;
    import javax.swing.*;
    public class ExitOnEscape extends JFrame
        public ExitOnEscape()
            setSize(300, 300);
            addKeyListener(new KeyAdapter()
                public void keyPressed(KeyEvent e)
                    int key = e.getKeyCode();
                    if(key == KeyEvent.VK_ESCAPE)
                        System.exit(0);
            setVisible(true);
        public static void main(String[] args)
            new ExitOnEscape();
    }

  • Is there a tool that could export objects used in a report program?

    Hello Experts,
    I'm new in ABAP programming, recently my team members wanted to find a tool in the SAP system, which could export a list of objects that used in a report program. For example, I want to figure out what function modules and classes are used in a report program, using the tool, I could get a list that have the name of the modules and classed used and even source code of them.
    The function of the tool acts like 'where-used list' showed in the SAP system, but the differences is I do not have to type the name of the objects. The tool is just focus on the specific report program and list the name and source code of the objects used in that report program.
    Hope I explain this clearly.
    Is SAP system has such tools? Please give me some hints on this.
    Thanks you all for the time and help in advance.

    Hi Anna,
    Welcome to ABAP world,
    Check this link
    How to identify various objects used in code
    hope this is useful to you.
    and also seach in the SCN you will find more.
    Regards!

  • Problem Using toString method from a different class

    Hi,
    I can not get the toString method to work from another class.
    // First Class Separate file MyClass1.java
    public class MyClass1 {
         private long num1;
         private double num2;
       public MyClass1 (long num1, double num2) throws OneException, AnotherException {
            // Some Code Here...
        // Override the toString() method
       public String toString() {
            return "Number 1: " + num1+ " Number 2:" + num2 + ".";
    // Second Class Separate file MyClass2.java
    public class MyClass2 {
        public static void main(String[] args) {
            try {
               MyClass1 myobject = new MyClass1(3456789, 150000);
               System.out.println(myobject);
             } catch (OneException e) {
                  System.out.println(e.getMessage());
             } catch (AnotherException e) {
                  System.out.println(e.getMessage());
    }My problem is with the System.out.println(myobject);
    If I leave it this way it displays. Number 1: 0 Number 2: 0
    If I change the toSting method to accept the parameters like so..
    public String toString(long num1, double num2) {
          return "Number 1: " + num1 + " Number 2:" + num2 + ".";
       }Then the program will print out the name of the class with some garbage after it MyClass1@fabe9. What am I doing wrong?
    The desired output is:
    "Number 1: 3456789 Number 2: 150000."
    Thanks a lot in advance for any advice.

    Well here is the entire code. All that MyClass1 did was check the numbers and then throw an error if one was too high or too low.
    // First Class Separate file MyClass1.java public class MyClass1 {
         private long num1;
         private double num2;
         public MyClass1 (long num1, double num2) throws OneException, AnotherException {              
         // Check num2 to see if it is greater than 200,000
         if (num2 < 10000) {
                throw new OneException("ERROR!:  " +num2 + " is too low!");
         // Check num2 to see if it is greater than 200,000
         if (num2 > 200000) {
                throw new AnotherException ("ERROR!:  " +num2 + " is too high!");
         // Override the toString() method
         public String toString() {
              return "Number 1: " + num1+ " Number 2:" + num2 + ".";    
    // Second Class Separate file MyClass2.java
    public class MyClass2 {
        // Main method where the program begins.
        public static void main(String[] args) {
            // Instantiate first MyClass object.
            try {
               MyClass1 myobject = new MyClass1 (3456789, 150000);
               // if successful use MyClass1 toString() method.
               System.out.println(myobject);
                         // Catch the exceptions within the main method and print appropriate
                         // error messages.
             } catch (OneException e) {
                  System.out.println(e.getMessage());
             } catch (AnotherException e) {
                  System.out.println(e.getMessage());
             }I am not sure what is buggy. Everything else is working fine.

  • How to know the tcodes/programs that uses a user exit

    Hi, anybody knows given the user exit (function module) how will i know the tcodes/programs that uses it? the where used list doesn't return any.

    Hi,
      You will find the enhancement for the exit EXIT_SAPLCOZF_001 ,go to se11>enetr MODSAP Table name in Memeber postion you can enter your function module name EXIT_SAPLCOZF_001>now you will get the enhancement COZF0001 (trx SMOD)
    yOU will find whre the exit is called from the t.code Try this method:
    All exits have the program name as part of their own name, for eg, EXIT_SAPLCOZF_001. In this, SAPLCOZF is the program that the exit is called in, you can use this program name and search for transaction codes related to the program (in SE93).
    The only hitch in the above method is when the program name is a function group program name (SAPL*), in which case you will have to drill down into the function group to find the corresponding tcode.
    Or
    Go to SMOD transaction.
    Enter the Enhancement Name in SMOD.
    Open in Display mode.
    Now get the package name from the window.
    Now go to transaction SE80.
    Choose package from the listbox
    and enter the package name.
    Now it will display the list of Transactions associated with the project.
    Regards
    Kiran Sure

  • How to use subroutine in user-exit program

    Hi Experts,
        I have a requirement in user-exit where i have to use some lines of code in several times. So i want to use Perform and perform inside the exit (i.e. Include ZXXX). But it is not recognizing the form part of the ubroutime and gives error.
                 Please let me know how to use the Perform and form statement in the exit or is there any way to  write repeated code once but used no of times in exit program.
    Thanks
    Ajit

    I'm sorry, I was overly harsh there. Please accept my apologies.  But I do despair sometime!
    Consider the structure of a function group and it should be clear - you need to remember that INCLUDES are just repositories of code. If you take the contents out of the include and put them into the main program, then this is what you get:
    function-pool xrsr.        
    * Global data definition.
    function exit_saplrrs0_001.
    * the source code within the zxrsru01 include.
    endfunction.
    Now, what you're trying to do, is create a form in your include. You can't do that, because you end up with:
    function-pool xrsr.        
    * Global data definition.
    function exit_saplrrs0_001.
      perform xyz.
      form xyz.
      endform.
    endfunction.
    And you can't have a FORM defined inside a function module definition. The solution is to put it outside the function module. If you follow the process suggested above, you end up with
    function-pool xrsr.        
    * Global data definition.
    function exit_saplrrs0_001.
      perform xyz.
    endfunction.
    form xyz. " This will be in LXRSRF01
    endform.
    Do you see how it works now?

  • Exiting programs that have use the fullscreen exclusive mode

    I have lots of problems, this is one of them:
    When making a program that uses fullscreen mode, the program does not exit by itself when it comes to the end of the program. In fact the only way I can get it to exit is through System.exit(0);
    And I don't want to use that for numerous reasons.
    try
    gd.setFullScreenWindow(jw);
    gd.setDisplayMode(dm[theDisplayMode]);
    finally
    gd.setDisplayMode(oldDisplayMode);
    gd.setFullScreenWindow(null);
    end of program......
              }

    I have lots of problems, this is one of them:
    When making a program that uses fullscreen mode, the program does not exit by itself when it comes to the end of the program. In fact the only way I can get it to exit is through System.exit(0);
    And I don't want to use that for numerous reasons.
    try
    gd.setFullScreenWindow(jw);
    gd.setDisplayMode(dm[theDisplayMode]);
    finally
    gd.setDisplayMode(oldDisplayMode);
    gd.setFullScreenWindow(null);
    end of program......
              }

  • Using a toString() method to round decimals

    I've been working on this project for school, building a class which models cartesian coordinates and can also convert them to polar coordinates. After much work I have a working product with some time to spare. Theres a small amount of extra credit to be gained if i can use toString() methods to manipulate my results to be exactly to two decimal places.
    I've been looking at the api documentation, which is what my teacher suggested, but its a little tough for a rookie like me to wade through. A point in the right direction or any help would be greatly apreciated.
    Thanks in advance

    I understand, I just dont want yall to feel like youre doing all the work for me.
    Anyways i searched google and using what i saw on this site
    http://www.particle.kth.se/~lindsey/JavaCourse/Book/Part1/Tech/Chapter05/decimalFormat.html
    adapted what i could to my class and came up with this
    String fmt = "0.00";
      DecimalFormat df = new DecimalFormat( fmt );
      String str_x = df.format(x);
      String str_y = df.format(y);
      public String toString()
        return "( " + str_x + ", " + str_y + " )";
      }x and y are the instance variables im using for my class: Coord
    when i try to compile i get these two error messages:
    Coord.java:133: cannot find symbol
    symbol : class DecimalFormat
    location: class Coord
    DecimalFormat df = new DecimalFormat( fmt );
    ^
    Coord.java:133: cannot find symbol
    symbol : class DecimalFormat
    location: class Coord
    DecimalFormat df = new DecimalFormat( fmt );
    ^
    I assume these errors mean my syntax is off but hopefully im headed in the right direction.

  • How to get the program where the User exit is use

    Hi,
       Could anyone let me know how to get the program which is using the user exit
    EXIT_SAPLFMR4_002 .
    Thank you.
    Donny~

    You can do a where used on the functino module EXIT_SAPLFMR4_002 in SE37.
    In this case, you user exit is called from a function module FMRE_FI_BELEG_CHECK.  Which in my system, doesn't appear to be called directly. It could be called dynamically.
    Regards,
    RichHeilman

  • Using JOptionPane.showInputDialog to return an integer

    I am currently using JOptionPane to return a string from the Object array i made with all possible choices.
         private static boolean determineService(){
              JLabel label;
              label=new JLabel("Please select which Service Model to use.",JLabel.CENTER);
              Object[] possibilities = {"AddressCleanse", "VIN", "PostalCode"};
              serviceModel = (String)JOptionPane.showInputDialog(
                                  null,
                                  label,
                                  "Select Service",
                                  JOptionPane.PLAIN_MESSAGE,null,
                                  possibilities,
                                  "AddressCleanse");
    //          If a string was returned, say so.
              if ((serviceModel != null) && (serviceModel.length() > 0)) {
                  System.out.println("You've selected " + serviceModel + "!");
                  setVariables();
                  return true;
              }else{
    //               If you're here, the return value was null/empty.
                   System.out.println("Null or Bad service selected!\n Exiting program.");
                   return false;
              }I would like to instead return the response as an integr so I can then use a switch, rather than recursive if, else if logic.
    Apparently java doesnt allow switches to use strings (like PHP does)
    any ideas?

    Just a question more than an answer: would using a hashmap ever work here? where the key is a string and the value is an (???) object that implements an interface that would allow you to call an appropriate method? Perhaps one could use the keySet() and toArray to build the Object array for the JOptionPane. I thought I read something about this somewhere, but am not sure....

  • Module Pool Programming using Abap Objects

    Hi gurus.,
    I need to create a module pool program with tabstrips and tablecontrols using Abap objects...plz guide me how i can achieve this... i am very much confused.. i dont know how and where to start .. plz send me documents and sample codes related to this topic..Also hoe i can implement f4 help in screen fields.. plz help me with Sample Code....
    Regards.,
    S.Sivakumar

    Hi Marcelo Ramos.,
         here is my code without using WebLOg ..
    PROGRAM  ZACR018_BOXKOD                          .
           TABLES DECLARATION
    TABLES: ZACT02_BOXKOD, ZACS018_STR, MARA.
    CONTROLS TABC TYPE TABLEVIEW USING SCREEN 102.
           END OF TABLES DECLARATION
    DEFINE DYN_DECLARE_CREATE.
    DATA: &1 TYPE REF TO &2.
    CREATE OBJECT &1.
    END-OF-DEFINITION.
    CONSTANTS C_WERKS TYPE WERKS_D VALUE '7600'.
    CONSTANTS C_REPID TYPE SY-REPID VALUE SY-REPID.
    CONSTANTS C_VERID TYPE VERID VALUE '0001'.
    CONSTANTS C_MDV01 TYPE MDV01 VALUE 'F3LB02'.
    CLASS CL_TABLE_CONTROL DEFINITION.
    PUBLIC SECTION.
    CLASS-DATA: IT_C_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
    CLASS-DATA: WA_DISPLAY TYPE ZACS018_STR.
    CLASS-DATA: WA_COLS LIKE LINE OF TABC-COLS.
    CLASS-METHODS M1 IMPORTING WA_C_DISPLAY TYPE ZACS018_STR EXPORTING ZACS018_STR_C TYPE ZACS018_STR.
    CLASS-METHODS M2 IMPORTING ZACS018_STR_C TYPE ZACS018_STR CHANGING  IT_C_DISPLAY LIKE IT_C_DISPLAY.
    CLASS-METHODS M3 IMPORTING SAVE_OK TYPE SY-UCOMM CHANGING C_TABC TYPE CX_TABLEVIEW.
    CLASS-METHODS M4 IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                               PATTERNSLNO    TYPE ZACT02_BOXKOD-PATTERNSLNO
                               SAVE_OK TYPE SY-UCOMM
                               CHANGING C_TABC TYPE CX_TABLEVIEW.
    ENDCLASS.
    CLASS CL_TABLE_CONTROL IMPLEMENTATION.
    METHOD M1.
    ZACS018_STR_C = WA_C_DISPLAY.
    ENDMETHOD.
    METHOD M2.
    DESCRIBE TABLE IT_C_DISPLAY.
    IF TABC-CURRENT_LINE > SY-TFILL.
        APPEND ZACS018_STR_C TO IT_C_DISPLAY.
    ELSE.
        MODIFY IT_C_DISPLAY FROM ZACS018_STR_C INDEX TABC-CURRENT_LINE.
    ENDIF.
    ENDMETHOD.
    METHOD M3.
    IF SAVE_OK = 'CHECK'.
    LOOP AT C_TABC-COLS INTO WA_COLS.
    IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
    WA_COLS-SCREEN-INPUT = 0.
    MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
    ENDIF.
    ENDLOOP.
    ELSE.
    LOOP AT C_TABC-COLS INTO WA_COLS.
    IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
    WA_COLS-SCREEN-INPUT = 1.
    MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDMETHOD.
    METHOD M4.
    IF MASTER_PATTERN IS INITIAL OR PATTERNSLNO  IS INITIAL.
    LOOP AT C_TABC-COLS INTO WA_COLS.
    IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
    WA_COLS-SCREEN-INPUT = 0.
    MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
    ENDIF.
    ENDLOOP.
    ELSE.
    IF SAVE_OK NE 'CHECK'.
    LOOP AT C_TABC-COLS INTO WA_COLS.
    IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
    WA_COLS-SCREEN-INPUT = 1.
    MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    ENDCLASS.
    INTERFACE I_DATA.
    DATA: WA_MARA TYPE MARA.
    DATA: WA_MARC TYPE MARC.
    DATA: WA_MAST TYPE MAST.
    DATA: WA_STKO TYPE STKO.
    DATA: WA_MKAL TYPE MKAL.
    DATA: IT_STPOX TYPE STANDARD TABLE OF STPOX.
    DATA: WA_STPOX TYPE STPOX.
    DATA: WA_ZACT02_BOXKOD TYPE ZACT02_BOXKOD.
    DATA: IT_C_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
    DATA: IT_SORT_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
    DATA: WA_DISPLAY TYPE ZACS018_STR.
    DATA: W_YIELD(5)  TYPE P DECIMALS 2.
    METHODS PARTNO_VAL IMPORTING PARTCODE TYPE ZACS018_STR-PARTCODE.
    METHODS MAINBI_VAL IMPORTING MAINB    TYPE ZACS018_STR-MAINB.
    METHODS CAVITY_VAL IMPORTING CAVITY   TYPE ZACS018_STR-CAVITY.
    METHODS GET_COMP_WT IMPORTING PARTCODE TYPE ZACS018_STR-PARTCODE EXPORTING GROSSWT TYPE ZACS018_STR-GROSSWT.
    METHODS NETWT_VAL IMPORTING NETWT TYPE ZACS018_STR-NETWT GROSSWT TYPE ZACS018_STR-GROSSWT.
    METHODS MASPAT_VAL IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN.
    METHODS PATSLNO_VAL IMPORTING PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                                  MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN .
    METHODS MAX_REF EXPORTING VERSNO TYPE ZACT02_BOXKOD-VERSNO.
    METHODS NOOFBOX_VAL IMPORTING BMSCH TYPE ZACT02_BOXKOD-BMSCH.
    METHODS TOTTIME_VAL IMPORTING VGW01 TYPE ZACT02_BOXKOD-VGW01.
    METHODS TOTRUNWT IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY
                     EXPORTING W_SUM_RUNWT LIKE ZACS018_STR-NETWT.
    METHODS TOTCOMP_WT  IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY
                        EXPORTING W_SUM_COMPWT LIKE ZACS018_STR-NETWT.
    METHODS CHECK_OK IMPORTING SAVE_OK TYPE SY-UCOMM.
    METHODS SCREEN_DISPLAY IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                                     PATTERNSLNO    TYPE ZACT02_BOXKOD-PATTERNSLNO
                                     SAVE_OK TYPE SY-UCOMM.
    METHODS DUP_CHECK IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY.
    METHODS BOX_YLD IMPORTING W_SUM_COMPWT LIKE ZACS018_STR-NETWT
                              W_TOT_WT LIKE ZACS018_STR-NETWT
                    EXPORTING W_YIELD LIKE W_YIELD.
    ENDINTERFACE.
    CLASS CL_CONTROL_EVENTS DEFINITION.
    PUBLIC SECTION.
    CLASS-DATA: C_WERKS TYPE WERKS_D VALUE C_WERKS.
    INTERFACES I_DATA.
    ENDCLASS.
    CLASS CL_CONTROL_EVENTS IMPLEMENTATION.
    METHOD I_DATA~PARTNO_VAL.
    SELECT SINGLE * FROM MARA INTO I_DATA~WA_MARA WHERE MATNR = PARTCODE.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-001 TYPE 'E'.
    ELSE.
    IF I_DATA~WA_MARA-MTART NE 'HALB'.
    MESSAGE TEXT-002 TYPE 'E'.
    ENDIF.
    SELECT SINGLE * FROM MARC INTO I_DATA~WA_MARC WHERE MATNR = PARTCODE AND
                                                 WERKS = C_WERKS.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-003 TYPE 'E'.
    ELSE.
    IF I_DATA~WA_MARC-FEVOR NE 'KOD'.
    MESSAGE TEXT-004 TYPE 'E'.
    ENDIF.
    ENDIF.
    ENDIF.
    SELECT SINGLE * FROM MKAL INTO I_DATA~WA_MKAL WHERE MATNR = PARTCODE AND
                                           WERKS = C_WERKS  AND
                                           VERID = C_VERID  AND
                                           MDV01 = C_MDV01.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-028 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~CAVITY_VAL.
    SET CURSOR FIELD 'ZACS018_STR-CAVITY' LINE SY-STEPL.
    IF CAVITY IS INITIAL.
    MESSAGE TEXT-005 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~MAINBI_VAL.
    SET CURSOR FIELD 'ZACS018_STR-MAINB' LINE SY-STEPL.
    IF MAINB IS INITIAL.
    MESSAGE TEXT-006 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~GET_COMP_WT.
    SET CURSOR FIELD 'ZACS018_STR-PARTCODE' LINE SY-STEPL.
    *SELECT SINGLE MAST~MATNR
                MAST~WERKS
                MAST~STLAL
                STKO~DATUV
                INTO (I_DATAWA_MAST-MATNR,I_DATAWA_MAST-WERKS,I_DATAWA_MAST-STLAL,I_DATAWA_STKO-DATUV)
                FROM MAST AS MAST INNER JOIN STKO AS STKO
                ON STKOSTLNR = MASTSTLNR AND STKOSTLAL = MASTSTLAL
                WHERE  MAST~MATNR = PARTCODE AND
                       STKO~STLST = '1' AND
                       STKO~STLTY = 'M' AND
                       STKO~LKENZ  = '' AND
                       STKO~LOEKZ  = ''.
    SELECT SINGLE * FROM MAST INTO I_DATA~WA_MAST WHERE MATNR = PARTCODE AND
                                                        STLAN = '1' AND
                                                        STLAL = '01' AND
                                                        WERKS = C_WERKS.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-009 TYPE 'E'.
    ENDIF.
    *CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
      PERCENTAGE       = 50
      TEXT             = TEXT-007.
    *WAIT UP TO 2 SECONDS.
    REFRESH I_DATA~IT_STPOX.
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
    EXPORTING
      FTREL                       = 'X'
      ALEKZ                       = ' '
      ALTVO                       = ' '
      AUFSW                       = ' '
      AUMGB                       = ' '
      AUMNG                       = 0
      AUSKZ                       = 'X'
      AMIND                       = ' '
      BAGRP                       = ' '
      BEIKZ                       = ' '
      BESSL                       = ' '
      BGIXO                       = 'X'
      BREMS                       = 'X'
       CAPID                       = 'PP01'
      CHLST                       = ' '
      COSPR                       = ' '
      CUOBJ                       = 000000000000000
      CUOVS                       = 0
      CUOLS                       = ' '
       DATUV                       = SY-DATUM
      DELNL                       = SPACE
      DRLDT                       = ' '
      EHNDL                       = '1'
      EMENG                       = 0
      ERSKZ                       = ' '
      ERSSL                       = ' '
      FBSTP                       = ' '
      KNFBA                       = ' '
      KSBVO                       = ' '
      MBWLS                       = ' '
      MKTLS                       = 'X'
      MDMPS                       = ' '
       MEHRS                       = ' '
      MKMAT                       = ' '
      MMAPS                       = ' '
      SALWW                       = ' '
      SPLWW                       = ' '
       MMORY                       = '0'
       MTNRV                       = PARTCODE
      NLINK                       = ' '
      POSTP                       = ' '
      RNDKZ                       = ' '
      RVREL                       = ' '
      SANFR                       = ' '
      SANIN                       = ' '
      SANKA                       = ' '
      SANKO                       = ' '
      SANVS                       = ' '
      SCHGT                       = ' '
      STKKZ                       = ' '
       STLAL                       = '01'
       STLAN                       = '1'
      STPST                       = 0
      SVWVO                       = 'X'
       WERKS                       = C_WERKS
      NORVL                       = ' '
      MDNOT                       = ' '
      PANOT                       = ' '
      QVERW                       = ' '
      VERID                       = ' '
      VRSVO                       = 'X'
    IMPORTING
      TOPMAT                      =
      DSTST                       =
      TABLES
        STB                         = I_DATA~IT_STPOX
      MATCAT                      =
    EXCEPTIONS
       ALT_NOT_FOUND               = 1
       CALL_INVALID                = 2
       MATERIAL_NOT_FOUND          = 3
       MISSING_AUTHORIZATION       = 4
       NO_BOM_FOUND                = 5
       NO_PLANT_DATA               = 6
       NO_SUITABLE_BOM_FOUND       = 7
       CONVERSION_ERROR            = 8
       OTHERS                      = 9
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT I_DATA~IT_STPOX INTO I_DATA~WA_STPOX.
    SELECT SINGLE FEVOR FROM MARC INTO I_DATA~WA_MARC-FEVOR WHERE MATNR = I_DATA~WA_STPOX-IDNRK AND
                                                           WERKS = I_DATA~WA_STPOX-WERKS AND
                                                           FEVOR = 'MLT'.
    IF SY-SUBRC EQ 0.
    GROSSWT = I_DATA~WA_STPOX-MNGLG.
    EXIT.
    ELSE.
    CLEAR GROSSWT.
    ENDIF.
    ENDLOOP.
    IF GROSSWT IS INITIAL.
    MESSAGE TEXT-008 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~NETWT_VAL.
    SET CURSOR FIELD 'ZACS018_STR-NETWT' LINE SY-STEPL.
    IF NETWT IS INITIAL.
    MESSAGE TEXT-010 TYPE 'E'.
    ELSE.
    IF NETWT >= GROSSWT.
    MESSAGE TEXT-011 TYPE 'E'.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~MASPAT_VAL.
    IF MASTER_PATTERN IS INITIAL.
    MESSAGE TEXT-014 TYPE 'E'.
    ENDIF.
    SELECT SINGLE * FROM MARA INTO I_DATA~WA_MARA WHERE MATNR = MASTER_PATTERN.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-001 TYPE 'E'.
    ELSE.
    IF I_DATA~WA_MARA-MTART NE 'FHMI'.
    MESSAGE TEXT-012 TYPE 'E'.
    ENDIF.
    SELECT SINGLE * FROM MARC INTO I_DATA~WA_MARC WHERE MATNR = MASTER_PATTERN AND
                                                 WERKS = C_WERKS.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-003 TYPE 'E'.
    ELSE.
    IF I_DATA~WA_MARC-FEVOR NE 'MLD'.
    MESSAGE TEXT-013 TYPE 'E'.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~PATSLNO_VAL.
    IF PATTERNSLNO IS INITIAL.
    MESSAGE TEXT-016 TYPE 'E'.
    ENDIF.
    SELECT SINGLE * FROM ZACT02_BOXKOD INTO I_DATA~WA_ZACT02_BOXKOD WHERE MASTER_PATTERN = MASTER_PATTERN
                                                               AND PATTERNSLNO    = PATTERNSLNO.
    IF SY-SUBRC EQ 0.
    MESSAGE TEXT-015 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~MAX_REF.
    SELECT SINGLE MAX( VERSNO ) FROM ZACT02_BOXKOD INTO VERSNO.
    VERSNO = VERSNO + 1.
    ENDMETHOD.
    METHOD I_DATA~NOOFBOX_VAL.
    IF BMSCH IS INITIAL.
    LOOP AT SCREEN.
    IF SCREEN-GROUP2 = 'BOT' AND SCREEN-NAME <> 'ZACT02_BOXKOD-PRD_ACT' AND SCREEN-NAME <> 'ZACT02_BOXKOD-SHOTS'.
    SCREEN-INPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    MESSAGE TEXT-017 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~TOTTIME_VAL.
    IF VGW01 IS INITIAL.
    MESSAGE TEXT-018 TYPE 'E'.
    ENDIF.
    IF VGW01 > 480.
    MESSAGE TEXT-019 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~TOTRUNWT.
    CLEAR W_SUM_RUNWT.
    LOOP AT IT_C_DISPLAY INTO I_DATA~WA_DISPLAY.
    W_SUM_RUNWT = W_SUM_RUNWT + I_DATA~WA_DISPLAY-NETWT * I_DATA~WA_DISPLAY-CAVITY.
    ENDLOOP.
    ENDMETHOD.
    METHOD I_DATA~TOTCOMP_WT.
    CLEAR W_SUM_COMPWT.
    LOOP AT IT_C_DISPLAY INTO I_DATA~WA_DISPLAY.
    W_SUM_COMPWT = W_SUM_COMPWT + I_DATA~WA_DISPLAY-GROSSWT * I_DATA~WA_DISPLAY-CAVITY.
    ENDLOOP.
    ENDMETHOD.
    METHOD I_DATA~CHECK_OK.
    IF SAVE_OK = 'CHECK'.
    LOOP AT SCREEN.
    IF SCREEN-GROUP2 = 'BOT'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ELSE.
    LOOP AT SCREEN.
    IF SCREEN-GROUP2 = 'BOT'.
    SCREEN-INPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~SCREEN_DISPLAY.
    IF MASTER_PATTERN IS INITIAL
    OR PATTERNSLNO IS INITIAL.
    LOOP AT SCREEN.
    IF SCREEN-GROUP2 = 'BOT'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ELSE.
    IF SAVE_OK NE 'CHECK'.
    LOOP AT SCREEN.
    IF SCREEN-GROUP2 = 'BOT'.
    SCREEN-INPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~DUP_CHECK. " IMPORTING IT_C_DISPLAY
    DATA: W_PARTCODE LIKE I_DATA~WA_DISPLAY-PARTCODE.
    I_DATA~IT_SORT_DISPLAY = IT_C_DISPLAY.
    SORT I_DATA~IT_SORT_DISPLAY BY PARTCODE.
    CLEAR W_PARTCODE.
    LOOP AT I_DATA~IT_SORT_DISPLAY INTO I_DATA~WA_DISPLAY.
    IF W_PARTCODE = I_DATA~WA_DISPLAY-PARTCODE.
    MESSAGE TEXT-027 TYPE 'E'.
    ENDIF.
    W_PARTCODE = I_DATA~WA_DISPLAY-PARTCODE.
    ENDLOOP.
    ENDMETHOD.
    METHOD I_DATA~BOX_YLD.
    W_YIELD = ( W_SUM_COMPWT / W_TOT_WT ) * 100.
    ENDMETHOD.
    ENDCLASS.
    inherited class for edit mode
    CLASS CL_CONTROL_EDIT DEFINITION INHERITING FROM CL_CONTROL_EVENTS .
    PUBLIC SECTION.
    METHODS GET_DATA IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                                  PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                     EXPORTING        VERSNO  TYPE ZACT02_BOXKOD-VERSNO
                                  CHANGING ZACT02_BOXKOD TYPE ZACT02_BOXKOD
                                           IT_C_DISPLAY  LIKE I_DATA~IT_C_DISPLAY
                                           IT_DEL_DISPLAY LIKE I_DATA~IT_C_DISPLAY
                                           TABC TYPE CX_TABLEVIEW.
    METHODS PATSLNO_VAL_CHG IMPORTING PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                                  MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN .
    ENDCLASS.
    CLASS CL_CONTROL_EDIT IMPLEMENTATION.
    METHOD GET_DATA.
    IF MASTER_PATTERN IS NOT INITIAL AND PATTERNSLNO IS NOT INITIAL.
    IF IT_C_DISPLAY IS INITIAL.
    IF IT_DEL_DISPLAY IS INITIAL.
    SELECT SINGLE MAX( VERSNO ) FROM ZACT02_BOXKOD INTO VERSNO WHERE
                                     MASTER_PATTERN = MASTER_PATTERN AND
                                     PATTERNSLNO    = PATTERNSLNO.
    SELECT SINGLE * FROM ZACT02_BOXKOD INTO ZACT02_BOXKOD WHERE
       MASTER_PATTERN = MASTER_PATTERN AND
       PATTERNSLNO    = PATTERNSLNO    AND
       VERSNO         = VERSNO..
    SELECT PARTCODE MAINB CAVITY GROSSWT NETWT FROM ZACT02_BOXKOD INTO
                    CORRESPONDING FIELDS OF TABLE IT_C_DISPLAY WHERE
                    MASTER_PATTERN = MASTER_PATTERN AND
                    PATTERNSLNO    = PATTERNSLNO    AND
                    VERSNO         = VERSNO.
    IT_DEL_DISPLAY[] = IT_C_DISPLAY[].
    DESCRIBE TABLE IT_C_DISPLAY.
    TABC-LINES = SY-TFILL.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD PATSLNO_VAL_CHG.
    SELECT SINGLE * FROM ZACT02_BOXKOD INTO I_DATA~WA_ZACT02_BOXKOD WHERE MASTER_PATTERN = MASTER_PATTERN
                                                               AND PATTERNSLNO    = PATTERNSLNO.
    IF PATTERNSLNO IS INITIAL.
    MESSAGE TEXT-016 TYPE 'E'.
    ENDIF.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-022 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    ENDCLASS.
    inheriting for display
    CLASS CL_CONTROL_DISPLAY DEFINITION INHERITING FROM CL_CONTROL_EDIT .
    PUBLIC SECTION.
    METHODS GET_DISPLAY_DATA IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                                       PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                                       VERSNO TYPE ZACT02_BOXKOD-VERSNO
                              CHANGING IT_C_DISPLAY LIKE I_DATA~IT_C_DISPLAY
                                       ZACT02_BOXKOD TYPE ZACT02_BOXKOD
                                       TABC TYPE CX_TABLEVIEW.
    ENDCLASS.
    CLASS CL_CONTROL_DISPLAY IMPLEMENTATION.
    METHOD GET_DISPLAY_DATA.
    SELECT SINGLE * FROM ZACT02_BOXKOD INTO ZACT02_BOXKOD WHERE
       MASTER_PATTERN = MASTER_PATTERN AND
       PATTERNSLNO    = PATTERNSLNO    AND
       VERSNO         = VERSNO..
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-026 TYPE 'E'.
    ENDIF.
    SELECT PARTCODE MAINB CAVITY GROSSWT NETWT FROM ZACT02_BOXKOD INTO
                    CORRESPONDING FIELDS OF TABLE IT_C_DISPLAY WHERE
                    MASTER_PATTERN = MASTER_PATTERN AND
                    PATTERNSLNO    = PATTERNSLNO    AND
                    VERSNO         = VERSNO.
    DESCRIBE TABLE IT_C_DISPLAY.
    TABC-LINES = SY-TFILL.
    ENDMETHOD.
    ENDCLASS.
    DATA: O_CONTROL_EVENTS TYPE REF TO CL_CONTROL_EVENTS.
    DATA: O_CONTROL_EVENTS_EDIT TYPE REF TO CL_CONTROL_EDIT.
    DATA: O_CONTROL_EVENTS_DISPLAY TYPE REF TO CL_CONTROL_DISPLAY.
           SELECTION SCREEN
           END OF SELECTION SCREEN
           VARIABLE DECLARATION         BEGIN WITH W_
    DATA: OK_CODE TYPE SY-UCOMM,
          SAVE_OK TYPE SY-UCOMM.
    DATA: W_TOT_WT LIKE ZACS018_STR-NETWT,
          W_SUM_COMPWT LIKE ZACS018_STR-NETWT,
          W_SUM_RUNWT LIKE ZACS018_STR-NETWT,
          W_YIELD(5)  TYPE P DECIMALS 2.
    DATA: W_TIMLO TYPE SY-TIMLO,
          W_MODE  TYPE SY-UCOMM.
    DATA: W_SCREEN_NO TYPE SY-DYNNR.
           END OF VARIABLE DECLARATION
           WORK AREAS DECLARATION         BEGIN WITH WA_
    DATA: WA_DISPLAY TYPE ZACS018_STR.
           END OF WORK AREAS DECLARATION
           INTERNAL TABLES          BEGIN WITH IT_
    DATA: IT_DISPLAY TYPE ZACS018_STR OCCURS 0.
    DATA: IT_DISPLAY_PRD TYPE ZACS018_STR OCCURS 0.
    DATA: IT_DEL_DISPLAY TYPE ZACS018_STR OCCURS 0.
    DATA: IT_ZACT02_BOXKOD TYPE ZACT02_BOXKOD OCCURS 0 WITH HEADER LINE.
    DATA: IT_ZACT02_BOXKOD_DEL TYPE ZACT02_BOXKOD OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF IT_F4MASTERPAT OCCURS 0,
          MASTER_PATTERN LIKE ZACT02_BOXKOD-MASTER_PATTERN,
          END OF IT_F4MASTERPAT.
    DATA: BEGIN OF IT_F4PATSLNO OCCURS 0,
          MASTER_PATTERN LIKE ZACT02_BOXKOD-MASTER_PATTERN,
          PATTERNSLNO    LIKE ZACT02_BOXKOD-PATTERNSLNO,
          VERSNO         LIKE ZACT02_BOXKOD-VERSNO,
          END OF IT_F4PATSLNO.
    DATA: IT_EXCLUDE TYPE TABLE OF SY-UCOMM..
    DATA : IT_DYNPRO LIKE  DYNPREAD OCCURS 0 WITH HEADER LINE.
           END OF INTERNAL TABLES DECLARATIONS
    LOAD-OF-PROGRAM.
    CREATE OBJECT O_CONTROL_EVENTS.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    SAVE_OK = OK_CODE.
    CLEAR OK_CODE.
    W_MODE = SAVE_OK.
    CASE SAVE_OK.
    WHEN 'CREATE'.
    CALL SCREEN 101.
    WHEN 'CHANGE'.
    CREATE OBJECT O_CONTROL_EVENTS_EDIT.
    CALL SCREEN 101.
    WHEN 'DISPLAY'.
    APPEND 'SAVE'  TO IT_EXCLUDE.
    APPEND 'CHECK' TO IT_EXCLUDE.
    APPEND 'ADD'   TO IT_EXCLUDE.
    CREATE OBJECT O_CONTROL_EVENTS_DISPLAY.
    CALL SCREEN 101.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0102  OUTPUT
          text
    MODULE STATUS_0102 OUTPUT.
    CALL METHOD CL_TABLE_CONTROL=>M3 EXPORTING SAVE_OK = SAVE_OK CHANGING C_TABC = TABC.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~CHECK_OK EXPORTING SAVE_OK = SAVE_OK.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~SCREEN_DISPLAY EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                                     PATTERNSLNO    = ZACT02_BOXKOD-PATTERNSLNO
                                     SAVE_OK = SAVE_OK.
    CALL METHOD CL_TABLE_CONTROL=>M4 EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                                               PATTERNSLNO    = ZACT02_BOXKOD-PATTERNSLNO
                                               SAVE_OK        = SAVE_OK
                                               CHANGING C_TABC = TABC.
    DESCRIBE TABLE IT_DISPLAY.
    IF TABC-LINES <= 1.
    IF SY-TFILL = 0.
    TABC-LINES = 1.
    ENDIF.
    ENDIF.
    IF SAVE_OK NE 'CHECK'.
    IF ZACT02_BOXKOD-TOOL_ACT <> 'X'.
    CLEAR ZACT02_BOXKOD-PRD_ACT.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZACT02_BOXKOD-PRD_ACT'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ELSE.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZACT02_BOXKOD-PRD_ACT'.
    SCREEN-INPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDIF.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTRUNWT EXPORTING IT_C_DISPLAY = IT_DISPLAY
                                           IMPORTING W_SUM_RUNWT = W_SUM_RUNWT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTCOMP_WT  EXPORTING IT_C_DISPLAY = IT_DISPLAY
                                           IMPORTING W_SUM_COMPWT = W_SUM_COMPWT.
    CLEAR W_TOT_WT.
    W_TOT_WT = W_SUM_RUNWT + W_SUM_COMPWT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~BOX_YLD EXPORTING W_SUM_COMPWT = W_SUM_COMPWT
                                               W_TOT_WT = W_TOT_WT
                                                 IMPORTING W_YIELD = W_YIELD.
    IF W_MODE <> 'CREATE'.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZACT02_BOXKOD-SHOTS'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    IF W_MODE = 'DISPLAY'.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ADD' OR SCREEN-NAME = 'ICON_DELETE'.
    SCREEN-INPUT = '0'.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDMODULE.                 " STATUS_0102  OUTPUT
    *&      Module  STATUS_0101  OUTPUT
          text
    MODULE STATUS_0101 OUTPUT.
      SET PF-STATUS 'STANDARD' EXCLUDING 'SAVE'.
      IF W_MODE = 'CREATE'.
      SET TITLEBAR  'STANDARD'.
      ELSEIF W_MODE = 'DISPLAY'.
      SET TITLEBAR  'STD_DIS'.
      ELSE.
      SET TITLEBAR 'STD_EDIT'.
      ENDIF.
      IF SAVE_OK = 'CHECK'.
      DESCRIBE TABLE IT_DISPLAY.
      IF SY-TFILL > 0.
      SET PF-STATUS 'STANDARD'.
      ENDIF.
      ENDIF.
      IF W_MODE = 'DISPLAY'.
      SET PF-STATUS 'STANDARD' EXCLUDING IT_EXCLUDE.
      ENDIF.
    IF ZACT02_BOXKOD-MASTER_PATTERN IS NOT INITIAL AND
       ZACT02_BOXKOD-PATTERNSLNO    IS NOT INITIAL.
    LOOP AT SCREEN.
    IF SCREEN-GROUP1 = 'TOP'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    IF W_MODE = 'DISPLAY'.
    IF ZACT02_BOXKOD-VERSNO IS INITIAL.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZACT02_BOXKOD-VERSNO'.
    SCREEN-INPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ELSE.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZACT02_BOXKOD-VERSNO'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDIF.
    ENDMODULE.                 " STATUS_0101  OUTPUT
    *&      Module  USER_COMMAND_0102  INPUT
          text
    MODULE USER_COMMAND_0102 INPUT.
    SAVE_OK = OK_CODE.
    CLEAR OK_CODE.
    CASE SAVE_OK.
    WHEN 'ADD'.
    DESCRIBE TABLE IT_DISPLAY.
    IF SY-TFILL >= TABC-LINES.
    IF TABC-LINES < 16.
    TABC-LINES = SY-TFILL + 1.
    ENDIF.
    ENDIF.
    WHEN 'DEL'.
    LOOP AT IT_DISPLAY INTO WA_DISPLAY WHERE MARK = 'X'.
    DELETE IT_DISPLAY INDEX SY-TABIX.
    ENDLOOP.
    DESCRIBE TABLE IT_DISPLAY.
    IF SY-TFILL >= 1.
    TABC-LINES = SY-TFILL.
    ELSE.
    TABC-LINES = 1.
    ENDIF.
    WHEN 'CHECK'.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~DUP_CHECK EXPORTING IT_C_DISPLAY = IT_DISPLAY.
    WHEN 'SAVE'.
    W_TIMLO = SY-TIMLO.
    IF W_MODE = 'CREATE'.
    PERFORM CREATE_SAVE.
    ENDIF.
    IF W_MODE = 'CHANGE'.
    PERFORM EDIT_SAVE.
    ENDIF.
    ENDCASE.
    IF W_MODE = 'DISPLAY'.
    SAVE_OK = 'CHECK'.
    ENDIF.
    ENDMODULE.                 " USER_COMMAND_0102  INPUT
    *&      Module  MOD_TABLE  INPUT
          text
    MODULE MOD_TABLE INPUT.
    CALL METHOD CL_TABLE_CONTROL=>M2 EXPORTING ZACS018_STR_C = ZACS018_STR CHANGING IT_C_DISPLAY = IT_DISPLAY.
    ENDMODULE.                 " MOD_TABLE  INPUT
    *&      Module  ASSIGN  OUTPUT
          text
    MODULE ASSIGN OUTPUT.
    CALL METHOD CL_TABLE_CONTROL=>M1 EXPORTING WA_C_DISPLAY = WA_DISPLAY IMPORTING ZACS018_STR_C = ZACS018_STR.
    ENDMODULE.                 " ASSIGN  OUTPUT
    *&      Module  CHK_PARTCODE  INPUT
          text
    MODULE CHK_PARTCODE INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~PARTNO_VAL EXPORTING PARTCODE = ZACS018_STR-PARTCODE.
    ENDMODULE.                 " CHK_PARTCODE  INPUT
    *&      Module  CHK_CAVITY  INPUT
          text
    MODULE CHK_CAVITY INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~CAVITY_VAL EXPORTING CAVITY = ZACS018_STR-CAVITY.
    ENDMODULE.                 " CHK_CAVITY  INPUT
    *&      Module  CHK_MAINB  INPUT
          text
    MODULE CHK_MAINB INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~MAINBI_VAL EXPORTING MAINB = ZACS018_STR-MAINB.
    ENDMODULE.                 " CHK_MAINB  INPUT
    *&      Module  GET_COMP_WT  INPUT
          text
    MODULE GET_COMP_WT INPUT.
    IF W_MODE <> 'DISPLAY'.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~GET_COMP_WT EXPORTING PARTCODE = ZACS018_STR-PARTCODE
                                              IMPORTING GROSSWT  = ZACS018_STR-GROSSWT.
    ENDIF.
    ENDMODULE.                 " GET_COMP_WT  INPUT
    *&      Module  CHK_NETWT  INPUT
          text
    MODULE CHK_NETWT INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~NETWT_VAL EXPORTING NETWT = ZACS018_STR-NETWT
                                                    GROSSWT = ZACS018_STR-GROSSWT.
    ENDMODULE.                 " CHK_NETWT  INPUT
    *&      Module  CHK_MPAT  INPUT
          text
    MODULE CHK_MPAT INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~MASPAT_VAL EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN.
    ENDMODULE.                 " CHK_MPAT  INPUT
    *&      Module  CHK_SLNO  INPUT
          text
    MODULE CHK_SLNO INPUT.
    IF W_MODE = 'CREATE'.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~PATSLNO_VAL EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                                  MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
    ELSEIF W_MODE = 'CHANGE' .
    CALL METHOD O_CONTROL_EVENTS_EDIT->PATSLNO_VAL_CHG EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                                  MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
    CALL METHOD O_CONTROL_EVENTS_EDIT->GET_DATA EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                                  PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                                  IMPORTING VERSNO  = ZACT02_BOXKOD-VERSNO
                                  CHANGING ZACT02_BOXKOD = ZACT02_BOXKOD
                                           IT_C_DISPLAY  =  IT_DISPLAY
                                           IT_DEL_DISPLAY = IT_DEL_DISPLAY
                                           TABC          = TABC.
    ELSE.
    CALL METHOD O_CONTROL_EVENTS_DISPLAY->PATSLNO_VAL_CHG EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                                  MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
    ENDIF.
    ENDMODULE.                 " CHK_SLNO  INPUT
    *&      Module  MAX_VER  INPUT
          text
    MODULE MAX_VER INPUT.
    IF W_MODE = 'CREATE'.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~MAX_REF IMPORTING VERSNO = ZACT02_BOXKOD-VERSNO.
    ENDIF.
    IF W_MODE = 'DISPLAY'.
    IF ZACT02_BOXKOD-VERSNO IS INITIAL.
    MESSAGE TEXT-023 TYPE 'E'.
    ENDIF.
    IF ZACT02_BOXKOD-MASTER_PATTERN IS NOT INITIAL AND
        ZACT02_BOXKOD-PATTERNSLNO IS NOT INITIAL AND
        ZACT02_BOXKOD-VERSNO IS NOT INITIAL.
    CALL METHOD O_CONTROL_EVENTS_DISPLAY->GET_DISPLAY_DATA EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                                  PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                                  VERSNO  = ZACT02_BOXKOD-VERSNO
                                  CHANGING ZACT02_BOXKOD = ZACT02_BOXKOD
                                           IT_C_DISPLAY  =  IT_DISPLAY
                                           TABC          = TABC.
    ENDIF.
    ENDIF.
    ENDMODULE.                 " MAX_VER  INPUT
    *&      Module  CHK_NOBOXES  INPUT
          text
    MODULE CHK_NOBOXES INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~NOOFBOX_VAL EXPORTING BMSCH = ZACT02_BOXKOD-BMSCH.
    ENDMODULE.                 " CHK_NOBOXES  INPUT
    *&      Module  CHK_TOTTIME  INPUT
          text
    MODULE CHK_TOTTIME INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTTIME_VAL EXPORTING VGW01 = ZACT02_BOXKOD-VGW01.
    ENDMODULE.                 " CHK_TOTTIME  INPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'INITIAL'.
      SET TITLEBAR 'STANDARD_MAIN'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  EXIT_PROGRAM  INPUT
          text
    MODULE EXIT_PROGRAM INPUT.
    LEAVE TO TRANSACTION 'ZAC16'.
    ENDMODULE.                 " EXIT_PROGRAM  INPUT

  • Trying to print a list using JOptionPane

    I am very new to Java and programming, so please forgive me if this should be apparent. I wrote a program for school which was for ordering pizzas. I wrote it as a console program and after much frustration it finally worked. Now I am trying to change it to a GUI program using JOptionPane. I was hoping that since I already had the logic written and working, I could focus on the GUI aspect. I was wrong. I want to print a list of enums on a JOptionPane and cannot figure out how to do it My code in the console program was:
    System.out.println("The available crust styles are: ");
         for(Pizza.Style style : Pizza.Style.values())
              System.out.println(style+" ");
    So how can I iterate through the for loop to list all of the styles in the JOptionPane? Do I need to turn it into a method with a return and then cal the method like
    JOptionPane.showMessageDialog(null, crustMethod()); ??

    OP said:
    ... Now I am trying to change it to a GUI program using JOptionPane. I was hoping that since I already had the logic written and working, I could focus on the GUI aspect. I was wrong. ...I wouldn't use JOptionPane. You need JFrame and maybe, but I doubt it, a JDialog. OP, the GUI is more than likely to be nothing more than a form that allows users to set certain properties or fields in a Java class. For example let's say we have this class.
    public class Point
      public int x;
      public int y;
    }Then a GUI for this would be something like a JPanel with two (2) JLabels and two (2) JTextFields. Maybe something like so...
    import java.awt.*;
    import javax.swing.*;
    public class PointGUI extends JPanel
      public JLabel xLabel = new JLabel("Coordinate X:");
      public JLabel yLabel = new JLabel("Coordinate Y:");
      public JTextField xField = new JTextField(4);
      public JTextField yField = new JTextField(4);
      public PointGUI(){
        setLayout(new GridLayout(2, 2));
        add(xLabel);
        add(xField);
        add(yLabel);
        add(yField);
    }Then to run the program...
    import javax.swing.*;
    public class Test
      public static void main(String[] args){
        SwingUtitlities.invokeLater(new Runnable(){
          public void run(){
            PointGUI gui = new PointGUI();
            JFrame f = new JFrame("PointGUI");
            f.getContentPane().add(gui, "Center");
            f.pack();
            f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
            f.setVisible(true);
    }... actually all the program does is display the GUI. But, can you see that the GUI's JLabels and JTextFields describe all the public properties of the Point class? Can you see that the entire GUI can be placed anywhere in a JFrame, or maybe even in a JDialog? From this point on, you can add other functions and features to your classes, GUI's and the main apps that run them.
    A hint on your project, you may need to write a Pizza class that decribes all the things a single pizza can be - then come up with a GUI for that and an app that runs it.

  • Running external program using java

    hi
    i am trying to run an external program using the runtime.exec() method. my problem is that the external program only runs when i press ctrl-c to exit my program. does anyone know how i can execute the external program while my program is still running without having to quit the program?should i be using threads?
    thanks

    As per the api doc exec will be executed as a seperate process
    Process exec(String command) ------Executes the specified string command in a separate process.
    Can you able to share that code what you have written ?

  • Comple errors using JOptionPane

    I'm trying to write a Java program using JOptionPane dialog/display boxes that reads an integer and checks whether it is even using true/false statements. I also want the program must check if the number the user entered is between 1 and 1000.
    I haven't found alot of help in the book I have and i've found some help in another forum but it doesn't seem to compile well, I get the following errors:
    IntegerRead.java:39: cannot find symbol
    symbol : method valueOf(java.lang.String)
    location: class Integer
    int number = Integer.valueOf(s);
    ^
    Integer.java:13: cannot find symbol
    symbol : class Scanner
    location: class Integer
    Scanner input = new Scanner( System.in );
    ^
    Integer.java:13: cannot find symbol
    symbol : class Scanner
    location: class Integer
    Scanner input = new Scanner( System.in );
    Here is the code:
    // Assignment 2.1: IntegerRead.java
    // This program reads an integer, checks if it's even and is between 1 and 1000.
    import javax.swing.JOptionPane; // program uses class JOptionPane
    public class IntegerRead
    public static boolean isNumber(String args)
    if(args.length() > 3)
    throw new IllegalArgumentException("Invalid argument");
    else
    boolean isNumber = false;
    for(int i = 0; i < args.length(); i++)
    char c = args.charAt(i);
    if(Character.isDigit(c))
    isNumber = true;
    else
    isNumber = false;
    return isNumber;
    public static boolean isEven(int aNumber)
    int a = aNumber & 1;
    return (a == 0);
    public static void main(String args[])
    String s = JOptionPane.showInputDialog("Please enter number between 0 to 999");
    System.out.println("Is Number " + isNumber(s));
    if(isNumber(s))
    int number = Integer.valueOf(s);
    System.out.println("Number " + number + "is Even " + isEven(number));
    for(int i = 0; i < 999; i++)
    System.out.println(i + " is " + isEven(i));
    I know i'm missing very simple. I'm new and have tried to build upon what I have so far, but I can't figure it out.
    Thanks....
    Edited by: Scott.Dishman on Jul 9, 2008 4:07 PM

    You have a class named Integer somewhere on your class path. Get rid of it or rename it. If you've already renamed your Integer.java file, you still need to delete the Integer.class file. You should never create your own class that has the same name as a class in the standard java.lang package.

  • How do I find customer exits quickly using SE80,SE81 or other transactions?

    Hello all,
    Is there a way of using SE80 or SE81 or any other transaction for that matter, to quickly find customer or user exists being used within a given program rather than doing a global search for CALL CUSTOMER within the program? Example, transaction EG31 (Installation Full) which runs the program SAPLE30D.
    In SE80 there seem to be no reference to user or customer exits. As for SE81 I was unable to relate SAPLE30D with an application component, or at least I don't know how to do it.
    In the Repository Info System (SE81 also) there is a reference to customer exits, but, you MUST know which project is tied to your program, otherwise you'll be chasing your tail!
    I guess you can say the easiest way would be to do a global search in the program using the CALL CUSTOMER key words.
    Well, I tried that too. The first set of results pointed to INCLUDES which turned out to be empty exits! That is, no code. So, by pure chance and unknowingly, I stumbled upon a customer exit which was the source of my errors. How I did it, I cannot remember. But the problem is that this exit was hidden in a program which was called by SAPLE30D at a later stage.
    So, all this searching took a long time and more importantly, it was a lucky find. Not a methodic approach.
    So the question is: How do I find customer exits quickly using SE80, SE81 or any other transaction for that matter?
    Your help is greatly appreciated.

    edited
    Edited by: abhinay chelamcherla on Feb 24, 2008 9:49 AM

Maybe you are looking for

  • Populating Additional Field in InfoSet Query

    Hello, My team and I are working on generating a relatively simple report from the VBAK (Sales Header), VBAP (Sales Items) and VEDA (Date data) tables.  We would prefer to be able to build an InfoSet (SQ02) and Query (SQ01) instead of writing a custo

  • Different types of Merge seems no difference

    I'm using Toplink 9.0.4.5 From the API doc and some previous posts: Create New Object with relationship with an existing object I understand that shallowMerge will "only merges direct attributes, and does not cascade or merge relationships" I some te

  • User Defined Metric and Notification rules

    I've created a user defined metric to list the age of my backups. My warning is set to 24 hours and my critical threshold is set to 48 hours. The metric is working fine. I want to be alerted if the metric goes critical for e.g.. When I go to Notifica

  • Which Index is better?

    Hi ,     Can u let me know which index on fact table is better for query performance. Is it bit map or bit tree? Also , how to change the type of index on the fact table. Thanks.

  • Got CS6 Master Collection Education Edition as gift, How to get serial?

    I was just given adobe Master Collection as a gift. It's the Education edition which requires a bunch of things, one being "Proof of eligibility" but I'm not a student. Can I still activate my product? I have Boxed product with product code too..I re