Need urgent help with the query - Beginer

Hello - I need help with a query to populate data in a table.Here is the scenario.
Source1
MnthID BranchCod CustID SegCode FXStatus ProfStatus Profit
200712 B1 C1 20 Y Y 100
Source2
MnthID BranchCod CustID ProdCode ProdIndex
200712 B1 C1 12 1
200712 B1 C2 12 0
Destination
MnthID BranchCod SegCode ProdCode CountSegCust CountProdCust ProfitProdCust
Condition and Calculations:
1)Source1 customer are base customers.If Source2 has customers who is not in source1 then that customer's record should not be fetched.
2)SegCode, FX Status, ProfStatus is one variable in destination table. [ SegCode = SegCode+ FXStatus (if FXStatus = Y)+ ProfStatus (if FXStatus = Y) ]
3)CountSegCust = CountCustID Groupby MnthID,BranchCod,SegCode Only.
4)CountProdCust = CountCustID Groupby MnthID,BranchCod,SegCode,ProdCode (when ProdIndex = 1)
5)ProfitProdCust = Sum of Profit of Customers Groupby MnthID,BranchCod,SegCode,ProdCode (when ProdIndex = 1)
Apologies for bad formatting.
Thanks in advance!!

A total guess indeed.
It's not clear whether some aggregation can be done (summing counts of grouped data might cause some customers being counted more than once)
insert into destination
select mnthid,branchcod,segcode,prodcode,countsegcust,countprodcust,profitprodcust
  from (select s1.mnthid,
               s1.branchcod,
               s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end segcode,
               s2.prodcode,
               count(s1.custid) over (partition by s1.mnthid,
                                                   s1.branchcod,
                                                   s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                          order by null
                                     ) countsegcust,
               count(case proindex when 1
                                   then custid
                     end
                    ) over (partition by s1.mnthid,
                                         s1.branchcod,
                                         s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                         s2.prodcode
                                order by null
                           ) countprodcust,
               sum(case proindex when 1
                                 then profit
                   end
                  ) over (partition by s1.mnthid,
                                       s1.branchcod,
                                       s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                       s2.prodcode
                              order by null
                         ) profitprodcust,
               row_number() over (partition by s1.mnthid,
                                               s1.branchcod,
                                               s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                               s2.prodcode
                                      order by null
                                 ) the_row
          from source1 s1,source2 s2
         where s1.mnthid = s2.mnthid
           and s1.branchcod = s2.branchcod
           and s1.custid = s2.custid
where the_row = 1Regards
Etbin

Similar Messages

  • I need urgent help with the GPS

    i've ask my family to buy Nokia n 97 from syria,while i live in cyprus,how ever i got the phone with a card inside the box says:
    this nokia device has been specially designed and manufactured for this market.the satandard GPS features have been disabled in accordance with market regulations.
    im using this mobile for the second day,i can't send it back to syria and i don't know what to do,i can't connect with the gps system in cyprus and i can't connect with the internet,please help me to find a way to enable the GPS system in my phone.
    THanks a lot

    As I explained in an earlier post, you WILL NOT be able to do it yourself.
    If the hardware is just disabled (the error message may be misleading), a Nokia service point may be able to reactivate it, though you'd have to pay because the phone only has warranty in Syria and because this wouldn't be a warranty fix anyway.
    If the hardware is removed, then you are more than likely stuck.

  • Need some help with the Select query.

    Need some help with the Select query.
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    select single vkorg abgru from ZADS into it_rej.
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
            VKORG TYPE VBAK-VKORG,
            ABGRU TYPE VBAP-ABGRU,
           END OF IT_REJ.
    This is causing performance issue. They are asking me to include the where condition for this select query.
    What should be my select query here?
    Please suggest....
    Any suggestion will be apprecaiated!
    Regards,
    Developer

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • Need urgent help with Ifs1.1 on Solaris

    We have installed IFS 1.1 with Oracle 8.1.7 on a three tier System (two Suns). We use JWS as WebServer. When we start IFS and JWS everything seems to work fine. But after some time (irregulary) we are not able to contact the JSP-Sites via a bowser. After restarting JWS, everything works fine for some time.
    Sometimes it happens (about one times a day), that the whole JWS crashes (JWS-Admin doesn't work). So we have to restart the whole IFS.
    What can be the problem? We need urgent help, because the deadline for our project is Wednesday.
    By the way:
    Where do I have to start CTX on the IFS- or the Oracle-Side?
    null

    Yes, we tried the Oracle HTTP - Server, but we weren4t able to get it to work. We didn4t get our JSP-Files to work with it. But that is another issue. I think it4s not a problem of JWS, but IFS.
    Additionally it is strange, that we are still able to connect to the database via SqlPlus.
    IFS works fine for about 15 minutes, than it crashes, nothing works anymore. We found following errors in the IfsAgents.log:
    maybe it can help?!
    Mon Dec 04 23:12:20 CET 2000
    Server STARTED: IfsAgents(19944) not managed
    Attempting to load agent EventExchangerAgent
    Agent EventExchangerAgent loaded
    Server STARTED: IfsProtocols(19945) not managed
    Attempting to start agent EventExchangerAgent
    EventExchangerAgent: Start request
    Agent EventExchangerAgent started
    Attempting to load agent ExpirationAgent
    Agent ExpirationAgent loaded
    EventExchangerAgent: starting timer
    Attempting to start agent ExpirationAgent
    ExpirationAgent: Start request
    Agent ExpirationAgent started
    Attempting to load agent GarbageCollectionAgent
    Agent GarbageCollectionAgent loaded
    ExpirationAgent: computed initial delay (in ms) is: 10024504
    ExpirationAgent: starting timer
    Attempting to start agent GarbageCollectionAgent
    GarbageCollectionAgent: Start request
    Agent GarbageCollectionAgent started
    Attempting to load agent ContentGarbageCollectionAgent
    Agent ContentGarbageCollectionAgent loaded
    GarbageCollectionAgent: computed initial delay (in ms) is: 11816890
    GarbageCollectionAgent: starting timer
    Attempting to start agent ContentGarbageCollectionAgent
    ContentGarbageCollectionAgent: Start request
    Agent ContentGarbageCollectionAgent started
    Attempting to load agent DanglingObjectAVCleanupAgent
    Agent DanglingObjectAVCleanupAgent loaded
    ContentGarbageCollectionAgent: starting timer
    Attempting to start agent DanglingObjectAVCleanupAgent
    DanglingObjectAVCleanupAgent: Start request
    Agent DanglingObjectAVCleanupAgent started
    Attempting to load agent OutboxAgent
    Agent OutboxAgent loaded
    DanglingObjectAVCleanupAgent: computed initial delay (in ms) is: 5500105
    DanglingObjectAVCleanupAgent: starting timer
    Attempting to start agent OutboxAgent
    OutboxAgent: Start request
    Agent OutboxAgent started
    Attempting to load agent ServiceWatchdogAgent
    Agent ServiceWatchdogAgent loaded
    OutboxAgent: Done processing
    Attempting to start agent ServiceWatchdogAgent
    ServiceWatchdogAgent: Start request
    Agent ServiceWatchdogAgent started
    Attempting to load agent QuotaAgent
    Agent QuotaAgent loaded
    ServiceWatchdogAgent: Initializing ServerWatchdogTable with 9 entries
    ServiceWatchdogAgent: starting timer
    Server STARTED: FtpServer(20082) managed by IfsProtocols(19945)
    ServiceWatchdogAgent: New Server being watchdogged
    Attempting to start agent QuotaAgent
    QuotaAgent: Start request
    Agent QuotaAgent started
    QuotaAgent: starting timer
    Server STARTED: CupServer(20124) managed by IfsProtocols(19945)
    ServiceWatchdogAgent: New Server being watchdogged
    Server STARTED: ImapServer(20130) managed by IfsProtocols(19945)
    ServiceWatchdogAgent: New Server being watchdogged
    Server STARTED: SmtpServer(20150) managed by IfsProtocols(19945)
    ServiceWatchdogAgent: New Server being watchdogged
    ServiceWatchdogAgent: Unlocked Server Detected in checkServer
    ServiceWatchdogAgent: Unlocked Server Detected in checkServer
    ServiceWatchdogAgent: Unlocked Server Detected in checkServer
    ServiceWatchdogAgent: Unlocked Server Detected in checkServer
    ServiceWatchdogAgent: Unlocked Server Detected in checkServer
    ServiceWatchdogAgent: Unlocked Server Detected in checkServer
    ServiceWatchdogAgent: Unlocked Server being investigated
    ServiceWatchdogAgent: Unlocked Server being investigated
    ServiceWatchdogAgent: Unlocked Server being investigated
    ServiceWatchdogAgent: Unlocked Server being investigated
    ServiceWatchdogAgent: Unlocked Server being investigated
    ServiceWatchdogAgent: Unlocked Server being investigated
    ServiceWatchdogAgent: Freeing unlocked server 19687
    ServiceWatchdogAgent: Freeing unlocked server 19666
    Server STOPPED: CupServer(19687) managed by IfsProtocols(19519)
    ServiceWatchdogAgent: Freeing unlocked server 19723
    ServiceWatchdogAgent: Freeing unlocked server 19520
    Server STOPPED: FtpServer(19666) managed by IfsProtocols(19519)
    Server STOPPED: SmtpServer(19723) managed by IfsProtocols(19519)
    ServiceWatchdogAgent: Freeing unlocked server 19519
    Server STOPPED: IfsAgents(19520) not managed
    ServiceWatchdogAgent: Freeing unlocked server 19712
    Server STOPPED: IfsProtocols(19519) not managed
    Server STOPPED: ImapServer(19712) managed by IfsProtocols(19519)
    ServiceWatchdogAgent: Freed Server removed from watchdog list
    ServiceWatchdogAgent: Freed Server removed from watchdog list
    ServiceWatchdogAgent: Freed Server removed from watchdog list
    ServiceWatchdogAgent: Freed Server removed from watchdog list
    ServiceWatchdogAgent: Freed Server removed from watchdog list
    ServiceWatchdogAgent: Freed Server removed from watchdog list
    QuotaAgent: Timer event: 0 active; 0 exceeded
    ContentGarbageCollectionAgent: Freed 5 unreferenced ContentObjects
    QuotaAgent: Timer event: 0 active; 0 exceeded
    ServiceWatchdogAgent: IfsException publishing timer details:
    ServiceWatchdogAgent: oracle.ifs.common.IfsException: IFS-11012: Unable to get events from other services
    java.sql.SQLException: ORA-03114: not connected to ORACLE
    ServiceWatchdogAgent: IfsException in checkForDeadServices():
    ServiceWatchdogAgent: oracle.ifs.common.IfsException: IFS-10651: Unable to begin transaction
    oracle.ifs.common.IfsException: IFS-10603: Unable to set database savepoint
    java.sql.SQLException: ORA-03114: not connected to ORACLE
    ServiceWatchdogAgent: IfsException in handle loop; continuing:
    ServiceWatchdogAgent: oracle.ifs.common.IfsException: IFS-10651: Unable to begin transaction
    oracle.ifs.common.IfsException: IFS-10603: Unable to set database savepoint
    java.sql.SQLException: ORA-03114: not connected to ORACLE
    ServiceWatchdogAgent: IfsException publishing timer details:
    ServiceWatchdogAgent: oracle.ifs.common.IfsException: IFS-10651: Unable to begin transaction
    oracle.ifs.common.IfsException: IFS-10603: Unable to set database savepoint
    java.sql.SQLException: ORA-03114: not connected to ORACLE
    ServiceWatchdogAgent: IfsException publishing timer details:
    ServiceWatchdogAgent: oracle.ifs.common.IfsException: IFS-10651: Unable to begin transaction
    oracle.ifs.common.IfsException: IFS-10603: Unable to set database savepoint
    java.sql.SQLException: ORA-03114: not connected to ORACLE
    ServiceWatchdogAgent: IfsException publishing timer details:
    ServiceWatchdogAgent: oracle.ifs.common.IfsException: IFS-10651: Unable to begin transaction
    oracle.ifs.common.IfsException: IFS-10603: Unable to set database savepoint
    java.sql.SQLException: ORA-03114: not connected to ORACLE
    ServiceWatchdogAgent: IfsException publishing timer details:
    ServiceWatchdogAgent: oracle.ifs.common.IfsException: IFS-10651: Unable to begin transaction
    oracle.ifs.common.IfsException: IFS-10603: Unable to set database savepoint
    java.sql.SQLException: ORA-03114: not connected to ORACLE
    ServiceWatchdogAgent: IfsException publishing timer details:
    ServiceWatchdogAgent: oracle.ifs.common.IfsException: IFS-10651: Unable to begin transaction
    oracle.ifs.common.IfsException: IFS-10603: Unable to set database savepoint
    java.sql.SQLException: ORA-03114: not connected to ORACLE
    null

  • Need some help with the colour profile please. Urgent! Thanks

    Dear all, I need help with the colour profile of my photoshop CS6. 
    I've taken a photo with my Canon DSLR. When I opened the raw with ACDSee, the colour looks perfectly ok.
    So I go ahead and open in photoshop. I did nothing to the photo. It still looks ok
    Then I'm prompt the Embedded Profile Mismatch error. I go ahead and choose Discard the embedded profile option
    And the colour started to get messed up.
    And the output is a total diasater
    Put the above photo side by side with the raw, the red has became crimson!!
    So I tried the other option, Use the embedded profile
    The whole picture turns yellowish in Photoshop's interface
    And the output is just the same as the third option.
    Could someone please guide me how to fix this? Thank you.

    I'm prompt the Embedded Profile Mismatch error. I go ahead and choose Discard the embedded profile option
    always use the embedded profile when opening tagged images in Photoshop - at that point Photoshop will convert the source colors over to your monitor space correctly
    if your colors are wrong at that point either your monitor profile is off, or your source colors are not what you think they are - if other apps are displaying correctly you most likely have either a defective monitor profile or source profile issues
    windows calibrate link:
    http://windows.microsoft.com/en-US/windows7/Calibrate-your-display
    for Photoshop to work properly, i recall you want to have "use my settings for this device" checked in Color Management> Device tab
    you may want to download the PDI reference image to check your monitor and print workflows
    and complete five easy steps to profile enlightenment in Photoshop
    with your settings, monitor profile and source profiles sorted out it should be pretty easy to pinpoint the problem...

  • Need urgent help with HSDIO hardware timing

    Hi everyone,
    I need urgent help regarding HSDIO hardware timing. I've been working in a project which generating serial ramp using HSDIO pxie device. 
    I'm using clock rate 40MHz and generating 14 bit of boolean for each step of ramp. And I have to generate simply 256 steps ramp.
    Which means, 256 (steps) x 14 (boolean array) x 25 ns (period of 1 boolean value) = 89,6 ns.
    What I'm doing right now is with using index of FOR loop as my input data (converting the index into 14bit boolean), then write into pxie device in every iteration,
    which means, my data is getting into output in every 1ms time, right? (I'm using windows)
    And I want to be able to generate faster than that. 
    How can I prewrite my 256 steps ramp, then write them all at once into pxie device. I'm really stuck here.
    In the picture can you see how I do the write into device in every iteration of FOR Loop.
    Regards,
    Yan.

    hi, thanks for responding.
    with using example of dynamic generation with script, I can manage to generate the ramp with controllable delay (generate the whole waveform, including delay with script command, then write to the card).
    But I still have 1 question, I can test the output of the generation using oscilloscope and cant see the start delay (I'm writing delay at the start, before generating the ramp). My signal generated at 0 sec.
    How can I check this start delay? is there any good example delivered with Labview to check this generation? Somehow I cant use the "dynamic generation and acquisition" example to see my generation (cant figure out how to capture the generated signal).
    regards,
    Yan.

  • I've just came on board from Andriod and need massive help with the Contacts application any one out there willing to help the 'noob'?

    I had the folks at the store port over all of my contacts from my old
    ratty Andriod phone to my new shiny iPhone.
    however all 200+ of my contacts sort of "shook" out,
    meaning say John Smith, on my old phone,
    had in my contacts the following:
    John Smith
    123 Main St. Anytown, Anystate USA
    555-826-4879 home
    555-799-4247 cell
    [email protected]
    johnsmith@facebook
    all nice and neat on my andriod but when it ported over
    all that information was just scattered all over my contacts sort of like:
    john smith, smith john
    john smith 123 main st. etc.
    johhn smith home 555 etc.
    john smith cell 555 etc.
    john smith johnsmith@ etc.
    etc.
    so for all those 200+ contacts in my phone, I've got a zillion of them now...
    so I'd like to get this all back in order before I and Siri explode.
    I know nothing, and I know even less about outlook and the sort.
    But I do know I am in Dire need of help with this... I figured that eveything else
    involving iphones and apple in general was supposed to be cake but it seems
    like this is the only thing that isn't cake at all... unless, I'm just a right idiot. (which is possible, hence spelling and grammatical issues).

    I believe I've tried to sync it with google, but it didn't seem to take
    muchless take my calender. it seems to favor my facebook calender
    more over my google calender, but Siri seems to be helping me re-write
    it...but that's not the game here, it's the contacts. I've tried to export
    the cvp (??) list and import it into my iTunes account. However, It only
    doubled my issue because it didn't over write my existing contacts.

  • Help with the query---urgent

    PROCEDURE Mktg_Obj_Cmpgn(p_attr_tbl_nm IN attr.attr_tbl_nm%TYPE,p_actn_cd IN chg_log.actn_cd%TYPE) IS
    v_tbl_nm varchar2(100);
    v_actn_cd varchar2(4);
    BEGIN
    v_tbl_nm := p_attr_tbl_nm;
    v_actn_cd := p_actn_cd;
    --dbms_output.put_line(v_tbl_nm);
    IF v_actn_cd = 'CRET' THEN
    SELECT to_clob(XMLELEMENT("requestmessage",XMLATTRIBUTES(xmlforest(
    seq_pblsh_rqst.nextval AS "publish_id")),
    XMLAGG(XMLELEMENT("campaign",XMLATTRIBUTES(XMLFOREST(chg.actn_cd AS "ACTION",
    pgm.program_idseq AS "parententityvalue",
    ent_sbsrb.ENT_ID AS "entid",
    pgm.campaign_idseq AS "campaignid",
    bus_unt.portfolio_subtype_id AS "campaignsegment",
    pgm_typ.pgm_type_nm AS "campaigntype",
    LKP.lookup_key_desc AS "campaignclass",
    pgm.editor_userid AS "campaignlastmodifiedby",
    pgm.edited_dtm AS "campaignlastmodifieddate",
    pgm.mkt_initv_proc_tx AS "campaignlink",
    ofr.offer_idseq AS "offerlink")))),
    XMLAGG(XMLELEMENT("PROCESSCODE", XMLATTRIBUTES(XMLFOREST(action as "link",PROGRAM.program_idseq AS "parententityvalue",
    ENT_SBSRB_ATTR.ent_id AS "entid"))))))AS "v_clob" into v_clob1
    FROM dual,
    chg_log chg,
    program pgm,
    ent_sbsrb_attr ent_sbsrb,
    business_unit bus_unt,
    program_type pgm_typ,
    offer ofr,
    (SELECT lookup_keyword,lookup_key_desc,lookup_type
    FROM lookup_key
    WHERE lookup_type = 'PRTFL_CMPGN_ID')LKP
    WHERE chg.attr_id = ent_sbsrb.attr_id
    and chg.parnt_ent_val_tx = to_char(pgm.program_idseq)
    and pgm.business_unit_idseq = bus_unt.business_unit_idseq
    and pgm.pgm_type_cd = pgm_typ.pgm_type_cd
    and ofr.program_idseq = pgm.program_idseq
    and pgm.pgm_cls_cd(+) = LKP.lookup_keyword;
    END IF;
    end Mktg_Obj_Cmpgn;
    I have this procedure within a package. v_clob1 is declared in packagebody as a CLOB variable. when i try to compile it i am getting the below given error.can anyone please help me?
    (1): PL/SQL: ORA-19208: parameter 1 of function XMLELEMENT must be aliased
    (2): PL/SQL: SQL Statement ignored

    hi sir,
    wanna ask u guyz one query
    let say i have table name account(parent) and service(child)
    account
    id name status
    1 john 0
    2 ki 1
    3 kdf 2
    service
    id trans_id name status
    1 1 et 9999
    1 2 eee 2222
    2 3 ere 999
    2 4 wew 0
    i plan to use something like this
    delete account from account t1,service t2 where t1id=t2.id and t1.status<>0;
    but sql command not correct so plz help me
    now i need a query to delete records from service table only but
    account.status <> 0 and accound.id=service.id
    i dunt want to delete record from account table
    so can u help me with this query
    thanks
    Message was edited by:
    mani_um

  • Need urgent help with communicating with the HP 4155B analyser with Labview

    i folks,
    I'm currently trying to communicate with our HP 4155B semiconductor pamaremter analyser.  I do not have experience with GPIB yet. I have installed the NI VISA.
    I was wondering if anyone could help with getting me started on how to start communicating with the device using Labview.
    I'm not certain where to start.
    Kind regards
    Rob

    Hi,
    Thanks for the help. I now have communication with the instrument.
    I was wondering if it's possible to to setup a data measurement (I-V Sweep) and be able to read the measurement data in realtime as it is being measured. So I basically see the graph updating itself on the PC during the measurement.
    Is this possible? Could anyone give advice on how I can go about this or are there any examples that can help me understand how to do this?
    I'm not completely sure how to initialise the instruemnt for communication and handle VISA WRITEs and READs. within LabView
    Best regards
    Rob

  • Need Urgent Help With Alesis Firewire 8: 10.6.5 cannot recognize the mixer?

    I managed to install all the up to date drivers on the Alesis website (as instructed by the manual). THen restarted the computer and when i go to my SYSTEM PREFERENCES to change the AUDI/MIDI to the mixer, the mixer isn't even there as an option (although it is on and connected to my macbook via 6-6pin firewire cable!
    -I also went on *ABOUT THIS MAC > MORE INFO > FIREWIRE >* nothing here just "Maximum Speed: Up to 400 Mb/sec"
    - THen I went BACK TO SYSTEM PREFERENCES, under OTHER there is a MULTIMIX icon but when I click on it it says "+Preferences Error. You can’t open MultiMix Settings preferences because it doesn’t work on an Intel-based Mac.+"
    - What im wondering about is the fact that I am running *Snow Leopard OSX 10.6.5* and on the alesis website [http://www.alesis.com/multimix8firewire#] Under Docs & Downloads of the Multimix FireWire 8, the latest drivers available for download are:
    1)MultiMix FireWire - Macintosh Drivers [v3.5.3.8671]
    Adds support for Mac OS 10.6.3 Snow Leopard.
    Updated by Alesis 06/16/2010.
    2) MB zip
    MultiMix FireWire - Macintosh Drivers [v3.4.2.6300]
    Adds support for Mac OS 10.6 Snow Leopard.
    Updated by Alesis 09/14/2009.
    Like i said, I am running * Snow Leopard OS X 10.6.5* so which one should I download? I have tried both and none have worked. I am frustrated. Somebody help me please! Thanks in advance.

    Gave them a call today. Apparently, it has to do with the version software im running (10.6.5 SL) which is too high. Because their latest available driver for download is for 10.6.3, I have to obtain the retail instal disks from apple to reformat my mac back to 10.6.0.
    Other than the fact that I had to wait 40 mins on phone hold before getting an Alesis customer service to help me, what bothers me the most is the fact that they said having a macbook with 10.6.3 should be compatible with their Alesis device, yet they were UNSURE about whether anything running higher than 10.6.3 would work with their interface. I think its important to let customers know that, yet they fail to do so.
    Does anyone know how long it takes to receive retail snow leopard instal disks?
    and thanks for the help!

  • Need some help with the Table Function Operator

    I'm on OWB 10gR2 for Sun/Solaris 10 going against some 10gR2 DB's...
    I've been searching up and down trying to figure out how to make OWB use a Table Function (TF) which will JOIN with another table; allowing a column of the joined table to be a parameter in to the TF. I can't seem to get it to work. I'm able to get this to work in regular SQL, though. Here's the setup:
    -- Source Table:
    DROP TABLE "ZZZ_ROOM_MASTER_EX";
    CREATE TABLE "ZZZ_ROOM_MASTER_EX"
    ( "ID" NUMBER(8,0),
    "ROOM_NUMBER" VARCHAR2(200),
    "FEATURES" VARCHAR2(4000)
    -- Example Data:
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (1,'Room 1',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (2,'Room 2',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (3,'Room 3','1,1;2,3;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (4,'Room 4','5,2;5,4;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (5,'Room 5',' ');
    -- Destination Table:
    DROP TABLE "ZZZ_ROOM_FEATURES_EX";
    CREATE TABLE "ZZZ_ROOM_FEATURES_EX"
    ( "ROOM_NUMBER" VARCHAR2(200),
    "FEATUREID" NUMBER(8,0),
    "QUANTITY" NUMBER(8,0)
    -- Types for output table:
    CREATE OR REPLACE TYPE FK_Row_EX AS OBJECT
    ID NUMBER(8,0),
    QUANTITY NUMBER(8,0)
    CREATE OR REPLACE TYPE FK_Table_EX AS TABLE OF FK_Row_EX;
    -- Package Dec:
    CREATE OR REPLACE
    PACKAGE ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX;
    END ZZZ_SANDBOX_EX;
    -- Package Body:
    CREATE OR REPLACE
    PACKAGE BODY ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX
    AS
    RETURN_VALUE FK_Table_EX := FK_Table_EX();
    i NUMBER(8,0) := 0;
    BEGIN
    -- TODO: Put some real code in here that will actually read the
    -- input string, parse it out, and put data in to RETURN_VALUE
    WHILE(i < 3) LOOP
    RETURN_VALUE.EXTEND;
    RETURN_VALUE(RETURN_VALUE.LAST) := FK_Row_EX(4, 5);
    i := i + 1;
    END LOOP;
    RETURN RETURN_VALUE;
    END UNFK;
    END ZZZ_SANDBOX_EX;
    I've got a source system built by lazy DBA's and app developers who decided to store foreign keys for many-to-many relationships as delimited structures in driving tables. I need to build a generic table function to parse this data and return it as an actual table. In my example code, I don't actually have the parsing part written yet (I need to see how many different formats the source system uses first) so I just threw in some stub code to generate a few rows of 4's and 5's to return.
    I can get the data from my source table to my destination table using the following SQL statement:
    -- from source table joined with table function
    INSERT INTO ZZZ_ROOM_FEATURES_EX(
    ROOM_NUMBER,
    FEATUREID,
    QUANTITY)
    SELECT
    ZZZ_ROOM_MASTER_EX.ROOM_NUMBER,
    UNFK.ID,
    UNFK.QUANTITY
    FROM
    ZZZ_ROOM_MASTER_EX,
    TABLE(ZZZ_SANDBOX_EX.UNFK(ZZZ_ROOM_MASTER_EX.FEATURES)) UNFK
    Now, the big question is--how do I do this from OWB? I've tried several different variations of my function and settings in OWB to see if I can build a single SELECT statement which joins a regular table with a table function--but none of them seem to work, I end up getting SQL generated that won't compile because it doesn't see the source table right:
    INSERT
    /*+ APPEND PARALLEL("ZZZ_ROOM_FEATURES_EX") */
    INTO
    "ZZZ_ROOM_FEATURES_EX"
    ("ROOM_NUMBER",
    "FEATUREID",
    "QUANTITY")
    (SELECT
    "ZZZ_ROOM_MASTER_EX"."ROOM_NUMBER" "ROOM_NUMBER",
    "INGRP2"."ID" "ID_1",
    "INGRP2"."QUANTITY" "QUANTITY"
    FROM
    (SELECT
    "UNFK"."ID" "ID",
    "UNFK"."QUANTITY" "QUANTITY"
    FROM
    TABLE ( "ZZZ_SANDBOX_EX"."UNFK2" ("ZZZ_ROOM_MASTER_EX"."FEATURES")) "UNFK") "INGRP2",
    "ZZZ_ROOM_MASTER_EX" "ZZZ_ROOM_MASTER_EX"
    As you can see, it's trying to create a sub-query in the FROM clause--causing it to just ask for "ZZZ_ROOM_MASTER_EX"."FEATURES" as an input--which isn't available because it's outside of the sub-query!
    Is this some kind of bug with the code generator or am I doing something seriously wrong here? Any help will be greatly appreciated!

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • Need some help with the samples

    I am using CR for Visual Studio 2010. After installing CR and verifying the install per the developer guide, I down loaded the samples crsdk_net_samples_12.zip and loaded VB_Win_Data_DataSets.sln, electing to convert it from VS2008 to VS2010.  After trying this several times, I could only get several error messages in the conversion log file. 
    I have read that it is easy to get these to work in VS 2010, but I can't find any instructions. The Crystal Reports for .NET SDK Samples download page has no readme file, or instructions or hints for conversion of these files into VS2010.  I could not find samples created specifically for VS2010.
    I must be missing something simple.  Can you help me get some of these samples working in VS2010? I am interested in connecting to Collections in my program and to strongly types xml datasets. I plan to use filters and parameters and to use the ReportDocument Object Model.  I could proceed without the samples -- but I am sure life would be a lot easier if I can get them to work and benefit from the good work that is there.
    I could provide the log file. In part, it says:
    Project: VB_Win_Data_DataSets Warning: this project requires Crystal Reports, which is no longer included with Visual Studio.
    The converter (VS 2008 to VS2010) showed one error, converted 1 file, and did not convert 19 files.
    Thanks

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • Need some help with count query

    Hello,
    I'm terrible @ oracle, so bear with me. I am trying to use the count function with my query but it counts rows from different tables.
    I want my query to basically add a column from another table but have it not be a part of the count.
    Say, table1 table2 table3. My count is right between the first two tables (Buyers,5).But since in table3 there are duplicate values(or accounts in this case(3), the count multiples by that many (15).
    I need it to read Buyers,5,account #. I've tried distinct and a union but to no avail.
    Help me please.

    If I understand you correctly, you want to count the records in table1 and table2 which have a one-to-one relationship, but you need to display additional data from table3 which has a one-to-many relationship. If this is correct, you need to use an in-line view to join table1 and table2 then join that in-line view to table3 to display the data from it. Something along the lines of:
    SELECT v.col1, v.col2, v.col3, v.col4, v.cnt, t3.col1 t3col1, t3.col2 t3col2
    FROM (SELECT t1.col1, t1.col2, t2.col1 col3, t2.col2 col4, COUNT(*) cnt
          FROM table1 t1, table2 t2
          WHERE <join conditions between t1 and t2> and
                <other conditions if required>
          GROUP BY t1.col1, t1.col2, t2.col1, t2.col2) v,
         table3 t3
    WHERE <join conditions between v and t3>
          <other conditions if required>John

  • Need some Help with the new Genius Mixes on iTunes 9

    I would like to know how to use the New Genius Mixes on iTunes 9. I don't quit know how to use it yet and like all of us we're all just learning how to use the Genius Mixes. I did watch the KeyNote but they didn't go into great detail on how to use it. Does Apple have a web site that has more detail instruction on how to use the genius Mixes? I did find some info. on how to use the Genius mixes but it didn't go into great detail on how or what to do with the genius Mixex and thats what I need.
    when I click on the genius Mixes icon under the "Genius", what shows up is a Big square with four album images of my music that I have in my music collection, I go and roll my mouse over the Big square with my four music albums and click on it to play the music and it'll play what ever I have in the Genius Mix list plus as I roll my mouse over the Big Square, under it it says "Jazz Mix" with some text writings under the Jazz mix.
    I want to change the Jazz mix Title and I want to know how to add more music square boxes to my Genius Mixes just like they show in the Keynote and I would like to edit and create my own four square music boxes in my Genius Mixes.
    I never used my music genius list, I always created just a play List, now I am just learning how to use this music Genius lists and I don't know how to use it at all and I need someone that knows how to use thr Genius Mixes list to help me how to use it since there isn't a how to book yet for the new iTunes 9.
    Can someone Please help me with the new genius Mixes on iTunes.
    Thank you,
    Mrs Trisha Foster

    Today, I was getting an array out of bounds exception on a split
    I don't see how that could happen with the 'split' method since it creates its own array.
    For this particular string, ordSplit.length = 24 and commas = 26.
    PERFECT! That is exactly what it should be!
    Look closely at the end of the sample string you posted and you will see that it has trailing empty strings at the end: '1096200000000242505,,,'
    Then if you read the Javadocs for the 'split' method you will find that those will NOT be included in the resulting array:
    http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#split(java.lang.String)
    split
    public String[] split(String regex)
    Splits this string around matches of the given regular expression.  This method works as if by invoking the two-argument split method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array.
    Just a hunch but your 'out of bounds exception' is likely due to your code assuming that there will be 26 entries in the array and there are really only 24.

  • I need urgent help for the logic

    hi all,
    Initially, the requirement was to create PO regardless the Purchase Requisition based on the formula
    If (Open Qty + Current Stock) < Safety Stock ==>> THEN A PO NEEDS TO BE CREATED
    This is absolutely fine, this created the PO as per the above condition.
    OUR REQUIREMENT
    Modify the same program to create PO's only if there is any PR for that material . Meaning, turn all the PR's into PO. Also, when creating PO, the delivery date should be = (Current date - 7 days) when creating a PO for an PR(I think the table name is VETVG.)  Nothing else. We need to change the  IF condition in the following code .
    so can any one let me that what modification i need to do ie what logic i should use to get the requirement fullfilled.
    *Report  Z_STO_SAFETY_STOCK                                            *
    Program Name : Z_STO_SAFETY_STOCK                                    *
    Date         : 09.03.2007                                            *
    Programmer   : Rajdeep Kumar
    Last Change  : Van Tran                22/03/2007                    *
    Specification:                                                       *
    Program Type : Report                                                *
    Description  : Create STO requirement for Plant
    Transaction  : None                                                  *
    Input Files  : None                                                  *
    Output Files : None                                                  *
    Scheduling Issues :                                                  *
    Run Frequency :                                                      *
    Mod#    Date          By            Description                      *
    New   09.03.2007   Rajdeep Kumar     Created                         *
                       DEVK905890                                        *
    M01   20.03.2007   Rajdeep Kumar     Material Group Added to         *
                       DEVK905892        Selection Screen                *
    *Update 05.04.2007   DEVK906082        Added two new selection         *
                                         fields beskz and sobsl          *
                                         and is select statement         *
    REPORT  z_sto_safety_stock NO STANDARD PAGE HEADING.
    *&                       TABLES
    TABLES:
            t001w,
          marc.                                               " M01
            marc,                                               " M01
            mara.                                               " M01
    *&                     DATA DECLARATION
    DATA: BEGIN OF it_marc OCCURS 0,
            matnr LIKE marc-matnr,
            werks LIKE marc-werks,
            eisbe LIKE marc-eisbe,
          bstmi LIKE marc-bstmi,
            bstrf LIKE marc-bstrf,
            beskz LIKE marc-beskz,
            sobsl LIKE marc-sobsl,
          END OF it_marc.
    DATA: BEGIN OF it_mard OCCURS 0,
            matnr LIKE mard-matnr,
            werks LIKE mard-werks,
            labst LIKE mard-labst,
          END OF it_mard.
    DATA: BEGIN OF it_po OCCURS 0,
            ebeln LIKE ekko-ebeln,
            werks LIKE ekpo-werks,
            ebelp LIKE ekpo-ebelp,
            loekz LIKE ekpo-loekz,
            etenr LIKE eket-etenr,
            matnr LIKE ekpo-matnr,
            menge LIKE eket-menge,
            wemng LIKE eket-wemng,
          END OF it_po.
    DATA: BEGIN OF it_po_2 OCCURS 0,
            matnr LIKE ekpo-matnr,
            werks LIKE ekpo-werks,
            ebeln LIKE ekko-ebeln,
            ebelp LIKE ekpo-ebelp,
            loekz LIKE ekpo-loekz,
            etenr LIKE eket-etenr,
            menge LIKE eket-menge,
            wemng LIKE eket-wemng,
          END OF it_po_2.
    DATA: BEGIN OF it_po_pend OCCURS 0,
            matnr LIKE ekpo-matnr,
            werks LIKE ekpo-werks,
            pendi LIKE eket-menge,
          END OF it_po_pend.
    DATA: BEGIN OF wa_join OCCURS 0,
            ebeln LIKE ekko-ebeln,
            werks LIKE ekpo-werks,
            ebelp LIKE ekpo-ebelp,
            loekz LIKE ekpo-loekz,
            etenr LIKE eket-etenr,
            matnr LIKE ekpo-matnr,
            menge LIKE eket-menge,
            wemng LIKE eket-wemng,
          END OF wa_join.
    DATA : BEGIN OF itab_marc_mard OCCURS 0,
             werks  LIKE marc-werks,
             matnr  LIKE marc-matnr,
             eisbe  LIKE marc-eisbe,
           bstmi  LIKE marc-bstmi,
             bstrf  LIKE marc-bstrf,
             beskz  LIKE marc-beskz,
             sobsl  LIKE marc-sobsl,
             labst  LIKE mard-labst,
             menge  LIKE ekpo-menge,
             ordqty LIKE ekpo-menge,
           END OF itab_marc_mard.
    DATA: BEGIN OF it_sto OCCURS 0,
          werks LIKE mard-werks,
          matnr LIKE mard-matnr,
          orqty LIKE ekpo-menge,
          eisbe LIKE marc-eisbe,
        bstmi LIKE marc-bstmi,
          bstrf LIKE marc-bstrf,
          beskz LIKE marc-beskz,
          sobsl LIKE marc-sobsl,
          labst LIKE mard-labst,
          pendi LIKE eket-menge,
          END OF it_sto.
    DATA: ws_poheader            LIKE   bapimepoheader.
    DATA: ws_poheaderx           LIKE   bapimepoheaderx .
    DATA: ws_ebeln               TYPE   mepoheader-ebeln.
    DATA: ws_posnr               LIKE   ekpo-ebelp.
    DATA: ws_etenr               LIKE   eket-etenr VALUE '0001'.
    DATA: ws_purchaseorder       LIKE   ekko-ebeln.
    DATA: ws_flg1                TYPE   c. " VALUE 'X'.
    DATA: ws_flg2                TYPE   c.
    DATA: ws_flg3                TYPE   c.
    *-- For Handling Error Messages in BAPI
    DATA: tbl_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    *-- For Item Details
    DATA: tbl_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
    DATA: tbl_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
    DATA: tbl_posched LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE.
    DATA: tbl_poschedx LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.
    *&                       CONSTANTS
    CONSTANTS:   ws_flg            TYPE   c   VALUE 'X'.
    CONSTANTS:   c_unistruct(2)    TYPE   c   VALUE 'Z3'. "For UNISTRUCT STO
    *&                      SELECTION-SCREEN
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_werks FOR t001w-werks,
                  s_matnr FOR marc-matnr.                     " M01
                    s_matnr FOR marc-matnr,                     " M01
                    s_matkl FOR mara-matkl,                     " M01
                    s_beskz FOR marc-beskz,
                    s_sobsl FOR marc-sobsl.
    PARAMETERS:     p_test  TYPE check.
    SELECTION-SCREEN : END OF BLOCK b1.
    *&                      START OF SELECTION EVENT
    START-OF-SELECTION.
    Get the Safety Stock & Minimum Lot Size for the materials
      PERFORM get_plant_data.
    Get the Quantities in stock
      PERFORM get_stock_data.
    Determine the open quantities for the materials concerned
    [EKKO, EKET, EKPO]
      PERFORM get_open_quantities.
    PERFORM open_quantities.
    Determine overall the quantities required for each material
      PERFORM determine_mat_qty_required.
    Print the details
      PERFORM print_details.
      IF p_test EQ space.
      PO is created for each plant.
      Create the PO required.
        PERFORM create_po.
      Create the PO's for each plant with the materials required
       PERFORM create_header_item.
      Bapi call to create a Purchase order
       PERFORM create_purhase_order.
      ENDIF.
    END-OF-SELECTION.
    TOP-OF-PAGE.
      PERFORM print_header.
    *&      Form  get_plant_data
          To get the Safety Stock
    -->  p1        text
    <--  p2        text
    FORM get_plant_data .
    start                                                     " M01
    SELECT      matnr werks eisbe bstmi
    INTO TABLE  it_marc
    FROM        marc
    WHERE       matnr IN s_matnr AND
                werks IN s_werks AND
                eisbe GT 0.
    end                                                       " M01
    start                                                     " M01
      SELECT      marc~matnr werks eisbe bstrf beskz sobsl
                                                              " bstmi
      INTO TABLE  it_marc
      FROM        marc AS marc
      INNER JOIN  mara AS mara
      ON          maramatnr EQ marcmatnr
      WHERE       marc~matnr IN s_matnr AND
                  werks      IN s_werks AND
                  matkl      IN s_matkl AND
                  beskz      IN s_beskz AND
                  sobsl      IN s_sobsl AND
                  eisbe      GT 0.
    end                                                       " M01
    ENDFORM.                    " get_plant_data
    *&      Form  get_stock_data
         To get the Current Stock
    -->  p1        text
    <--  p2        text
    FORM get_stock_data .
      DATA: BEGIN OF lt_mard OCCURS 0,
              matnr LIKE mard-matnr,
              werks LIKE mard-werks,
              lgort LIKE mard-lgort,
              labst LIKE mard-labst,
            END OF lt_mard.
      CHECK NOT it_marc[] IS INITIAL.
      SELECT      matnr werks lgort labst
      INTO TABLE  lt_mard
      FROM        mard
      FOR         ALL ENTRIES IN it_marc
      WHERE       matnr EQ it_marc-matnr AND
                  werks EQ it_marc-werks.
      SORT lt_mard BY matnr werks.
      LOOP AT lt_mard.
        AT NEW werks.
          it_mard-matnr = lt_mard-matnr.
          it_mard-werks = lt_mard-werks.
        ENDAT.
        it_mard-labst = it_mard-labst + lt_mard-labst.
        AT END OF werks.
          APPEND it_mard.
          CLEAR  it_mard.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_stock_data
    *&      Form  open_quantities
          text
    -->  p1        text
    <--  p2        text
    FORM open_quantities .
    Storing MARC and MARD data in an internal table to find the open
    quantities
      LOOP AT it_marc.
        itab_marc_mard-matnr = it_marc-matnr.
        itab_marc_mard-werks = it_marc-werks.
        itab_marc_mard-eisbe = it_marc-eisbe.
      itab_marc_mard-bstmi = it_marc-bstmi.
        itab_marc_mard-bstrf = it_marc-bstrf.
        itab_marc_mard-beskz = it_marc-beskz.
        itab_marc_mard-sobsl = it_marc-sobsl.
        READ TABLE it_mard WITH KEY matnr = it_marc-matnr.
        IF sy-subrc EQ 0.
          itab_marc_mard-labst = it_mard-labst.
        ENDIF.
        APPEND itab_marc_mard.
        CLEAR itab_marc_mard.
      ENDLOOP.
      CHECK NOT itab_marc_mard[] IS INITIAL.
    Join EKKO EKPO
      SELECT a~ebeln
             b~ebelp
             b~werks
             b~matnr
             b~menge
             c~etenr
             c~wamng
             INTO CORRESPONDING FIELDS OF TABLE it_po
      FROM ekpo AS b
      INNER JOIN ekko AS a
      ON aebeln = bebeln
      INNER JOIN eket AS c
      ON bebeln = cebeln AND bebelp = cebelp
      FOR ALL ENTRIES IN itab_marc_mard
      WHERE b~matnr = itab_marc_mard-matnr AND
            b~werks IN s_werks .
      DATA : t_menge TYPE ekpo-menge . "local variable
    *Store the contents of it_po to the work area to get the minimum order
    *quantity
      wa_join[] = it_po[].
      LOOP AT it_po.
    delete the entries where MENGE = WAMNG
        DELETE it_po WHERE menge = it_po-wemng.
        LOOP AT wa_join WHERE matnr = it_po-matnr
                               AND werks = it_po-werks.
          t_menge = t_menge + wa_join-menge.
        ENDLOOP.
        it_po-menge = t_menge.
        MODIFY TABLE it_po TRANSPORTING menge.
        CLEAR  :t_menge.
      ENDLOOP.
    Once you get the quantities delete the repeating materials for the
    plant.
      DELETE ADJACENT DUPLICATES FROM it_po COMPARING werks matnr.
      SORT it_po BY matnr.
      LOOP AT itab_marc_mard.
        READ TABLE it_po WITH KEY matnr = itab_marc_mard-matnr
            APPEND it_sto.
        ELSE.
          WRITE:/ 'There are no open quantities to create Purchase order'.
        ENDIF.
        CLEAR it_sto.
      ENDLOOP.                         werks = itab_marc_mard-werks BINARY
    SEARCH.
        itab_marc_mard-ordqty = itab_marc_mard-labst + it_po-menge .
         If Open quantiy + Current Stock < Safety Stock
        IF itab_marc_mard-ordqty LE itab_marc_mard-eisbe.
         Minimum order qty = Safety Stock - (Open qty + current stock)
          itab_marc_mard-ordqty = itab_marc_mard-eisbe - ( it_po-menge +
    itab_marc_mard-labst )  .
           Move all the contents to the internal table it_sto ie Plant,
    Material and the Min Order Qty
           so that we can create PO based on this internal table
          it_sto-matnr = itab_marc_mard-matnr.
          it_sto-werks = itab_marc_mard-werks.
          it_sto-orqty = itab_marc_mard-ordqty.
    ENDFORM.                    " open_quantities
    *&      Form  CREATE_HEADER_ITEM
          text
    FORM create_header_item.
      LOOP AT it_sto.
    *--- Document date with flag
        ws_poheader-doc_date             = sy-datum.
        ws_poheaderx-doc_date            = ws_flg.
    *--- Document type with flag
        ws_poheader-doc_type             = 'Z3'(c01).
        ws_poheaderx-doc_type            = ws_flg.
    *--- Purchasing group with Flag
        ws_poheader-pur_group            = '005'.   " hardcoded
        ws_poheaderx-pur_group           =  ws_flg.
    *--- Purchasing Organization with flag
        ws_poheader-purch_org            = '2000'.
        ws_poheaderx-purch_org           = ws_flg.
    *--- Supply plant with flag
        ws_poheader-suppl_plnt           = '2000'.
        ws_poheaderx-suppl_plnt          = ws_flg.
    *--- Company Code with flag
        ws_poheader-comp_code            = '2000'.
        ws_poheaderx-comp_code           = ws_flg.
    *<--- assinging new item No.
        ws_posnr = ws_posnr + 10.
    *POPULATE ITEM DATA.
        tbl_poitem-po_item                 = ws_posnr.
        tbl_poitem-material                = it_sto-matnr.
        tbl_poitem-item_cat                = 'U'(c02).
        tbl_poitem-plant                   = it_sto-werks.
        tbl_poitem-quantity                = it_sto-orqty.
        APPEND tbl_poitem.
        CLEAR  tbl_poitem.
    *POPULATE ITEM FLAG TABLE
        tbl_poitemx-po_item                = ws_posnr.
        tbl_poitemx-po_itemx               = ws_flg.
        tbl_poitemx-material               = ws_flg.
        tbl_poitemx-plant                  = ws_flg.
        tbl_poitemx-item_cat               = ws_flg.
        tbl_poitemx-quantity               = ws_flg.
        APPEND tbl_poitemx.
        CLEAR  tbl_poitemx.
      ENDLOOP.
    ENDFORM.                    "CREATE_PO
    *&      Form
          text
    -->  p1        text
    <--  p2        text
    FORM create_purhase_order .
      CLEAR:  tbl_poitem,
              tbl_poitemx,
              ws_poheader,
              ws_poheaderx.
      REFRESH:  tbl_poitem,
                tbl_poitemx.
      CLEAR  : tbl_return.
      REFRESH: tbl_return.
    *<--- Bapi to create Purchase order
      IF NOT tbl_poitem[] IS INITIAL.
        CALL FUNCTION 'BAPI_PO_CREATE1'
          EXPORTING
            poheader         = ws_poheader
            poheaderx        = ws_poheaderx
          IMPORTING
            exppurchaseorder = ws_purchaseorder
          TABLES
            return           = tbl_return
            poitem           = tbl_poitem
            poitemx          = tbl_poitemx.
        READ TABLE tbl_return WITH KEY type = 'E'.
    *<--- Bapi to commit the changes
        IF sy-subrc <> 0.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
        ENDIF.
      ENDIF.
      LOOP AT tbl_return.
    *<--- Ignore the warning messages
        IF tbl_return-type = 'W'.
          CONTINUE.
        ENDIF.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        IF tbl_return-type = 'S'.
          FORMAT COLOR COL_POSITIVE ON.
        ELSEIF tbl_return-type = 'W'.
          FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
        ELSEIF tbl_return-type = 'E'.
          FORMAT COLOR COL_NEGATIVE INTENSIFIED OFF.
        ENDIF.
        WRITE:/3 tbl_return-type,12 tbl_return-id,20(85)  tbl_return-message
               86(10) tbl_return-field,95(20) tbl_return-system.
        FORMAT COLOR OFF.
      ENDLOOP.
    ENDFORM.                    " create_purhase_order
    *&      Form  get_open_quantities
          text
    -->  p1        text
    <--  p2        text
    FORM get_open_quantities .
      CHECK NOT it_mard[] IS INITIAL.
      SELECT      ekkoebeln ekpoebelp ekpowerks ekpomatnr
                  ekpomenge eketetenr eket~wemng
                  INTO CORRESPONDING FIELDS OF TABLE it_po
      FROM        ekko AS ekko
      INNER JOIN  ekpo AS ekpo
      ON          ekpoebeln EQ ekkoebeln
      INNER JOIN  eket AS eket
      ON          eketebeln EQ ekpoebeln AND
                  eketebelp EQ ekpoebelp
      FOR         ALL ENTRIES IN it_mard
      WHERE       ekko~bstyp EQ 'F'             AND
                  ekko~bsart EQ 'Z3'            AND
                  ekko~bsakz EQ 'T'             AND
                  ekko~loekz EQ space           AND
                  ekpo~matnr EQ it_mard-matnr   AND
                  ekpo~werks EQ it_mard-werks   AND
                  ekpo~loekz EQ space           AND
                  ekpo~elikz EQ space.
      SORT it_po BY ebeln ebelp etenr.
    delete entries where the schedule is complete, else copy to new table
      LOOP AT it_po.
        IF it_po-wemng GE it_po-menge.
          DELETE it_po.
        ELSE.
          MOVE-CORRESPONDING it_po TO it_po_2.
          APPEND it_po_2.
          CLEAR  it_po_2.
        ENDIF.
      ENDLOOP.
      SORT it_po_2 BY matnr werks.
    To determine the pending quantities of the materials at plant level
      LOOP AT it_po_2.
        AT NEW werks.
          it_po_pend-matnr = it_po_2-matnr.
          it_po_pend-werks = it_po_2-werks.
        ENDAT.
        it_po_pend-pendi = it_po_pend-pendi + it_po_2-menge - it_po_2-wemng.
        AT END OF werks.
          APPEND it_po_pend.
          CLEAR  it_po_pend.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_open_quantities
    *&      Form  determine_mat_qty_required
          text
    -->  p1        text
    <--  p2        text
    FORM determine_mat_qty_required .
      DATA: lv_eisbe LIKE marc-eisbe,
            lv_labst LIKE mard-labst,
            lv_menge LIKE eket-menge,
          lv_bstmi_old LIKE marc-bstmi,
            lv_bstrf_old LIKE marc-bstrf,
            lv_beskz_old LIKE marc-beskz,
            lv_sobsl_old LIKE marc-sobsl,
            lv_pendi LIKE eket-menge,
            lv_total_conf     LIKE ekpo-menge,
          lv_bstmi          LIKE marc-bstmi,
          lv_min_qty        LIKE marc-bstmi,
            lv_bstrf          LIKE marc-bstrf,
            lv_min_qty        LIKE marc-bstrf,
            lv_qty_req        LIKE mard-labst,
            lv_remainder      TYPE i.
      LOOP AT it_marc.
      safety stock
        lv_eisbe = it_marc-eisbe.
       lv_bstmi_old = it_marc-bstmi.
         lv_bstrf_old = it_marc-bstrf.
         lv_beskz_old = it_marc-beskz.
         lv_sobsl_old = it_marc-beskz.
        READ TABLE it_mard
        WITH KEY matnr = it_marc-matnr
                 werks = it_marc-werks
                 BINARY SEARCH.
        IF sy-subrc EQ 0.
        qty onhand
          lv_labst = it_mard-labst.
        ELSE.
          CLEAR lv_labst.
        ENDIF.
        READ TABLE it_po_pend
        WITH KEY matnr = it_marc-matnr
                 werks = it_marc-werks
                 BINARY SEARCH.
        IF sy-subrc EQ 0.
        PO pending qty
          lv_pendi = it_po_pend-pendi.
        ELSE.
          CLEAR lv_pendi.
        ENDIF.
      Total qty on hand & PO qty pending
        lv_total_conf = lv_labst + lv_pendi.
      Now determine if a PO is required for the material concerned.
        IF lv_total_conf < lv_eisbe.
          it_sto-matnr = it_marc-matnr.
          it_sto-werks = it_marc-werks.
          it_sto-eisbe = lv_eisbe.
        it_sto-bstmi = lv_bstmi_old.
          it_sto-bstrf = lv_bstrf_old.
          it_sto-beskz = lv_beskz_old.
          it_sto-sobsl = lv_sobsl_old.
          it_sto-labst = lv_labst.
          it_sto-pendi = lv_pendi.
        Actual Qty Required
          lv_qty_req = lv_eisbe - lv_total_conf.
         IF it_marc-bstmi IS INITIAL.
           IF it_marc-bstrf IS INITIAL.
            it_sto-orqty = lv_qty_req.
          ELSE.
           lv_bstmi = it_marc-bstmi.
           lv_min_qty = it_marc-bstmi.
             lv_bstrf = it_marc-bstrf.
             lv_min_qty = it_marc-bstrf.
            DO.
              IF lv_qty_req <= lv_min_qty.
                lv_qty_req = lv_min_qty.
                it_sto-orqty = lv_qty_req.
                EXIT.
              ELSE.
               lv_min_qty = lv_min_qty + lv_bstmi.
                 lv_min_qty = lv_min_qty + lv_bstrf.
              ENDIF.
            ENDDO.
          ENDIF.
          APPEND it_sto.
          CLEAR  it_sto.
        ENDIF.
      ENDLOOP.
      SORT it_sto BY werks matnr.
    ENDFORM.                    " determine_mat_qty_required
    *&      Form  print_details
          text
    -->  p1        text
    <--  p2        text
    FORM print_details .
      LOOP AT it_sto.
        WRITE:/ it_sto-werks UNDER text-h01,
                it_sto-matnr UNDER text-h02,
                it_sto-orqty UNDER text-h03,
                it_sto-eisbe UNDER text-h04,
              it_sto-bstmi UNDER text-h05,
                it_sto-bstrf UNDER text-h05,
                it_sto-labst UNDER text-h06,
                it_sto-pendi UNDER text-h07.
      ENDLOOP.
    ENDFORM.                    " print_details
    *&      Form  print_header
          text
    -->  p1        text
    <--  p2        text
    FORM print_header .
      WRITE:  AT 001 text-h01,
                 015 text-h02,
               030 text-h03,
               050 text-h04,
               070 text-h05,
               090 text-h06,
               110 text-h07.
                 030 text-h03 RIGHT-JUSTIFIED,
                 050 text-h04 RIGHT-JUSTIFIED,
                 070 text-h05 RIGHT-JUSTIFIED,
                 090 text-h06 RIGHT-JUSTIFIED,
                 110 text-h07 RIGHT-JUSTIFIED.
      NEW-LINE.
    ENDFORM.                    " print_header
    *&      Form  create_po
          text
    -->  p1        text
    <--  p2        text
    FORM create_po .
    *-Document date with flag
      ws_poheader-doc_date             = sy-datum.
      ws_poheaderx-doc_date            = ws_flg.
    *-Document type with flag
      ws_poheader-doc_type             = 'Z3'(c01).
      ws_poheaderx-doc_type            = ws_flg.
    *-Purchasing group with Flag
      ws_poheader-pur_group            = '005'.   " hardcoded
      ws_poheaderx-pur_group           =  ws_flg.
    *-Purchasing Organization with flag
      ws_poheader-purch_org            = '2000'.
      ws_poheaderx-purch_org           = ws_flg.
    *-Supply plant with flag
      ws_poheader-suppl_plnt           = '2000'.
      ws_poheaderx-suppl_plnt          = ws_flg.
    *-Company Code with flag
      ws_poheader-comp_code            = '2000'.
      ws_poheaderx-comp_code           = ws_flg.
      LOOP AT it_sto.
        AT NEW werks.
          CLEAR  tbl_poitem.
          CLEAR  tbl_poitemx.
          CLEAR  tbl_return.
          CLEAR  tbl_posched.
          CLEAR  tbl_poschedx.
          REFRESH tbl_poitem.
          REFRESH tbl_poitemx.
          REFRESH tbl_return.
          REFRESH tbl_posched.
          REFRESH tbl_poschedx.
          CLEAR ws_posnr.
        ENDAT.
        ws_posnr = ws_posnr + 10.
      Item Data
        tbl_poitem-po_item                 = ws_posnr.
        tbl_poitem-material                = it_sto-matnr.
        tbl_poitem-item_cat                = 'U'(c02).
        tbl_poitem-plant                   = it_sto-werks.
        tbl_poitem-quantity                = it_sto-orqty.
        APPEND tbl_poitem.
        CLEAR  tbl_poitem.
      Item X Data
        tbl_poitemx-po_item                = ws_posnr.
        tbl_poitemx-po_itemx               = ws_flg.
        tbl_poitemx-material               = ws_flg.
        tbl_poitemx-plant                  = ws_flg.
        tbl_poitemx-item_cat               = ws_flg.
        tbl_poitemx-quantity               = ws_flg.
        APPEND tbl_poitemx.
        CLEAR  tbl_poitemx.
      Schedule Data
        tbl_posched-po_item = ws_posnr.
        tbl_posched-sched_line = '0001'.
        tbl_posched-delivery_date = sy-datum.
        tbl_posched-quantity = it_sto-orqty.
        APPEND tbl_posched.
        CLEAR  tbl_posched.
      Schedule Data X
        tbl_poschedx-po_item = ws_posnr.
        tbl_poschedx-po_itemx = ws_flg.
        tbl_poschedx-sched_line = '0001'.
        tbl_poschedx-sched_linex = ws_flg.
        tbl_poschedx-delivery_date = ws_flg.
        tbl_poschedx-quantity = ws_flg.
        APPEND tbl_poschedx.
        CLEAR  tbl_poschedx.
        AT END OF werks.
        Create the PO
          CALL FUNCTION 'BAPI_PO_CREATE1'
            EXPORTING
              poheader         = ws_poheader
              poheaderx        = ws_poheaderx
            IMPORTING
              exppurchaseorder = ws_purchaseorder
            TABLES
              return           = tbl_return
              poitem           = tbl_poitem
              poitemx          = tbl_poitemx
              poschedule       = tbl_posched
              poschedulex      = tbl_poschedx.
          LOOP AT tbl_return WHERE type EQ 'E' OR type EQ 'A'.
            EXIT.
          ENDLOOP.
        If Loop is false - then no error occurred
          IF sy-subrc NE 0.
          No Errors - Commit
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait = 'X'.
          ENDIF.
          SKIP.
          LOOP AT tbl_return.
            FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
            IF tbl_return-type = 'E' OR tbl_return-type = 'A'.
              FORMAT COLOR COL_NEGATIVE INTENSIFIED OFF.
            ELSEIF tbl_return-type = 'W'.
              FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
            ELSE.
              FORMAT COLOR COL_POSITIVE ON.
            ENDIF.
            WRITE:/3 tbl_return-type,12 tbl_return-id,20(85)
    tbl_return-message,
                   86(10) tbl_return-field,95(20) tbl_return-system.
            FORMAT COLOR OFF.
          ENDLOOP.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " create_po

    Hi,
    first you can store these 2 dates into some internal table sat it_sobid  and it_ObjectID.Now
    sort  it_sobid ascending.
    loop at  it_ObjectID.
    Read date from  it_sobid  binary search index sy-index.
    it_ObjectID-date =  it_sobid-date.
    flag = 'y'.
    endloop.
    you can write some logic like this. Its just a rough idea you can modify according to ur need.
    Regards,
    Ravi

Maybe you are looking for

  • DSO request not activating

    Hi Experts I have one request in DSO in my Development system whose request is not activating, not even giving any message.  I tried with delete and reload but not working. please suggest some ideas.

  • Reading file anf using input for main

    Hello Amigos, I have the following code but I have my doubts if it will work for what I want. I want to read in a file that will call a method with specific arguments. Example: Method: addTwoNumbers(int oneNum, int twoNum); File: sum.txt: addTwoNumbe

  • Weblogic sql injection...

    Hello! I would like to pentest weblogic application using sql injection, Dos, XSS. Can anyone help me what should I do to start testing it? Which tools should I use (I have to use open source tools). I would be very grateful for your help.

  • Character Styles parameters that doesn't apply

    Yesterday, I've created a "No Break" character style to use with GREP Styles. In this Style, only the No Break checkbox is checked. The problem was that the GREP Style expressions .{8}$ worked with all my other character style but the "No Break". I d

  • What form does one export from FCE to get it into movie theater tape form?

    If one is wildly enthused about one's documentary, and thinks it is what the world is waiting to see in theaters, how does one take it from FCE to...? Can one simply upload it to a miniDV camcorder, and then send it to some professional editing compa