[SOLVED] Problem in getting a secondary null device

Hi everybody!
I need to have a null device in a chroot environment. I know that I could mount the /dev directory with "-bind" option, but I want to share only the essential. So I thought to create the null device with the following (typed as root):
# mknod mynull c 1, 3
# chmod a+w mynull
I tested the new block device with:
# ls -l
crw-rw-rw- 1 root root 1, 3 Apr 12 14:51 mynull
# echo blabla > mynull
bash: mynull: Permission denied
I really don't understand why it doesn't work.
Thanks.
Last edited by EnergiaPotenziale (2014-04-16 09:15:40)

Ok, i found that the partition in which I created mynull was mounted with "nodev" option. Aftter changing the partition, worked fine.

Similar Messages

  • [solved] systemd times out waiting for dev-null.device on encrypted fs

    I have a relatively new install of Arch on my laptop. The relevant sections of the drive setup are a luks encrypted root device (with associated unencrypted /boot), and a large ntfs device encrypted with truecrypt. That contains my home directory, which is shared with the Windows 8 dual-boot on the machine.
    I have all this mounted on boot, so my typical usage is to enter my password for the encrypted root, followed by the password for the truecrypt-encrypted data drive, then normal login.
    This has been working fine for a couple of weeks. This afternoon I rebooted my machine from Windows to Linux, at which point the secondary encrypted drive failed to mount. The root device mounts fine.
    On further examination, in the form of journalctl -xb, I'm getting the following errors after mounting the encrypted root device:
    Feb 12 21:29:54 kafka systemd[1]: Job dev-null.device/start timed out.
    Feb 12 21:29:54 kafka systemd[1]: Timed out waiting for device dev-null.device.
    -- Subject: Unit dev-null.device has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/li … temd-devel
    -- Documentation: http://www.freedesktop.org/wiki/Softwar … e9d022f03d
    -- Unit dev-null.device has failed.
    -- The result is timeout.
    Feb 12 21:29:54 kafka systemd[1]: Dependency failed for Cryptography Setup for cryptdata.
    -- Subject: Unit [email protected] has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/li … temd-devel
    -- Documentation: http://www.freedesktop.org/wiki/Softwar … e9d022f03d
    -- Unit [email protected] has failed.
    As my root home directory is on the root filesystem, I can still log in as root. If I try to mount or unmount the truecrypt device (located at /data) the command hangs. After removing "auto,x-systemd.automount" from that device from /etc/fstab and rebooting, I have a significant delay at boot, but I can then mount the /data device as normal.
    I can't find anything related to this either here or on Google. Any ideas?
    Last edited by tealeaf (2014-02-13 12:01:55)

    WonderWoofy wrote:A bit OT, but I just want to mention that having your $HOME on ntfs is probably not the best idea either.  It may work, but because it is not a POSIX compliant filesystem, there is a good chance you might run into some issues.
    Thanks for the warning. Sadly, as there are applications I need for work that only run in Windows, I need to dual boot this machine with Windows 8.1. This is the best option I can find for sharing my home directory, which is also a necessity due to the amount of data I have to share between the systems. I would much rather trust to ntfs-3g-ar and its UserMapping (and all the fiddling with ACLs that I had to do) than to the Windows ext2 drivers I can find. They all seem to be several years out of date. Linux is much better at talking NTFS than Windows is at talking EXT. (To be honest, I'm actually quite impressed with Windows 8 since the upgrade to 8.1. As a long term Arch user and a fan of tiling window managers it's interesting to see Windows moving in the right direction. )
    With 'permissions' in the /etc/fstab and the .NTFS-3G/UserMapping file in place it works almost seamlessly. (It took a lot of tinkering with ACLs in Windows and Linux, but it's working very well now. One tip that I'll write here in case it's of use is that you want the last line of the UserMapping file to be a 'generic' mapping. When I didn't have that there were very strange things going on.)
    The only two minor problems I have now are:
    1) A few applications don't like FUSE filesystems. Steam worked for a while and then broke; reinstalling it failed at every stage. When I checked, it seems that FUSE is a known problem for Steam. (I don't think it's restricted to NTFS.) My response to that was to create /home/.local/$HOME on my root (ext4) filesystem and symlink out to it for troublesome applications.
    2) There are a few characters for filenames that Windows doesn't like, making those files inaccessible in Windows. (Colons are the major culprit.) They're usually quite easily renamed. (The exception being my .maildir folder, which I have had to duplicate natively in cygwin.)
    Neither of these are anything more than minor niggles. I appreciate the warning, though.
    Having said that, if you have an alternative that lets me share a truecrypt-encrypted drive between Linux and Windows that is better than the NTFS-3G approach, I'd love to hear it for future reference.

  • Problem with Set/Get volume of input device with single channel

    from Symadept <[email protected]>
    to Cocoa Developers <[email protected]>,
    coreaudio-api <[email protected]>
    date Thu, Dec 10, 2009 at 2:45 PM
    subject Problem with Set/Get volume of input device with single channel
    mailed-by gmail.com
    hide details 2:45 PM (2 hours ago)
    Hi,
    I am trying to Set/Get Volume level of Input device which has only single channel but no master channel, then it fails to retrieve the kAudioDevicePropertyPreferredChannelsForStereo and intermittently kAudioDevicePropertyVolumeScalar for each channel. But this works well for Output device.
    So is there any difference in setting/getting the volume of input channels?
    I am pasting the downloadable link to sample.
    http://www.4shared.com/file/169494513/f53ed27/VolumeManagerTest.html
    Thanks in advance.
    Regards
    Mustafa
    Tags: MacOSX, CoreAudio, Objective C.

    That works but the the game will not be in full screen, it will have an empty strip at the bottom.
    I actually found out what's the problem. I traced the stageWidth and stageHeight during resizing event. I found out that when it first resized, the stage width and height were the size with the notification bar. So when I pass the stage into startling, myStarling = new Starling(Game,stage), the stage is in the wrong size. For some reason, I can only get the correct stage width and height after the third resizing event.
    So now I need to restart Starling everytime a resizing event happened. It gives me the right result but I am not sure it is a good idea to do that.
    And thanks a lot for your time kglad~I really appriciate your help.

  • My dvd player will not let me change regions, it just quits when i do, now its stuck on region 1. Any thoughts how i can solve this problem or get round it in some way?

    My dvd player will not let me change regions, it says i have one more chance to change it, then it just quits when i do, now its stuck on region 1. Any thoughts how i can solve this problem or get round it in some way?

    Usually if you have some kind of hardware failure there is some beeping during POST or most motherboards now have LED indicators to produce and error message based on the type of failure
    So if its bad memory, not place properly, mismatched, processor not inserted properly, mismatched voltage or voltage connector not present etc it beeps or generates the error id.
    Power supplies can be tested for failure. There are some walk throughs for testing just them with a switch, paperclip or a jumper (I'd suggest not doing this if you are not familiar with the dangers of electricity).
    Memory can be tested with memory diagnostics programs like Memtest+
    Processors can overheat if the proper precautions have not been taken usually you will get a POST beep or error code for that.
    If the motherboard has no response then do the basics first:
    Check power connectors and power supply. Once you determine that is not the case move on to other items like graphics cards in all the way or memory.

  • Getting nuts with null atributes problem

    Hello everybody,
    I have this problem:
    My project is working fine except one JSP-Backing bean pair that is driving me crazy, When I load the JSP through a tree2 menu, the page loads ok, I have some selectOneMenu components, that are loaded in the constructor of my backing bean using some Business Delegate Methods, in the JSP I also have some InputText components, when I click the button that takes all values to build a BO object that I have to pass to ht Business Delegate, everything into the bean is null.
    I have tried to read the value of the components using the two normal ways:
    1. Calling the name of the variable directly: for example:
    String nameValue = strNameSelected();2. Calling its get method:
    String nameValue = getStrNameSelected();None of the work, when I print them in console all values are null.
    All calls are into the same bean, nonetheless, everything gets returned as null, so I tried first to acquire the bean from the session, to read its values, like this:
    MyBackingBean myBean =
                   (MyBackingBean ) sesion.getAttribute("MyBackingBean ");
          bearing in mind that MyBackingBean is the name in the faces-config.xml.
    However, this brings the same results. Null elements into the bean.
    The declaration of the bean in the faces-config.xml is this:
    <managed-bean>
              <managed-bean-name>MyBackingBean </managed-bean-name>
              <managed-bean-class>com.mycompany.bean.MyBackingBean </managed-bean-class>
              <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>What I cannot understand is Why the selectOneMenus are getting loaded with the right values in the constructor, but at the time I call the value of the elements they are null :-(
    Have anyone faced a problem like this?? I'm in a very big hurry, hope someone can help me :-)
    Thanks a lot

    Hello Pringi,
    I have found the source of the problem, I had a immediate="true" attribute in the button, so this was generating the problem.
    Thanks a lot for your interest.

  • I have a macbook pro core i7 mid 2012 And update to the latest version 10.8.4 system after updating the system I have the problem appeared to take off the device and stops at the apple logo for about 5 minutes and then enters the desktop How can I solve t

    I have a macbook pro core i7 mid 2012
    And update to the latest version 10.8.4 system after updating the system I have the problem appeared to take off the device and stops at the apple logo for about 5 minutes and then enters the desktop How can I solve this problem and thank you

    If you have more than one user account, these instructions must be carried out as an administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Step 1
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Enter "BOOT_TIME" (without the quotes) in the search box. Note the timestamps of those log messages, which refer to the times when the system was booted. Now clear the search box and scroll back in the log to the last boot time when you had the problem. Select the messages logged after the boot, during the time something abnormal was happening. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V).
    For example, if the problem is a slow startup taking three minutes, post the messages timestamped within three minutes after the boot time, not before. Please include the BOOT_TIME message at the beginning of the log extract.
    If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message.
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.
    Step 2
    Still in Console, look under System Diagnostic Reports for crash or panic logs, and post the entire contents of the most recent one, if any. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if present (it may not be.) Please don’t post shutdownStall, spin, or hang logs — they're very long and not helpful.

  • Getting error reading settings with service profile manager. Why and what can I do to solve problem?

    Getting "error reading settings" with the service profile manager in Lion server OS. Why and what can I do to solve problem?

    I have also had the 'Error reading settings' problem in Profile Manager, despite trying everything in the discussions and clean reinstalls (which work for a little while only).
    It seems that various different fixes work for some people but not others; and the underlying cause of the problem has not been resolved.
    There are now numerous threads on this problem (there are yet others with similar problems):
    https://discussions.apple.com/thread/3189397
    https://discussions.apple.com/thread/3195100
    https://discussions.apple.com/thread/3212015
    https://discussions.apple.com/thread/3208533
    https://discussions.apple.com/thread/3249062
    https://discussions.apple.com/thread/3199734
    https://discussions.apple.com/thread/3212304
    I have posted this in each to try and pull things together a bit.
    Does anyone know if Apple has acknowledged the issue and offered an official response?

  • I just downloaded Find my iphone and my phones linked up no problem; my ipad appeared in my devices, but could never be located; I tried everything...icloud, network are all on, did the troubleshoot stuff...eventually deleted it...how to get it to work?

    Just downloaded Find my iphone and phones are OK but ipad showed in MY devices but could never be located; tried all the fixes (icloud on, find my phone on, on wifi network, etc. including all troubleshooting.  Just deleted it...how do I get it back to My devices and get app to locate the device?

    You got the new iphone?????   I have same problem.  I transferred audiobooks to device to find no audiobooks on device (despite it being in iTunes as if it was).  Have you found a solution?????   I even tried to change import settings on format transfer but hasn't worked. 

  • When starting imovie I get an error missing quicktime components. To solve the problem I have upgraded to latest version but it didn't help. I want to either solve this problem or get a refund for the useless upgrade.

    when starting imovie I get an error missing quicktime components. To solve the problem I have upgraded to latest version but it didn't help. I want to either solve this problem or get a refund for the useless upgrade.

    Mac OS X 10.6 includes QuickTime versions 10.0 and 7.6.3. The QuickTime 7 player will only be present if a QuickTime Pro key was present at the time of installation, or if specified as part of a custom install, or individually downloaded:
    http://support.apple.com/kb/dl923
    Snow Leopard update 10.6.4 included an update to 7.6.6 (if installed). You can install it from the above link  even though it says for 10.6.3. It's the same version of QuickTime Player 7.6.6.
    (Only QuickTime Player 7.6.3 or 7.6.6 can be updated to "Pro".)
    iMovie does not, AFAIK, use QT 10.

  • When I try to sign on to Mac App Store I get the message "Your device or computer cannot be verified" Yet I can sign on in iTunes no problem.  I've tried all the suggestions from App Support but no luck.

    When I try to sign on to Mac App Store I get the message "Your device or computer cannot be verified" Yet I can sign on in iTunes no problem.  I've tried all the suggestions from App Support but no luck. What am I doing wrong?

    What troubleshooting techniques have you tried? Have you restarted the app? Have you restarted your computer?
    One idea is to Trash this file; Mac HD/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist and restart.

  • The file "Acceptance Letter.pages" doesn't exist. Since installing Yosemite on MacBook Pro I cannot save or export from Pages. Just get the message at beginning of this post. How to solve problem?

    I cannot save or export from Pages since installing Yosemite on MacBook Pro . I just get the message at beginning of this post “Acceptance Letter.pages” doesn’t exist or whatever file title I have inserted How to solve problem?

    Thanks Peter but I was not seeking to store with I-Cloud. In fact I never store documents with I-cloud.
    I was in fact trying to store the files to Documents, which is where I usually keep such things.
    Have now discovered that if I leave the file untiled and simply close it, rather than saving it then it will save, oddly, to Documents. I then have to re-title it and move to the folder I want it in.
    Despite the above, even once it is titled and saved in Documents then if I reopen it I still cannot then Export it to a Word or PDF file. I still just get the message . xxxxxx.pages does not exist!
    Bad news as I am constantly exporting documents to Word and PDF to send to others who do not use a Mac

  • Started having problems with itunes...I tried updating it and kept getting "Service "apple mobile device " failed to start.  verify that you have sufficient privileges to start system services.  What can I do?

    I need to figure out how to install itunes again on my HP..I keep getting "service "apple mobile device" failed to start.  Verify that you have sufficient privileges to start system services"...help

    Try the following user tip:
    Troubleshooting issues with iTunes for Windows updates

  • Problem in getting the database connection from a connection pool

    Hai All,
    I am facing a problem in getting the database connection from a connection pool created on weblogic server 8.1.
    I am using the Oracle database 8.1.7.
    I have configured my connection pool, datasource and JNDI in weblogic.
    In my java program i have the following code to retrieve the connection.
    import java.sql.*;    
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    class jdbcshp1 {
        public static void main(String[] args) {
         Connection connection = null;
         try {
               Hashtable ht = new Hashtable();
               ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");  // Wanna get rid of this.
               ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); // wanna get rid of this.
               // Get a context for the JNDI look up
               Context ctx = new InitialContext(ht);
            javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myjndi1");
              //Create a connection object
              connection = ds.getConnection();
         The above code is working fine but, the two ht.put statements are creating problem.
    The problem is, after converting the application into WAR file it can be deployed
    on any machine or different port on same machine. My application fails if its deployed on
    weglogicserver which is at different port.
    Is there any way that i can get rid of those ht.put statements or any other way to solve the problem.
    any help is appreciated.
    Thanks in advance
    Pooja.

    Hai All,
    Firstly, thanks for ur reply.
    Even i have seen some code which uses context constructor with out any parameter and works fine.
    i dont understand why its not working for my code.
    When i remove those ht.put code and use context constructor with out any parameter, it giving an error.
    Context ctx = new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("ocjndi");
    connection = ds.getConnection();The error is as follows:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    the above error is forcing me to include those code but if the port number is changed the code will not work. Plz let meknow if some setting have to be made.
    I appreciate all ur valuable help.
    Thanks once again.
    Pooja.

  • Problem in displaying 2nd secondary list

    Hi ABAP Gurus,
    Here i got an assignment to develope interactive report (basic list, 1st secondary, 2nd secondary list)
    according to my report i am able to get 1st secondary list perfectly but i am not able to get 2nd secondary list .pls solve my problem
    below is my code.
    *& Report  ZCRPT_MM_MRP
    REPORT  zcrpt_mm_mrp .
    *& Report       : ZRPT_MM_PR_HISTORY                               *
    Dev. Class   : ZCVS                                             *
    Program Name : ZRPT_MM_PR_HISTORY                               *
    Description  : PO History Details List                          *
    Author       : Sujit   Created on : 12.11.2007          *
    SAP Release  : SAP ERP Central Component 5.0                    *
    Tcode        : Req DKIK905199  N-160                            *
                  :     DKIK905248  N-160 For Deletion indicator     *
    S O U R C E   C O D E   C H A N G E   H I S T O R Y             *
    CODE     | AUTHOR     | DATE     |   Description                *
              |            |          |                              *
          TABLE  DECLARATIONS                                        *
    TABLES: ekko,ekpo,mara, makt,ekes,eban,mard,s994.
    Internal tables decleration
    TYPE-POOLS: slis.
    DATA: BEGIN OF it_vbrkvbrp OCCURS 0,
            vbeln TYPE vbrk-vbeln,
            fktyp TYPE vbrk-fktyp,
            matnr TYPE vbrp-matnr,
            fkimg TYPE vbrp-fkimg,
            fklmg TYPE vbrp-fklmg,
            vrkme TYPE vbrp-vrkme,
            meins TYPE vbrp-meins,
            shkzg TYPE vbrp-shkzg,
          END OF it_vbrkvbrp.
    DATA: BEGIN OF it_vbrk OCCURS 0,
            matnr TYPE vbrp-matnr,
            fkimg TYPE vbrp-fkimg,
            meins TYPE vbrp-meins,
          END OF it_vbrk.
    DATA: BEGIN OF it_ekko OCCURS 0,
            ebeln TYPE ekko-ebeln,
            bukrs TYPE ekko-bukrs,
            frggr TYPE ekko-frggr,
            frgsx TYPE ekko-frgsx,
            frgke TYPE ekko-frgke,
            frgzu TYPE ekko-frgzu,
          END OF it_ekko.
    DATA: BEGIN OF it_ekbe OCCURS 0,
          ebeln type ekbe-ebeln,
          ebelp type ekbe-ebelp,
          belnr type ekbe-belnr,
          buzei type ekbe-buzei,
          xblnr type ekbe-xblnr,
          END OF it_ekbe.
    DATA: BEGIN OF it_lips OCCURS 0,
          vbeln type lips-vbeln,
          posnr type lips-posnr,
          matnr type lips-matnr,
          vgbel type lips-vgbel,
          lfimg type lips-lfimg,
          meins type lips-meins,
          END OF it_lips.
    data : it1_lips like it_lips occurs 0 with header line.
    DATA: BEGIN OF itab OCCURS 1 ,
          banfn     LIKE eban-banfn,    " Purchase requisition number
          bnfpo     LIKE eban-bnfpo,    " PR Item Number
          werks     LIKE ekpo-werks,    " Plant
          matnr     LIKE ekpo-matnr,    " Material
          maktx     LIKE makt-maktx,    " Name of Material
          pr_menge  LIKE eban-menge,    " PR Quantity
          meins     LIKE ekpo-meins,    " Unit
          ebeln     LIKE ekpo-ebeln,    " PO No
          bsart     LIKE ekko-bsart,    " Purchasing Document Type
          ebelp     LIKE ekpo-ebelp,    " Item
          menge     LIKE ekpo-menge,    " PO Qty
          grn_menge LIKE ekpo-menge,    " GRN Qty
          trn_menge LIKE ekpo-menge,    " Transit Qty
          bal_menge LIKE ekpo-menge,    " Balance PO Qty
          labst     LIKE mard-labst,    " Valuated stock with unrestricted
          fkimg     LIKE vbrp-fkimg,    " Actual billed quantity
          minbe TYPE marc-minbe,
          mabst TYPE marc-mabst,
          fixkz TYPE eban-fixkz,
          zfixkz(7) TYPE c,
          matkl TYPE mara-matkl,
          mvgr1 TYPE mvke-mvgr1,
          bezei TYPE tvm1t-bezei,
          zconfirm1(3) TYPE c,
          zconfirm2(3) TYPE c,
          zconfirm3(3) TYPE c,
        END OF itab.
    DATA: BEGIN OF itab_sale OCCURS 1 ,
          matnr     LIKE ekpo-matnr,    " Material
          werks     LIKE ekpo-werks,    " Plant
          maktx     LIKE makt-maktx,    " Name of Material
          labst     LIKE mard-labst,    " Valuated stock with unrestricted
        END OF itab_sale.
    DATA : i_eban LIKE eban OCCURS 0 WITH HEADER LINE.
    DATA : del_menge LIKE ekes-menge,
           grn_dabmg LIKE ekes-dabmg.
    DATA: BEGIN OF it_marc OCCURS 0,
            matnr TYPE marc-matnr,
            werks TYPE marc-werks,
            minbe TYPE marc-minbe,
            mabst TYPE marc-mabst,
          END OF it_marc.
    DATA: BEGIN OF it_eban OCCURS 0,
            banfn TYPE eban-banfn,
            bnfpo TYPE eban-bnfpo,
            fixkz TYPE eban-fixkz,
            ebeln type eban-ebeln,
          END OF it_eban.
    DATA: BEGIN OF it_mara OCCURS 0,
            matnr TYPE mara-matnr,
            matkl TYPE mara-matkl,
          END OF it_mara.
    DATA: BEGIN OF it_mvke OCCURS 0,
            matnr TYPE mvke-matnr,
            mvgr1 TYPE mvke-mvgr1,
            mvgr2 TYPE mvke-mvgr2,
            mvgr3 TYPE mvke-mvgr3,
            mvgr4 TYPE mvke-mvgr4,
          END OF it_mvke.
    DATA: BEGIN OF it_tvm1t OCCURS 0,
            mvgr1 TYPE tvm1t-mvgr1,
            bezei TYPE tvm1t-bezei,
          END OF it_tvm1t.
    DATA:  fcat TYPE slis_t_fieldcat_alv,
           fcat1 TYPE slis_t_fieldcat_alv,
           fcat2 TYPE slis_t_fieldcat_alv,
           heading  TYPE slis_t_listheader,
           heading1  TYPE slis_t_listheader,
           heading2  TYPE slis_t_listheader,
           events   TYPE slis_t_event,
           events1   TYPE slis_t_event,
           events2   TYPE slis_t_event,
           repname  LIKE sy-repid.
    DATA: keyinfo  TYPE slis_keyinfo_alv.
    CONSTANTS: formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    CONSTANTS: formname_top_of_page1 TYPE slis_formname VALUE 'TOP_OF_PAGE1'
    CONSTANTS: formname_top_of_page2 TYPE slis_formname VALUE 'TOP_OF_PAGE2'
    RANGES : s_erdat FOR vbrk-erdat.
    DATA: ss_date TYPE mkpf-budat.
    DATA: ss_period(3) TYPE n.
    Screen Selection
    SELECTION-SCREEN BEGIN OF BLOCK  s1 WITH FRAME TITLE text-001.
    *SELECT-OPTIONS : s_ebeln FOR ekpo-ebeln,
                    s_werks FOR ekpo-werks.
    SELECT-OPTIONS : s_banfn FOR eban-banfn,  "Purchase requisition number
                     s_badat FOR eban-badat,  "Requisition (request) date
                     s_matnr FOR eban-matnr,  "Material Number
                     s_werks FOR eban-werks,  "Plant
                     s_lgort FOR eban-lgort,  "Storage Location
                     s_matkl FOR eban-matkl,  "Material group
                     s_flief FOR eban-flief,  "Fixed Vendor
                     s_bsart FOR ekko-bsart NO INTERVALS.   " Purchasing
    SELECTION-SCREEN  END    OF BLOCK  s1 .
    SELECTION-SCREEN BEGIN OF BLOCK  s2 WITH FRAME TITLE text-002.
    PARAMETERS: s_period(3) TYPE n .
    SELECTION-SCREEN  END    OF BLOCK  s2 .
    initialization.
    repname = sy-repid.
      PERFORM build_eventtab  USING events[].
      PERFORM build_eventtab1  USING events1[].
      PERFORM build_eventtab2  USING events2[].
      PERFORM build_comment USING heading[].
      PERFORM build_comment1 USING heading1[].
      PERFORM build_comment2 USING heading2[].
    Strat-of-Selection
    START-OF-SELECTION.
      PERFORM getdata.
      PERFORM getfieldcatalog USING fcat[].
      PERFORM getfieldcatalog1 USING fcat1[].
      PERFORM getfieldcatalog2 USING fcat2[].
      PERFORM alvdisplaydata.
    END-OF-SELECTION.
    *&      Form  getdata
          text
    -->  p1        text
    <--  p2        text
    FORM getdata.
      SELECT * FROM eban INTO CORRESPONDING FIELDS OF TABLE i_eban
               WHERE banfn IN s_banfn      "Purchase requisition number
               AND   badat IN s_badat      "Requisition (request) date
               AND   matnr IN s_matnr      "Material Number
               AND   werks IN s_werks      "Plant
               AND   lgort IN s_lgort      "Storage Location
               AND   matkl IN s_matkl      "Material group
               AND   flief IN s_flief      "Fixed Vendor
               AND   loekz NE 'X'          "Deletion Pocument
               AND   afnam EQ 'MRP'.       "Name of requisitioner/requester
      IF NOT i_eban[] IS INITIAL.
        LOOP AT i_eban.
          CLEAR itab.
          itab-banfn     =  i_eban-banfn.
          itab-bnfpo     =  i_eban-bnfpo.
          itab-pr_menge  =  i_eban-menge.
          itab-meins     =  i_eban-meins.
          itab-ebeln     =  i_eban-ebeln.
          itab-ebelp     =  i_eban-ebelp.
          itab-matnr     =  i_eban-matnr.
          itab-werks     =  i_eban-werks.
    **----Get Material Description
          IF NOT i_eban-matnr IS INITIAL.
            SELECT SINGLE * FROM  makt
                            WHERE matnr EQ i_eban-matnr.
            IF sy-subrc EQ 0.
              itab-maktx = makt-maktx.
            ENDIF.
          ELSE.
            itab-maktx = i_eban-txz01.
          ENDIF.
    *----Get PO & GRN Quantity
          IF i_eban-ebeln GT 0 AND i_eban-ebelp GT 0.
            SELECT SINGLE * FROM ekpo
                            WHERE ebeln = i_eban-ebeln
                            AND   ebelp = i_eban-ebelp.
            IF sy-subrc EQ 0.
              itab-menge     = ekpo-menge.
            ENDIF.
            SELECT SINGLE * FROM ekko
                            WHERE ebeln = i_eban-ebeln.
            IF sy-subrc EQ 0.
              itab-bsart     = ekko-bsart.
            ENDIF.
    *-------Get GRN Quantity
            CLEAR : del_menge,grn_dabmg.
            IF  ekpo-bstae = '0004'.  " GRN Against InbondDelivery
              SELECT SUM( menge ) SUM( dabmg )
                      FROM ekes
                      INTO (del_menge,grn_dabmg)
                      WHERE ebeln =  i_eban-ebeln
                      AND   ebelp =  i_eban-ebelp
                      AND   ebtyp = 'LA'.
              IF sy-subrc EQ 0.
                itab-grn_menge = grn_dabmg.
                itab-trn_menge = del_menge - grn_dabmg.
              itab-bal_menge = ekpo-menge - del_menge.
                IF itab-bal_menge < 0.
                 itab-bal_menge = 0.
                ENDIF.
              ELSE.
               itab-bal_menge = itab-menge.
              ENDIF.
            ELSE.          " Regular GRN
              SELECT SUM( menge )
                      FROM ekbe
                      INTO (grn_dabmg)
                      WHERE ebeln =  i_eban-ebeln
                      AND   ebelp =  i_eban-ebelp
                      AND   bewtp = 'E'
                      AND   bwart = '101'.
              IF sy-subrc EQ 0.
                itab-grn_menge = grn_dabmg.
              itab-trn_menge = del_menge - grn_dabmg.
              ENDIF.
    For Cancelled GRN
              SELECT SUM( menge )
                      FROM ekbe
                      INTO (grn_dabmg)
                      WHERE ebeln =  i_eban-ebeln
                      AND   ebelp =  i_eban-ebelp
                      AND   bewtp = 'E'
                      AND   bwart = '102'.
              IF sy-subrc EQ 0.
                itab-grn_menge = itab-grn_menge - grn_dabmg.
              itab-trn_menge = del_menge - grn_dabmg.
              ENDIF.
              IF itab-bsart = 'UB'.
                CLEAR : grn_dabmg,grn_dabmg.
                SELECT SUM( menge )
                        FROM ekbe
                        INTO (grn_dabmg)
                        WHERE ebeln =  i_eban-ebeln
                        AND   ebelp =  i_eban-ebelp
                        AND   bewtp = 'U'
                        AND   bwart = '641'.
                IF sy-subrc EQ 0.
                  itab-trn_menge  = grn_dabmg.
                ENDIF.
    For Reversal of Issue Document
                SELECT SUM( menge )
                        FROM ekbe
                        INTO (grn_dabmg)
                        WHERE ebeln =  i_eban-ebeln
                        AND   ebelp =  i_eban-ebelp
                        AND   bewtp = 'U'
                        AND   bwart = '642'.
                IF sy-subrc EQ 0.
                  itab-trn_menge  = itab-trn_menge  - grn_dabmg.
                ENDIF.
                IF itab-grn_menge <> 0.
                  itab-trn_menge = 0.
                ENDIF.
              ENDIF.
    End
            ENDIF.
    *-------End
          ENDIF.
          itab-bal_menge = itab-menge - ( itab-grn_menge + itab-trn_menge ).
          CALL FUNCTION 'CONVERSION_EXIT_CCMAT_OUTPUT'
            EXPORTING
              input  = itab-matnr
            IMPORTING
              output = itab-matnr.
          itab_sale-matnr = itab-matnr.
          itab_sale-werks = itab-werks.
          itab_sale-maktx = itab-maktx.
          COLLECT itab_sale.
          APPEND itab.
        ENDLOOP.
      ENDIF.
      IF NOT s_bsart[] IS INITIAL.
        DELETE itab WHERE bsart NOT IN s_bsart.
      ENDIF.
      IF NOT itab_sale IS INITIAL.
        LOOP AT itab_sale.
    *-----Get Sales Quantity
          CALL FUNCTION 'CONVERSION_EXIT_CCMAT_INPUT'
            EXPORTING
              input  = itab_sale-matnr
            IMPORTING
              output = itab_sale-matnr.
    *-----Change as on 08.12.2007
          SELECT SUM( clabs ) INTO  itab_sale-labst
                              FROM  mchb
                              WHERE matnr = itab_sale-matnr
                              AND   werks = itab_sale-werks.
    *-----End
          MODIFY itab_sale TRANSPORTING labst matnr.
        ENDLOOP.
        LOOP AT itab.
          READ TABLE itab_sale WITH KEY matnr = itab-matnr
                               werks = itab-werks.
          IF sy-subrc = 0.
            CALL FUNCTION 'CONVERSION_EXIT_CCMAT_OUTPUT'
              EXPORTING
                input  = itab_sale-matnr
              IMPORTING
                output = itab_sale-matnr.
            MOVE itab_sale-labst TO itab-labst.
          ENDIF.
          MODIFY itab TRANSPORTING labst.
          CLEAR itab.
        ENDLOOP.
      ENDIF.
      CHECK itab[] IS NOT INITIAL.
      SELECT * FROM marc CLIENT SPECIFIED
                              INTO CORRESPONDING FIELDS OF TABLE it_marc
                              FOR ALL ENTRIES IN itab
                              WHERE mandt = sy-mandt
                              AND matnr EQ itab-matnr
                              AND werks EQ itab-werks.
      SELECT * FROM eban CLIENT SPECIFIED
                             INTO CORRESPONDING FIELDS OF TABLE it_eban
                             FOR ALL ENTRIES IN itab
                             WHERE mandt = sy-mandt
                             AND banfn EQ itab-banfn
                             AND bnfpo EQ itab-bnfpo.
      SELECT * FROM mara CLIENT SPECIFIED
                            INTO CORRESPONDING FIELDS OF TABLE it_mara
                            FOR ALL ENTRIES IN itab
                            WHERE mandt = sy-mandt
                            AND matnr EQ itab-matnr.
      SELECT * FROM mvke CLIENT SPECIFIED
                           INTO CORRESPONDING FIELDS OF TABLE it_mvke
                           FOR ALL ENTRIES IN itab
                           WHERE mandt = sy-mandt
                           AND matnr EQ itab-matnr.
      IF sy-subrc = 0.
        SELECT * FROM tvm1t CLIENT SPECIFIED
                       INTO CORRESPONDING FIELDS OF TABLE it_tvm1t
                       FOR ALL ENTRIES IN it_mvke
                       WHERE mandt = sy-mandt
                       AND mvgr1 EQ it_mvke-mvgr1.
      ENDIF.
      IF s_period IS NOT INITIAL.
        ss_period = s_period.
        ss_period = ss_period + 1.
        s_erdat-sign = 'I'.
        s_erdat-option = 'BT'.
        s_erdat-high = sy-datum.
        ss_date = sy-datum - ss_period.
        s_erdat-low = ss_date.
        APPEND s_erdat.
        CLEAR s_erdat.
        SELECT * FROM zcvi_vbrk_vbrp CLIENT SPECIFIED
                             INTO CORRESPONDING FIELDS OF TABLE it_vbrkvbrp
                                     FOR ALL ENTRIES IN itab
                                     WHERE mandt = sy-mandt
                                     AND matnr = itab-matnr
                                     AND   fkart IN ('Z3PS','ZVIT',
                                           'ZVDT','ZFRV',
                                           'ZDRV','ZCMR')
                                     AND fkdat IN s_erdat
                                     AND fksto EQ space
                                     AND sfakn EQ space
                                     AND rfbsk NE 'E'
                                     AND fkimg NE 0.
        LOOP AT it_vbrkvbrp.
          IF it_vbrkvbrp-fktyp NE 'L'.
            DELETE it_vbrkvbrp.
            CONTINUE.
          ENDIF.
          IF it_vbrkvbrp-vrkme NE it_vbrkvbrp-meins.
            it_vbrkvbrp-fkimg = it_vbrkvbrp-fklmg.
            it_vbrkvbrp-meins = it_vbrkvbrp-vrkme.
          ENDIF.
          IF it_vbrkvbrp-shkzg = 'X'.
            it_vbrkvbrp-fkimg = it_vbrkvbrp-fkimg * -1.
          ENDIF.
          it_vbrk-matnr = it_vbrkvbrp-matnr.
          it_vbrk-fkimg = it_vbrkvbrp-fkimg.
          it_vbrk-meins = it_vbrkvbrp-meins.
          IF it_vbrk[] IS INITIAL.
            APPEND it_vbrk.
            CLEAR it_vbrk.
          ELSE.
            COLLECT it_vbrk.
            CLEAR it_vbrk.
          ENDIF.
        ENDLOOP.
      ENDIF.
      SORT it_vbrkvbrp BY matnr.
      SELECT * FROM ekko CLIENT SPECIFIED
                                 INTO CORRESPONDING FIELDS OF TABLE it_ekko
                                  FOR ALL ENTRIES IN itab
                                  WHERE mandt = sy-mandt
                                  AND ebeln = itab-ebeln.
      SORT it_ekko BY ebeln.
      LOOP AT itab.
        READ TABLE it_ekko BINARY SEARCH WITH KEY
                                                ebeln = itab-ebeln.
        IF sy-subrc = 0.
          IF it_ekko-frgke = 'R'.
            itab-zconfirm1 = 'YES'.
            itab-zconfirm2 = 'YES'.
            itab-zconfirm3 = 'YES'.
          ELSEIF it_ekko-frgzu = 'X'.
            itab-zconfirm1 = 'YES'.
          ELSEIF it_ekko-frgzu = 'XX'.
            itab-zconfirm1 = 'YES'.
            itab-zconfirm2 = 'YES'.
          ENDIF.
        ENDIF.
        IF s_period IS NOT INITIAL.
          READ TABLE it_vbrk BINARY SEARCH
                                           WITH KEY matnr = itab-matnr.
          IF sy-subrc = 0.
            itab-fkimg = it_vbrk-fkimg.
          ENDIF.
        ENDIF.
        READ TABLE it_marc WITH KEY matnr = itab-matnr
                                    werks = itab-werks.
        IF sy-subrc = 0.
          MOVE it_marc-minbe TO itab-minbe.
          MOVE it_marc-mabst TO itab-mabst.
        ENDIF.
        READ TABLE it_eban WITH KEY banfn = itab-banfn
                                    bnfpo = itab-bnfpo.
        IF sy-subrc = 0.
          IF it_eban-fixkz EQ 'X'.
            itab-zfixkz = 'Firmed'.
          ENDIF.
        ENDIF.
        READ TABLE it_mara WITH KEY matnr = itab-matnr.
        IF sy-subrc = 0.
          MOVE it_mara-matkl TO itab-matkl.
        ENDIF.
        READ TABLE it_mvke WITH KEY matnr = itab-matnr.
        IF sy-subrc = 0.
          MOVE it_mvke-mvgr1 TO itab-mvgr1.
          READ TABLE it_tvm1t WITH KEY mvgr1 = itab-mvgr1.
          IF sy-subrc = 0.
            MOVE it_tvm1t-bezei TO itab-bezei.
          ENDIF.
        ENDIF.
        MODIFY itab.
        CLEAR itab.
      ENDLOOP.
    ENDFORM.                    " getdata
    *&      Form  build_eventtab
          text
         -->P_EVENTS[]  text
    FORM build_eventtab  USING   p_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = p_events.
      READ TABLE p_events WITH KEY name = slis_ev_top_of_page
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE formname_top_of_page TO ls_event-form.
        APPEND ls_event TO p_events.
      ENDIF.
    ENDFORM.                    " build_eventtab
    *&      Form  build_comment
          text
         -->P_HEADING[]  text
    FORM build_comment  USING    p_heading TYPE slis_t_listheader.
      DATA: hline TYPE slis_listheader.
      CLEAR: hline.
      hline-info = 'Purchase Requision History'.
      hline-typ  = 'H'.
      APPEND hline TO p_heading.
      CLEAR hline.
    ENDFORM.                    " build_comment
    *&      Form  getfieldcatalog
          text
    -->  p1        text
    <--  p2        text
    FORM getfieldcatalog USING  p_fcat TYPE slis_t_fieldcat_alv.
      DATA : w_fcat TYPE slis_fieldcat_alv.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'BANFN'.
      w_fcat-seltext_l    = 'PR No '.
      w_fcat-key          = 'X'.
      w_fcat-col_pos      = 1.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'BNFPO'.
      w_fcat-seltext_l    = 'PR Item '.
      w_fcat-key          = 'X'.
      w_fcat-col_pos      = 2.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'MATNR'.
      w_fcat-seltext_l    = 'Material '.
      w_fcat-col_pos      = 3.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'MAKTX'.
      w_fcat-seltext_l    = 'Name of the Mateiral '.
      w_fcat-col_pos      = 4.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'WERKS'.
      w_fcat-seltext_l    = 'Plant '.
      w_fcat-col_pos      = 5.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'EBELN'.
      w_fcat-seltext_l    = 'PO No '.
      w_fcat-hotspot        = 'X'.
      w_fcat-col_pos      = 6.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'EBELP'.
      w_fcat-seltext_l    = 'PO Item '.
      w_fcat-col_pos      = 7.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'PR_MENGE'.
      w_fcat-seltext_l    = 'PR Qty '.
      w_fcat-col_pos      = 8.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'MEINS'.
      w_fcat-seltext_l    = 'Unit'.
      w_fcat-col_pos      = 9.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'MENGE'.
      w_fcat-seltext_l    = 'PO Quantity '.
      w_fcat-col_pos      = 10.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'GRN_MENGE'.
      w_fcat-seltext_l    = 'GRN Qty '.
      w_fcat-col_pos      = 11.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'TRN_MENGE'.
      w_fcat-seltext_l    = 'Transit Qty '.
      w_fcat-col_pos      = 12.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'BAL_MENGE'.
      w_fcat-seltext_l    = 'Balance PO Qty '.
      w_fcat-col_pos      = 13.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'LABST'.
      w_fcat-seltext_l    = 'Current Stock'.
      w_fcat-col_pos      = 14.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'FKIMG'.
      w_fcat-seltext_l    = 'Sales Qty '.
      w_fcat-col_pos      = 15.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'MINBE'.
      w_fcat-seltext_l    = 'Reorder Point'.
      w_fcat-col_pos      = 16.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'MABST'.
      w_fcat-seltext_l    = 'Maximum stock level'.
      w_fcat-col_pos      = 17.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'ZFIXKZ'.
      w_fcat-seltext_l    = 'Fixed Indicator'.
      w_fcat-col_pos      = 18.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'MATKL'.
      w_fcat-seltext_l    = 'Design'.
      w_fcat-col_pos      = 19.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'MVGR1'.
      w_fcat-seltext_l    = 'Size'.
      w_fcat-col_pos      = 20.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'BEZEI'.
      w_fcat-seltext_l    = 'Size Desc.'.
      w_fcat-col_pos      = 21.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'FKIMG'.
      w_fcat-seltext_l    = 'Sales Qty '.
      w_fcat-col_pos      = 22.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'ZCONFIRM1'.
      w_fcat-seltext_l    = 'Release1'.
      w_fcat-col_pos      = 23.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'ZCONFIRM2'.
      w_fcat-seltext_l    = 'Release2'.
      w_fcat-col_pos      = 24.
      APPEND w_fcat TO fcat.
      CLEAR w_fcat.
      w_fcat-tabname      = 'ITAB'.
      w_fcat-fieldname    = 'ZCONFIRM3'.
      w_fcat-seltext_l    = 'Release3'.
      w_fcat-col_pos      = 25.
      APPEND w_fcat TO fcat.
    ENDFORM.                    " getfieldcatalog
    *&      Form  alvdisplaydata
          text
    -->  p1        text
    <--  p2        text
    FORM alvdisplaydata .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = repname
          i_callback_user_command = 'USER_COMMAND'
          it_fieldcat             = fcat
          it_events               = events[]
        TABLES
          t_outtab                = itab.
      IF sy-subrc <> 0.
        WRITE: 'SY-SUBRC: ', sy-subrc, 'REUSE_ALV_LIST_DISPLAY'.
      ENDIF.
    ENDFORM.                    " alvdisplaydata
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = heading.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  build_eventtab1
          text
         -->P_EVENTS[]  text
    FORM build_eventtab1  USING   p_events1 TYPE slis_t_event.
      DATA: ls_event1 TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = p_events1.
      READ TABLE p_events1 WITH KEY name = slis_ev_top_of_page
                               INTO ls_event1.
      IF sy-subrc = 0.
        MOVE formname_top_of_page1 TO ls_event1-form.
        APPEND ls_event1 TO p_events1.
      ENDIF.
    endform.
    *&      Form  build_comment
          text
         -->P_HEADING[]  text
    FORM build_comment1  USING    p_heading1 TYPE slis_t_listheader.
      DATA: hline1 TYPE slis_listheader.
      hline1-info = '1 Secondary List'.
      hline1-typ  = 'H'.
      APPEND hline1 TO p_heading1.
      CLEAR hline1.
    ENDFORM.                    " build_comment
    *&      Form  getfieldcatalog1
          text
         -->P_FCAT1[]  text
    form getfieldcatalog1  using    p_fcat1 TYPE slis_t_fieldcat_alv.
    DATA : w_fcat1 TYPE slis_fieldcat_alv.
      CLEAR w_fcat1.
      w_fcat1-tabname      = 'IT_LIPS'.
      w_fcat1-fieldname    = 'VBELN'.
      w_fcat1-seltext_l    = 'Pr.No'.
      w_fcat1-hotspot   = 'X'.
      w_fcat1-col_pos      = 1.
      APPEND w_fcat1 to fcat1.
      CLEAR w_fcat1.
      w_fcat1-tabname      = 'IT_LIPS'.
      w_fcat1-fieldname    = 'POSNR'.
      w_fcat1-seltext_l    = 'PR Item'.
      w_fcat1-col_pos      = 2.
      APPEND w_fcat1 to fcat1.
      CLEAR w_fcat1.
      w_fcat1-tabname      = 'IT_LIPS'.
      w_fcat1-fieldname    = 'MATNR'.
      w_fcat1-seltext_l    = 'Material'.
      w_fcat1-col_pos      = 3.
      APPEND w_fcat1 to fcat1.
      CLEAR w_fcat1.
      w_fcat1-tabname      = 'IT_LIPS'.
      w_fcat1-fieldname    = 'LFIMG'.
      w_fcat1-seltext_l    = 'Actual quantity delivered'.
      w_fcat1-col_pos      = 4.
      APPEND w_fcat1 to fcat1.
      CLEAR w_fcat1.
      w_fcat1-tabname      = 'IT_LIPS'.
      w_fcat1-fieldname    = 'MEINS'.
      w_fcat1-seltext_l    = 'Base Unit of Measure'.
      w_fcat1-col_pos      = 5.
      APPEND w_fcat1 to fcat1.
    endform.                    " getfieldcatalog1
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM      text
         -->RS_SELFIELD  text
    FORM user_command  USING r_ucomm LIKE sy-ucomm
          rs_selfield TYPE slis_selfield.
    READ TABLE itab INDEX rs_selfield-tabindex.
      IF sy-subrc EQ 0.
      select vbeln
             posnr
             matnr
             vgbel
             lfimg
             meins from lips into table it_lips
             where vgbel = itab-ebeln.
      ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = repname
          i_callback_user_command = 'USER_COMMAND'
          it_fieldcat             = fcat1
          it_events               = events1[]
        TABLES
          t_outtab                = it_lips.
      IF sy-subrc <> 0.
        WRITE: 'SY-SUBRC: ', sy-subrc, 'REUSE_ALV_LIST_DISPLAY'.
      ENDIF.
    ENDFORM.                    "USER_COMMAND
          FORM TOP_OF_PAGE1                                              *
    FORM top_of_page1.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = heading1.
    ENDFORM.                    "TOP_OF_PAGE1
    *&      Form  build_eventtab1
          text
         -->P_EVENTS[]  text
    FORM build_eventtab2  USING   p_events2 TYPE slis_t_event.
      DATA: ls_event2 TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = p_events2.
      READ TABLE p_events2 WITH KEY name = slis_ev_top_of_page
                               INTO ls_event2.
      IF sy-subrc = 0.
        MOVE formname_top_of_page2 TO ls_event2-form.
        APPEND ls_event2 TO p_events2.
      ENDIF.
    endform.
    *&      Form  build_comment
          text
         -->P_HEADING[]  text
    FORM build_comment2  USING    p_heading2 TYPE slis_t_listheader.
      DATA: hline2 TYPE slis_listheader.
      hline2-info = '2 Secondary List'.
      hline2-typ  = 'H'.
      APPEND hline2 TO p_heading2.
      CLEAR hline2.
    ENDFORM.                    " build_comment
    *&      Form  getfieldcatalog1
          text
         -->P_FCAT1[]  text
    form getfieldcatalog2  using    p_fcat2 TYPE slis_t_fieldcat_alv.
    DATA : w_fcat2 TYPE slis_fieldcat_alv.
      CLEAR w_fcat2.
      w_fcat2-tabname      = 'IT_EKBE'.
      w_fcat2-fieldname    = 'EBELN'.
      w_fcat2-seltext_l    = 'Pr.Doc No'.
      w_fcat2-col_pos      = 1.
      APPEND w_fcat2 to fcat2.
      CLEAR w_fcat2.
      w_fcat2-tabname      = 'IT_EKBE'.
      w_fcat2-fieldname    = 'EBELP'.
      w_fcat2-seltext_l    = 'PR Doc Item'.
      w_fcat2-col_pos      = 2.
      APPEND w_fcat2 to fcat2.
      CLEAR w_fcat2.
      w_fcat2-tabname      = 'IT_EKBE'.
      w_fcat2-fieldname    = 'BELNR'.
      w_fcat2-seltext_l    = 'No.Mat Doc'.
      w_fcat2-col_pos      = 3.
      APPEND w_fcat2 to fcat2.
      CLEAR w_fcat2.
      w_fcat2-tabname      = 'IT_EKBE'.
      w_fcat2-fieldname    = 'BUZEI'.
      w_fcat2-seltext_l    = 'Item in Mat Doc'.

    Hi,
    You did mistakes hear.
    check for >>>>
    *& Report ZCRPT_MM_MRP
    REPORT zcrpt_mm_mrp .
    *& Report : ZRPT_MM_PR_HISTORY *
    Dev. Class : ZCVS *
    Program Name : ZRPT_MM_PR_HISTORY *
    Description : PO History Details List *
    Author : Sujit Created on : 12.11.2007 *
    SAP Release : SAP ERP Central Component 5.0 *
    Tcode : Req DKIK905199 N-160 *
    : DKIK905248 N-160 For Deletion indicator *
    S O U R C E C O D E C H A N G E H I S T O R Y *
    CODE | AUTHOR | DATE | Description *
    | | | *
    TABLE DECLARATIONS *
    TABLES: ekko,ekpo,mara, makt,ekes,eban,mard,s994.
    Internal tables decleration
    TYPE-POOLS: slis.
    DATA: BEGIN OF it_vbrkvbrp OCCURS 0,
    vbeln TYPE vbrk-vbeln,
    fktyp TYPE vbrk-fktyp,
    matnr TYPE vbrp-matnr,
    fkimg TYPE vbrp-fkimg,
    fklmg TYPE vbrp-fklmg,
    vrkme TYPE vbrp-vrkme,
    meins TYPE vbrp-meins,
    shkzg TYPE vbrp-shkzg,
    END OF it_vbrkvbrp.
    DATA: BEGIN OF it_vbrk OCCURS 0,
    matnr TYPE vbrp-matnr,
    fkimg TYPE vbrp-fkimg,
    meins TYPE vbrp-meins,
    END OF it_vbrk.
    DATA: BEGIN OF it_ekko OCCURS 0,
    ebeln TYPE ekko-ebeln,
    bukrs TYPE ekko-bukrs,
    frggr TYPE ekko-frggr,
    frgsx TYPE ekko-frgsx,
    frgke TYPE ekko-frgke,
    frgzu TYPE ekko-frgzu,
    END OF it_ekko.
    DATA: BEGIN OF it_ekbe OCCURS 0,
    ebeln type ekbe-ebeln,
    ebelp type ekbe-ebelp,
    belnr type ekbe-belnr,
    buzei type ekbe-buzei,
    xblnr type ekbe-xblnr,
    END OF it_ekbe.
    DATA: BEGIN OF it_lips OCCURS 0,
    vbeln type lips-vbeln,
    posnr type lips-posnr,
    matnr type lips-matnr,
    vgbel type lips-vgbel,
    lfimg type lips-lfimg,
    meins type lips-meins,
    END OF it_lips.
    data : it1_lips like it_lips occurs 0 with header line.
    DATA: BEGIN OF itab OCCURS 1 ,
    banfn LIKE eban-banfn, " Purchase requisition number
    bnfpo LIKE eban-bnfpo, " PR Item Number
    werks LIKE ekpo-werks, " Plant
    matnr LIKE ekpo-matnr, " Material
    maktx LIKE makt-maktx, " Name of Material
    pr_menge LIKE eban-menge, " PR Quantity
    meins LIKE ekpo-meins, " Unit
    ebeln LIKE ekpo-ebeln, " PO No
    bsart LIKE ekko-bsart, " Purchasing Document Type
    ebelp LIKE ekpo-ebelp, " Item
    menge LIKE ekpo-menge, " PO Qty
    grn_menge LIKE ekpo-menge, " GRN Qty
    trn_menge LIKE ekpo-menge, " Transit Qty
    bal_menge LIKE ekpo-menge, " Balance PO Qty
    labst LIKE mard-labst, " Valuated stock with unrestricted
    fkimg LIKE vbrp-fkimg, " Actual billed quantity
    minbe TYPE marc-minbe,
    mabst TYPE marc-mabst,
    fixkz TYPE eban-fixkz,
    zfixkz(7) TYPE c,
    matkl TYPE mara-matkl,
    mvgr1 TYPE mvke-mvgr1,
    bezei TYPE tvm1t-bezei,
    zconfirm1(3) TYPE c,
    zconfirm2(3) TYPE c,
    zconfirm3(3) TYPE c,
    END OF itab.
    DATA: BEGIN OF itab_sale OCCURS 1 ,
    matnr LIKE ekpo-matnr, " Material
    werks LIKE ekpo-werks, " Plant
    maktx LIKE makt-maktx, " Name of Material
    labst LIKE mard-labst, " Valuated stock with unrestricted
    END OF itab_sale.
    DATA : i_eban LIKE eban OCCURS 0 WITH HEADER LINE.
    DATA : del_menge LIKE ekes-menge,
    grn_dabmg LIKE ekes-dabmg.
    DATA: BEGIN OF it_marc OCCURS 0,
    matnr TYPE marc-matnr,
    werks TYPE marc-werks,
    minbe TYPE marc-minbe,
    mabst TYPE marc-mabst,
    END OF it_marc.
    DATA: BEGIN OF it_eban OCCURS 0,
    banfn TYPE eban-banfn,
    bnfpo TYPE eban-bnfpo,
    fixkz TYPE eban-fixkz,
    ebeln type eban-ebeln,
    END OF it_eban.
    DATA: BEGIN OF it_mara OCCURS 0,
    matnr TYPE mara-matnr,
    matkl TYPE mara-matkl,
    END OF it_mara.
    DATA: BEGIN OF it_mvke OCCURS 0,
    matnr TYPE mvke-matnr,
    mvgr1 TYPE mvke-mvgr1,
    mvgr2 TYPE mvke-mvgr2,
    mvgr3 TYPE mvke-mvgr3,
    mvgr4 TYPE mvke-mvgr4,
    END OF it_mvke.
    DATA: BEGIN OF it_tvm1t OCCURS 0,
    mvgr1 TYPE tvm1t-mvgr1,
    bezei TYPE tvm1t-bezei,
    END OF it_tvm1t.
    DATA: fcat TYPE slis_t_fieldcat_alv,
    fcat1 TYPE slis_t_fieldcat_alv,
    fcat2 TYPE slis_t_fieldcat_alv,
    heading TYPE slis_t_listheader,
    heading1 TYPE slis_t_listheader,
    heading2 TYPE slis_t_listheader,
    events TYPE slis_t_event,
    events1 TYPE slis_t_event,
    events2 TYPE slis_t_event,
    repname LIKE sy-repid.
    DATA: keyinfo TYPE slis_keyinfo_alv.
    CONSTANTS: formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    CONSTANTS: formname_top_of_page1 TYPE slis_formname VALUE 'TOP_OF_PAGE1'
    CONSTANTS: formname_top_of_page2 TYPE slis_formname VALUE 'TOP_OF_PAGE2'
    RANGES : s_erdat FOR vbrk-erdat.
    DATA: ss_date TYPE mkpf-budat.
    DATA: ss_period(3) TYPE n.
    Screen Selection
    SELECTION-SCREEN BEGIN OF BLOCK s1 WITH FRAME TITLE text-001.
    *SELECT-OPTIONS : s_ebeln FOR ekpo-ebeln,
    s_werks FOR ekpo-werks.
    SELECT-OPTIONS : s_banfn FOR eban-banfn, "Purchase requisition number
    s_badat FOR eban-badat, "Requisition (request) date
    s_matnr FOR eban-matnr, "Material Number
    s_werks FOR eban-werks, "Plant
    s_lgort FOR eban-lgort, "Storage Location
    s_matkl FOR eban-matkl, "Material group
    s_flief FOR eban-flief, "Fixed Vendor
    s_bsart FOR ekko-bsart NO INTERVALS. " Purchasing
    SELECTION-SCREEN END OF BLOCK s1 .
    SELECTION-SCREEN BEGIN OF BLOCK s2 WITH FRAME TITLE text-002.
    PARAMETERS: s_period(3) TYPE n .
    SELECTION-SCREEN END OF BLOCK s2 .
    initialization.
    repname = sy-repid.
    PERFORM build_eventtab USING events[].
    PERFORM build_eventtab1 USING events1[].
    PERFORM build_eventtab2 USING events2[].
    PERFORM build_comment USING heading[].
    PERFORM build_comment1 USING heading1[].
    PERFORM build_comment2 USING heading2[].
    Strat-of-Selection
    START-OF-SELECTION.
    PERFORM getdata.
    PERFORM getfieldcatalog USING fcat[].
    PERFORM getfieldcatalog1 USING fcat1[].
    PERFORM getfieldcatalog2 USING fcat2[].
    PERFORM alvdisplaydata.
    END-OF-SELECTION.
    *& Form getdata
    text
    --> p1 text
    <-- p2 text
    FORM getdata.
    SELECT * FROM eban INTO CORRESPONDING FIELDS OF TABLE i_eban
    WHERE banfn IN s_banfn "Purchase requisition number
    AND badat IN s_badat "Requisition (request) date
    AND matnr IN s_matnr "Material Number
    AND werks IN s_werks "Plant
    AND lgort IN s_lgort "Storage Location
    AND matkl IN s_matkl "Material group
    AND flief IN s_flief "Fixed Vendor
    AND loekz NE 'X' "Deletion Pocument
    AND afnam EQ 'MRP'. "Name of requisitioner/requester
    IF NOT i_eban[] IS INITIAL.
    LOOP AT i_eban.
    CLEAR itab.
    itab-banfn = i_eban-banfn.
    itab-bnfpo = i_eban-bnfpo.
    itab-pr_menge = i_eban-menge.
    itab-meins = i_eban-meins.
    itab-ebeln = i_eban-ebeln.
    itab-ebelp = i_eban-ebelp.
    itab-matnr = i_eban-matnr.
    itab-werks = i_eban-werks.
    **----Get Material Description
    IF NOT i_eban-matnr IS INITIAL.
    SELECT SINGLE * FROM makt
    WHERE matnr EQ i_eban-matnr.
    IF sy-subrc EQ 0.
    itab-maktx = makt-maktx.
    ENDIF.
    ELSE.
    itab-maktx = i_eban-txz01.
    ENDIF.
    *----Get PO & GRN Quantity
    IF i_eban-ebeln GT 0 AND i_eban-ebelp GT 0.
    SELECT SINGLE * FROM ekpo
    WHERE ebeln = i_eban-ebeln
    AND ebelp = i_eban-ebelp.
    IF sy-subrc EQ 0.
    itab-menge = ekpo-menge.
    ENDIF.
    SELECT SINGLE * FROM ekko
    WHERE ebeln = i_eban-ebeln.
    IF sy-subrc EQ 0.
    itab-bsart = ekko-bsart.
    ENDIF.
    *-------Get GRN Quantity
    CLEAR : del_menge,grn_dabmg.
    IF ekpo-bstae = '0004'. " GRN Against InbondDelivery
    SELECT SUM( menge ) SUM( dabmg )
    FROM ekes
    INTO (del_menge,grn_dabmg)
    WHERE ebeln = i_eban-ebeln
    AND ebelp = i_eban-ebelp
    AND ebtyp = 'LA'.
    IF sy-subrc EQ 0.
    itab-grn_menge = grn_dabmg.
    itab-trn_menge = del_menge - grn_dabmg.
    itab-bal_menge = ekpo-menge - del_menge.
    IF itab-bal_menge < 0.
    itab-bal_menge = 0.
    ENDIF.
    ELSE.
    itab-bal_menge = itab-menge.
    ENDIF.
    ELSE. " Regular GRN
    SELECT SUM( menge )
    FROM ekbe
    INTO (grn_dabmg)
    WHERE ebeln = i_eban-ebeln
    AND ebelp = i_eban-ebelp
    AND bewtp = 'E'
    AND bwart = '101'.
    IF sy-subrc EQ 0.
    itab-grn_menge = grn_dabmg.
    itab-trn_menge = del_menge - grn_dabmg.
    ENDIF.
    For Cancelled GRN
    SELECT SUM( menge )
    FROM ekbe
    INTO (grn_dabmg)
    WHERE ebeln = i_eban-ebeln
    AND ebelp = i_eban-ebelp
    AND bewtp = 'E'
    AND bwart = '102'.
    IF sy-subrc EQ 0.
    itab-grn_menge = itab-grn_menge - grn_dabmg.
    itab-trn_menge = del_menge - grn_dabmg.
    ENDIF.
    IF itab-bsart = 'UB'.
    CLEAR : grn_dabmg,grn_dabmg.
    SELECT SUM( menge )
    FROM ekbe
    INTO (grn_dabmg)
    WHERE ebeln = i_eban-ebeln
    AND ebelp = i_eban-ebelp
    AND bewtp = 'U'
    AND bwart = '641'.
    IF sy-subrc EQ 0.
    itab-trn_menge = grn_dabmg.
    ENDIF.
    For Reversal of Issue Document
    SELECT SUM( menge )
    FROM ekbe
    INTO (grn_dabmg)
    WHERE ebeln = i_eban-ebeln
    AND ebelp = i_eban-ebelp
    AND bewtp = 'U'
    AND bwart = '642'.
    IF sy-subrc EQ 0.
    itab-trn_menge = itab-trn_menge - grn_dabmg.
    ENDIF.
    IF itab-grn_menge <> 0.
    itab-trn_menge = 0.
    ENDIF.
    ENDIF.
    End
    ENDIF.
    *-------End
    ENDIF.
    itab-bal_menge = itab-menge - ( itab-grn_menge + itab-trn_menge ).
    CALL FUNCTION 'CONVERSION_EXIT_CCMAT_OUTPUT'
    EXPORTING
    input = itab-matnr
    IMPORTING
    output = itab-matnr.
    itab_sale-matnr = itab-matnr.
    itab_sale-werks = itab-werks.
    itab_sale-maktx = itab-maktx.
    COLLECT itab_sale.
    APPEND itab.
    ENDLOOP.
    ENDIF.
    IF NOT s_bsart[] IS INITIAL.
    DELETE itab WHERE bsart NOT IN s_bsart.
    ENDIF.
    IF NOT itab_sale IS INITIAL.
    LOOP AT itab_sale.
    *-----Get Sales Quantity
    CALL FUNCTION 'CONVERSION_EXIT_CCMAT_INPUT'
    EXPORTING
    input = itab_sale-matnr
    IMPORTING
    output = itab_sale-matnr.
    *-----Change as on 08.12.2007
    SELECT SUM( clabs ) INTO itab_sale-labst
    FROM mchb
    WHERE matnr = itab_sale-matnr
    AND werks = itab_sale-werks.
    *-----End
    MODIFY itab_sale TRANSPORTING labst matnr.
    ENDLOOP.
    LOOP AT itab.
    READ TABLE itab_sale WITH KEY matnr = itab-matnr
    werks = itab-werks.
    IF sy-subrc = 0.
    CALL FUNCTION 'CONVERSION_EXIT_CCMAT_OUTPUT'
    EXPORTING
    input = itab_sale-matnr
    IMPORTING
    output = itab_sale-matnr.
    MOVE itab_sale-labst TO itab-labst.
    ENDIF.
    MODIFY itab TRANSPORTING labst.
    CLEAR itab.
    ENDLOOP.
    ENDIF.
    CHECK itab[] IS NOT INITIAL.
    SELECT * FROM marc CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE it_marc
    FOR ALL ENTRIES IN itab
    WHERE mandt = sy-mandt
    AND matnr EQ itab-matnr
    AND werks EQ itab-werks.
    SELECT * FROM eban CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE it_eban
    FOR ALL ENTRIES IN itab
    WHERE mandt = sy-mandt
    AND banfn EQ itab-banfn
    AND bnfpo EQ itab-bnfpo.
    SELECT * FROM mara CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE it_mara
    FOR ALL ENTRIES IN itab
    WHERE mandt = sy-mandt
    AND matnr EQ itab-matnr.
    SELECT * FROM mvke CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE it_mvke
    FOR ALL ENTRIES IN itab
    WHERE mandt = sy-mandt
    AND matnr EQ itab-matnr.
    IF sy-subrc = 0.
    SELECT * FROM tvm1t CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE it_tvm1t
    FOR ALL ENTRIES IN it_mvke
    WHERE mandt = sy-mandt
    AND mvgr1 EQ it_mvke-mvgr1.
    ENDIF.
    IF s_period IS NOT INITIAL.
    ss_period = s_period.
    ss_period = ss_period + 1.
    s_erdat-sign = 'I'.
    s_erdat-option = 'BT'.
    s_erdat-high = sy-datum.
    ss_date = sy-datum - ss_period.
    s_erdat-low = ss_date.
    APPEND s_erdat.
    CLEAR s_erdat.
    SELECT * FROM zcvi_vbrk_vbrp CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE it_vbrkvbrp
    FOR ALL ENTRIES IN itab
    WHERE mandt = sy-mandt
    AND matnr = itab-matnr
    AND fkart IN ('Z3PS','ZVIT',
    'ZVDT','ZFRV',
    'ZDRV','ZCMR')
    AND fkdat IN s_erdat
    AND fksto EQ space
    AND sfakn EQ space
    AND rfbsk NE 'E'
    AND fkimg NE 0.
    LOOP AT it_vbrkvbrp.
    IF it_vbrkvbrp-fktyp NE 'L'.
    DELETE it_vbrkvbrp.
    CONTINUE.
    ENDIF.
    IF it_vbrkvbrp-vrkme NE it_vbrkvbrp-meins.
    it_vbrkvbrp-fkimg = it_vbrkvbrp-fklmg.
    it_vbrkvbrp-meins = it_vbrkvbrp-vrkme.
    ENDIF.
    IF it_vbrkvbrp-shkzg = 'X'.
    it_vbrkvbrp-fkimg = it_vbrkvbrp-fkimg * -1.
    ENDIF.
    it_vbrk-matnr = it_vbrkvbrp-matnr.
    it_vbrk-fkimg = it_vbrkvbrp-fkimg.
    it_vbrk-meins = it_vbrkvbrp-meins.
    IF it_vbrk[] IS INITIAL.
    APPEND it_vbrk.
    CLEAR it_vbrk.
    ELSE.
    COLLECT it_vbrk.
    CLEAR it_vbrk.
    ENDIF.
    ENDLOOP.
    ENDIF.
    SORT it_vbrkvbrp BY matnr.
    SELECT * FROM ekko CLIENT SPECIFIED
    INTO CORRESPONDING FIELDS OF TABLE it_ekko
    FOR ALL ENTRIES IN itab
    WHERE mandt = sy-mandt
    AND ebeln = itab-ebeln.
    SORT it_ekko BY ebeln.
    LOOP AT itab.
    READ TABLE it_ekko BINARY SEARCH WITH KEY
    ebeln = itab-ebeln.
    IF sy-subrc = 0.
    IF it_ekko-frgke = 'R'.
    itab-zconfirm1 = 'YES'.
    itab-zconfirm2 = 'YES'.
    itab-zconfirm3 = 'YES'.
    ELSEIF it_ekko-frgzu = 'X'.
    itab-zconfirm1 = 'YES'.
    ELSEIF it_ekko-frgzu = 'XX'.
    itab-zconfirm1 = 'YES'.
    itab-zconfirm2 = 'YES'.
    ENDIF.
    ENDIF.
    IF s_period IS NOT INITIAL.
    READ TABLE it_vbrk BINARY SEARCH
    WITH KEY matnr = itab-matnr.
    IF sy-subrc = 0.
    itab-fkimg = it_vbrk-fkimg.
    ENDIF.
    ENDIF.
    READ TABLE it_marc WITH KEY matnr = itab-matnr
    werks = itab-werks.
    IF sy-subrc = 0.
    MOVE it_marc-minbe TO itab-minbe.
    MOVE it_marc-mabst TO itab-mabst.
    ENDIF.
    READ TABLE it_eban WITH KEY banfn = itab-banfn
    bnfpo = itab-bnfpo.
    IF sy-subrc = 0.
    IF it_eban-fixkz EQ 'X'.
    itab-zfixkz = 'Firmed'.
    ENDIF.
    ENDIF.
    READ TABLE it_mara WITH KEY matnr = itab-matnr.
    IF sy-subrc = 0.
    MOVE it_mara-matkl TO itab-matkl.
    ENDIF.
    READ TABLE it_mvke WITH KEY matnr = itab-matnr.
    IF sy-subrc = 0.
    MOVE it_mvke-mvgr1 TO itab-mvgr1.
    READ TABLE it_tvm1t WITH KEY mvgr1 = itab-mvgr1.
    IF sy-subrc = 0.
    MOVE it_tvm1t-bezei TO itab-bezei.
    ENDIF.
    ENDIF.
    MODIFY itab.
    CLEAR itab.
    ENDLOOP.
    ENDFORM. " getdata
    *& Form build_eventtab
    text
    -->P_EVENTS[] text
    FORM build_eventtab USING p_events TYPE slis_t_event.
    DATA: ls_event TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    i_list_type = 0
    IMPORTING
    et_events = p_events.
    READ TABLE p_events WITH KEY name = slis_ev_top_of_page
    INTO ls_event.
    IF sy-subrc = 0.
    MOVE formname_top_of_page TO ls_event-form.
    APPEND ls_event TO p_events.
    ENDIF.
    ENDFORM. " build_eventtab
    *& Form build_comment
    text
    -->P_HEADING[] text
    FORM build_comment USING p_heading TYPE slis_t_listheader.
    DATA: hline TYPE slis_listheader.
    CLEAR: hline.
    hline-info = 'Purchase Requision History'.
    hline-typ = 'H'.
    APPEND hline TO p_heading.
    CLEAR hline.
    ENDFORM. " build_comment
    *& Form getfieldcatalog
    text
    --> p1 text
    <-- p2 text
    FORM getfieldcatalog USING p_fcat TYPE slis_t_fieldcat_alv.
    DATA : w_fcat TYPE slis_fieldcat_alv.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'BANFN'.
    w_fcat-seltext_l = 'PR No '.
    w_fcat-key = 'X'.
    w_fcat-col_pos = 1.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'BNFPO'.
    w_fcat-seltext_l = 'PR Item '.
    w_fcat-key = 'X'.
    w_fcat-col_pos = 2.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'MATNR'.
    w_fcat-seltext_l = 'Material '.
    w_fcat-col_pos = 3.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'MAKTX'.
    w_fcat-seltext_l = 'Name of the Mateiral '.
    w_fcat-col_pos = 4.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'WERKS'.
    w_fcat-seltext_l = 'Plant '.
    w_fcat-col_pos = 5.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'EBELN'.
    w_fcat-seltext_l = 'PO No '.
    w_fcat-hotspot = 'X'.
    w_fcat-col_pos = 6.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'EBELP'.
    w_fcat-seltext_l = 'PO Item '.
    w_fcat-col_pos = 7.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'PR_MENGE'.
    w_fcat-seltext_l = 'PR Qty '.
    w_fcat-col_pos = 8.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'MEINS'.
    w_fcat-seltext_l = 'Unit'.
    w_fcat-col_pos = 9.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'MENGE'.
    w_fcat-seltext_l = 'PO Quantity '.
    w_fcat-col_pos = 10.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'GRN_MENGE'.
    w_fcat-seltext_l = 'GRN Qty '.
    w_fcat-col_pos = 11.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'TRN_MENGE'.
    w_fcat-seltext_l = 'Transit Qty '.
    w_fcat-col_pos = 12.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'BAL_MENGE'.
    w_fcat-seltext_l = 'Balance PO Qty '.
    w_fcat-col_pos = 13.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'LABST'.
    w_fcat-seltext_l = 'Current Stock'.
    w_fcat-col_pos = 14.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'FKIMG'.
    w_fcat-seltext_l = 'Sales Qty '.
    w_fcat-col_pos = 15.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'MINBE'.
    w_fcat-seltext_l = 'Reorder Point'.
    w_fcat-col_pos = 16.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'MABST'.
    w_fcat-seltext_l = 'Maximum stock level'.
    w_fcat-col_pos = 17.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'ZFIXKZ'.
    w_fcat-seltext_l = 'Fixed Indicator'.
    w_fcat-col_pos = 18.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'MATKL'.
    w_fcat-seltext_l = 'Design'.
    w_fcat-col_pos = 19.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'MVGR1'.
    w_fcat-seltext_l = 'Size'.
    w_fcat-col_pos = 20.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'BEZEI'.
    w_fcat-seltext_l = 'Size Desc.'.
    w_fcat-col_pos = 21.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'FKIMG'.
    w_fcat-seltext_l = 'Sales Qty '.
    w_fcat-col_pos = 22.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'ZCONFIRM1'.
    w_fcat-seltext_l = 'Release1'.
    w_fcat-col_pos = 23.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'ZCONFIRM2'.
    w_fcat-seltext_l = 'Release2'.
    w_fcat-col_pos = 24.
    APPEND w_fcat TO fcat.
    CLEAR w_fcat.
    w_fcat-tabname = 'ITAB'.
    w_fcat-fieldname = 'ZCONFIRM3'.
    w_fcat-seltext_l = 'Release3'.
    w_fcat-col_pos = 25.
    APPEND w_fcat TO fcat.
    ENDFORM. " getfieldcatalog
    *& Form alvdisplaydata
    text
    --> p1 text
    <-- p2 text
    FORM alvdisplaydata .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = repname
    i_callback_user_command = 'USER_COMMAND'
    it_fieldcat = fcat
    it_events = events[]
    TABLES
    t_outtab = itab.
    IF sy-subrc <> 0.
    WRITE: 'SY-SUBRC: ', sy-subrc, 'REUSE_ALV_LIST_DISPLAY'.
    ENDIF.
    ENDFORM. " alvdisplaydata
    FORM TOP_OF_PAGE *
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = heading.
    ENDFORM. "TOP_OF_PAGE
    *& Form build_eventtab1
    text
    -->P_EVENTS[] text
    FORM build_eventtab1 USING p_events1 TYPE slis_t_event.
    DATA: ls_event1 TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    i_list_type = 0
    IMPORTING
    et_events = p_events1.
    READ TABLE p_events1 WITH KEY name = slis_ev_top_of_page
    INTO ls_event1.
    IF sy-subrc = 0.
    MOVE formname_top_of_page1 TO ls_event1-form.
    APPEND ls_event1 TO p_events1.
    ENDIF.
    endform.
    *& Form build_comment
    text
    -->P_HEADING[] text
    FORM build_comment1 USING p_heading1 TYPE slis_t_listheader.
    DATA: hline1 TYPE slis_listheader.
    hline1-info = '1 Secondary List'.
    hline1-typ = 'H'.
    APPEND hline1 TO p_heading1.
    CLEAR hline1.
    ENDFORM. " build_comment
    *& Form getfieldcatalog1
    text
    -->P_FCAT1[] text
    form getfieldcatalog1 using p_fcat1 TYPE slis_t_fieldcat_alv.
    DATA : w_fcat1 TYPE slis_fieldcat_alv.
    CLEAR w_fcat1.
    w_fcat1-tabname = 'IT_LIPS'.
    w_fcat1-fieldname = 'VBELN'.
    w_fcat1-seltext_l = 'Pr.No'.
    w_fcat1-hotspot = 'X'.
    w_fcat1-col_pos = 1.
    APPEND w_fcat1 to fcat1.
    CLEAR w_fcat1.
    w_fcat1-tabname = 'IT_LIPS'.
    w_fcat1-fieldname = 'POSNR'.
    w_fcat1-seltext_l = 'PR Item'.
    w_fcat1-col_pos = 2.
    APPEND w_fcat1 to fcat1.
    CLEAR w_fcat1.
    w_fcat1-tabname = 'IT_LIPS'.
    w_fcat1-fieldname = 'MATNR'.
    w_fcat1-seltext_l = 'Material'.
    w_fcat1-col_pos = 3.
    APPEND w_fcat1 to fcat1.
    CLEAR w_fcat1.
    w_fcat1-tabname = 'IT_LIPS'.
    w_fcat1-fieldname = 'LFIMG'.
    w_fcat1-seltext_l = 'Actual quantity delivered'.
    w_fcat1-col_pos = 4.
    APPEND w_fcat1 to fcat1.
    CLEAR w_fcat1.
    w_fcat1-tabname = 'IT_LIPS'.
    w_fcat1-fieldname = 'MEINS'.
    w_fcat1-seltext_l = 'Base Unit of Measure'.
    w_fcat1-col_pos = 5.
    APPEND w_fcat1 to fcat1.
    endform. " getfieldcatalog1
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->RS_SELFIELD text
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    READ TABLE itab INDEX rs_selfield-tabindex.
    IF sy-subrc EQ 0.
    select vbeln
    posnr
    matnr
    vgbel
    lfimg
    meins from lips into table it_lips
    where vgbel = itab-ebeln.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = repname
    >>>> i_callback_user_command = 'USER_COMMAND1'
    it_fieldcat = fcat1
    it_events = events1[]
    TABLES
    t_outtab = it_lips.
    IF sy-subrc 0.
    WRITE: 'SY-SUBRC: ', sy-subrc, 'REUSE_ALV_LIST_DISPLAY'.
    ENDIF.
    ENDFORM. "USER_COMMAND
    FORM TOP_OF_PAGE1 *
    FORM top_of_page1.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = heading1.
    ENDFORM. "TOP_OF_PAGE1
    *& Form build_eventtab1
    text
    -->P_EVENTS[] text
    FORM build_eventtab2 USING p_events2 TYPE slis_t_event.
    DATA: ls_event2 TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    i_list_type = 0
    IMPORTING
    et_events = p_events2.
    READ TABLE p_events2 WITH KEY name = slis_ev_top_of_page
    INTO ls_event2.
    IF sy-subrc = 0.
    MOVE formname_top_of_page2 TO ls_event2-form.
    APPEND ls_event2 TO p_events2.
    ENDIF.
    endform.
    *& Form build_comment
    text
    -->P_HEADING[] text
    FORM build_comment2 USING p_heading2 TYPE slis_t_listheader.
    DATA: hline2 TYPE slis_listheader.
    hline2-info = '2 Secondary List'.
    hline2-typ = 'H'.
    APPEND hline2 TO p_heading2.
    CLEAR hline2.
    ENDFORM. " build_comment
    *& Form getfieldcatalog1
    text
    -->P_FCAT1[] text
    form getfieldcatalog2 using p_fcat2 TYPE slis_t_fieldcat_alv.
    DATA : w_fcat2 TYPE slis_fieldcat_alv.
    CLEAR w_fcat2.
    w_fcat2-tabname = 'IT_EKBE'.
    w_fcat2-fieldname = 'EBELN'.
    w_fcat2-seltext_l = 'Pr.Doc No'.
    w_fcat2-col_pos = 1.
    APPEND w_fcat2 to fcat2.
    CLEAR w_fcat2.
    w_fcat2-tabname = 'IT_EKBE'.
    w_fcat2-fieldname = 'EBELP'.
    w_fcat2-seltext_l = 'PR Doc Item'.
    w_fcat2-col_pos = 2.
    APPEND w_fcat2 to fcat2.
    CLEAR w_fcat2.
    w_fcat2-tabname = 'IT_EKBE'.
    w_fcat2-fieldname = 'BELNR'.
    w_fcat2-seltext_l = 'No.Mat Doc'.
    w_fcat2-col_pos = 3.
    APPEND w_fcat2 to fcat2.
    CLEAR w_fcat2.
    w_fcat2-tabname = 'IT_EKBE'.
    w_fcat2-fieldname = 'BUZEI'.
    w_fcat2-seltext_l = 'Item in Mat Doc'.
    w_fcat2-col_pos = 4.
    APPEND w_fcat2 to fcat2.
    CLEAR w_fcat2.
    w_fcat2-tabname = 'IT_EKBE'.
    w_fcat2-fieldname = 'MENGE'.
    w_fcat2-seltext_l = 'Quantity'.
    w_fcat2-col_pos = 5.
    APPEND w_fcat2 to fcat2.
    CLEAR w_fcat2.
    w_fcat2-tabname = 'IT_EKBE'.
    w_fcat2-fieldname = 'XBLNR'.
    w_fcat2-seltext_l = 'Ref Doc Num'.
    w_fcat2-col_pos = 5.
    APPEND w_fcat2 to fcat2.
    endform. " getfieldcatalog2
    *& Form USER_COMMAND1
    text
    -->R_UCOMM text
    -->RS_SELFIELD text
    FORM user_command1 USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    READ TABLE it_lips INDEX rs_selfield-tabindex.
    IF sy-subrc EQ 0.
    select ebeln
    ebelp
    belnr
    buzei
    menge
    xblnr from ekbe into table it_ekbe
    where xblnr = it_lips-vbeln.
    endif.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = repname
    i_callback_user_command = 'USER_COMMAND1'
    it_fieldcat = fcat2
    it_events = events2[]
    TABLES
    t_outtab = it_ekbe.
    IF sy-subrc 0.
    WRITE: 'SY-SUBRC: ', sy-subrc, 'REUSE_ALV_LIST_DISPLAY'.
    ENDIF.
    ENDFORM. "USER_COMMAND
    FORM TOP_OF_PAGE1
    FORM top_of_page2.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = heading2.
    ENDFORM. "TOP_OF_PAGE2

  • I am trying to pair my new mouse to my mac i get the message this device does not have the necessary

    i am trying to pair my new magic mouse to my macbook pro and i get the message "this device does not have the necessary services".

    Hi Barry
    Thanks for the advice.
    I have solved the problem by senting up a new bluetooth device.
    Should have read the directions.
    Many thanks
    John

Maybe you are looking for

  • I can't open bookmarks from the menu in new tab on firefox 6.0 using the mouse middle button or right click. Is this normal?

    I can't open my bookmarks from the menu in a new tab. I'm wondering if this is simply not a feature and requires an add-on. I'd rather not need to use an add-on. can anybody help?

  • What does image cannot be edited. The original is offline.

    I was trying to edit a photo in an album and got an error message in right panel: Image Cannot be Edited; Original is offline.  What does that mean?

  • How to hide Context Area in CRM 2007

    Hi All Is it possible in CRM2007 to hide context area ( header ) in CRM 2007 by clicking on a button. For example, when We click on "collapse navigation" button, navigation bar become hidden. I need same functionality for context area too. Best Regar

  • ORA-12170

    Dear Expert, I am wondering if someone can help me with the following: I am trying to connect to the oracle database using sqlplus, but got tns connection time out error: ORA-12170. Below is my tnsname.ora file on the client: CBSSDEV = (DESCRIPTION =

  • Updating Apps...stuck in a sign-in loop!

    I just saw that the app store shows I have 9 updates available for my iPad 3GS. When I went to update my apps, I did the typical sign-in to the App store. It appeared that it was going to go through the normal app install beginning with my flight tra