Change of base value for calculation of Excise.

Hi All,
I have a senario which needs to be maaped in SAP. Please help in maaping the senario.
We are purchasing Oil from manufacturer like IOCL & HPCL. The contract is such that, the excise is calculated on the proce of the oil on the day the chalan has been created. Eg:-
Contract base price is 100
Ed@ 14.42%                14.42
But on the day of despatch the base price is 110, hence the excise will be calculated on 110 only not on 100.
So in PO we want to maintain a condition apart from basic price PBXX and PB00 on which only the excise will be calculated. The excise shouldnt be calculated on PBXX & PB00.
So please tell me how to map this in pricing procedure using routine.
Regards,
Mohar

Hi,
I hope your requirement can be met using the manual Excise condition - JEXC in MM Pricing Procedure by maintaining  the subtotal as 5.
Enter the JEXC condition in PO Item condition manually & enter the amount on which excise needs to be calculated.
Based on subtotal 5 the value will flow to tax procedure automatically & excise will be calculated on the same.
Hope its clear.
Thanks & Regards,

Similar Messages

  • CONDITION BASE VALUE / ALT CALCULATION TYPE Pricing

    Dear All,
    I have a scenario where in I want the condition base value for calculating the value for a condition type to be based on
    Gross weight -  Net weight value of a material.
    Is it possible and if yse how do I acheive the same.
    Deepak

    Deepak,
    Alternative Calculation Type:
    Normally if you want to calculate a value you have to use a calculation type for determinating the value. This calculation type is either addition, subtraction or multiplication. Similarly SAP also has got a default calculation type in the control data of the condition type. There you have the options of either Qty based , Fixed Amount Based or Percentage based.  
    Here what happens is suppose if you define Your condition type that calculates the base price of a material on Qty based. Then the calculation will be done based on the quantity of the material. If the customer orders 10 Nos and you have maintained a unit price of 100 Rs for each material then the value determined is 1000 INR. Similarly if the discount condition type , you maintain the calculation type as %. This means if you maintain the value of 10  % in the condition record. Then this percentage is taken as the calculation type  and the condition value is determined.
    In some cases you have to forego the default calculation types and use the customer specific method for calculating a value. For ex if you are calculating the Freight charges for a Material . it depends on so many criteria like, the weight, volume  and also the minimum amount etc etc, in those cases, you forego the default value and then use the alternative calculation type in calculating the condition value against the particular condition.
    Alternative Condition Base value :
    If you have to calculate any value then you have to have a base value for it. For ex if you want to calculate the  discount of 10 % for a material then you have to have a base value on which this 10% is calculated. Normally you take the  condition value of the base price of the material to calculate the value.
    Now you don't want to take the base value and take other values as base value which are derived on some formulae. So you create a routine which will do the mathematical operations in the routine and derive you a value which is now used as the base value for calculating the condition value for a particular condition type.
    Reward poitns if u finds this helpful....
    Regds
    MM

  • Base value for excise duty

    Hello All,
    Base value for Excise duty and different service tax. calculated with the BASB condition type.
    can we change the the base value pick up method.
    Means i dont want to pick this value fron Net (gross price less discount).
    I want to have this value from Calculated Net value with considering freight  charge and less discount.
    is it possible to change,
    Abhinay Waikar.

    Hi,
    Assign subtotal "5" against the freight condition types in MM calculation schema and then try.

  • In import process,how excise base value is calculated in MIGO

    Hi expert's,
    In import process,how excise base value is calculated in MIGO,with what referance values get add to base value.
    waiting for your valuable response,
    Regards
    V.raj

    hi,
    we Tried with your following reply ! but still not finding exact value in base value .
    (MATERIAL PRICE* QTY IN MIGO * EXCHANGE RATE)
    thanks & regards
    V.Raj

  • CIN: Alteration of base value for CST in TAXINN

    Hi,
    In our business process there is a requirement that CST should not be calculated only on Basic Price + Excise Duties (BEDEcessSEcess) rather base value for CST should be Basic Price + Excise Duties (BEDEcessSEcess) + 2 Additional Surcharges as mentioned below:
    Basic Price     100.00
    BED (10%)     10.00
    Ecess (2%)     0.20
    SEcess (1%) 0.10
    Additional Surcharge1     4.00
    Additional Surcharge2     6.00
    Base for CST 120.30 (100100.20.14+6)
    CST (2%)     2.41 (2% of 120.30)
    Total Value     122.71
    The tax procedure being used is TAXINN
    Is there any standard routine or subtotal available so that by using this in PO Calculation Schema and TAXINN the base value of CST can be modified as desired?
    Please provide some useful ideas.
    Thanks in advance
    Edited by: Sapdear on Aug 29, 2011 8:22 AM

    Hi,
    The additional surcharges are condition types in the calculation schema of PO whereas CST is being calculated in Tax Procedure TAXINN so how "From" and "To" functionality can work. The surcharges are getting calculated in PO Pricing and CST in tax procedure TAXINN (both at different places)
    We want to use a tax code (BED10%Ecess2%SEcess1%+CST2%) to calculate Excise Duties and CST by additional surcharges taking into account.
    Can any one provide some idea to resolve this issue?
    Thanks in advance

  • Base Value for Imports

    All SAP Gurus,
    While capturing / posting excise invoice for Imports, which value to be considered as base value?
    Is it the value of material only or some duties and other costs to be added over it to consider it as base value?
    In our case material value + BCD is displayed as base value, while capturing / posting excise invoice.
    Is it correct?
    If we want to take some more conditions (or delete some conditions) from being calculating as Base amount, what should be done?
    Please reply.
    Regards,

    Find the fin. acct, entry genrated by system with end of every transaction and Import Business Process.
    1. Create PO, in contion tab of PO , maintaint all possible Bill of entry coponent and assigned it with custom vendor.
    2. Create MIRO for custom vendor ( Planned delivery cost)
    FI Entry of Import( Planned Delivery Cost)
    1 K 2001000 customs 60,592.36- INR
    2 S 2027100 CVD Clearing 336.07INR
    3 S 2025000Customs Provision 9,845.38INR
    4 S 2025000Customs Provision 985.38INR
    5 S 2027100CVD Clearing 33,606.65INR
    6 S 2027100CVD Clearing 672.13INR
    7 S 2025000Customs Provision 492.69INR
    8 S 2025000Customs Provision1 4,654.06 INR
    3. Create GR for Excisble /non-excisable mat.
    for Materail
    1 89 4002100 RM:coal 221,365.01 INR
    2 96 2021000 Provisional Liab-GR 195,387.50- INR
    3 50 2025000 Customs Provision 14,654.06- INR
    4 50 2025000 Customs Provision 985.38- INR
    5 50 2025000 Customs Provision 492.69- INR
    6 50 2025000 Customs Provision 9,845.38- INR
    for Excise
    1 40 4610410 RG 23A-Higher Ed Ces 336.07 INR V0
    2 40 4610100 RG 23A-BED 33,606.65 INR V0
    3 40 4610400 RG 23A-Ed Cess 672.13 INR V0
    4 50 2027100 CVD Clearing 34,614.85- INR V0
    4. create MIRO for importer liab.
    FI for Vendor( Importer)
    1 K 2001000 test / 195,387.50- INR
    2 S 2021000 Provisional Liab 195,387.50 INR
    so as per the example the base base value will  be  195,387.50
    regards
    kunal
    award if helpful

  • Change Condition Base Value in Billing Process.

    Dear SAP experts
    for now, In third-party process, condtion base value of billing  only come from oder doc's.
    but we want to change condition base value of billing from PO doc's for some condition type.
    (actually, we want PO Quantity as a condition base value in billing process)
    where can i apply alternative solution?
    Regards.
    Juyoung

    HI,
    To elaborate, you can change the condition base value settings in the pricing procedure for the condition type.
    Take help of ABAPer and let him know what exact qty or value you want system to pick up while processing billing docs.
    Prior to do any changes, please also ceck if the new changes are impacting any old logics...
    Hope it helps..
    Regards,
    SB.

  • Change of  Base value percentage

    Hi ,
    I want to change the base value percentage with t-code :S_ALR_87009145
    now, there are many assets have to update.
    Is there any way to change the percentage for many assets?(Ex.batch input, bapi....)
    Regards,

    Hi Bernhard Kirchner,
    Thank you.
    it will change all assets with you method.
    but if I want to change the base value based on assets,
    is there some idea?
    Regards

  • Base value for Excise calculation

    Hi SD Gurus,
    Is <b>Excise duty</b> calculated on the basis of gross value of the material.?? what happens in case there is some discount given to the customer? Pleae confirm.
    Does <b>assement value</b> is considered for evaluating the excise duty..??
    Gupta.P

    Hi Gupta,
    The base value needs to be declared by the company to the excise department.  Based on this value the excise duty is calculated. Irrespective the discount given the excise duty is to be computed on the base value
    prasanna

  • Excise base value for CVD Calculation in Import depot pricing?

    Hi,
    In case of Import procedure the condition base value which is copying to excise should be sum of assessable value + Basic customs but it is not happening..
    kindly suggest me on the same..
    regards,

    Hi
    for  custome invoice valu will be
    1) IN CVD
    2) ECESS on CVD (%)
    3) SHECESS on CVD (%)
    4) additinal
    5) IN Basic customs
    6)Custom's Edu Cess
    7)Sec ECESS ON Customs
    out of these
    1 t0 4 will be in excise invoice
    1)chek in po tax code 0
    2)chek following setting in spro-
    Logistic general-tax on goods movement-account determination-specifiy exciseaccounts per trasnction and psecify excise gruopper transction chek IP here for you Grop setting
    3) chek condiiton type with accuralse and account key is there or not
    GRPO IP CR CLEAR
    GRPO IP DR MSUSP
    GRPO IP DR ONHOLD
    GRPO IP DR PLAAED
    GRPO IP DR PLAAT1
    GRPO IP DR PLABED
    GRPO IP DR PLACESS
    GRPO IP DR PLAECS
    GRPO IP DR RG23AED
    GRPO IP DR RG23AT1
    GRPO IP DR RG23BED
    GRPO IP DR RG23ECS
    GRPO IP DR RG23SED
    EWPO IP CR CLEAR
    EWPO IP DR PLAECS
    EWPO IP DR RG23AED
    EWPO IP DR RG23AT1
    EWPO IP DR RG23BED
    EWPO IP DR RG23ECS
    EWPO IP DR RG23SED
    Regards
    Kailas ugale

  • Asset value for Calculation of Tax Depreciation

    We have been told that many of the assets created as of 1/1/2008 have a different (lower) tax value than their beginning book value.  Book value is correct for standard book depreciation.     Is there a process to update the tax value of assets created in SAP similar to the transaction AS92 used to update values for Converted Assets?
    It was suggested that we use the method of Unplanned Depreciation tcode ABAA with TTY 642/652 to change the tax value of the asset.  When I tested this I found the various tax depreciation methods were calculated based on the beginning book value for year 1 and not using taking the special depreciation into consideration until subsequent years.   This is using Depreciation Area 10, MACRS, Dep. Key M200.
    Is there a better method of altering asset book value for tax purposes or a better way to alter the tax depreciation calculation so it takes Unplanned Depreciation into consideration during year 1?
    Current simplified tax depreciation example:
    Beg. BV $1,000
    unplanned dep posted $100
    tax depreciation for year 1 $100
    tax depreciation for years 2-10 $88.88
    The preferred depreciation is $90 years 1 - 10.
    Thanks for your assistance,
    Jeff

    I think I had the cart before the horse on this problem.  The correct way to look at this is what is the best way to get the correct "Net Book Value" and not the correct tax depreciation posting as it never actually gets booked.  
    By knowing the incorrect Beginning BV, the rate depreciation is applied in year 1 and finally the desired Net BV value at the end of year 1 for tax purposes I am able to calculate the correct Unplanned Depreciation for tax to make everything work out correctly.
    correct beginning tax BV $1,200
    Beginning Asset Book Value $1,800
    depreciation $360 (20% of BV)
    Unplanned depreciation  $?
    Net BV for tax at end of Yr1  $960 ;  or  1,200 - (1,200*.2)
    With the know values above that makes my unplanned depreciation for Yr 1 to be $480.  Year 1 and all following years depreciate correctly after the Unplanned Depreciation is posted.
    I am marking this as resolved unless someone sees an error in my thinking.
    Thanks,
    Jeff

  • Sub total column in MM pricing and Base value for tax

    Hi,
      In MM pricing in M/08 for the condition we can use subtotal filed for multiple conditions if we use same subtotal fileds the value of all condition will be added in the define subtotal filed,  so this is only effect of subtotal  or it has also some othere effect,  second think which I want to know  in PO after PBXX we have some custom condition for Surcharge % (Item) whatever % we maintain in this  the tax amount is calculated on the addition of PBXX and  Surcharge % (Item,  this is oK as per our requirement,  but in M/08  for  Surcharge % (Item ) the subtotal field os blank,  also  in OBQ3 Fi pricing  for the Condition BASB  the column for Alternative formula for condition base value ALSO Condition formula for alternative calculation type are also blank  then How system found the BASB  value as the adition of PBXX and  Surcharge %, what is nasic rule behind this  for the BASB value calculation.
    regards,
    zafar

    Hi,
      Thakns for your reply, In our existing system, in tax procedure 362/363 is not maintain, so in case this is not maintain,  which value is considered as the base price.
    regards,
    zafar

  • How to define maximum base value for vehicle.

    Hi.
    Could you clearify me why I can't fix maximum value for vehicles (1,000,000)
    I already did configure as below:
    IMG>> FI >> Asset Accounting >> Depreciation >> Valuation methods >> Dep key >> Caculation method >> Define maximun amount method
    then assign to asset class by
    IMG>> FI >> Asset Accounting >> Depreciation >> Valuation methods >> further setting >> Define maximun base value
    after that I test maximum value  and display value but I found that amount that use to calculate dep dosen't be 1,000,000
    where is the mistake and how can I fix it ?
    Thank you in advance
    Best regards,
    Utarat.

    Hi Utarat,
    I assume you have linked this maximum amount methods to the depreciation key   > AFAMA (V_T090NA-METHBT).                                                                               
    Please check also the amounts entered as maximun amount and if you  have flagged the fiels XKUMU (read the documentation on it F1)                                                                               
    Have you set any maximun base value that can affect the calculations  (Transaction OAW2)?                                                         
    Note 1048448 could be helpful.
    regards Bernhard
    Edited by: Bernhard Kirchner on Sep 29, 2010 8:51 PM

  • How to update a large (over 4 million item) List(Of Byte) quickly by altering indexes contained in a Dictionary(Of Integer, Byte) where the Dictionaries keys are the indexes in the List(Of Byte) that need to be changed to the values for those indexes?

       I'm having some difficulty with transferring images from a UDP Client to a UDP Server. The issue is receiving the bytes necessary to update an original image sent from the Client to the Server and updating the Servers List(Of Byte) with the
    new bytes replacing bytes in that list. This is a simplex connection where the Sever receives and the Client sends to utilize the least amount of bandwidth for a "Remote Desktop" style application where the Server side needs image updates of whatever
    occurs on the Client desktop.
       So far I can tranfer images with no issue. The images can be be any image type (.Bmp, .Gif, .JPeg, .Png, etc). I was working with sending .JPeg's as they appear to be the smallest size image when a Bitmap is saved to a memory stream as type
    .JPeg. And then I am using GZip to compress that byte array again so it is much smaller. However on a loopback on my NIC the speed for sending a full size screen capture is not very fast as the Server updates fairly slowly unless the Clients screen capture
    Bitmap is reduced in size to about 1/3'd of the original size. Then about 12000 bytes or less are sent for each update.
       Due to .JPeg compression I suppose there is no way to get the difference in bytes between two .JPegs and only send those when something occurs on the desktop that alters the desktop screen capture image. Therefore I went to using .Bmp's as each
    .Bmp contains the same number of bytes in its array regardless of the image alterations on the desktop. So I suppose the difference in bytes from a second screen capture and an inital screen capture are what is different in the second image from the initial
    image.
       What I have done so far is save an initial Bitmap of a screen capture using a memory stream and saving as type .Bmp which takes less than 93 milliseconds for 4196406 bytes. Compressing that takes less than 118 milliseconds to 197325 bytes for
    the current windows on the desktop. When that is done PictureBox1 is updated from nothing to the captured image as the PictureBox's background image with image layout zoom and the PictureBox sized at 1/2 my screens width and 1/2 my screens height.
       Then I save a new Bitmap the same way which now contains different image information as the PictureBox is now displaying an image so its back color is no longer displayed (solid color Aqua) and the cursor has moved to a different location. The
    second Bitmap is also 4196406 in bytes and compressed it was 315473 bytes in size.
       I also just found code from this link Converting a Bitmap to a Byte Array (and Byte Array to Bitmap) which gets a byte array
    directly from a Bitmap and the size of that is 3148800 for whatever is full screen captured on my laptop. So I should be able to work with smaller byte arrays at some point.
       The issue I'm having is that once the Client sends an image of the desktop to the Server I only want to update the server with any differences occuring on the Clients desktop. So what I have done is compare the first screen captures bytes (stored
    in a List(Of Byte)) to the second screen captures bytes (stored in a List(Of Byte)) by using a For/Next for 0 to 4196405 where if a byte in the first screen captures List is not equal to a byte in the second screen captures List I add the index and byte of
    the second screen captures list to a Dictionary(Of Integer, Byte). The Dictionary then only contains the indexes and bytes that are different between the first screen capture and second screen capture. This takes about 125 milliseconds which I think is pretty
    fast for 4196406 byte comparison using a For/Next and adding all the different bytes and indexes for each byte to a Dictionary.
        The difference in Bytes between the inital screen capture and the second screen capture is 242587 as an example which changes of course. For that amount of bytes the Dictionary contains 242587 integers as indexes and 242587 bytes as different
    bytes totaling 485174 bytes for both arrays (keys, values).  Compressed the indexes go from 242587 to 43489 bytes and the values go from 242587 to 34982 bytes. Which means I will have to send 78, 481 bytes from the Client to the Server to update the display
    on the server. Quite smaller than the original 4196406 bytes of the second Bitmap saved to type .Bmp or the compressed size of that array which was 315473 bytes. Plus a few bytes I add as overhead so the server knows when an image array ends and how many packets
    were sent for the array so it can discard complete arrays if necessary since UDP is lossfull although probably not so much in current networks like it may originally have been when the internet started.
        In reality the data from the Client to the Server will mostly be the cursor as it moves and updating the Server image with only a few hundred bytes I would imagine at a time. Or when the cursor selects a Button for example and the Buttons
    color changes causing those differences in the original screen capture.
       But the problem is if I send the Dictionaries Indexes and Bytes to the Server then I need to update the original Bitmap List(Of Byte) on the server by removing the Bytes in the received informations Index locations array from the Servers Bitmap
    List(Of Byte) and replacing those Bytes with the Bytes in the received informations Byte array. This takes so long using a For/Next for however many indexes are in the received informations Index array to update the Bitmap List(Of Byte) on the server using
    "Bmp1Bytes.RemoveAt(Index As Integer)" followed by "Bmp1Bytes.Insert(Index As Integer, Item As Byte)" in the For/Next.
        I've tried various For/Next statements including using a new List(Of Byte) with If statements so If the the integer for the For/Next ='s the Key in a Dictionary(Of Integer, Byte) using a Counter to provide the Dictionaries Key value then
    the Dictionaries byte value will be added to the List(Of Byte) and the counter will increas by one Else the List(Of Byte) adds the original "Bmp1Bytes" byte at that index to the new List(Of Byte). This takes forever also.
       I also tried the same For/Next adding to a new Dictionary(Of Integer, Byte) but that takes forever too.
       I think I could use RemoveRange and AddRange to speed things up. But I don't know how to retrieve a contiguous range of indexes in the received indexes that need to be updated in the servers "Bmp1Bytes" List(Of Byte) from the received
    array of indexes and bytes which are in a Dictionary(Of Integer, Byte).  But I believe this would even be slower than some realistic method for replacing all Bytes in a List(Of Byte) when I have the indexes that need to be replaced and the bytes to replace
    them with.
       Even if I just used AddRange on a new List(Of Byte) to add ranges of bytes from the original "Bmp1Bytes" and the changes from the Dictionary(Of Integer, Byte) I think this would be rather slow. Although I don't know how to do that
    by getting contiguous ranges of indexes from the Dictionaries keys.
       So I was wondering if there is some method perhaps using Linq or IEnumerable which I've been unable to figure anything out which could do this.
       I do have some copy and pasted code which I don't understand how it works that I am using which I would guess could be altered for doing something like this but I can't find information that provides how the code works.  Or even if I did
    maybe I can't understand it. Like the code below which is extremely fast.
       Dim strArray() As String = Array.ConvertAll(Of Integer, String)(BmpComparisonDict.Keys.ToArray, Function(x) x.ToString())
    La vida loca

    Monkeyboy,
    That was quite a bit to read, but still a bit unclear. Could you put a specific list of goals/questions, asked in the smallest possible form?
    It seems like either you're making a program that monitors activity on your computer, or you're writing some kind of remote pc app.
    When you do get your bytes from using lockbits, keep in mind all the files header info would be lost. I think retaining the header info is worth the extra bytes.
    The other, thing: I'm not sure if you're taking 32bpp screen shots, but also keep in mind that the "whole desktop" is the final destination for blended graphics, if that makes sense. What I mean is that there is no need to capture an "alpha"
    channel for a desktop screenshot, as alpha would always be 255, this could save you 1 byte per pixel captured... Theres nothing "behind" the desktop, therefore no alpha, and every window shown above the desktop is already blended. I suggest using
    24Bpp for a full screen capture.
    Your X,Y information for the mouse could be stored as UINT16, this would save you a measly 2 bytes per location update/save.
    When you update your byte arrays, maybe you can turn the array into a stream and write to whatever index, however many bytes, that should prevent a "Shift" of bytes, and instead overwrite any bytes that "get in the way".
    ex
    Dim example As String = "This is an example."
    Dim insertString As String = "was"
    Dim insertBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(insertString)
    Dim bytes As Byte() = System.Text.Encoding.ASCII.GetBytes(example)
    Dim modifiedBytes As Byte() = {}
    Using ms As New System.IO.MemoryStream(bytes)
    ms.Position = 5
    ms.Write(insertBytes, 0, 3)
    modifiedBytes = ms.ToArray
    End Using
    Dim newString As String = System.Text.Encoding.ASCII.GetString(modifiedBytes)
    'Notice how below there isn't the word "is" anymore, and that there isn't a
    'space.
    'This demonstrates that you overwrite existing data, versus shifting everything to
    'the right.
    'Returns: This wasan example.
    MsgBox(newString)
    “If you want something you've never had, you need to do something you've never done.”
    Don't forget to mark
    helpful posts and answers
    ! Answer an interesting question? Write a
    new article
    about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.
    Well it's too much to read. I was really tired when I wrote it. Even the below is too much to read but perhaps gets the point across of what I would like to do which I think
    Joel Engineer may have answered but I'm not sure. As I'm still too tired to understand that yet and research what he said in order to figure it out yet.
    But maybe the code below can provide the concept of the operation with the comments in it. But seeing as how I'm still tired it may be confused.
    Option Strict On
    Imports System.Windows.Forms
    Imports System.IO
    Imports System.IO.Compression
    Imports System.Drawing.Imaging
    Imports System.Runtime.InteropServices
    Public Class Form1
    Dim Bmp1Bytes As New List(Of Byte)
    Dim Bmp1BytesCompressed As New List(Of Byte)
    Dim Bmp2Bytes As New List(Of Byte)
    Dim BmpComparisonDict As New Dictionary(Of Integer, Byte)
    Dim BmpDifferenceIndexesCompressed As New List(Of Byte)
    Dim BmpDifferenceBytesCompressed As New List(Of Byte)
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    SomeSub()
    End Sub
    Private Sub SomeSub()
    ' Pretend this code is in UDP Client app. A screen capture is performed of the desktop. Takes about 90 milliseconds.
    Bmp1Bytes.Clear()
    Using BMP1 As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
    Using g1 As Graphics = Graphics.FromImage(BMP1)
    g1.CopyFromScreen(0, 0, 0, 0, BMP1.Size)
    Cursor.Draw(g1, New Rectangle(Cursor.Position.X, Cursor.Position.Y, Cursor.Size.Width, Cursor.Size.Height))
    Using MS As New MemoryStream
    BMP1.Save(MS, System.Drawing.Imaging.ImageFormat.Bmp)
    Bmp1Bytes.AddRange(MS.ToArray)
    End Using
    End Using
    End Using
    Bmp1BytesCompressed.AddRange(Compress(Bmp1Bytes.ToArray))
    ' UDP Client app sends Bmp1BytesCompressed.ToArray to UDP Server which is the entire image of the desktop that the UDP
    ' Client is on. This image takes awhile to send since compressed it is about 177000 bytes from over 4000000 bytes.
    ' I will be using different code just to get the bytes from the actual Bitmap in the future. That is not important for now.
    ' Pretend the UDP Server has received the bytes, decompressed the array received into a List(Of Byte) and is displaying
    ' the image of the UDP Clients desktop in a PictureBox.
    ' Now the image on the UDP Clients desktop changes due to the mouse cursor moving as an example. Therefore a new Bitmap
    ' is created from a screen capture. This takes about 90 milliseconds.
    Bmp2Bytes.Clear()
    Using BMP2 As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
    Using g1 As Graphics = Graphics.FromImage(BMP2)
    g1.CopyFromScreen(0, 0, 0, 0, BMP2.Size)
    Cursor.Draw(g1, New Rectangle(Cursor.Position.X, Cursor.Position.Y, Cursor.Size.Width, Cursor.Size.Height))
    Using MS As New MemoryStream
    BMP2.Save(MS, System.Drawing.Imaging.ImageFormat.Bmp)
    Bmp2Bytes.AddRange(MS.ToArray)
    End Using
    End Using
    End Using
    ' Now I have the original images bytes in Bmp1Bytes and the new images bytes in Bmp2Bytes on the UDP Client. But I don't
    ' want to send all of the bytes in Bmp2Bytes to the UDP Server. Just the indexes of and the bytes that are different in
    ' Bmp2Bytes from Bmp1Bytes.
    ' This takes less than 100 milliseconds for what I've tested so far where over 500000 bytes in Bmp2Bytes are different
    ' than the bytes in Bmp1Bytes. Usually that amount would be much less. But during testing I was displaying the image
    ' from Bmp1 bytes in a PictureBox so a large amount of data would change between the first screen shot, the PictureBox
    ' then displaying an image on the same PC and then the second screen shot.
    BmpComparisonDict.Clear()
    For i = 0 To Bmp1Bytes.Count - 1
    If Bmp1Bytes(i) <> Bmp2Bytes(i) Then
    BmpComparisonDict.Add(i, Bmp2Bytes(i))
    End If
    Next
    ' So now I have all the difference bytes and their indexes from Bmp2Bytes in the BmpComparisonDict. So I compress
    ' the indexes into on List and the Bytes into another List.
    BmpDifferenceIndexesCompressed.Clear()
    BmpDifferenceBytesCompressed.Clear()
    BmpDifferenceIndexesCompressed.AddRange(Compress(BmpComparisonDict.Keys.SelectMany(Function(d) BitConverter.GetBytes(d)).ToArray()))
    BmpDifferenceBytesCompressed.AddRange(Compress(BmpComparisonDict.Values.ToArray))
    ' Now pretend the UDP Client has sent both those arrays to the UDP Server which has added both decompressed arrays
    ' to a Dictionary(Of Integer, Byte). And the server has the original image decompressed bytes received in a List
    ' called Bmp1Bytes also.
    ' This is where I am stuck. The UDP Server has the Dictionary. That part was fast. However there is no
    ' fast method I have found for creating a new List(Of Byte) where bytes in the originally received List(Of Byte) that
    ' do not have to be altered are placed into a new List(Of Byte) except for the indexes listed in the
    ' Dictionary(Of Integer, Byte) that need to be placed into the appropriate index locations of the new List(Of Byte).
    ' The below example for doing so is exceptionally slow. Pretend UpdateDictionary has all of the decompressed indexes
    ' and bytes received by the UDP Server for the update contained within it.
    Dim UpdateDictionary As New Dictionary(Of Integer, Byte)
    Dim UpdatedBytes As New List(Of Byte)
    Dim Counter As Integer = 0
    For i = 0 To Bmp1Bytes.Count - 1
    If i = UpdateDictionary.Keys(Counter) Then ' Provides the index contained in the Keys for the Dictionary
    UpdatedBytes.Add(UpdateDictionary.Values(Counter))
    Counter += 1
    If Counter > UpdateDictionary.Count - 1 Then Counter = 0
    Else
    UpdatedBytes.Add(Bmp1Bytes(i))
    End If
    Next
    ' So what I'm trying to do is find an extremely fast method for performing something similar to what the
    ' above operation performs.
    End Sub
    Private Function Compress(BytesToCompress() As Byte) As List(Of Byte)
    Dim BytesCompressed As New List(Of Byte)
    Using compressedStream = New MemoryStream()
    Using zipStream = New GZipStream(compressedStream, CompressionMode.Compress)
    zipStream.Write(BytesToCompress, 0, BytesToCompress.Count)
    zipStream.Close()
    BytesCompressed.AddRange(compressedStream.ToArray)
    End Using
    End Using
    Return BytesCompressed
    End Function
    Private Function Decompress(BytesToDecompress() As Byte) As List(Of Byte)
    Dim BytesDecompressed As New List(Of Byte)
    Using DecompressedStream = New MemoryStream()
    Using zipStream = New GZipStream(DecompressedStream, CompressionMode.Decompress)
    zipStream.Write(BytesToDecompress, 0, BytesToDecompress.Count)
    zipStream.Close()
    BytesDecompressed.AddRange(DecompressedStream.ToArray)
    End Using
    End Using
    Return BytesDecompressed
    End Function
    End Class
    La vida loca

  • How to Change the return value for the parameters

    Hi, Can anyone help me with my problem?
    I have a parameter called "P1_Projects" defined in the HTMLDB page, on the report region, there are 2 buttons, one is "Go" button to submit the report on the screen, so user can preview the report, then another button "Export to PDF" can be clicked to generate the report using Oracle Report Services. The "Export to PDF" button will use the same set of parameters submitted for the "Go" button.
    So, the parameter "P1_Projects" is being used by these 2 buttons. and I have to pass a "%" wild card for "All Projects". To make the "Export to PDF" button work, I have to safe encode the return value for "%" to "%25" in order to pass the URL formula, but now my "Go" button doesn't work with "%25", it only recognize the "%" wild card.
    Is there a way to conditionally change the value depends which button is clicked?
    Any hint or help is highly appreciated!
    Hong

    try creating a plsql process which sets the P1_Projects item as required.
    in the plsql you can do:
    if :REQUEST = 'GO' then
    xxx
    else
    xxxx
    end if;
    set the condition to plsql expression:
    :REQUEST in ('GO', 'EXPORT')
    NB. the request value is usually set to the button name when a page is submitted from a button

Maybe you are looking for