Proper way to Module Code for Problem

Hi I am looking solution for this problem If any one can help me out .....
At ACME a "job" is a group of print items.
JOB For example, a job can be a run of business cards, envelopes, and letterhead together.
Some items qualify as being sales tax free, whereas, by default, others
are not. Sales tax is 7%.
ACME also applies a margin, which is the percentage above printing cost that is charged to the customer.
For example, an item that costs $100 to print that has a margin of 11% will cost:
item: $100 -> $7 sales tax = $107
job: $100 -> $11 margin
total: $100 + $7 + $11 = $118
The base margin is 11% for all jobs this problem. Some jobs have an "extra margin" of 5%. These jobs that are flagged as extra margin have an additional 5% margin (16% total) applied.
The final cost is rounded to the nearest even cent. Individual items are rounded to the nearest cent.
Write a program in Java that calculates the total charge to a customer for a job. The program should accept the inputs below and output the total bill for the customer.
Include this problem statement with your solution.
Job 1:
extra-margin
envelopes 520.00
letterhead 1983.37 exempt
should output:
envelopes: $556.40
letterhead: $1983.37
total: $2940.30
Job 2:
t-shirts 294.04
output:
t-shirts: $314.62
total: $346.96
Job 3:
extra-margin
frisbees 19385.38 exempt
yo-yos 1829 exempt
output:
frisbees: $19385.38
yo-yos: $1829.00
total: $24608.68
Thanks

