Pack and unpack in ABAP objects

can anyone explain me how to pack or unpack a field inside a method which is inside a class.

Hi
See the doc of PACK and UNPACK
PACK source TO destination.
This statement, <b>which is forbidden in classes</b>, converts the content of the data object source to the data type p of length 16 without decimal places. In contrast to the conversion rules for elementary data types, a decimal separator in source is ignored. This assigns the converted content to the data object destination.
The data type of source must be character-type, flat, and its content must be interpretable as a numeric value. The data type of destination must be flat. If destination has the data type p, the interim result is assigned to it from left to right. Surplus characters are cut off on the left, and the decimal places are determined by the data type of destination. If destination does not have the data type p, the interim result is converted to the data type of destination according to the rules in the conversion table for source field type p.
UNPACK source TO destination.
This statement converts the content of the data object source according to a specific rule and assigns the converted content to data object destination. For source, the data type p of length 16 without decimal places is expected. The data type of destination must be character-type and flat.
The conversion is performed according to the following rules:
If the data type of source is not of the type p with length 16 and without decimal places, then the content of source is converted to this data type. Contrary to the rules described in conversion rules for elementary data types, any decimal separator in source is completely ignored.
The digits of the interim result are assigned to data object destination right-aligned and without +/- sign. Any additional places in destination are filled with leading zeros. If the length of destination is not sufficient, the assigned variable is truncated from the left.
Reward points for useful Answers
Regards
Anji

