Reg the logic required

Hi,
LOOP AT it_output INTO wa_output.
if wa_output-bldat  <= p_date.
    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
      EXPORTING
        i_datum_bis                   = p_date
        i_datum_von                   = wa_output-bldat
  I_KZ_EXCL_VON                 = '0'
  I_KZ_INCL_BIS                 = '0'
  I_KZ_ULT_BIS                  = ' '
  I_KZ_ULT_VON                  = ' '
  I_STGMETH                     = '0'
  I_SZBMETH                     = '1'
     IMPORTING
       e_tage                        = wa_date
EXCEPTIONS
   days_method_not_defined       = 1
   OTHERS                        = 2.
    IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF wa_date <= 30.
      MOVE wa_output-wrbtr TO amount.
      amount = amount + wa_output-wrbtr1.
      move amount to wa_output-wrbtr1.
    ELSEIF wa_date > 30 AND wa_date =< 60.
      MOVE wa_output-wrbtr TO wa_output-wrbtr2.
      amount1 = amount1 + wa_output-wrbtr2.
      move amount1 to wa_output-wrbtr2.
   ELSEIF wa_date > 60 AND wa_date <= 90.
      MOVE wa_output-wrbtr TO wa_output-wrbtr3.
.     amount2 = amount2 + wa_output-wrbtr3.
      move amount2 to wa_output-wrbtr3.
   ELSEIF wa_date > 90.
      MOVE wa_output-wrbtr TO wa_output-wrbtr4.
      amount3 = amount3 + wa_output-wrbtr4.
      move amount3 to wa_output-wrbtr4.
      append wa_output to it_output.
ENDIF.
   append wa_output to it_output.
    MODIFY it_output FROM wa_output.
ENDLOOP.
in this code the the wa_output is not filling all the data,
it is picking all the data ,,when it come out of the loop wrbtr3 is
becoming 0, but wrbtr4 is getting the value..........it is getting value becoming the wa_date is more the 90....
wrtbr3 also i need to get...
pls on this issue
some body can help to fill the all the fields when it come out of the loop,

Hi,
Why are you modifying the output table after appeninding it? Is there any reason for that?
when you are reading a record where date is more than 90, are sure there is value in wrbtr3? if there is no value this field wa_output-wrbrt3 will be empty because the loop is reading a different record.
If you still have doubts get in touch with me.
Thanks,
Anil