I want to make best use of OOPS concepts to modularize this problem, like using interface, abstract class, etc. What to keep in mind (steps) before modularizing such a problem. If some one can focus some light on it , that would be of great use.
I had solution as under, But what else could be best way.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class Job {
     private List itemList; //Job contains a list of Item objects
     //Job object can contain any number of Item objects, as given by user at runtime
     private boolean extraMarginApplied;
     private double totalCostforJob;
     //Following three variables will be provided by user
     //For each input, construct one item object and add it to the Job-ItemList
     private String itemName;
     private double itemCost;
     private boolean itemTaxExempted;
     private static final double SALESTAX = 0.07; //Sales tax applied
     private static final double MARGIN = 0.11;
     private static final double EXTRAMARGIN = 0.05;
     public Job() {
          itemList = new ArrayList();
     public String getItemName() {
          return itemName;
     public void setItemName(String itemName) {
          this.itemName = itemName;
     public double getItemCost() {
          return itemCost;
     public void setItemCost(double itemCost) {
          this.itemCost = itemCost;
     public boolean isItemTaxExempted() {
          return itemTaxExempted;
     public void setItemTaxExempted(boolean itemTaxExempted) {
          this.itemTaxExempted = itemTaxExempted;
     public List getItemList() {
          return itemList;
     public void setItemList(List itemList) {
          this.itemList = itemList;
     public boolean isExtraMarginApplied() {
          return extraMarginApplied;
     public void setExtraMarginApplied(boolean extraMargin) {
          this.extraMarginApplied = extraMargin;
     public double isTotalCostforJob() {
          return totalCostforJob;
     public void setTotalCostforJob(double totalCostforJob) {
          this.totalCostforJob = totalCostforJob;
     public Item getItemFromUser(InputStreamReader isr, BufferedReader br)
               throws IOException {
          System.out.println("Enter Item Name: ");
          setItemName(br.readLine());
          System.out.println("Enter Item Cost: ");
          setItemCost(Double.parseDouble(br.readLine()));
          System.out.println("Item Tax Exempted(Y/N)?: ");
          String input = br.readLine();
          if (input.equals("Y") || input.equals("y")) {
               setItemTaxExempted(true);
          } else {
               setItemTaxExempted(false);
          //Now construct an Item object and return it
          return new Item(itemName, itemCost, itemTaxExempted);
     public static String getSystemExit() throws IOException {
          System.out.println("\nDo you want to add more items(Y/N)?: ");
          InputStreamReader isr = new InputStreamReader(System.in);
          BufferedReader br = new BufferedReader(isr);
          return br.readLine();
     public void addItemToJob(InputStreamReader isr, BufferedReader br)
               throws IOException {
          itemList.add(getItemFromUser(isr, br));
     public static void main(String agr[]) throws IOException {
          String proceed;
          InputStreamReader isr = new InputStreamReader(System.in);
          BufferedReader br = new BufferedReader(isr);
          Job job = new Job();
          job.getExtraMargin(isr, br);
          do {
               job.addItemToJob(isr, br);
               proceed = getSystemExit();
          } while (proceed.equals("Y") || proceed.equals("y"));
          job.calculateAndPrintTotalCostforJob();
          br.close();
          isr.close();
     private void getExtraMargin(InputStreamReader isr, BufferedReader br)
               throws IOException {
          System.out
                    .println("Is extra margin to be charged for this Job?(Y/N)?: ");
          String input = br.readLine();
          if (input.equals("Y") || input.equals("y")) {
               setExtraMarginApplied(true);
          } else {
               setExtraMarginApplied(false);
     private void calculateAndPrintTotalCostforJob() {
          Iterator itr = itemList.iterator();
          Item item;
          double totalCost = 0;
          double itemCostWithSalesTax;
          while (itr.hasNext()) {
               item = (Item) itr.next();
               if (item.isTaxExempted()) {
                    itemCostWithSalesTax = item.getCost(); //No sales tax applied, so cost is same
               } else {
                    itemCostWithSalesTax = item.getCost() * (1 + SALESTAX); //Add sales tax
               if (isExtraMarginApplied()) {
                    totalCost = totalCost + itemCostWithSalesTax + item.getCost()
                              * (MARGIN + EXTRAMARGIN);
               } else {
                    totalCost = totalCost + itemCostWithSalesTax + item.getCost()
                              * MARGIN;
               System.out.println(item.getItemName() + ":  "
                         + itemCostWithSalesTax);
          setTotalCostforJob(totalCost);
          System.out.println("Total: " + totalCostforJob);
}=================================================================================
public class Item {
    private String itemName;
    private double cost;
    private boolean taxExempted=false;
    public Item(String itemName, double cost, boolean taxExp) {
        this.itemName = itemName;
        this.cost = cost;
        this.taxExempted = taxExp;
    public String getItemName() {
        return itemName;
    public void setItemName(String itemName) {
        this.itemName = itemName;
    public double getCost() {
        return cost;
    public void setCost(int cost) {
        this.cost = cost;
    public boolean isTaxExempted() {
        return taxExempted;
    public void setTaxExempted(boolean b) {
        this.taxExempted = b;
}Thank you for your help and guideline.

Similar Messages

  • Is it a proper way to use queue for consumer/producer model?

    Hi all,
      I am following the example of consumer/producer model to use the queue to synchronize the following process: The producer is a loop to produce N numbers, I will put every generated number into an array and after every 5 numbers generated, I put the array into the queue and pass it to the consumer. I have to wait the consumer use up the data and it will then remove the element from queue so the producer will get a chance to produce another 5 numbers. Since I set the maximum size of the queue to be ONE, I expect the producer and consumer take turns to produce / consume all five numbers and pass the chance to the other. Here is my code
    when the case box is false, the code will be
    For the first 5 numbers, the produce will generate every thing right and put that into the array, and it will pass the array to the quere so the consumer will get a chance to loop over the array. I except the procude's loop will continue only when the queue is available (i.e. all elements are removed), but it seems that once the consumer start the loop the produce 's loop will continue (so the indicator x+1 and x+2 will show numbers changed). But it is not what I want, I know there must be something wrong but I can't tell what is it.
    Solved!
    Go to Solution.

    dragondriver wrote:
    As you said in 1, the sequency structure enforcing the execution order, that's why I put it there, in this example, to put the issue simple, I replace the complete code with number increase, in the real case, the first +1 and +2 must be executed in that order.
    Mikeporter mentioned:
    1. Get rid of all the sequence structures. None of them are doing anything but enforcing an execution order that would be the same without them.
    So even if you remove the sequence structure, there will be a fixed & defined execution order and that is because LabVIEW follows DATA FLOW MODEL.
    Data Flow Model (specifically in context of LabVIEW): A block diagram node executes when it receives all required inputs. When a node executes, it produces output data and passes the data to the next node in the dataflow path. The movement of data through the nodes determines the execution order of the VIs and functions on the block diagram (Click here for reference).
    Now in your code, just removing the sequence structure will not make sure that the execution order will gonna remain same but you need to do few very small modifications (like pass the error wire through For loop, before it goes to 'Dequeue Element' node).
    Coming to the main topic: is it a proper way to use queue for consumer/producer model?
    The model you're using (and calling it as consumer/producer model) is way too deviated from the original consumer/producer model model.
    dragondriver wrote:
    For the second one, yes, it is my fault to remove that while. I actually start from the example of Producer/Consumer design pattern template, but I didn't pay attention to the while loop in the consumer part.
    While loops (both Producer & Consumer) are the essential part of this architecture and can't be removed. You may want to start your code again using standard template.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • What is proper way to report suggestions for app features And bugs to Apple

    What is the proper way to report suggestions for app features to Apple? Or, do they even want suggestions?
    And, how about reporting app bugs? Should I just assume the bug is already known, or is there a way for (quickly) reporting them?

    I'm not sure about bugs in non-Apple apps, but bugs in Apple apps can be reported via this form:
    http://www.apple.com/feedback/ipad.html

  • Proper way to scale assets for multiple devices

    I am working on an ActionScript Mobile app which I intend to build for iphone 3gs, iPhone 4 and iPad 1&2.
    What is the correct way to scale assets such as background images so that I may be able to use the same graphical assets for all of the mobile devices above?
    Using AIR 2.7 and in my app descriptor file I have specified "cpu" for renderMode and "true" for fullScreen. From what I have read, the fullscreen bug in AIR 2.7 is only present when using gpu as the rendermode w/ fullscreen, so I don't think that is what is going on.
    I have a background image which is supposed to fill up the entire screen for all devices. This image is in a swc file and has these dimensions: 960 x 640
    In my main class I have included the following:
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;
    When I test on iPhone 4, it looks fine and fills up the entire screen as expected. When I test on iPad 1, the image is not wide enough and is a bit too short. Shouldn't the following code force the background image to fill the entire screen regardless of device?
    backgroundImage.width = stage.stageWidth;
    backgroundImage.height = stage.stageHeight;
    Instead, it makes the backgound really small in the upper left hand corner for all devices. Can someone shed some light here?  I am stumped.
    Hopefully I am doing someone stupid and it is an easy fix..Thanks!

    Here is what I have been doing. Do what you did by scaling the stage to the top left and fill the entire screen.
    Now set up an onEnterFrame event to give your background image dimensions. Since you want one image to work for all the devices it has to be an image that works even if part of it is not showing so design with that in mind.
    So lets say your image is iPad screen size 768 wide x 1024 tall. I pad is a 3/4 screen ration so 3 wide by 4 tall in proportion.
    Set up a variable that measures the screen ratio, so something like
    var frameRatio = stage.stageWidth / stage.stageHeight;
    this will return a result of 0.75 or 3/4
    Now since you know this you can set up an if else statemenet (excuse my sloppy code, do not copy paste)
    if (frameRatio >= 0.75)
    backgroundImage.height = stage.stageHeight;
    backgroundImage.scaleX = backgroundImage.scaleY <------ this will scale the image proportionally to match the height.
    else if (frameRatio < 0.75)
    backgroundImage.wdith = stage.stageWidth; <------ notice if its less than .75 we now make the image first fill the stage to the stage's width
    backgroundImage.scaleY = backgroundImage.scaleX  <---- notice these are flipped so now we proportionally scale the height based on the width
    This works well for me even with orientation changes. Its easiest to set you background image point of refrence to the center and then orient it by simply dividing the stageWidth and stageHeight by 2 for the x and the y values respectively.
    Let me know if that helped at all I can post an actual line of code if need be.

  • What is the proper way to change rowHeight? (possibly animate?)

    What is the proper way to change rowHeight for UITableView? I set tableView.rowHeight and do a [tableView reloadData]. Is this necessary? Also, is it possible to animate the height change? It is not a standard transition.

    Not a perfect solution for your animation question - but....
    in the function where you want to change the height
    WARNING PSUDO CODE
    //indexPath is the path for theCell you want to edit
    thePlaceThatYouStoreYourHeights[x] = aNewHeight;
    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationTop];
    and inside of - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath (NSIndexPath *)indexPath
    return thePlaceThatYouStoreYourHeights[indexPath.row];
    Basic flow
    1. Store new desired height somewhere
    2. Remove the cell deleteRowsAtIndexPaths
    3. UITableView paints the animation for the "remove" transition **see note
    4. Re-add the cell insertRowsAtIndexPaths (which subsequently kicks of a call to heightForRowAtIndexPath before animating)
    5. UITableView paints the animation for the "add" transition
    You do NOT need to call reloadData to get this to work.
    **note: an enum such as UITableViewRowAnimationNone does not exist (it should but it doesnt seem to). the docs for InsertRowsAtIndexPaths say "A constant that either specifies the kind of animation to perform when inserting the cell or requests no animation." however there are only 5 items in the UITableViewRowAnimation enum and UITableViewRowAnimationFade resolves to 0 - so passing NO will actually get you fade. Nor will it take nil.
    Hope this helps shed some light.

  • Is anyone having a problem connecting 400 firewire thru an adapter for the 800 firewire port on a Macbook Pro 2011? It does a kernel panic every time I connect it. Is there a "proper way" to connect it?

    Is anyone having a problem connecting 400 firewire thru an adapter for the 800 firewire port on a Macbook Pro 2011? It does a kernel panic every time I connect it. Is there a "proper way" to connect it? Just in case it makes a difference I am trying to hook up an Avid Mbox Pro for Pro tools.

    What is the part number and model of Firewire adapter?
    I have used them in the past without any problems whatsoever.
    Allan

  • NI9203 - Need to know how to set up the FPGA code for multiple NI9203 modules and how to calibrate the data

    Hi. I'm using the NI9203 module to detect pressure, temerature and flow rate of water in a cooling system. I have 17 different inputs coming in therefore i'm using 3 NI9203 modules. I've used the example provided with labview as a base for designing my code. The example can be found here : Program Files\National Instruments\LabVIEW 8.0\examples\CompactRIO\Module Specific\NI 9203.
    I've had no problems when testing this code out for a single NI9203 module but when i add code for 3 modules the code will not compile as my resources are over mapped. Is there a simpler way to program the FPGA code.
    That said how do you go about calibrating the data that's received from the module. Preferably i'd like to write a vi to do the calibrating. Just need help on how to go about writing this vi

    Hi havok,
    Firstly, I would use constants to configure the modules, it'll save some resources on the FPGA.  I'm not typically changing the settings on the fly, so using constants whenever possible helps.  I would also take a look at the following KnowledgeBase article on other changes you can make to the FPGA VI to compile the code:
    http://digital.ni.com/public.nsf/allkb/311C18E2D635FA338625714700664816?OpenDocument
    The best changes you can make are to use fewer arrays and front panel elements.  This can be done by using a DMA FIFO or constants on the block diagram. 
    Now actually calibrating the data will require you to do it on the host side.  There is an example VI called Binary to Nominal that changes the raw data to something more useful for datalogging, display, etc.  It can be found in some of the example VIs, or in the following link:
    http://digital.ni.com/public.nsf/allkb/E86D8D460C4C092F8625752F00050A61?OpenDocument 

  • What is the proper way to close all open sessions of a NI PXI-4110 for a given Device alias?

    I've found that, when programming the NI PXI-4110 that, if a the VI "niDCPower Initialize With Channels VI" (NI-DCPower pallette) is called with a device
    alias that all ready has one or more sessions open (due to an abort or other programming error) a device reference results from the reference out that has a (*) where "*" is post-fixed to the device reference where and is an integer starting that increments with each initialize call. In my clean up, I would like to close all open sessions. For example, let's said the device alias is "NIPower_1" in NI Max, and there are 5 open sessions; NIPower_1, NIPower_1 (1), NIPower_1 (2), NIPower_1 (3), and NIPower_1 (4). A simple initialize or reset (using niDCPower Initialize With Channels VI, or, niDCPower Initialize With Channels VI, etc.) What is the proper way to close all open sessions?
    Thanks in advance. Been struggleing with this for days!

    When you Initialize a session to a device that already has a session open, NI-DCPower closes the previous session and returns a new one. You can verify this very easily: try to use the first session after the second session was opened.
    Unfortunately, there is a small leak and that is what you encountered: the previous session remains registered with LabVIEW, since we unregister inside the Close VI and this was never called. So the name of the session still shows in the control like you noted: NIPower_1, NIPower_1 (1), NIPower_1 (2), NIPower_1 (3), and NIPower_1 (4), etc.
    There may be a way to iterate over the registered sessions, but I couldn't find it. However, you can unregister them by calling "IVI Delete Session". Look for it inside "niDCPower Close.vi". If you don't have the list of open sessions, but you have the device name, then you can just append (1), (2) and so forth and call "IVI Delete Session" in a loop. There's no problem calling it on sessions that were never added.
    However - I consider all this a hack. What you should do is write code that does not leak sessions. Anything you open, you should close. If you find yourself in a situation where there are a lot of leaked sessions during development, relaunching LabVIEW will clear it out. If relaunching LabVIEW is too much of an annoyance, then write a VI that does what I described above and run it when needed. You can even make it "smarter" by getting the names of all the NI-DCPower devices in your system using the System Configuration or niModInst APIs.
    Hope this helps.
    Marcos Kirsch
    Principal Software Engineer
    Core Modular Instruments Software
    National Instruments

  • Creating Java code for the function module

    Hi Colleagues,
    I have a fuction module in ABAP system. Now I want to Generate java code for the FM.
    I cam to know that we can achive that using AXIS, By getting the XML file for the fuction module and generate Java
    Class file using that XML file.
    Can any one tell me how to achive it.
    Or any other way to do that?
    Please provide you valid suggestions.
    Regards,
    Sathya

    Hi,
    You can integrate axis2 in eclipse. I think you have to find the plugin for that.
    After that you can let axis generate the jave code (stubs and proxies) for your web service via the wsdl file.
    Kind Regards,
    Robin

  • Proper way to make bulk changes the Owner ID, Path and file share credentials for my existing subscriptions, ExtensionSettings

    We are going through with an upgrade/migration to SSRS 2012 and moving everything to a different domain. We have about 200 active subscriptions running, the reports are being delivered to a file share.  What is the correct way, in bulk, to change
    the OwnerId, the Path and the FileShare Username password credentials for these subscriptions?  I see these values are being stored in Subscriptions > ExtensionSettings.  I see that the file share path and Owner wouldn't be a problem to change,
    but since I see the file share credentials are encrypted I would not be able change them directly in ExtensionSettings.  Anyone know the proper way to change the Owner ID, Path and file share credentials for my existing subscriptions without having to
    change each one of them manually in the report manager?
    Note: Reporting Services Native upgrade from SSRS 2005 to SSRS 2012.
    Thanks in advance.

    Hi Cygnus46,
    Based on my understanding, you want to change the Owner ID, Path and file share credentials for all existing subscriptions.
    In Reporting Services, the subscription information are stored in the Report Server database. In your scenario, you can go to report server database and run the query to list all the subscriptions, then modify the owner and fileshare paths in the subscriptions
    table. For more information, please refer to this article: Tip: Change the Owner of SQL Reporting Services Subscription. If you want to change
    the file share credentials for subscriptions, you can run the query provided by
    wiperzeus from this similar thread:
    Windows File Share Delivery/ SSRS 2008 R2.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Need VB code for solving my problem as describe as under.

    Hi!
    Let me describe my architecture. I have implemented domain in my infrastructure(same building and remote location) . Some User ID having rights to install any software in any computer having the same domain and some other user ID does not having rights.
    But the problem is that an application need to update very frequently both location local and remote we can not share the admin password to user to install the update patch of the same application without log off the limited access user account. I wanna develop
    a program that can execute the setup file with admin Rights on all the systems without sharing the password. Please help me in this situation that what code I use to develop the same program.
    Regards!
    Mukesh Kumar

    But the end user dose not having rights to install any software. I don't wanna go to end user system to put user id and password by any way either physical or remote.
    Thats why I seeking code for by pass the UAC.
    Sorry but there is no way to do that with a script.  You must use Group Policy or walk around to each machine and type in the admin credentials.  THat is just how Windows works.
    Sorry.
    ¯\_(ツ)_/¯

  • Copying a new .class file for WLS to use, proper way?

    Hello. I'm doing some servlet development and I would like to know what is
    the proper way to deploy any .class files and servlets (also .class files)?
    If I just copy them into the proper directory, am I supposed to have to
    restart the server? Is that normal, or should WLS just pick up the new one?
    It does that with JSPs, can it do that with servlets and supporting classes?
    Thanks.

    I found out that I was copying the wrong file to the right place (.java
    instead of the .class :<). So once I fixed that small little :> problem, I
    was off and running. Thank you for your help! :>
    "Slava Imeshev" <[email protected]> wrote in message
    news:[email protected]..
    Hi Peter,
    Normally weblogic will redeploy automatically application, either web
    or ejb, without restarting the server, when it's copied to applications
    directory on the server. Applications should be properly packaged.Servlets
    and supported files should be in war file, ejb-s in ejb-jar files.
    I'm not sure if it would work right for plain unpacked class files.
    Regards,
    Slava Imeshev
    "PeterH" <!REMOVEBeforeSending! > wrote in message
    news:[email protected]..
    Hello. I'm doing some servlet development and I would like to know whatis
    the proper way to deploy any .class files and servlets (also .classfiles)?
    If I just copy them into the proper directory, am I supposed to have to
    restart the server? Is that normal, or should WLS just pick up the newone?
    It does that with JSPs, can it do that with servlets and supportingclasses?
    Thanks.

  • HT203977 is there any way to restore factory settings on an Iphone 5s that will not connect to Itunes because the phone is locked with a pass code.  Problem is that the screen is completely shattered.

    is there any way to restore factory settings on an Iphone 5s that will not connect to Itunes because the phone is locked with a pass code.  Problem is that the screen is completely shattered.

    If the screen is completely shattered why bother to try and restore the phone?
    Forgot passcode for your iPhone, iPad, or iPod touch, or your device is disabled - Apple Support

  • GDE - function module.. code .. problem

    hi all,
    I am extracting data using FM
    from PAYR and REGUH.
    I need:
    Payr
    doc1 ven01.........filds.a b c.
    doc2 ven02.........filds..
    doc3 ven02.........filds..
    doc4 ven03.........filds..
    My Fm is working fine.
    I need from REGUH:
    doc1 ven01.........filds p q r..
    doc2 ven02.........filds..
    doc3 ven02.........filds..
    doc4 ven03.........filds..
    doc5 ven05.........filds..
    doc6 ven06.........filds..
    doc5 and Doc6 not there in Payr table. finally i need 6 records with a, b,c, p, q, r
    I wrote code:
    ========
    error : It returns dump..
    saying : INDEX problem..?
    Modify e_t_data index sy-tabix.
    FUNCTION z_biw_payr_get_data .
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(I_REQUNR) TYPE  SRSC_S_IF_SIMPLE-REQUNR
    *"     VALUE(I_DSOURCE) TYPE  SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
    *"     VALUE(I_MAXSIZE) TYPE  SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
    *"     VALUE(I_INITFLAG) TYPE  SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
    *"     VALUE(I_READ_ONLY) TYPE  SRSC_S_IF_SIMPLE-READONLY OPTIONAL
    *"     REFERENCE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT
    *"       SBIWA_C_FLAG_OFF
    *"  TABLES
    *"      I_T_SELECT TYPE  SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
    *"      I_T_FIELDS TYPE  SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
    *"      E_T_DATA STRUCTURE  ZBIW_AP_PAYR OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
    Example: DataSource for table SFLIGHT
      TABLES: payr.
    Auxiliary Selection criteria structure
      DATA: l_s_select TYPE srsc_s_select.
    Maximum number of lines for DB table
      STATICS: s_s_if TYPE srsc_s_if_simple,
    counter
              s_counter_datapakid LIKE sy-tabix,
    cursor
              s_cursor TYPE cursor.
    *internal tables:
    I_payr like payr occurs 0 with header line.
    I_reguh like reguh occurs 0 with header line.
    Select ranges
      RANGES: l_r_gjahr   FOR zap_payr-gjahr,
              l_r_vblnr   FOR zap_payr-vblnr,
              l_r_zbukr   FOR zap_payr-zbukr.
    Initialization mode (first call by SAPI) or data transfer mode
    (following calls) ?
      IF i_initflag = sbiwa_c_flag_on.
    Initialization: check input parameters
                    buffer input parameters
                    prepare data selection
    please Check DataSource validity
        CASE i_dsource.
          WHEN 'ZAP_PAYR'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE e009(r3). ENDIF.
    this is a typical log call. Please write every error message like this
            log_write 'E'                  "message type
                      'R3'                 "message class
                      '009'                "message number
                      i_dsource   "message variable 1
                      ' '.                 "message variable 2
            RAISE error_passed_to_mess_handler.
        ENDCASE.
        APPEND LINES OF i_t_select TO s_s_if-t_select.
    Fill parameter buffer for data extraction calls
        s_s_if-requnr    = i_requnr.
        s_s_if-dsource = i_dsource.
        s_s_if-maxsize   = i_maxsize.
    Fill field list table for an optimized select statement
    (in case that there is no 1:1 relation between InfoSource fields
    and database table fields this may be far from beeing trivial)
        APPEND LINES OF i_t_fields TO s_s_if-t_fields.
      ELSE.                 "Initialization mode or data extraction ?
    Data transfer: First Call      OPEN CURSOR + FETCH
                   Following Calls FETCH only
    First data package -> OPEN CURSOR
        IF s_counter_datapakid = 0.
    Fill range tables BW will only pass down simple selection criteria
    of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
          LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'GJAHR'.
            MOVE-CORRESPONDING l_s_select TO l_r_gjahr.
            APPEND l_r_gjahr.
          ENDLOOP.
          LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'VBLNR'.
                  MOVE-CORRESPONDING l_s_select TO l_r_vblnr.
            APPEND l_r_vblnr.
          ENDLOOP.
          LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'ZBUKR'.
            MOVE-CORRESPONDING l_s_select TO l_r_zbukr.
            APPEND l_r_zbukr.
          ENDLOOP.
    Determine number of database records to be read per FETCH statement
    from input parameter I_MAXSIZE. If there is a one to one relation
    between DataSource table lines and database entries, this is trivial.
    In other cases, it may be impossible and some estimated value has to
    be determined.
    Extracts from Tableu2026..1
          OPEN CURSOR WITH HOLD s_cursor FOR
          SELECT mandt zbukr hbkid hktid rzawe chect checf laufd laufi lifnr
            kunnr empfg ubhkt vblnr gjahr zaldt waers rwbtr strgb pridt
            priti prius xmanu xbanc bancd extrd extrt xbukr zanre znme1
            znme2 znme3 znme4 zpstl zort1 zstra zpfac zland zregi zbnks
            zbnkn zbnkl zbkon voidr voidd voidu checv hbkiv hktiv zpst2
            xragl pernr seqnr btznr rec_belnr rec_gjahr zpfor uzawe ichec
            irefe rwskt
          FROM  payr
          WHERE zbukr  IN l_r_zbukr
                AND   vblnr  IN l_r_vblnr
          AND   gjahr  IN l_r_gjahr.
        AND   rzawe  EQ 'C'.
        ENDIF.                             "First data package ?
    Fetch records into interface table.
      named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR s_cursor
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE e_t_data
                   PACKAGE SIZE s_s_if-maxsize.
        IF sy-subrc <> 0.
          CLOSE CURSOR s_cursor.
          RAISE no_more_data.
        ENDIF.
    **get all u2018Du2019 and 2 series VBLNR records from REGUH
    _** --- CHECK the codes for WITH CASE 1 OR CASE 2._
    Case 1 :
    *Select * from reguh*
         Into corresponding fields of table i_reguh
         For all entries in e_t_data
         Where lifnr = e_t_data-lifnr
          And  rzawe = u2018Du2019
          and  Vblnr like u20182%u2019.
    Or u2026u2026 Or u2026u2026 Or u2026u2026
    Case2 :
    *Select * from reguh*
         Into corresponding fields of table i_reguh
         Where rzawe = u2018Du2019
          and  Vblnr like u20182%u2019.
    Loop at e_t_data.
      Read table i_reguh with key lifnr = e_t_data-lifnr
        If sy-subrc = 0.
          E_t_data-laufi  like reguh- laufi.
          E_t_data-Zbukr like reguh-zbukr.
          E_t_data-lifnr like reguh- lifnr .
          E_t_data-empfg like reguh- empfg.
          E_t_data-vblnr  like reguh-vblnr
          E_t_data-waers like reguh-waers
          E_t_data-srtgb like reguh-srtgb.
          E_t_data-znme1 like reguh- znme1.
          E_t_data-znme2  like reguh- znme2.
          E_t_data-znme3 like reguh- znme3.
          E_t_data-znme4 like reguh- znme4.
          E_t_data-zpstl like reguh-zpstl.
          E_t_data-zort1   like reguh-zortl.
          E_t_data-zstra like reguh-zstra.
          E_t_data-zpfac like reguh-zpfac.
          E_t_data-zland like reguh-zland.
          E_t_data-zregi like reguh-zregi.
          E_t_data-zbnkl like reguh-zbnkl.
          E_t_data-rzawe like reguh-rzawe.
          E_t_data-hktid like reguh-hktid.
          E_t_data-hbkid like reguh-hbkid.
          E_t_data-zpst2 like reguh-zpst2.
          E_t_data-uzawe like reguh-uzawe.
                E_t_data-pernr like reguh-pernr.
         E_t_data-btznr like reguh-btanr.
         E_t_data-laufd like reguh-laufd.
         E_t_data-zaldt like reguh-zaldt.
         E_t_data-rwbtr like reguh-rwbtr.
         E_t_data-rwskt like reguh-rwskt.
         Modify e_t_data index sy-tabix.
    Else.
         E_t_data-laufi  like reguh- laufi.
                E_t_data-Zbukr like reguh-zbukr.
         E_t_data-lifnr like reguh- lifnr .
         E_t_data-empfg like reguh- empfg.
         E_t_data-vblnr  like reguh-vblnr
         E_t_data-waers like reguh-waers
         E_t_data-srtgb like reguh-srtgb.
         E_t_data-znme1 like reguh- znme1.
         E_t_data-znme2  like reguh- znme2.
         E_t_data-znme3 like reguh- znme3.
         E_t_data-znme4 like reguh- znme4.
         E_t_data-zpstl like reguh-zpstl.
         E_t_data-zort1   like reguh-zortl.
         E_t_data-zstra like reguh-zstra.
         E_t_data-zpfac like reguh-zpfac.
         E_t_data-zland like reguh-zland.
         E_t_data-zregi like reguh-zregi.
         E_t_data-zbnkl like reguh-zbnkl.
         E_t_data-rzawe like reguh-rzawe.
         E_t_data-hktid like reguh-hktid.
         E_t_data-hbkid like reguh-hbkid.
         E_t_data-zpst2 like reguh-zpst2.
         E_t_data-uzawe like reguh-uzawe.
         E_t_data-pernr like reguh-pernr.
         E_t_data-btznr like reguh-btanr.
         E_t_data-laufd like reguh-laufd.
         E_t_data-zaldt like reguh-zaldt.
         E_t_data-rwbtr like reguh-rwbtr.
         E_t_data-rwskt like reguh-rwskt.
    Modify e_t_data index sy-tabix.
    Endif.
    Endloop.
    Logic for eliminating voided Checks Begin
        itab[] = e_t_data[].
        SORT itab BY chect.
        LOOP AT itab WHERE ( voidu NE space ) AND ( voidd NE space ).
          wa_idx = sy-tabix.
          wa_chect = itab-chect. CLEAR wa_found.
                wa_zbukr = itab-zbukr.
          wa_hbkid = itab-hbkid.
          wa_hktid = itab-hktid.
          wa_rzawe = itab-rzawe.
          DO.
            SELECT SINGLE * FROM payr WHERE
            zbukr = wa_zbukr AND
            hbkid = wa_hbkid AND
            hktid = wa_hktid AND
            rzawe = wa_rzawe AND
            chect = wa_chect.
            IF sy-subrc NE 0.
    Not transferring this record to BW
          message 'Invalid Check No.' type 'I'.
              DELETE itab.
              wa_found = 'Y'. EXIT.
            ENDIF.
            IF ( payr-voidu NE space ) AND ( payr-voidd NE space ).
              wa_chect = payr-checv.
              wa_zbukr = payr-zbukr.
              wa_hbkid = payr-hbkid.
                        wa_hktid = payr-hktid.
              wa_rzawe = payr-rzawe.
    If the Replacement Check # points to Original Check No., this record
    will be skipped.
              IF itab-chect = payr-checv.
                DELETE itab INDEX wa_idx.
                EXIT.
              ENDIF.
            ELSE.
              MOVE-CORRESPONDING payr TO itab.
              APPEND itab. wa_found = 'Y'.
              MOVE-CORRESPONDING itab TO itab1.
              APPEND itab1.
              EXIT.
            ENDIF.
            IF wa_found = 'Y'.
              EXIT.
            ENDIF.
          ENDDO.
        ENDLOOP.
        SORT itab by zbukr hbkid hktid rzawe chect.
            DELETE ADJACENT DUPLICATES FROM itab COMPARING zbukr hbkid hktid
        rzawe chect.
        LOOP AT itab1.
          READ TABLE itab WITH KEY
          zbukr = itab1-zbukr
          hbkid = itab1-hbkid
          hktid = itab1-hktid
          rzawe = itab1-rzawe
          chect = itab1-chect BINARY SEARCH.
          IF ( itab-voidu IS NOT INITIAL ).
            DELETE TABLE itab FROM itab1.
          ENDIF.
        ENDLOOP.
    04/13/08 commented to satisfy 4th condition
    Do not extract the Original record of the replaced Check
       LOOP AT itab.
         IF ( itab-voidu IS NOT INITIAL ) AND
            ( itab-voidd IS NOT INITIAL ).
           DELETE itab.
         ENDIF.
       ENDLOOP.
    04/13/08 commented to satisfy 4th condition
    Logic for eliminating voided Checks End
    ***The below process can be used for Delta Extraction using Time Stamp
       loop at itab.
         concatenate itab-pridt itab-priti into wa_timstmp.
         move wa_timstmp to itab-timstmp.
         move-corresponding itab to e_t_data.
         append e_t_data.
       endloop.
        e_t_data[] =    itab[].
        s_counter_datapakid = s_counter_datapakid + 1.
      ENDIF.              "Initialization mode or data extraction ?
    ENDFUNCTION.
    =========
    Please advise me and where will i correct the code.
    Thanks in advance,
    Siri.
    Edited by: SIRI SIRI on Jun 3, 2008 3:26 PM

    Hi,
    use the following:
    define a index variable.
    data: l_index type sy-tabix.
    in your loop at e_t_data.
    loop at e_t_data.
    new statement
    l_index = sy-tabix.
    changed statement
    modify e_t_data index l_index.
    endloop.
    The other read operations on internal tables will reset sy-tabix so that it will point to a invalid record.
    regards
    Siggi

  • When I try to enter codes for digital movie downloads it tells me "code redemption is temporarily unavailable. Try again later." Customer support has been no help. Anyone else have this problem?

    When I try to enter codes for digital movie downloads it tells me "code redemption is temporarily unavailable. Try again later." Customer support has been no help. Anyone else have this problem?
    Am sick of going back and forth with what has turned out to be worthless customer support. Have sent them so much info and pictures, no help. All they do is send me links for instructions on how to redeem the codes. I know how to redeem, I have redeemed at least 50 codes. To them I am obviously an idiot though. To me it seems to be a problem on their end, but can't get an answer from them on why it is telling me code redemption is unavailable. Please help! Anybody!

    Confirming my suspicions with every passing hour. Support on this forum is non-existent like the support from Apple support. But, you got my money now... why would you care?

Maybe you are looking for