Similar Messages

  • Packing and Unpacking BITS from a SHORT

    Hello everyone,
    I am have six pieces of data packed into a 16bit short value and I am wondering if my code to pack and unpack the short looks right to everyone else. The six smaller values that I am pulling out of the short are of the length (in order) 2+2+3+3+3+3 bits . My approach to unpacking the short is applying a bitmask to isolate just the sub-value I want, then using the bitwise-left shift ( << operator) to move that value to the 0-position in the short, then casting the value to a byte for use in my program. The code to do that looks something like this:
    public final short maskValue1 = Short.parseShort("0000000000000011", 2);
    public final short maskValue2 = Short.parseShort("0000000000001100", 2);
    public final short maskValue3 = Short.parseShort("0000000001110000", 2);
    public final short maskValue4 = Short.parseShort("0000001110000000", 2);
    public final short maskValue5 = Short.parseShort("0001110000000000", 2);
    public final short maskValue6 = Short.parseShort("111000000000000", 2);
         public void unpackEncodedMap(short map, byte[] outMap) {
              outMap[0] = (byte)((map & maskValue1) << 14);
              outMap[1] = (byte)((map & maskValue2) << 12);
              outMap[2] = (byte)((map & maskValue3) << 9);
              outMap[3] = (byte)((map & maskValue4) << 6);
              outMap[4] = (byte)((map & maskValue5) << 3);
              outMap[5] = (byte)(map & maskValue6);
    The approach I use to encode the short value involves taking my input byte array and casting each into a short. Then I use the bitwise-right shift operator ( >> ) to move the bit value into the appropriate position. To apply the next byte-value I bitwise-OR the previous value onto the new mask. The values in the byte-array are assured not to be greater then their sub-value bit lengths ... so the downcast is all right. Here is my code to do the packing:
         public short encodeMap(byte[] mymap) {
              short out = (short)(((short)mymap[0]) >> 2);
              out = (short)((out | ((short)mymap[1])) >> 2);
              out = (short)((out | ((short)mymap[2])) >> 3);
              out = (short)((out | ((short)mymap[3])) >> 3);
              out = (short)((out | ((short)mymap[4])) >> 3);
              out = (short)(out | ((short)mymap[5]));
              return out;
    Thanks for looking at my functions and point out any inconsistencies. I feel like there is something I am not seeing in my code. Thanks!

    Well...thanks for the one-line answer :) yes, in the sense that it compiles and runs, but I am not sure if there is a problem with my logic or not.My program is acting strange and I am trying to isolate my problem, I think the problem might be in my pack/unpack methods.... possibly in my bit-math.

  • WebLogic Pack and Unpack

    When you pack and unpack the domain from one server to another server, config.xml is missing while we unpack the same,
    here we would like to know, do we need to metion the same path(Same folder structure) while pack and unpack?

    Hi
    Yes, one of the basic requirements is all the Machines should have Absolutely same version of Weblogic Software and in the same folder structure. The reason is when we run Pack command on the main master domain, it does store the full folder structure of some folders that has all the modules. So when you run UnPack on this other machine, basically it will unpack. But runtime, if folder structure is not matching, the most common error you may get is like Java home not found, middleware home not found and ofcourse ends up with all NoClassDefFound errors.
    Hence the folder structure should be same. And one more thing. After running unpack command, immediately you will NOT see any managed server folders under your domain/servers. That folder will be still Empty only. Only when you start the managed server like startManagedWeblogic.cmd myMS1 adminurl, thats when under domain/servers you will see a new folder named "myMS1" which is the name of managed server that you gave when you created the main master domain and packed it. Also, note it will prompt for username and password. ALSO, everytime you start managed servers, it will go to Admin Server and get some important files like config.xml file, jdbc files and few other config files and mainly all the LDAP files. Basically everytime it Syncs from AdminServer. So do NOT make any changes to any files on ManagedServer. Because when you restart they will get overwritten by admin files.
    Thanks
    Ravi Jegga

  • Pack and unpack a JFrame

    Hi,
    I'm using a JFrame and I 'd like to put a JButton to pack and unpack the window. Now, the pack is simple (I use the pack() method), but to enlarge the window? I've tried to store the original size before pack, and then resize the window but, since I use a BorderLayout layout manager the center panel doen't return visible.
    can anyone help me?

    You likely are not calling validate() on the layout after the resize
    Eximport javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test extends JFrame implements ActionListener
       private JPanel p;
       private Rectangle r;
       public Test()
          super("Flip");
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          setSize(770,580);
          p = new JPanel(new BorderLayout());
          JPanel p2 = new JPanel(new FlowLayout());
          p2.add(new JLabel("North"));
          p.add(p2, BorderLayout.NORTH);
          p2 = new JPanel(new FlowLayout());
          p2.add(new JLabel("West"));
          p.add(p2, BorderLayout.WEST);
          p2 = new JPanel(new FlowLayout());
          p2.add(new JLabel("East"));
          p.add(p2, BorderLayout.EAST);
          p2 = new JPanel(new FlowLayout());
          p2.add(new JLabel("Center"));
          p.add(p2, BorderLayout.CENTER);
          p2 = new JPanel(new FlowLayout());
          JButton pack = new JButton("Pack");
          JButton unpack = new JButton("Unpack");
          pack.addActionListener(this);
          unpack.addActionListener(this);
          p2.add(pack);
          p2.add(unpack);
          p.add(p2, BorderLayout.SOUTH);
          setContentPane(p);
       public void actionPerformed(ActionEvent ae)
          String s = ae.getActionCommand();
          if(s.equals("Pack"))
             r= getBounds();
             pack();
          else
             setBounds(r);
             validate();
       public static void main(String[] args)
          new Test().setVisible(true);
    }

  • Toools to Analysis and Design in ABAP Objects

    Hi All?
       Somebody knows about an "Analysis and Design Tools" from SAP? I need choice an tools to documentation class in ABAP Objects. Or, is there other like free tools for JAVA?
       Is there an Analysis and Design Model recomended from SAP?
       Thanks.
       Fábio Ferri -
       Cosultant -  ABAP/XI/ Netweaver.

    Hi Fabio,
    SAP Recommends the use of UML (Unified Modeling Language). They worked with Rational Software in order to provide an external modeling tool to supports SAP's class.
    Check this link in order to get more information.
    <a href="http://www.sapinsideronline.com/archive/volume_03_(2002)/issue_03_(july-september)/v3i3a11.cfm?session=&promo=iz1321">http://www.sapinsideronline.com/archive/volume_03_(2002)/issue_03_(july-september)/v3i3a11.cfm?session=&promo=iz1321</a>
    Regards,
    Eric

  • Pack and Unpack in HU

    Hi MM Gurus,
    I have a requirement of packing one HU of say 5EA Qty and Unpack in two HUs say 4EA & 1EA.Is this scenario is  possible in Handling Unit Management. If possible please explain.
    Regards,
    Manikyappa

    hi,
    if you have handling unit management activated (TVSHP-EXIDV_UNIQUE), you can create HUs within hu02. Here you can pack the f.e. 5 pieces into one HU or also unpack it into two HUs with 4+1 pieces (add material, total quantity, plant and storage location and the packaging material -> select these to lines and push "pack" button in the middle of the screen for packing it; to unpack HUs use the "empty" or "delete HU" button on the left side of the screen, after this you can pack again like you want... you have several possibilities to create HUs within this transaction). You can also use transaction humo for changing HUs (and for a lot of useful things used with HUs).
    (If you do not have handling unit management activated, you can only create shipping units within a delivery (you have the same screen there as in hu02).)
    I hope I could help you.
    Regards, Ely

  • Hanlding Unit Pack and Unpack Function module

    Hi All,
        Can any one know the functiona modules for PACK Handling Unit and UNPACK Handling Unit? If so please reply me.
    Thanks,
      Pranav

    Hi,
    Please check this FM.
    PACK_HANDLING_UNIT
    UNPACK_HANDLING_UNIT
    Hope this will help.
    Regards,
    Ferry Lianto

  • Changing WL port using pack and unpack Commands

    Hi,
    I am an experienced WL8 user, just starting with WL9.
    I created a first domain relatively easily using "config.sh"; and after finishing this proof of concept thought that it might be a good idea to create a template from it for the rest of the guys here.
    For that I used the ?pack? command, which works fine.
    The completing ?unpack? command also seems to works fine.
    The only thing is that I fail to locate any option to determine the server?s listen port (always sets to be 7001 like my original domain), and this is problem because we all work on the same linux machine.
    The only option I found so far is to start the server on it original port (7001) and than change it using the admin console. This is not good enough since we want to use an automatic install wizard?
    Did I miss something?
    Is there any command line to help?
    Or any other tips?
    Your help is appreciated,
    zilbi

    Hi Again,
    solved it using the WLST offline tool.
    the script (customCmpDomain.py):
    #=======================================================================================
    # Open the domain template.
    #=======================================================================================
    readTemplate("cmpDomainTemplate.jar")
    #=======================================================================================
    # Change server's port
    #=======================================================================================
    cd('Servers/AdminServer')
    set('ListenPort', 7080)
    #=======================================================================================
    # Open (unpack) the domain.
    #=======================================================================================
    writeDomain("/home/rami/domains/cmpDomain")
    #=======================================================================================
    # Close & Exit
    #=======================================================================================
    closeTemplate()
    exit()
    and just run it using 'weblogic.WLST'
    thanks anyway!
    zilbi

  • String pack and unpack

    Hi, i�m having trouble trying to write a methode to unpack a string packed with the following methode.
    can some one tell me how to write the unpack methode ?
    thanks.
    public String pack(String s) {
    byte[] a = new byte[16];
    //If the string is an odd length then pack with an F
    if ( s.length() % 2 == 1 ) {  
    s = (char) 0xFF + s ;
    //Now pack each pair of bytes into the array
    for ( int i = 0, j = 0 ; i < s.length() ; i += 2, j++ ) {
    a[j] = (byte) ( ( (s.charAt(i) & 0x0F) << 4 ) +
    (s.charAt(i+1) & 0x0F) ) ;
    return new String(A);
    }

    You need know the assumptions about the content of the original string. A packing algorithm like the one you describe might be used to pack a numeric string into an array of bytes. In that case, you assume that the original string consisted of nothing but ASCII digits, and you can recover the string with the following method:
    public String unpack(String a) {
      byte [] b = a.getBytes();
      StringBuffer buff = new StringBuffer(b.length * 2);
      for (int i = 0; i < b.length; i++) {
        buff.append((char)(0x30 | ((b[i] & 0xf0) >> 4)));
        buff.append((char)(0x30 | (b[i] & 0x0f)));
      // If the first char was a pad char, then remove it
      if (buff.charAt(0) == (char)0x3f)
        return buff.substring(1);
      return buff.toString();
    }

  • Pack and unpack

    Hi
    Please do help me.
      Data: dmshb(11),             "amount in SEK or EUR
              amount_1    LIKE dfkkop-betrw.  " of length 13 and decimal 2 with +/-sign
      amount_1 = '   91111111.00-'.
      dmshb = amount.
    the result of this is   dmshb = *111111.00-
    the expected is  dmshb = 09111111100
    Please do tell me the logic to do this
    promise to reward points
    bye
    Mac

    Hi Madan,
    This is your code.
    REPORT ZTEST_TEST01 .
    Data: dmshb(11), "amount in SEK or EUR
    amount_1 type netpr. " of length 13 and decimal 2 with +/-sign
    amount_1 = ' 91111111.00-'.
    unpack amount_1 to dmshb.
    *dmshb = amount_1.
    write: / 'amount', amount_1 ,
             'dmshhb', dmshb.
    Regards,
    Raghav

  • Pack and unpack Radius VSA attributes

    Hi
    As far as I know there are some methods to pack radius VSA attributes. Here are:
    As the part of Cisco-AVPair
    26 - VSA
    Length
    9  - Vendor ID
    1  - Vendor Type (Cisco-AVPair Attribute ID)
    Attribute Name=Value
    In the Vendor Specific attribute ("throught attribute ID")
    26  - VSALength
    9 - Vendor ID
    2 - Vendor Type (Attribute ID)
    Vendor Length
    Attribute Name=Value
    In the Vendor Specific attribute ("throught attribute ID") 
    26 - VSA
    Length
    9 - Vendor ID
    2 - Vendor Type (Attribute ID)
    Value
    i.e. with attribute name and witout.
    How to understand which attribute needs attribute name in value string?
    For example:
    26|Length|9|2|Vendor Length|1|h323-incoming-conf-id=82b5fc8cd6f411dfa3c6080027716a9a
    26|Length|9|2|Vendor Length|35|h323-incoming-conf-id=82b5fc8cd6f411dfa3c6080027716a9a
    26|Length|9|2|Vendor Length|35|82b5fc8cd6f411dfa3c6080027716a9a
    which of the methods is right?

    Hi,
    For the specific VSA you used in the example (h323-incoming-conf-id), (1) is the correct encoding, since Cisco VSA vendor type 1 (also more commonly referred to as  cisco AV Pair) is always encoded in strings with the format of "attribute=value". This applies to other cisco VSAs that use string encoding as well. For VSA's that don't use string encoding, eg., fax-pages (vendor type 5, encoding integer), it typically doesn't include the value. You should be able to check that against the vendor dictionary to confirm. Please also see:
    http://www.cisco.com/en/US/docs/ios/voice/cdr/developer/guide/cdrdefs.html
    Thanks,
    Wen

  • How to Implement Abap Object and Access Key for se24 developers.

    Hi every One,
    This is Abdul Rahman, Started Learning Abap Objects i want a simple program to be executed i.e. in Local class (Abap program)and as well in global class(class builder).
    Also i would like to know  When ,Were and Why Abap Object should be used.
    prob to Me :- When i wanted execute F8 a Class in se24 Class Builder it is asking me AcessKey , plz if this is required plz any one send Me.
    I have this key 36687663221261278694 it is already used in Abap editor , it is not accepting in se24 .
    plz help Me , waiting for response ..
    thankyou so much
    Abdul Rahman.

    Hello Abdul
    Here are my answers to your questions:
    (1) <b>Local classes</b>: <i>Do not use them.</i>
    - As long as your class is rather small (few attributes and methods), local classes  are ok yet as soon as they become larger you will loose the overview
    (2) <b>Global classes</b>: <i>Do use them.</i>
    - Make use of global classes even if they are only used for your training. The big advantage over local classes is that you will get used to the classe builder (SE24) which has a plethora of functions.
    (3) <b>Executing global classes</b>: <i>Can be done if you have defined an OO-transaction.</i>
    - An OO-transaction has a class and one of its public methods as parameters (similar like report transactions). When you all the OO-transaction an instance of you class is created and the public method is called.
    (4) <b>Where and Why use ABAP Objects?</b> <i>Everywhere. Anytime.</i>
    - ABAP objects is about stability, maintainability and re-usability of coding. These developer aims can be much more fulfilled using ABAP OO means than in classical programming.
    Regards
       Uwe
    PS: There are situations where local classes are quite appropriate and, using ABAP Unit testing, are obligatory.

  • INTERFACE AND EVENTS IN ABAP OO

    Can some one explain me the real time need with example for use of interfaces and events in abap objects
    (asking interface and events along doesnt mean that i am relating them).
    <removed_by_moderator>
    Pankaj Giri
    Edited by: Julius Bussche on Jul 14, 2008 1:36 PM

    Events :
    Technically speaking :
    " Events are notifications an object receives from, or transmits to, other objects or applications. Events allow objects to perform actions whenever a specific occurrence takes place. Microsoft Windows is an event-driven operating system, events can come from other objects, applications, or user input such as mouse clicks or key presses. "
    Lets say you have an ALV - An editable one ...
    Lats say - Once you press some button  you want some kind of validation to be done.
    How to do this ?
    Raise an Event - Which is handled by a method and write the validation code.
    Now you might argue, that I can do it in this way : Capture the function code - and call the validate method.
    Yes, in this case it can be done.. But lets say .. you change a field in the ALV and you want the validation to be done as soon as he is done with typing.
    Where is the function code here ? No function code... But there is an event here - The data changed event.
    So you can raise a data changed event that can be handled and will do the validation.
    It is not user friendly that you ask the user to press a button (to get the function code) for validation each time he enters a data.
    The events can be raised by a system, or by a program also. So in this case the data changed event is raised by a system that you can handle.
    Also, Lets say on a particular action you want some code to trigger. (You can take the same example of validation code). In this case the code to trigger is in a separate class. The object of which is not available here at this moment. (This case happens very frequently).
    Advantage with events : Event handlers can be in a separate class also.
    e.g : In the middle of some business logic .. you encounter a error. You want to send this information to the UI (to user - in form of a pop up) and then continue with some processing.
    In many cases - A direct method call to trigger the pop up is not done. Because (in ideal cases) the engine must not interact with UI directly - Because the UI could be some other application - like a windows UI but the error comes from some SAP program.
    So - A event is raised from the engine that is handled in the UI and a pop up is triggered.
    Here -- I would have different classes (lets say for different Operating Systems). And all these classes must register to the event ERROR raised in application.
    And these different classes for different Operation systems will have different code to raise a pop-up.
    Now you can imagine : If you coded a pop-up for Windows (in your application logic) .. it will not work for Mac or Linux. But of you raise a event.. that is handled separately by a different UI classes for Win, Linux or Mac  they will catch this event and process accordingly.
    May be I complicated this explanation .... but I couldn't think of a simpler and concrete example.
    Cheers.
    Varun.

  • Screen Programming(Module Pool ) 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..
    Regards.,
    S.Sivakumar

    Hi Sivakumar,
    Go through the following links:
    [url]http://www.savefile.com/download/156691?PHPSESSID=c49d6bed6630d830f3270f7eab51e547 [url]
    [url]http://www.sapdb.info/category/sap-ebooks[url]
    [url]http://sap.niraj.tripod.com/id25.html[url]
    [url]http://abaplovers.blogspot.com/2008/03/sap-abap-tutorial-module-pool_17.html[url]
    Thank you,
    Prasad G.V.K
    Edited by: Craig Cmehil on Jul 1, 2008 9:48 PM

  • 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

Maybe you are looking for

  • My iPhone 4 from the Apple store. Now changing provider and it appears locked. Should it be?

    I bought my iPhone 4 from an Apple store a couple of years ago and understood it to be unlocked.  Now I am changing provider and it appears to be locked. I have tried the new SIM card with other phones and it is okay.  Originally I was with Vodafone

  • PDF that doesn't start as a Word document

    I need to design a pdf that is fillable and has a signature option but I want to design it as a PDF and not keep changing it in the Word file. Is this possible to make it a one-step process instead of converting from Word each time? Is Form Central o

  • New HP Pavilion computer won't display most thumbnails on internet

    I have HP Pavilion p6-2120 PC. Product number 00359-OEM-8992687-00010. Running Windows 7. Thumnails in Elements 10 work okay. But can't display thumbnails or small pictures on NY Times slideshow, the 3 headlines under main photo of NY Post, thumbnail

  • Changing BorderPane contraints causes component to disappear

    Hello everyone, I have this short snippet that is giving me a headache, don't know if it's something i'm doing wrong but the behavior seems weird to me: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.But

  • Parsing elements that has special characters

    I have to parse xml from a clob that has elements that contain characters cut and pasted from word perfect documents. The resulting text has the literal characters &#13; and inside the element start and end tags. I've looked at using an entity, but I