Need Oracle code logic

i have a single row sub query which returns row with del_flag as N. Now in my db, there are 2 rows getting added from the incoming feed with del_flag as Y & N.
So how can i modify the query to return the row with del_flag as N. if there is no row with del_flag as N, it should return the row with del_flag as Y.
Could some one help me on this.

Try this:
SQL> select * from tab;
      ID_1 DEL_F       ID_3
         1 Y             10
         1 N             11
         2 Y              5
         3 N              6
SQL> SELECT id_1,
       MIN(CASE
             WHEN del_flag = 'N' THEN del_flag
             WHEN del_flag = 'Y' THEN del_flag
           END) del_flag,
       MIN(CASE
             WHEN del_flag = 'N' THEN id_3
             WHEN del_flag = 'Y' THEN id_3
           END) id_3
FROM   tab
GROUP  BY id_1 
      ID_1 DEL_F       ID_3
         1 N             10
         2 Y              5
         3 N              6

Similar Messages

  • Need help on Analysing the oracle code.

    Hi,
    Here i try to frame question, pls understand and give the best way to solve this.
    We have running 20 to 30 unix scripts on daily basis. Each script has connected to oracle session and execute the corresponding packages & procedures. Some scripts are running at the same time. At this time oracle code in the script is not executed due to the table locking in other script. We have oracle trace files whenever the oracle code is not executed it shows the error and terminates the oracle session.
    Examples:
    Below the sample oracle execution log file. where we get the error and terminate the oracle session for your reference.
    ==================================================================================
    SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 10 06:18:45 2012
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Data Mining and Real Application Testing options
    SQL> SQL>
    Session altered.
    SQL> 2 3 4 5 6 7 8 9 begin
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
    ORA-06512: at "SIEB7P04.P_ARCHIVE_TBL", line 42
    ORA-06512: at line 4
    SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Data Mining and Real Application Testing options
    goin into RunProcedures Function
    0
    SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 10 06:19:19 2012
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Data Mining and Real Application Testing options
    SQL> SQL>
    Session altered.
    SQL> 2 3 4 5 6
    PL/SQL procedure successfully completed.
    SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Data Mining and Real Application Testing options
    goin into Check error report Function
    Pkg_Tfm_If_Merge OK
    ==========================================================================
    When you observe the above code, in unix script we try to connect to the oracle instance 2 times,
    1st instance it was terminated with some error.
    2nd instance it was successfully executed the oracle code.
    By analysing the above log we found where the error was occured and the reson behind this also we know.
    Assume the script called the procedure 'P_ARCHIVE_TBL' 5 times and the procedure works on different parameter(we could say different table) each time it was called.
    Is it possible for us to know in which procedure call, it is errored out.
    For any information pls revert us or ping me to this mail [email protected],
    Regards,
    Mani.

    Hi,
    You would need to have an exception block in your pl/sql code. You should also save table name in a variable when this procedure is called for every table. You should return/print the error code from exception block alongwith the table name and then you will be able to know that during which call of this procedure, the error was returned.
    Salman

  • Error while running application under  Oracle Web logic server 10.3

    Hi all,
    I am using  Oracle Web logic server 10.3 to run reports(CR4E).when at the time of adding server in to crystal report application
    i had taken Application Development Support Then at run time it is showing following error message
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException---- Error code:-2147467259 Error code name:failed
    How to Solve these critical  problem
    Thanks ,
    Amol Patil

    Hi Rahul,
    Server logs may contain JDK warnings such as the following if the jdk folder is an mklink.
    *[WARN ][osal ] Could not add counter (null)\ for query*
    *[WARN ][osal ] Failed to init virtual size counter.*
    These are just warnings and do not affect any servers.
    Workaround
    To suppress these warnings, add the following line in the FRAMEWORK_LOCATION\provisioning\provisioning-plan\fusionapps_start_params.properties file
    -Xverbose:osal=error
    You can even try the solution provided in below link
    http://hirt.se/blog/?p=169
    Regards
    Fabian

  • ACE and Oracle Web logic

    Hi All,
    I have here a 6509-E chassis with a Sup720 in it and an ACE module also in it.
    Our enviornment is getting oracle web-logic virtual servers via OVM.  Our ERP team would like to be able to load-balance to the web servers located in the oracle OVM box.  The Oracle OVM stuff, as near as I can make out uses java processes to direct traffic once it hits the box to the virtual web servers it contains. The java processes listen on different ports, thereby meaning there can be loads of web servers on the one box assuming the physical box has enough resources.
    That said, I currently have three web servers all sitting on the one physical box.
    For example:
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman","serif";}
    server1 = http://10.1.95.70:9999
    server2 = http://10.1.95.70:9888
    server3 = http://10.1.95.70:9777
    The Company bought ACE modules a while ago and we'd like to be able to use them to load balance across the three servers (there are a lot more than three but this illustrates the point).
    In the configuration of the ACE module, the rserver mode (real server) requires an IP to be assigned to the rserver, this is the real IP address of the actual server and is classes as 'serverside' I think:
    eg
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman","serif";}
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman","serif";}
    rserver host SVR_9999
      description Real Server 9999
      ip address 10.1.95.70
      inservice
    As the second web server also resides on that same IP, should it not also have the same IP?  ie
    rserver host SVR_9888
      description Real Server 9888
      ip address 10.1.95.70
      inservice
    When I try to enter in the ip address however it errors out with a duplicate:
    ACE1/TEST_CTX(config)# rserver host SVR_9888
    ACE1/TEST_CTX(config-rserver-host)# ip address 10.1.95.70
    Error: Duplicate IP address or subnet
    My question is:  Is there a way I can use the ACE module to load balance to different web servers on the one IP address (assuming the rest of the configuration is fine)?   Something that would achieve the following eg?
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman","serif";}
    rserver host SVR_9999
      description Real Server 9999
      ip address 10.1.95.70:9999
      inservice
    rserver host SVR_9888
      description Real Server 9888
      ip address 10.1.95.70:9888
      inservice
    Many thanks in advance.
    Brad

    Hi
    You need to create one rserver and multipul serverfams with port number as follow.
    rserver host SVR_1
      description Real Server
        ip address 10.1.95.70
      inservice
    rserver host SVR_2
      description Real Server
        ip address 10.1.95.70
      inservice
    serverfarm host SRV_9999
        rserver SVR_1 9999
          inservice
        rserver SVR_2 9999
           inservice
    serverfarm host SRV_9888
        rserver SVR_1 9888
           inservice
        rserver SVR_2 9888
           inservice
    serverfarm host SRV_9777
        rserver SVR_1 9777
           inservice
        rserver SVR_2 9777
           inservice
    sticky ip-netmask 255.255.255.255 address both STICKY_9999
      timeout 510
      replicate sticky
      serverfarm SRV_9999
    sticky ip-netmask 255.255.255.255 address both STICKY_9888
      timeout 510
       replicate sticky
       serverfarm SRV_9888
    sticky ip-netmask 255.255.255.255 address both STICKY_9777
      timeout 510
       replicate sticky
       serverfarm SRV_9777
    class-map match-all VIP_9999
      2 match virtual-address xxx.xxx.xxx.xxx tcp eq 9999
    class-map match-all VIP_9888
       2 match virtual-address xxx.xxx.xxx.xxx tcp eq 9888
    class-map match-all VIP_9777
       2 match virtual-address xxx.xxx.xxx.xxx tcp eq 9777
    policy-map type loadbalance first-match SLB_ORACLE_9999
      class class-default
        sticky-serverfarm SRV_9999
    policy-map type loadbalance first-match SLB_ORACLE_9888
       class class-default
         sticky-serverfarm SRV_9888
    policy-map type loadbalance first-match SLB_ORACLE_9777
       class class-default
         sticky-serverfarm SRV_9777
    policy-map multi-match ORACLE
      class VIP_9999
        loadbalance vip inservice
        loadbalance policy SLB_ORACLE_9999
        loadbalance vip icmp-reply
      class VIP_9888
        loadbalance vip inservice
        loadbalance policy SLB_ORACLE_9888
        loadbalance vip icmp-reply
      class VIP_9777
        loadbalance vip inservice
        loadbalance policy SLB_ORACLE_9777
        loadbalance vip icmp-reply
    interface vlan xx
       ip address yyy.yyy.yyy.yyy 255.255.255.0
         service-policy input  ORACLE
    Regards,
    Vashdev

  • What is Oracle Code Tree?

    Dear buddies,
    Whats Oracle Code Tree? I need to understand it in order to create a dblink from Oracle to SQLServer. I even came across the term here.
    http://www.dba-oracle.com/t_connecting_sql_server_oracle.htm
    Please guide me.
    Nith

    Hi Hemanth,
    You mean its just the arrangement of the folders?
    like Oracle Home - Network - Admin
    Thanks a bunch for your timely reply.
    Nith

  • Oracle CODE Submission Web Page - MAKE IT WORK  finally ( not temporary! )

    Is it possible to finally FIX Oracle Code Submission web page. Last year ( last half ) it return errors, same this time. Is any possible way to finally FIX it without anytime alert that it is not working or broken. As far as I understand that the place were we share our code/tips/ideas, not publish our friends or something like that. I think if we use it, then at least put warning prior than we try to submit. No conversations about re-type same code ( tip used SQL, new tip - SAME but using PL/SQL function ), but at least make it work.
    Thanks/Ilya

    Thanks, Olivier. That may help me in future and shows me where I can edit some of the HTML code (though I've no experience yet of even reading HTML or Javascript, let alone editing it!).
    The web page I'm trying to edit has a URL of https://....../sap/bc/gui/sap/its/bbpstart which fits your example but the templates under service BBPSTART seem to bear no resemblance to the screen I need. The code under services BBPSC01 and BBPSC02 looks more relevant but still doesn't refer to the screen input field that I'm looking to edit.
    Doing View Source on the web-page dumps the (very lengthy) generated code. Extracted from the header of that code-dump is...
    This page was created by the SAP Integrated ITS, WebAS: SRA, workprocess: 0
    Template: bbpsc02/99/saplbbp_sc_ui_its_2000.html
    Does that point me to the actual editable source?
    (I am using SE80 in the SRA system.)
    I wrote the above on 3rd Jan but was unable to post it.
    Since then I have found template SAPLBBP_SC_UI_ITS 2000 in service BBPSC01 does bear a resemblance to the displayed page code but as a scanty framework. The generated code has vastly more lines. I can't yet see how the template becomes the web page and where all the addditional lines of code come from and are edited.

  • Oracle DataGuard Logical Standby

    Hi , I'd like to know what are the premisses to make a standby logical replication.
    I have two environments (production and standby) with different number of processors and storage.
    I'd like to know if it's possible to create data guard solution with these two environments and what are the premisses that I need aware to install the solution.
    Thanks in advance.

    Hello;
    Yes the storage ( as long as you have enough space ) and cpu don't matter.
    You can use hardware that's quite a bit different and it will work fine.
    You can also create a Logical Standby fro a physical standby.
    These notes may help :
    NOTE 413484.1 - Data Guard Support for Heterogeneous Primary and Physical Standbys in Same Data Guard Configuration
    Mixed Oracle Version support with Data Guard Redo Transport Services [ID 785347.1]
    Logical Standby's don't seem to be very popular and the support base suffers because of this. I would consider a physical standby with Active Data Guard if costs allow.
    Active Data Guard makes an excellent "Reader" database plus I believe your switchover and failover options are much better than a Logical Standby.
    Oracle DataGuard Logical Standby Setup :
    http://orajourn.blogspot.com/2007/02/setting-up-logical-standby-database.html
    http://garyzhu.net/notes/DataGuard.html
    Best Regards
    mseberg
    Edited by: mseberg on Apr 25, 2012 10:07 AM

  • I need to change logic behind Calculate Duration button in Leave of Absence

    Hello,
    I need to change logic behind Calculate Duration button in Leave of Absence creation page.
    How I can do that?
    Please suggest.
    Regards,
    mofizur

    This will be a OAF customization, you have extend this oracle.apps.per.selfservice.absence.webui.AbsenceCO Controller.
    in processFormRequest you have catch event to Calculate Duration Button.
    You need to write custom your requrirement Logic for event to Calculate Duration.
    Thanks, Avaneesh

  • Change from jboss to Oracle Web Logic Server

    Dear all
    Currently, we have used the jboss for start T24 Browser, ATM, ... Now we want to change it to ORACLE WEB LOGIC SERVER
    Could you please guide me detail as per-requisist , license , how to configure, where could i download to test it?
    Thanks

    Hi,
    Please follow the below steps :-
    1)In order to install Weblogic it depends on the type of OS bit version.
      If you would install it on a 32 bit version then it has embedded JDK in it but if you use 64 bit then you need first either install Sun JDK or Jrockit JDK 64 version and download the Generic jar and install it.
      Java 64 bit could downloaded from the below  URL :-
      http://www.oracle.com/technetwork/java/javase/archive-139210.html
      Note :- Java 8 is not supported or certified with Weblogic.So request you to either use Java 6 or Java 7 depending upon the version of Weblogic and its certification.
    ====
    2)Could you please refer to the below certification matrix to verify if the OS is supported with Weblogic on which the configuration would be done :-
       Oracle Fusion Middleware Supported System Configurations
        Either you could use Weblogic 12C or Weblogic 10.3.1 to 10.3.6 depeding upon your requriement.
    3)Please follow the below link where all the Weblogic installers could be downloaded :-
      http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html
       "Accept the License " to download the installers.
    4)Regarding License it would be better to check with Oracle  SAN for you account or contact Oracle Support depending upon the region you belong to by following the below URL :-
       http://www.oracle.com/us/support/contact/index.html
    Regards,
    Prakash.

  • Color code logic not feasible in Pocket Browser

    Hi Team,
    We had a requirement in which we need to color the rows of SAP SRS application's ItemOverView table based on SalesOrder in a particular Purchase Order. My ex-colleague, did a solution with CellVariant that ran excellently well with Desktop applications.
    Client never tested this application in latest Mobile devices with the Pocket Browser and compatible OS.
    Now, when they tested it. First, I came to know that the standard functionality of SAP SRS MDE like GoFunctionKey is not working.
    Then, my onsite lead installed the Proper OS and Compatible Browser Pocket Browser and all the standard functionalities are working fine in SAP SRS MDE application.
    SAP had clearly mentioned to me that Cellvariant logic will not work with the Mobile Device and the Pocket Browser and also; I implemented the color code logic in the desktop application with cell design but the color code did not work with Cell Design and SAP also verified it.
    Now, please tell me how to differentiate the rows based on PO Number and the SalesOrder. They want it to be marked differently for one range and different for another range.
    OSS Message: ( 471108 / 2011 )
    17.06.2011 - 14:27:08 CET - Reply by SAP              
    Dear Kaushik,
    As mentioned in my reply dated:13.06.2011 14:28:53, yes the cell
    variants in the table UI is ignored., this is due to rich JavaScript
    and HTML support.
    Kindly close the message at your earliest.
    Thanks, Siraj
    OSS Message: ( 421670 / 2011 )
    SAP gave this link.
    https://websmp203.sap-ag.de/~sapidb/011000358700000304702008E
    UI Element Restrictions       Ignored Properties
    Table                                   design, enabled, readOnly, tooltip, width
    Thanks & Regards
    Kaushik Banerjee
    SAP Portal

    Not sure if you want to apply the blue/teal color to the name of the executive or the whole first paragraph, but you could try the following for just the name color change.
    Add this style rule:
    span.name {color: #258dbe; font-weight:bold;}
    and then for the html:
    <p><span class="name">Sandra Kozusko, President & CEO,</span> started her training and consulting career in 1988.  With more than 20 years experience in the design, development and delivery of leadership, price and profit management, change management, customer service, sales, retention, operations and technical training programs, Mrs. Kozusko has held various teaching positions at Union County College, Edison Township Adult School of Education, and The Cittone Institute.</p>
    This will change the title of the executive to blue.
    As for divs and classes... the important thing to remember is that you can use an ID (#nameofdiv) once per page, but a class can be used as many times as you like per page.

  • Oracle Code Migration

    Hi
    How often is Oracle database code migration done? What is DBA part in it?
    Thanks
    JIL

    Can you define what you mean by "Oracle code migration"?
    Oracle releases a new version of Oracle about every 3 years. First the dot one release then about 18 months later you get the dot two release.
    Patch sets come out more frequently and can be applied as needed/desired etc....
    Every time you patch or upgrade you have to retest the application with the new release/version.
    HTH -- Mark D Powell --

  • Issue in calling web service from SoapUI 4.0.0 to Oracle web logic server10

    Hi All,
    I am trying to call a web service from soapUI 4.0.0 to Oracle Web logic server 10.3 in which primavera p6 war file is deployed..
    getting an error::*this class does not support saaj 1.3*
    setting the following system property in the Weblogic startup script:
    -Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl does not work..
    setting the following system property in the Weblogic startup script:
    -Djavax.xml.soap.MessageFactory=weblogic.xml.saaj.MessageFactoryImpl
    even does not work..
    how to resolve this error,plz help me its urgent..

    Have you tried submitting your help request on the SmartBear soapUI forum?
    http://www.eviware.com/forum/viewforum.php?f=5
    Or if a soapUI Pro user:
    http://www.eviware.com/forum/viewforum.php?f=2
    Best,
    Alex

  • I need the code to delete record in the database not in the form???

    I need the code to delete record in the database not in the form...
    because when i execute a form always insert the datas in the data base but i want insert value on a text file and delete in the data base the record whith this value of text file.
    i'm spanish an my english is bad sorry.
    thank, javier

    Well, I fail to understand why you want to complicate easy things, but anyway you can do that by using TEXT_IO within Forms to create text file (see Forms builder help), and UTL_FILE package to read it within Pl/Sql : you could create a stored procedure, and call it from Forms passing the file name as parameter. See UTL_FILE documentation

  • Need sample code with RV_INVOICE_CREATE used

    Hi everybody!
    I need sample code with RV_INVOICE_CREATE or similar FMs used.
    The thing is that I do not know how to populate parametres of this and other invoicing FMs....
    For example, there are some tables to be passed to RV_INVOICE_CREATE
         TABLES
              XKOMFK     = XKOMFK
              XKOMV       = XKOMV
              XTHEAD      = XTHEAD
              XVBFS        = XVBFS
              XVBPA        = XVBPA
              XVBRK        = XVBRK
              XVBRP        = XVBRP
              XVBSS        = XVBSS
    How to populate them? I mean how to fill them with needed values?
    Useful answers will be awarded.
    Kind regards, M.

    RV_INVOICE_CREATE is the function module to create invoice based on delivery .
    when you pass delivery number ,it will create invoice ,see the invoice number in vf02,vf03 transaction. and also see the data vbrk,vbrp tables
    I have done this development and i have cancelled invoice,reverse goods issue,updated the delivery and again i am createing invoice..see the below progrm to get better understanding.
    REPORT ZWM_OVERWEIGHT_FIX  no standard page heading
                               message-id zwm.
    ======================================================================
    Program Name : ZWM_OVERWEIGHT_FIX                                    *
    Description  : Tool to fix Overweight in delivery line item,         *
                   Used All Function module to cancel invoice ,          *
                   Reverse the goods issue  ,Update Delivery qty,Create  *
                   invoice                                               *
    Author       : Seshu                                                 *
    Date         : 05/08/2007                                            *
    MODIFICATION HISTORY                                                 *
    DATE    | AUTHOR   | CHANGE #   | DESCRIPTION OF MODIFICATION        *
    --|||--
    05/08/07| Seshu    | DEVK921979 | Initial                            *
    D A T A - D E C L A R A T I O N     *******************
    Tables
    Tables : vbak,
             vbap,
             vbfa,
             likp,
             lips,
             vbrk,
             vbrp.
    Internal Tables
    data : i_lips like lips occurs 0 with header line,
           i_vbap like vbap occurs 0 with header line.
    Variables
    data : v_deliv like vbfa-vbelv,
           v_invoic like vbfa-vbelv.
    Data Declaration Part for Post Goods Issue
    DATA: l_vbeln LIKE likp-vbeln,
          l_vbkok LIKE vbkok,
          i_prot LIKE prott OCCURS 0 WITH HEADER LINE,
          ef_error_any_0 TYPE c,
          ef_error_in_item_deletion_0 TYPE c,
          ef_error_in_pod_update_0 TYPE c,
          ef_error_in_interface_0 TYPE c,
          ef_error_in_goods_issue_0 TYPE c,
          ef_error_in_final_check_0 TYPE c,
          d_return   LIKE bapireturn1.
    Internal tables for BAPI Function Module
    data : i_cret like BAPIRETURN1 occurs 0 with header line,
           i_csucess like BAPIVBRKSUCcESS occurs 0 with header line,
           i_ret2 like bapiret2 ,
           flag type c,
           i_mesg like mesg occurs 0 with header line.
    Data Declaration for Invoice Creation
    DATA: VBSK_I     LIKE  VBSK.
    data: d_success  type  c.
    DATA: XKOMFK LIKE      KOMFK   OCCURS 0 WITH HEADER LINE,
          XKOMV  LIKE      KOMV    OCCURS 0 WITH HEADER LINE,
          XTHEAD LIKE      THEADVB OCCURS 0 WITH HEADER LINE,
          XVBFS  LIKE      VBFS    OCCURS 0 WITH HEADER LINE,
          XVBPA  LIKE      VBPAVB  OCCURS 0 WITH HEADER LINE,
          XVBRK  LIKE      VBRKVB  OCCURS 0 WITH HEADER LINE,
          XVBRP  LIKE      VBRPVB  OCCURS 0 WITH HEADER LINE,
          XVBSS  LIKE      VBSS    OCCURS 0 WITH HEADER LINE,
          XKOMFKGN LIKE    KOMFKGN OCCURS 0 WITH HEADER LINE.
    S E L E C T I O N  -  S C R E E N   ******************
    Selection-screen
    Selection-screen : begin of block blk with frame title text-001.
    parameters : p_vbeln like vbak-vbeln obligatory.
    selection-screen : end of block blk.
    A T -  S E L E C T I O N  - S C R E E N ***************
    Validation on Sales order
    at selection-screen on p_vbeln.
    Check the data on VBAK Table
      select single vbeln from vbak into vbak-vbeln
                                where vbeln = p_vbeln.
      if sy-subrc ne 0.
        message e006 with p_vbeln.
      endif.
    S T A R T  - O F - S E L E C T I O N *******************
    Start-of-selection.
      break sreddy.
    Get the Invoice Number corresponding Sales Order Number
      perform get_invoice.
    Step 1.
    Cancel the Invoice  - Transaction VF11
      perform cancel_invoice.
    Reverse the goods issue
      perform reverse_goodsissue.
    Get the Order and Delivery Items
      perform get_sales_deliv.
    Delivery Change
      perform Delivery_change.
    Create Invoice document
      perform invoice_create.
    E N D  -  O F -  S E L E C T I O N  *******************
    end-of-selection.
    if flag = 'X'.
    message i012 with p_vbeln.
    endif.
    *&      Form  get_invoice
          Get Invoice Number
    FORM get_invoice.
    Clear Variables
      clear : v_deliv,
              v_invoic,
              flag.
    Get the Delivery Number First
      select single vbeln from vbfa into v_deliv
                               where vbelv = p_vbeln
                               and   vbtyp_n = 'J'.
      if sy-subrc ne 0.
        message i004 with p_vbeln.
        stop.
      endif.
    Get the Invoice Number
      select single vbeln from vbfa into v_invoic
                               where vbelv = p_vbeln
                               and   vbtyp_n = 'M'.
      if sy-subrc ne 0.
        message i003 with p_vbeln.
        stop.
      endif.
    ENDFORM.                    " get_invoice
    *&      Form  cancel_invoice
          Cancel the Invoice
    FORM cancel_invoice.
      clear : i_ret2,
              i_cret,
              i_csucess.
      refresh : i_cret,
                i_csucess.
      CALL FUNCTION 'BAPI_BILLINGDOC_CANCEL1'
        EXPORTING
          BILLINGDOCUMENT       = v_invoic
      TESTRUN               =
      NO_COMMIT             =
      BILLINGDATE           =
        TABLES
          RETURN                = i_cret
          SUCCESS               = i_csucess
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
                WAIT   = space
           IMPORTING
                RETURN = i_ret2.
    read table i_cret with key type = 'E'.
      if sy-subrc ne 0.
        message i005 with v_invoic.
        stop.
      endif.
    ENDFORM.                    " cancel_invoice
    *&      Form  reverse_goodsissue
          Reverse the goods Issue
    FORM reverse_goodsissue.
    Local Variable
      data : lv_vbtyp like likp-vbtyp.
      clear : i_mesg,
              lv_vbtyp.
      refresh : i_mesg.
      select single vbtyp from likp into lv_vbtyp
                               where vbeln = v_deliv.
      CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
        EXPORTING
          I_VBELN                         = v_deliv
          I_BUDAT                         = sy-datum
        I_COUNT                         =
        I_MBLNR                         =
        I_TCODE                         =
          I_VBTYP                         = lv_vbtyp
        TABLES
          T_MESG                          = i_mesg
       EXCEPTIONS
         ERROR_REVERSE_GOODS_ISSUE       = 1
         OTHERS                          = 2
      if sy-subrc ne 0.
        message i007 with v_deliv.
      endif.
    ENDFORM.                    " reverse_goodsissue
    *&      Form  get_sales_deliv
          Get the Sales order and Deliv Items
    FORM get_sales_deliv.
    Local Variables
      data : lv_kwmeng like vbap-kwmeng.
      clear : i_lips,
              i_vbap.
      refresh : i_lips,
                i_vbap.
    Select the data from LIPS
      select * from lips into table i_lips
                         where vbeln = v_deliv.
      if sy-subrc ne 0.
        message i008 with v_deliv.
        stop.
      endif.
      sort i_lips by vbeln posnr.
      Get the Sales order Item Data.
      select * from vbap into table i_vbap
                              where vbeln = p_vbeln.
      if sy-subrc ne 0.
        message i006 with p_vbeln.
        stop.
      endif.
      sort i_vbap by vbeln posnr.
    Compare delivery Item and Order Items
      loop at i_lips.
        clear lv_kwmeng.
        read table i_vbap with key posnr = i_lips-posnr.
        if sy-subrc eq 0.
          lv_kwmeng = i_vbap-kwmeng * 2.
          if lv_kwmeng >= i_lips-lfimg.
            i_lips-lfimg = i_vbap-kwmeng.
            modify i_lips.
          endif.
        endif.
      endloop.
    ENDFORM.                    " get_sales_deliv
    *&      Form  Delivery_change
          Delivery Update
    FORM Delivery_change.
      Clear : i_prot.
      refresh : i_prot.
    Delivery Update
      CALL FUNCTION 'LE_MOB_DELIVERY_UPDATE'
           EXPORTING
                do_commit                = 'X'
           TABLES
                t_delivery_items         = i_lips
                prot                     = i_prot
           EXCEPTIONS
                conversion_overflow      = 1
                essential_data_missing   = 2
                error                    = 3
                nothing_to_update        = 4
                lock_after_update_failed = 5
                error_in_delivery_update = 6
                OTHERS                   = 7.
      COMMIT WORK.
      IF sy-subrc <> 0.
        MESSAGE i009 with v_deliv.
      endif.
    Post Goods Issue
      CLEAR:    d_return,
                i_prot,
                l_vbeln,
                l_vbkok.
      REFRESH i_prot.
      CLEAR:  ef_error_in_item_deletion_0    ,
              ef_error_in_pod_update_0       ,
              ef_error_in_interface_0        ,
              ef_error_in_goods_issue_0      ,
              ef_error_in_final_check_0      .
    carry out goods issue
      l_vbeln          = v_deliv.
      l_vbkok-vbeln_vl = l_vbeln.
      l_vbkok-wabuc    = 'X'.
    carry out goods issue
      l_vbeln          = v_deliv.
      l_vbkok-vbeln_vl = l_vbeln.
      l_vbkok-wabuc    = 'X'.
    SET UPDATE TASK LOCAL.
      CALL FUNCTION 'WS_DELIVERY_UPDATE'
           EXPORTING
                vbkok_wa                    = l_vbkok
                synchron                    = 'X'
                no_messages_update          = ' '
                update_picking              = 'X'
                commit                      = 'X'
                delivery                    = l_vbeln
                nicht_sperren               = 'X'
                if_error_messages_send_0    = space
           IMPORTING
                ef_error_any_0              = ef_error_any_0
                ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
                ef_error_in_pod_update_0    = ef_error_in_pod_update_0
                ef_error_in_interface_0     = ef_error_in_interface_0
                ef_error_in_goods_issue_0   = ef_error_in_goods_issue_0
                ef_error_in_final_check_0   = ef_error_in_final_check_0
           TABLES
                prot                        = i_prot
           EXCEPTIONS
                error_message               = 1
                OTHERS                      = 2.
      if sy-subrc ne 0.
        message i010 with v_deliv.
      else.
        COMMIT WORK .
      endif.
    ENDFORM.                    " Delivery_change
    *&      Form  invoice_create
          Invoice Creation
    FORM invoice_create.
      refresh: XKOMFK, XKOMV,
               XTHEAD, XVBFS,
               XVBPA,  XVBRK,
               XVBRP,  XVBSS.
      clear  : XKOMFK, XKOMV,
               XTHEAD, XVBFS,
               XVBPA,  XVBRK,
               XVBRP,  XVBSS,
               VBSK_I.
      VBSK_I-SMART = 'F'.
      XKOMFK-VBELN =  v_deliv.
      XKOMFK-VBTYP = 'J'.
      APPEND XKOMFK.
      CALL FUNCTION 'RV_INVOICE_CREATE'
           EXPORTING
                VBSK_I       = VBSK_I
                WITH_POSTING = 'C'
           TABLES
                XKOMFK       = XKOMFK
                XKOMV        = XKOMV
                XTHEAD       = XTHEAD
                XVBFS        = XVBFS
                XVBPA        = XVBPA
                XVBRK        = XVBRK
                XVBRP        = XVBRP
                XVBSS        = XVBSS.
      if sy-subrc eq 0.
        COMMIT WORK.
       flag = 'X'.
      else.
      message i011 with p_vbeln.
      endif.
    ENDFORM.                    " invoice_create
    Reward Points if it is helpful
    Thanks
    Seshu

  • Monitor loggedin user in Oracle Web Logic Server

    Dear All,
    We are using IPM (11.1.1.3.0) with Oracle Web Logic Server 10.3.3.0 (Embedde LDAP).
    Can you please let me know how to monitor user login sessions (which user login at what time to the system, when he last loggedin) from Web Logic Server ?
    Also let me know whether it is possible to create a monthly report of each user login duration and how can I do it.
    Thank You

    >
    For Oracle Forms and Reports 11g Release 2 (11.1.2), download Oracle WebLogic Server 11g (10.3.5) from OTN or
    >
    from http://docs.oracle.com/cd/E23104_01/download_readme_cr2/download_readme_cr2.htm#BABDBHCJ
    Oracle Fusion Middleware 11g Software
    http://www.oracle.com/technetwork/middleware/weblogic/downloads/index.html

Maybe you are looking for

  • PlayBook Contact & Calendar Sync/Video Chat - can't get them to work

    I love my PlayBook ((OS 2.1.0.1088) and as a BB9790 user had never bothered to try to use native contacts/calendar applications until recently when a couple of relatives bought PBs and asked me questions. I have a number of GMail accounts which work

  • Switching to Mac what is me IE solution here?

    I am sick and tired of my PC and I made a really bold move today and bought a Mac Pro. It cost me $4000 but boy is it loaded. Anyhow I am sure I am going to like it more but here is my question... I know you can dual boot with Windows on the new Inte

  • Add Forecasting column to a Query

    Hi, The user wants to add a forecasting column to a query that has the actual and plan costs. He wants the option to change the values of this column in the query. Can I use any planning cubes for this? My plan is to make a copy of the cube that has

  • IMac A1200 Intel Core 2 Duo question

    Greetings. I'm looking at the possibility of purchasing a iMac 24" A1200 Intel Core 2 Duo, 2.33 GHz, 2 GB RAM, 250 GB Hard Drive. Is there something about the A1200 that is making this a less desirable machine other than being manufactures in 2006/07

  • Apple TV will not stop syncing.

    I have three AppleTVs that are use with iTunes on a PC. Since the last iTunes update 8.1.1, none of the AppleTVs sync properly. The SYNC NEVER STOPS. I do custom syncing that includes, movies, music, and picture from "My Pictures" folder. I note that