Similar Messages

  • Logic required to findout "Release To Date" of the Purchase order

    Hi
    We are developing a custom program to release purchase orders as per clients requirements. In that, in the output, we need to display the "Release To Date" of the purchase order. Consider the release codes are R1,R2& R3, and currently the PO is released by R1, then we need to show "Release To Date" as R1. Simillerly once R2 also released the PO, we need to show "R1 R2" in the Release To Date field. This you can see in the Release Tab of the PO.
    Now we need to adopt the same logic in our custom program also. Which table i can find the release to date details. The latest release code of the PO also good enough to build the logic to findout the "Release To Date"
    Any pointers would be of great help.
    Thanks
    Venkat.

    Hi Venkat,
    Check up these tables
    T16FC, T16FD, T16FG, V_T16FC
    Regards,
    Hareesha
    If it's help's reward the pts

  • Programming Logic required for pulling the records for past month /week

    Hi All
    I need help in the SQL programming logic.
    Oracle Database Version: 10.2.0.3.0
    Requirement
    In a data warehouse environment, I need to programme for weekly and monthly automated batch jobs to insert the data from Data_tbl to Reporting_tbl for generating reports. Tables descriptions are given below.
    Table1 - Data_tbl (Source table –this table gets updated everyday).
    Record_dt     first_name     last_name
    Table2 - Reporting_tbl_(Target table)
    Cycle_dt     first_name     last_name
    1. Monthly Report
    In the SQL Query, I have where clause condition—
    Where Record_dt >=’01-nov-08’ and record_dt<=’30-nov-08’
    Using the above condition in development, I am pulling the data from source table for the past month data. This will be repeated every month and it should be automated.
    i.e., if I run this report any time in dec 2008, it should pick records of dates from Nov 01st to Nov 30th 2008. if I run this report any time in Jan 2009, it should pick records of dates from Dec 01st to Dec 31st 2008.
    Date Values should be assigned for past month. Value of Cycle_dt in target table should be end date of past month like 30-nov-2008, 31-dec-2008.
    2. Weekly Report
    In the SQL Query, I have where clause condition—
    Where Record_dt >=’01-dec-08’ and record_dt<=’07-dec-08’
    Here week start day is Monday and end day is Sunday.
    If I run the report between Dec 08th to Dec 14th , it should pull records of dates from Dec 01st to Dec 07th 2008.
    On Dec 15th, it should pick from Dec 08th to Dec 14th.
    Value of Cycle_dt in target table should be end date of past week like 07-Dec-2008, 14-Dec-2008.
    Please help me with the logics for both Monthly and Weekly reports.
    Thanks

    Hi,
    For the monthly report, instead of
    Where Record_dt >=’01-nov-08’ and record_dt<=’30-nov-08’say:
    Where   Record_dt >= TRUNC (ADD_MONTHS (SYSDATE, -1), 'MM')
    and     record_dt <  TRUNC (SYSDATE, 'MM')SYSDATE is the current DATE.
    TRUNC (SYSDATE, 'MM') is the beginning of the current month. (Notice the condition above is less than this date, not equal to it.)
    ADD_MONTHS (STSDATE, -1) is a date exactly one month ago, therefore it is in the previous month.
    For the weekly report, instead of:
    Where Record_dt >=’01-dec-08’ and record_dt<=’07-dec-08’say
    Where   Record_dt >= TRUNC (SYSDATE - 7, 'IW')
    and     record_dt <  TRUNC (SYSDATE, 'IW')TRUNC (dt, 'IW') is the beginning of the ISO week (Monday-Sunday) that contains dt. Again, notice the end condition is strictly less than the beginning of the current week.

  • Reg logic required for selection-screen.

    Hi,
    i have one requirement
    on selection screen 2 radio button
    1 for service
    2 for account
    Parameter      FILE     LOCALFILE     Filename
    If the radiobutton ACCOUNT is selected the default name for file will be:
         ‘Rev_acc_com_&system_time_stamp&.dat’
    Elseif the radiobutton SERVICE is selected the default name for file will be:
         ‘Rev_srv_com_&system_time_stamp&.dat’
    some body can give the logic for this.

    take the following solution
    data: tstamp type TZNTSTMPS.
    data: filename type string.
    call function 'CONVERT_INTO_TIMESTAMP'
    exporting
       I_DATLO  = sy-datum
       I_TIMLO   = sy-uzeit
    importing
       E_TIMESTAMP = tstamp.
    if ACCOUNT is selected then
    concatenate 'Rev_srv_com_' tstamp '.dat' into filename.
    else if SERVICE is selected then
    concatenate 'Rev_srv_com_' tstamp '.dat' into filename.
    the filename variable will be containing ur required file name..
    reward points if useful....

  • Reg:Logic required

    Hi ,
    We are working on one development for this we are using exit:MV45AFZZ and written code on it.The logic we have written is when ever the field FPLT:FAKSP is blank at contarct level ,then it should trigger an intimation mail .First time it is triggering mail and even when we go go second and third time and make some change other than field FAKSK again it is triggering mail.How to stop further mails ,it should trigger only when we make change in field FAKSK only .Pls help.
    Regards,
    Sash .
    Use meaningful subject for your future questions
    Edited by: Vijay Babu Dudla on Feb 26, 2009 7:54 AM

    Hi ,
    The requirement is when ever the user removes a billing block at filed FPLT:FAKSP then it should trigger a mail .Logic we have taken is :Pass the VBAK:VBELN to FPLA:VBELN and pick the FPLNR then send it to FPLT and check FAKSP ,if it is space then trigger a mail .Pls suggest exit and required coding.
    Thnaking you in advance.
    With Regards,
    Sash.

  • SAP logic for calculating the replenishment requirement - IS Retail

    Hi All,
              Could you explain from where does the RPLRQ field is getting picked up from the WRPT table.And what is the SAP logic for calculating the replenishment requirement for a particular article.
    Regards,
    PSS

    Dear PSS,
    Field RPLRQ represents for the replenishment requirement determined in the previous replenishment run. This can be changed when follow-on documents are created if order optimizing is active (for example, if quantities are to be rounded off).
    Bye,
    Muralidhara

  • Logic required for the requirement (urgent)

    HI experts,
    can anyone help me out regarding the following logic.
    The logic will check for both complete and partial goods receipts and invoice receipts. Based on the PO line item history it will calculate the totals into following categories:
    (1) Total PO Line Item value with both GR & IR
    (2) Total PO Line Item value with GR but no IR
    (3) Total PO Line Item value with IR but no GR
    For a single PO line, it is possible to have the Total Line Item Value divided into one or more of the above three categories at the same time. For example, if for a PO line item with 100 unit at $10.00 per unit, there is a GR for 50 Units and IR for only 30 units, the three columns above will be populated as:
    (1) Total PO Line Item value with both GR & IR – 30 x 10 = 300
    (2) Total PO Line Item value with GR but no IR – 20 x 10 = 200
    (3) Total PO Line Item value with IR but no GR – 0 x 10 = 0
    Similarly, if for a PO line item with 100 units and $10.00 per unit, there is a GR for 50 units and IR for 70 units, the three columns will be populated as:
    (1) Total PO Line Item value with both GR & IR – 50 x 10 = 500
    (2) Total PO Line Item value with GR but no IR – 0 x 10 = 0
    (3) Total PO Line Item value with IR but no GR – 20 x 10 = 200
    Regards,
    Nagaraj

    Maybe this example will help....
    report zrich_0002 .
    data: iekbe type table of ekbe with header line.
    data: xmbew type mbew.
    data: xekpo type ekpo.
    data: begin of ibuckets occurs 0,
          ebeln type ekpo-ebeln,
          ebelp type ekpo-ebelp,
          pgrir type p decimals 2,  " Total GR & IR
          pgr   type p decimals 2,  " Total GR
          pir   type p decimals 2,  " Total IR
          pgrni type p decimals 2,  "GR no IR
          pirng type p decimals 2,  "IR no GR
          end of ibuckets.
    parameters: p_ebeln type ekko-ebeln,
                p_ebelp type ekpo-ebelp.
    start-of-selection.
      clear iekbe.  refresh iekbe.
      select * into table iekbe from ekbe
                  where ebeln = p_ebeln
                    and ebelp = p_ebelp
                    and vgabe in ('1','2').
      loop at iekbe.
        clear ibuckets.
        ibuckets-ebeln = iekbe-ebeln.
        ibuckets-ebelp = iekbe-ebelp.
        select single * from ekpo into xekpo
                      where ebeln = iekbe-ebeln
                        and ebelp = iekbe-ebelp.
        select single * from mbew into xmbew
                       where matnr = xekpo-matnr.
        case iekbe-vgabe.
          when  '1'.
            ibuckets-pgrir = iekbe-menge * xmbew-stprs.
            ibuckets-pgr   = iekbe-menge * xmbew-stprs.
          when '2'.
            ibuckets-pgrir = iekbe-menge * xmbew-stprs.
            ibuckets-pir   = iekbe-menge * xmbew-stprs.
        endcase.
        collect ibuckets.
      endloop.
      loop at ibuckets.
        ibuckets-pgrni = ibuckets-pgr - ibuckets-pir.
        ibuckets-pirng = ibuckets-pir - ibuckets-pgr.
        if ibuckets-pgrni < 0.
          clear ibuckets-pgrni.
        endif.
        if ibuckets-pirng < 0.
          clear ibuckets-pirng.
        endif.
        modify ibuckets.
      endloop.
      loop at ibuckets.
        write:/    ibuckets-ebeln,
                   ibuckets-ebelp ,
                   ibuckets-pgrir,
                   ibuckets-pgr   ,
                   ibuckets-pir  ,
                   ibuckets-pgrni ,
                   ibuckets-pirng .
      endloop.
    Regards,
    Rich Heilman

  • An RFC destination could not be specified for the logical system

    Hello Experts,
    I am trying post goods receipt in EWM system in a simple inbound delivery process. It is not getting posted back in ECC. I have my RFC connection setup properly(I assume since I was able to transfer inbound delivery to EWM in first place).It seems some setting related to Outbound queue in EWM is missing.Can anyone tell me in detail what settings are required?Is it something to do with WE20 transaction?I am not sure what settings should be done there.The error log is as below-
    An RFC destination could not be specified for the logical system
    SB3CLNT011
    Message No. B1550
    Diagnosis
    An RFC destination should be specified for the logical system SB3CLNT011.
    This could not be done in this case. SB3CLNT011 is not your local logical system
    and this system is not included in the relevant Customizing tables.
    Procedure
    Check:
    RFC
    destination
    Port
    definitions
    oubound partner profile of
    message type SYNCH for this logical system
    Regards,
    Khushboo

    Hi Oritra and Suraj,
    I have checked remote connection in SM59 for both the logical system.It works fine.I understand this is more of a technical issue,but I don't have A local basis team to help me so reaching out to experts here.Can you guide me what technical settings could be checked for EWM-->ECC connection?When I execute BD82 for SB3CLNT011 it shows me green status with message "No messages have been defined for the selection conditions in the model".
    Although when I do this for EWM logical system SB3CLNT012 it shows me this with all green status-
    System SB3CLNT011 as a partner type already exists
    System SB3CLNT012 as a partner type already exists
    Port A000000018 with RFC destination SB3CLNT011 already exists
    Outbound parameters for message type SHP_IBDLV_CHANGE SHP_IBDLV_CHANGE01 already
    Outbound parameters for message type SHP_IBDLV_SAVE_REPLICA SHP_IBDLV_SAVE_REPLI
    Outbound parameters for message type SYNCH SYNCHRON already exist
    Am I missing something in WE20?
    Regards,
    Khushboo

  • How to create the logical file name

    Hi All,
        I have requirement where i need to post the Inventory Management data. for this i need to execute std. program RM07MMBL which is having logical file name in the selection screen. but i have placed my input file in application server.
       Can any one tell how to create the Logical filename which refers the physical path. I also tried <b>t-code SF01 & Table - FILENAMEC</b>I and found that we need to add an entry in this table but i really dont know how we have to do since this table cannot be maintained in SM30 also..
      Help Me.
      Thanks in Advance!...
    Regards,
    Ramkumar

    Hi Ram,
    Try using FILE transaction code...
    Follow these steps to create:::
    Double click on Logical file Path Definition
    Click on New Entries,
    Give Logical file Path name as Z_LOGICAL PATH and save it
    now choose this path and double click on Assignemt of Physical path to Logical path
    double click on the OS name
    Give some description and give some Physical path name from AL11 transaction and save it
    Now Double click on Logical File Name Definition,
    Click on New Entries,
    Give some logical file name: Z_LOGICAL_FILENAME
    Physical file: test
    Data Format: BIN
    Logical Path: Z_LOGICAL PATH
    Hope this helps
    Regards,
    Phani
    Message was edited by:
            Sivapuram Phani Kumar

  • Hi all.When pressed play and make some changes in loop (eg fade in fade out) are very slow to implement, and also the loops from the library are very slow to play, corrects the somewhat self so is the Logic??

    hi all.When pressed play and make some changes in loop (eg fade in fade out) are very slow to implement, and also the loops from the library are very slow to play, corrects the somewhat self so is the Logic??

    Hey there Logic Pro21,
    It sounds like you are seeing some odd performance issues with Logic Pro X. I recommend these troubleshooting steps specifically from the following article to help troubleshoot what is happening:
    Logic Pro X: Troubleshooting basics
    http://support.apple.com/kb/HT5859
    Verify that your computer meets the system requirements for Logic Pro X
    See Logic Pro X Technical Specifications.
    Test using the computer's built-in audio hardware
    If you use external audio hardware, try setting Logic Pro X to use the built-in audio hardware on your computer. Choose Logic Pro X > Preferences > Audio from the main menu and click the Devices tab. Choose the built in audio hardware from the Input Device and Output Device pop-up menus. If the issue is resolved using built-in audio, refer to the manufacturer of your audio interface.
    Start Logic with a different project template
    Sometimes project files can become damaged, causing unexpected behavior in Logic. If you use a template, damage to the template can cause unexpected results with any project subsequently created from it. To create a completely fresh project choose File > New from Template and select Empty Project in the template selector window. Test to see if the issue is resolved in the new project.
    Sometimes, issues with the data in a project can be repaired. Open an affected project and open the Project Information window with the Project Information key command. Click Reorganize Memory to attempt to repair the project. When you reorganize memory, the current project is checked for any signs of damage, structural problems, and unused blocks. If any unused blocks are found, you will be able to remove these, and repair the project. Project memory is also reorganized automatically after saving or opening a project.
    Delete the user preferences
    You can resolve many issues by restoring Logic Pro X back to its original settings. This will not impact your media files. To reset your Logic Pro X user preference settings to their original state, do the following:
    In the Finder, choose Go to Folder from the Go menu.
    Type ~/Library/Preferences in the "Go to the folder" field.
    Press the Go button.
    Remove the com.apple.logic10.plist file from the Preferences folder. Note that if you have programmed any custom key commands, this will reset them to the defaults. You may wish to export your custom key command as a preset before performing this step. See the Logic Pro X User Manual for details on how to do this. If you are having trouble with a control surface in Logic Pro X, then you may also wish to delete the com.apple.logic.pro.cs file from the preferences folder.
    If you have upgraded from an earlier version of Logic Pro, you should also remove~/Library/Preferences/Logic/com.apple.logic.pro.
    Restart the computer.
    Isolate an issue by using another user account
    For more information see Isolating an issue by using another user account.
    Reinstall Logic Pro X
    Another approach you might consider is reinstalling Logic Pro X. To do this effectively, you need to remove the application, then reinstall Logic Pro X. You don't have to remove everything that was installed with Logic Pro X. Follow the steps below to completely reinstall a fresh copy of Logic Pro X.
    In the Finder, choose Applications from the Go menu.
    Locate the Logic Pro X application and drag it to the trash.
    Open the Mac App Store
    Click the Purchases button in the Mac App Store toolbar.
    Sign in to the Mac App Store using the Apple ID you first used to purchase Logic Pro X.
    Look for Logic Pro X in the list of purchased applications in the App Store. If you don't see Logic Pro X in the list, make sure it's not hidden. See Mac App Store: Hiding and unhiding purchases for more information.
    Click Install to download and install Logic Pro X.
    Thank you for using Apple Support Communities.
    Cheers,
    Sterling

  • Logic Required

    Hi All,
    Pl find the requirement below.
    We have a inventory report in that we were showing the stock as on date and the value of that stock.
    This inventory data ( Stock Only) will come from AFS( SAP System) as well as Non-SAP System.To calculate the stock value we are capturing the Moving avarage value from MBEW Table ( Data Source : 0MAT_PLANT_ATTR).It's kf so i have added KF in the 0MAT_PLANT and directly i was inserting this in Query level and doing caluclation.
    Issue : In MBEW Table level moving average price will be maintained at material level and it will contain only the latest price.Means If moving price changes several times in MBEW table it will contain latest one and it will be updated the same in BI also.When i am calculating the inventory for back months it will take the new price and stock value will come .This should not happen.
    Ex :
    Material                Month         Stock           Moving avarage  Price        Value
    A                           jUL'10             10             120 /-                            10*120
    B                          SEP'10              10              150                              10*150
    As per the above example if i run report in Jul'10        value will come as 1200   after two months i will go back and check the value of stock for Jul'2010 will be 1500.But actually it was 1200.
    Solution : As informed by FS-Consultants there is one more table MBEWH contains historic information moving avarage prise based on period and month.But when i have chaked there is no standard extractorbased on MBEWH and how can i include in the reporting(How to impliment the logic).
    Regards
    Ramakanth.

    Hi All,
    Pl find the requirement below.
    We have a inventory report in that we were showing the stock as on date and the value of that stock.
    This inventory data ( Stock Only) will come from AFS( SAP System) as well as Non-SAP System.To calculate the stock value we are capturing the Moving avarage value from MBEW Table ( Data Source : 0MAT_PLANT_ATTR).It's kf so i have added KF in the 0MAT_PLANT and directly i was inserting this in Query level and doing caluclation.
    Issue : In MBEW Table level moving average price will be maintained at material level and it will contain only the latest price.Means If moving price changes several times in MBEW table it will contain latest one and it will be updated the same in BI also.When i am calculating the inventory for back months it will take the new price and stock value will come .This should not happen.
    Ex :
    Material                Month         Stock           Moving avarage  Price        Value
    A                           jUL'10             10             120 /-                            10*120
    B                          SEP'10              10              150                              10*150
    As per the above example if i run report in Jul'10        value will come as 1200   after two months i will go back and check the value of stock for Jul'2010 will be 1500.But actually it was 1200.
    Solution : As informed by FS-Consultants there is one more table MBEWH contains historic information moving avarage prise based on period and month.But when i have chaked there is no standard extractorbased on MBEWH and how can i include in the reporting(How to impliment the logic).
    Regards
    Ramakanth.

  • Is there a way of testing the logic board via Terminal?

    About 5 days ago, my mac book pro experienced the gray screen flashing folder scenario, telling me that it can't find the OS.
    I opened in Internet Recovery mode, and when opening disk utility to check my hard drive, the hard drive didn't show.
    After a breif call to apple support, it looked like my hard drive was kapput, so I bought another hard drive (something I've wanted to upgrade for a while anyway).
    The new hard drive is a seagate momentus xt 750GB, and fairly sure it's compatible as I watched a youtube vid showing me how to replace the hard drive with the very same drive.
    The disk utility cannot find this hard drive either, which means it could be a number of things, the worst being an issue with the logic board..
    I cannot open in apple diagnostic mode, but I can access terminal without an OS, can I check the logic board, or anything else that could be causing the problem from there?
    I'm trying to find out as much as I can about the problem before I have to pay to get it diagnosed.. hopefully it just needs a replacement SATA cable!
    Thanks all,
    Joe

    Did you format the new drive?  This can be done with the Internet Recovery Mode. Try booting holding the command option R keys to get to Disk Utility.
    JRod37  wrote:
    I cannot open in apple diagnostic mode
    You can run the Apple Hardware Test / Apple Diagnostics:
    may not be aware is that Apple dumped AHT this past June. New Macs, introduced in June 2013 or later, no longer include the software. Instead, they have an entirely new diagnostic application called, appropriately enough, Apple Diagnostics. You access Diagnostics exactly the same way as you do AHT: Hold down the D key at startup.
    http://support.apple.com/kb/HT5781
    New MacBooks can access HardWareTest by rebooting holding the D key, no disk required.
    http://support.apple.com/kb/ht1509
    or older machines Boot off your Install Disk while holding down the D key, (not c key), then run the extended Apple Hardware Test. Some disks require you to use the Option key at bootup to select AHT. Some models have a separate AHT CD.
    If any error codes are generated, post that code back here for interpretation.

  • Help needed on the logic used to display ERP Sales order in CRM WEB UI

    Hi,
    I have a requirement where i need to trigger an activity/workflow in CRM for orders that are created through ERP Salesorder functionality. In the workflow list, we need to give the order description and provide an hyperlink to the order number. on selection of order number, it should display the ERP sales order. To achive this in workflow, i am trying to understand the as-is standard functionality which is available in Agent Inbox search on ERP sales order.This search is getting the ERP orders and on selecting the order it is opening the ERO sales order page. I tried debugging the method GET_MAINCATAEGORY available in the component iccmp_inbox and in the view Inboxsearch.But couldnt really able to crack the logic how it is retrieving the ERP sales order from inbox search. Any pointers on how this is achieved will be of great help.
    Thanks,
    Udaya

    Hi Denis,
    very good idea. I thougt myself about that workaround, but it is not really that for what I searched.
    I mean the "SAP Query" is a really good standard tool, that are used by many customers. That is why think there must be a standard way to display the SAP Query in the Web UI without using Transaction Launcher.
    But it seems that there is no way, except of the transaction launcher or by using an additional analyse system like SAP BI.
    By the way do you know a Web UI compoment which enable the user to start reports like SE38?
    Regards
    Fabian

  • Replacing the Logic Board on an iMac G4 (flat panel)

    Hi all
    A friend of mine has a G4 Flat Panel iMac, and apparently, though I've not seen it for myself yet, her Logic Board died on her. She has since bought an iMac G5. But I've been trying to find where one can get a replacement logic board from, that isn't going to break the bank. I've found nothing so far. Are these available anywhere? And will they be so expensive as to make it not worth the bother? And of course I have not found any technical data about how you open and replace components in one of these iMacs. Apple don't post them since they are supposed to be tampered with only by Apple certified technicians.
    Thanks.

    Hello,
    Apple doesn't typically make their repair components available to the end-user. So, it's a bit harder to find a replacement logic-board for one of their computers.
    The service centers can get them, but it's not going to be cheap.
    Typically, you can expect to pay $500 to $800 for a replacement logic-board from Apple.
    And, the service center is only going to sell it to you if you let them install it.
    But, you can sometimes find places that sell them.
    This place used to sell lots of Apple logic-boards, case parts, brackets, keyboards, etc. But, they stopped for some reason. But, you might call and see if they have what you need in a warehouse somewhere:
    http://cgnusa.com/scripts/default.asp
    And, this place does sell some parts for the Do-It-Youself person. But, they typically require you to send in your system for a new logic-board. But, you might be able to get a price from them:
    http://www.dttservice.com/index.html
    In all honesty, if you are looking for a part you can install yourself, and don't want to pay $500 or more, then you are probably better-off trying to find a used part.
    If you can find one who's screen died, but the logic-board is still good on, then you may be able to work out a deal. I hate to recommend them, but e-bay is probably your best chance for a used replacement logic-board. Just don't pay too much.
    Whatever route you / they choose, keep in-mind the price of a low-end Mac Mini. Don't spend more to repair an old system than you would spend to buy a current low-end system.
    I hope this helps.

  • 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

  • Communication Link B/W ASP and SAP

    Hi All,          I have rare requirement at clients place i.e I need to capture the data infact the end result of a AP tool developed on ASP to fill few fields in SAP Invoice verification transaction, can some one help me out as how to establish a li

  • Airport and WRT54G (LINKSYS)

    Does any use the Linksys WRT54G with thier Mac? I bought one knowing it wasn't Mac compatable because I was just going to use it to play my Xbox wireless, but wanted to get airport down the road. I have an iBook and just wanted to know if anyone used

  • Changeability of Purchasing Document During/After Release

    Dear All I want that whenever there is any kind of change in PR/PO after start of release process the PR/PO should get de-released.I mean if PR/PO quantity is increased or decreased by 1 ea or price is increased or decreased by even 1 Re or any kind

  • How to customize Windows partition icon in bootloader?

    Hi, I customized my windows partition icon in OS X but bootcamp's bootloader still shows the partition with a normal disk icon. Is there any possible way to change the icon to customized icon? I've searched lots of information on the net, couldn't fi

  • Best practise for external service when amount is not sure

    Hi friends , What could be the best practise from the PM side when we want to send an equipment for external repair and the service cost is not sure . Also if we will create only service PR and not PO then there could be some legal problems while sen