Incorrect  $ Value when reversing a GR via MBST

I'm trying to reverse a GR that was received in on a schedule agreement with the wrong price($790/1000).  However, the value that is posted to accounting is incorrect.  It should be $790 but SAP calculates it at $793.82.  I used MBST to do the reversal.  The material is set to moving average price.  How can I get the reversal to be valued at $790.  Also, when I tried to do another GR and then tried to reverse it, the value went down to $793.74.  Can anyone explain why?  See PO history below.  Thank you
GR   5000013882 0001 101 07/31/07            1,000  EA            790.00  USD
GR   5000013883 0001 102 07/31/07            1,000- EA            793.82- USD
GR   5000013884 0001 101 07/31/07            1,000  EA            790.00  USD
GR   5000013885 0001 102 07/31/07            1,000- EA            793.74- USD

Here is another example that I recreated in our QAS system:
Step 1:  Received in 1000 EA @ $790 per 1000 (wrong price)
Step 2:  Received in 1000 EA @ $79 per 1000 (correct price)
Step 3:  Ran MBST on mat doc 5000013888 (reversed step 1)
Is this correct?  I would expect the value of the 102 to be $790 and not $428.27.  Am I missing something?
GR   5000013888 0001 101 08/01/07            1,000  EA            790.00  USD
GR   5000013889 0001 101 08/01/07            1,000  EA             79.00  USD
GR   5000013890 0001 102 08/01/07            1,000- EA            428.27- USD

Similar Messages

  • SAPBEXgetConnection doesn't return proper values when BEX is open via RRMX

    had to put a lot of interactivity in some workbook based on the user profile and going far beyond the simple authorisation objects.
    Following the advice of some specialists such as Peter Knoer, I used the following code to get the user connection details:
    <i>Set myConnection = Run("SAPBEX.XLA!SAPBEXgetConnection")
    With myConnection ' call the connection
    Sheets("BAPI").Cells(27, 2).Value = myConnection.Client
    Sheets("BAPI").Cells(28, 2).Value = myConnection.User
    Sheets("BAPI").Cells(29, 2).Value = myConnection.language
    Sheets("BAPI").Cells(30, 2).Value = myConnection.SystemNumber
    Sheets("BAPI").Cells(31, 2).Value = myConnection.System
    Sheets("BAPI").Cells(32, 2).Value = myConnection.ApplicationServer
    End With</i>
    Everything works fine as long as the user first launch BEX and connect directly in BEX.
    This command function fails if BEX is launch from SAP EasyAccess Menu via the RRMX transaction.
    Any clue why this function does not work in the case of a launch via RRMX?
    I tried several alternative, is there a better Function to use to get all the user connection details in this case?
    thanks for your insights on this point.

    Hi Peter,
    why do I need to test what is the current login?
    I had the request to make truly dynamic workbook based on user profile: logo, workbook label based on user language  etc.
    To do so, I need to pass either the user name or the system number or the language to two RFC/BAPI functions from excel. Have a look at the complete macro below:
    +Sub BAPIUserDetail()
    'Declaration for the necessary objects
    Dim myConnection, myConnection2, objLogonControl, objBAPIControl, objConnection, objUserDetail, objUserName, objTranslation, objTranslationTable As Object
    Dim objTranslationDelimiter As Object
    Dim objTranslationOptions As Table
    Sheets("BAPI").Range("B27:B33").Value = ""
    Set myConnection = Run("SAPBEX.XLA!SAPBEXgetConnection")
    With myConnection ' call the connection
    Sheets("BAPI").Cells(27, 2).Value = myConnection.Client
    Sheets("BAPI").Cells(28, 2).Value = myConnection.User
    Sheets("BAPI").Cells(29, 2).Value = myConnection.language
    Sheets("BAPI").Cells(30, 2).Value = myConnection.SystemNumber
    Sheets("BAPI").Cells(31, 2).Value = myConnection.System
    Sheets("BAPI").Cells(32, 2).Value = myConnection.ApplicationServer
    '.UseSAPLogonIni = False 'important for automatic connection
    '.Logon 0, True ' This will provide a dialog to appear
    'If .IsConnected <> 1 Then
    '.Logon 0, False
    'If .IsConnected <> 1 Then Exit Sub
    'End If
    End With
    'Run "sapbex.xla!sapbexinit"
    ' if the user launch bex via SAPGUI easyaccess, sometimes the connection parameter fails
    Dim objVerifyConnection As String
    objVerifyConnection = Sheets("BAPI").Cells(27, 2).Value
    If objVerifyConnection = "" Then
    'Close completely the connection to BW !
    Run "sapbex.xla!dialOut", True, True
    'We warn-out the user that BEX connection is not correct
    MsgBox "ATTENTION: Les Parametres de Connection de votre BEX ne sont pas correctement transmis depuis votre SAPGUI. Veuillez vous reconnecter et relancer la derniere requête."
    'We recreate a new connection via SAPlogon dialog and relaunch the first query in the sequence of SAPBEXqueries worksheet
    Dim r As Range
    Set r = Range("SAPBEXqueries!SAPBEXq0003")
    Run "sapbex.xla!SAPBEXrefresh", False, r
    'We get another time all the connection parameter in the BAPI sheet
    Set myConnection2 = Run("SAPBEX.XLA!SAPBEXgetConnection")
    With myConnection2 ' call the connection
    Sheets("BAPI").Cells(27, 2).Value = myConnection2.Client
    Sheets("BAPI").Cells(28, 2).Value = myConnection2.User
    Sheets("BAPI").Cells(29, 2).Value = myConnection2.language
    Sheets("BAPI").Cells(30, 2).Value = myConnection2.SystemNumber
    Sheets("BAPI").Cells(31, 2).Value = myConnection2.System
    Sheets("BAPI").Cells(32, 2).Value = myConnection2.ApplicationServer
    End With
    End If
    'Create automatic connection for the user USER_BAPI to gather the Entity and Logo parameters linked to the user connected
    Set objBAPIControl = CreateObject("SAP.Functions") 'Create ActiveX object
    'Specify user
    objBAPIControl.Connection.User = "USER_BAPI"
    'Then password
    objBAPIControl.Connection.Password = "BOUYGUES"
    'Client
    objBAPIControl.Connection.Client = Sheets("BAPI").Cells(27, 2).Value
    'Target server address
    objBAPIControl.Connection.ApplicationServer = Sheets("BAPI").Cells(32, 2).Value
    'Language code
    objBAPIControl.Connection.language = Sheets("BAPI").Cells(29, 2).Value
    'System ID
    objBAPIControl.Connection.System = Sheets("BAPI").Cells(31, 2).Value
    'System Number
    objBAPIControl.Connection.SystemNumber = Sheets("BAPI").Cells(30, 2).Value
    'Finally, try to logon to the specified system and check if the connection established
    If objBAPIControl.Connection.Logon(0, True) <> True Then
    MsgBox "Cannot Log on to SAP" 'Issue message if cannot logon
    Else
    '  MsgBox "Logged on to SAP!"
    End If
    On Error Resume Next
    ' BAPI_USER_GET_DETAIL to get the user's parameter1 values
    Set objUserDetail = objBAPIControl.Add("BAPI_USER_GET_DETAIL")
    Set objUserName = objUserDetail.exports("USERNAME")
    objUserName.Value = Sheets("BAPI").Cells(15, 2).Value
    ' Function call
    objUserDetail.call
    ' Getting the result set in a table
    Dim objTable As Table
    Set objTable = objUserDetail.Tables("PARAMETER1")
    ' Printing the number of company codes
    'MsgBox "Row count :" & objTable.RowCount
    Sheets("BAPI").Cells(16, 2) = objTable.RowCount
    ' Clearing the PARAMETER1 Table on the Excel Sheet
    Sheets("BAPI").Range("A18:C25").Value = ""
    ' Saving the PARAMETER1 Table to the Excel Sheet
    For i = 1 To objTable.RowCount
    Sheets("BAPI").Cells(17 + i, 1) = objTable.Cell(i, 1)
    Sheets("BAPI").Cells(17 + i, 2) = objTable.Cell(i, 2)
    Next i
    'if any error then displaying the same to the users
    If Err Then
        MsgBox Err.Description
    End If
    ' Determine the standard SAP language code
    Dim language As String
    language = Sheets("BAPI").Cells(29, 2).Value
    Select Case language
    'FR
    Case "FR"
    Sheets("BAPI").Cells(16, 5).Value = "F"
    'EN
    Case "EN"
    Sheets("BAPI").Cells(16, 5).Value = "E"
    'DE
    Case "DE"
    Sheets("BAPI").Cells(16, 5).Value = "D"
    'ES
    Case "ES"
    Sheets("BAPI").Cells(16, 5).Value = "S"
    'Empty Language
    Case ""
    Sheets("BAPI").Cells(16, 5).Value = "F"
    Case Else
    Sheets("BAPI").Cells(16, 5).Value = "F"
    End Select
    ' RFC_READ_TABLE to get all the translation for the text label according to user preference
    Set objTranslation = objBAPIControl.Add("RFC_READ_TABLE")
    Set objTranslationTable = objTranslation.exports("QUERY_TABLE")
    objTranslationTable.Value = Sheets("BAPI").Cells(8, 5).Value
    Set objTranslationDelimiter = objTranslation.exports("DELIMITER")
    objTranslationDelimiter.Value = Sheets("BAPI").Cells(10, 5).Value
    Set objTranslationSkips = objTranslation.exports("ROWSKIPS")
    objTranslationSkips.Value = "0"
    Set objTranslationCount = objTranslation.exports("ROWCOUNT")
    objTranslationCount.Value = "0"
    'Define the filters for the OPTIONS table
    Dim area As String
    Dim langu As String
    area = Sheets("BAPI").Cells(14, 5)
    langu = Sheets("BAPI").Cells(16, 5)
    Set objTranslationOptions = objTranslation.Tables("OPTIONS")
    objTranslationOptions.AppendRow
    objTranslationOptions(1, "TEXT") = "AREA = '" & area & "' AND LANGU = '" & langu & "'"
    ' Function call
    objTranslation.call
    ' Getting the result set in a table
    Dim objTTable As Table
    Set objTTable = objTranslation.Tables("DATA")
    ' Printing the number of company codes
    'MsgBox "Row count :" & objTTable.RowCount
    Sheets("BAPI").Cells(12, 5) = objTTable.RowCount
    ' Clearing the  Table on the Excel Sheet
    Sheets("BAPI").Range("G7:Z10000").Value = ""
    ' Saving the  Table to the Excel Sheet
    For i = 1 To objTTable.RowCount
    Sheets("BAPI").Cells(6 + i, 7) = objTTable.Cell(i, 1)
    Next i
    'Convert to column the semicolon delimited text from the
    Dim objRange1 As Range
        'Set up the ranges
        Set objRange1 = Sheets("BAPI").Range("G7:G10000")
        'Do the first parse
        objRange1.TextToColumns _
          Destination:=Range("G7"), _
          DataType:=xlDelimited, _
          Tab:=False, _
          Semicolon:=True, _
          Comma:=False, _
          Space:=False, _
          Other:=False, _
          OtherChar:="-"
    'Replace the * by the € symbol, there is a pb with this caracter in the RFC_READ_TABLE
      Dim Cell As Variant
        For Each Cell In Sheets("BAPI").Range("K7:K1000")
            Cell.Value = Replace(Cell.Value, "*", "€")
        Next Cell
    'Insert logo in the BAPI worksheet
    Dim objPic As Object
    Dim ApplicationServer As String
    Dim logo As String
    ApplicationServer = Sheets("BAPI").Cells(32, 2).Value
    logo = Sheets("BAPI").Cells(20, 5).Value
    If logo = "Langue!" Then
    MsgBox "Attention: Il n'y a pas d'Entité et de Logo associés à votre profile! Veuillez contacter votre Administrateur."
    Else
    'Assign inserted image to an object
    Set objPic = Worksheets("BAPI").Pictures.Insert("http://" & ApplicationServer & ".bouygues-construction.com:8000/sap/bw/Mime/BEx/Bouygues%20Logos/" & logo & ".gif")
    objPic.Left = 400
    objPic.Top = 300
    objPic.Name = "MyLogo"
    objPic.Height = 100
    ' using the name reference to change width
    'Worksheets("BAPI").Shapes("MyLogo").Width = Worksheets("BAPI").Shapes("MyLogo").Width / 4
    'if any error then displaying the same to the users
    'Insert logo in the BAPI worksheet
    Dim objMainPic As Object
    'Dim ApplicationServer As String
    'Dim logo As String
    'ApplicationServer = Sheets("BAPI").Cells(32, 2).Value
    'logo = Sheets("BAPI").Cells(20, 5).Value
    'Assign inserted image to an object
    Set objMainPic = Worksheets("TBD dynamique").Pictures.Insert("http://" & ApplicationServer & ".bouygues-construction.com:8000/sap/bw/Mime/BEx/Bouygues%20Logos/" & logo & ".gif")
    objMainPic.Left = 30
    objMainPic.Top = 30
    objMainPic.Name = "MyMainLogo"
    'objMainPic.Height = 100
    ' using the name reference to change width
    Worksheets("TBD dynamique").Shapes("MyMainLogo").Width = Worksheets("TBD dynamique").Shapes("MyMainLogo").Width * 0.9
    End If
    If Err Then
        MsgBox Err.Description
    End If
    'log off for the USER_BAPI
    objBAPIControl.Connection.Logoff
    End Sub+
    But as I said the SAPBEXgetConnection  does not behave the same way if login is done directly done in BEX or via RRMX. Any Clue?

  • User or group column is populated with incorrect values when adding data from CSOM

    Hi All,
    I am working on a console application that updates list items using managed CSOM. I have a user or group column in this list that can contain multiple values. Now, I am using below code to update the value of this column:
    User newUser = web.EnsureUser("LoginName");
    context.Load(newUser);
    context.ExecuteQuery();
    FieldUserValue userValue = new FieldUserValue();
    userValue.LookupId = newUser.Id;
    listItem["User"] = userValue;
    The issue is if i assign the value of user1 to this column, the value that I see after the column is updated is another user; like user2. I don't know why it is populating this code with some other user? 
    Any idea on this issue? Thanks in advance.

    try these links:
    http://blogs.msdn.com/b/kaevans/archive/2013/11/30/setting-a-sharepoint-person-or-group-field-value-with-csom.aspx
    http://stackoverflow.com/questions/637859/sharepoint-group-by-is-broken-when-using-allow-multiple-values-for-a-column
    http://stackoverflow.com/questions/26815640/caml-person-or-group-field-with-multiple-values
    Please mark answer as correct if it is correct else vote for it if you find it useful

  • Bug-fix needs your vote: queries w/ joins against SQLite return incorrect values because Adobe treats PK col as alias for rowid when it should not

    For someone new to Adobe the forums and products can be bewildering. I've been advised to repost something I posted in Flash Data Integration in this forum.
    Here is the link to the post I put there:
    http://forums.adobe.com/message/2363777#2363777
    I have reported this bug: http://bugs.adobe.com/jira/browse/FB-23750
    I gather bugs get fixed if people vote for them to be fixed. Please vote for it to be fixed. It is serious, and you might not even realize you're suffering from it because the incorrect values returned by the query will seem perfectly plausible.
    If the link above doesn't work, here it is again:
    When I execute the following query in Flex and/or Lita:
    select wrdid, uspelling from WRD WHERE uspelling = 'wingeard'
    the results are:
    uspelling...wrdid
    wingeard   3137
    Look at what comes back when I execute this query using .NET provider by  Robert Simpson for SQLite and SQLite Manager by Mrinal Kant:
    SELECT     rowid, wrdid, uspelling
    FROM         WRD
    WHERE     (uspelling = 'wingeard')
    rowid.......wrdid...........uspelling
    3137........3042............wingeard
    No wonder none of my queries with joins is working correctly in Flex.
    wrdid is defined as "int" not INTEGER.
    http://www.sqlite.org/lang_createtable.html (see INTEGER PRIMARY KEY section):
    "The special behavior of INTEGER PRIMARY KEY is only available if the type name is exactly "INTEGER" (in any mixture of upper and lower case.)  Other integer type names like "INT" or "BIGINT" or "SHORT INTEGER" or "UNSIGNED INTEGER" causes the primary key column to behave as an ordinary table column with integer affinity and a unique index, not as an alias for the rowid."  [emphasis added]
    Now, I happen to think the SQLite developers made a mistake here in failing to follow standards, preferring not to break legacy code. They'd rather break current code instead???  I would not characterize this as a "corner case" and the bug-at-hand is de facto evidence of that.

    Did you try running the queries I posted? What were your results with those?
    What I am seeing is that when I use "int PRIMARY KEY" in a CREATE TABLE statement, that column becomes the special "rowid" column. I believe this is also what you are seeing.
    However, what confuses me is how you're getting a table with three columns "rowid", "id", and "name" in the first place. When I run this SQL...
    CREATE TABLE test
    id int PRIMARY KEY,
    name String
    ...I get a table with two columns: a normal column named "name", and a special primary key column named "id", which for this table is identical to the column represented by the rowid identifier.
    However, if I understand correctly, your table has three columns, "id", "name", and the special primary key column (i.e. "rowid"). Is that right? Can you give me the SQL that was used to create the table, or tell me how the table was created (e.g. if you used a tool like Lita) so I can try to re-create your exact situation? That would really be very very helpful -- it was the only detail that was missing in your last post, so I had to guess on that one detail.
    I tried something else to re-create your situation. I ran the following statement:
    CREATE TABLE test
    id int
    name String
    That gave me a table with two real columns plus the rowid column. Then I ran the three insert statements on that table, and when I ran the select statement I got the expected result:
    id     name
    1     one
    2     two
    7     seven
    Again, I'm guessing that your table was created differently than my test table, and that's the explanation for the difference.
    Some other possibilities to consider:
    The screen shot doesn't show a SQLResult object, so it seems that you're using some wrapper library or code to execute the query, or at least that you've copied the SQLResult.data Array to another variable named results. Although it seems less likely to me, it's possible that somewhere in that code something is getting scrambled. (But I'd rather rule out AIR as the underlying cause first before attempting to explore those paths.)
    As a side note, if you really want the database to have three columns (the special rowid column and your two columns id and name), and you don't want id to be the special rowid column, then it sounds to me like you don't actually want to define id as the primary key. If you just want the id column to have a constraint that prevents duplicate values, you can define it as a UNIQUE column:
    CREATE TABLE test
    id int UNIQUE,
    name String
    That gives you the same database-enforced constraint of not allowing duplicate values, but it tells the database explicitly that id isn't the same thing as the rowid primary key. (You can still join another table to the id column even if it's not defined as the primary key.)
    P.S. I'm sure you don't mean it this way, but using gigantic red text comes across like shouting -- it's very "loud". I'm trying my best to understand the issue you're having and help you resolve it, and using multiple colors and font sizes doesn't really make your post any more or less clear. Just because I ask you questions, or say that I'm seeing different results than you, doesn't mean I don't believe that you're seeing the results you're seeing. I've definitely seen strange variations and cases where something happens on my computer but others can't duplicate it on their computers -- so I believe that you are getting the results you're getting. I'm just trying to figure out how to make it so that I can also get those results, so that I can pass that on to the engineers who are in a position to make changes.

  • How to cancel reversed document via MBST

    Hi Gurus,
    is there any way how to reverse material document cancellation? I mean revese document cancelled via MBST.
    I tried procced via MBST, but got error M7067 (all items of the material.doc entered have already been reversed.
    I need to process this step due to wrong period booking.
    Thank you for help!

    Cancelation via MIGO does not help. Still got the same message as through MBST:
    All items of document 5000900204 already cancelled/reversed
    Message no. M7067
    Diagnosis
    All items of the material document entered have already been reversed.
    System response
    The system cannot take any items from this document for reversal.
    Procedure
    Do you want to display the list of cancelled material documents?

  • Vendor consignment pick up value when doing stock count

    Hi experts!
    I'm seeking your kindness to help me solve a problem.My client has done a stock count of vendor consignment stock.But why the system pick up the value of the stock when they do adjustment to the system which this item should not have any value as it was under vendor consignment?
    When i go to MI20 to check display the list of inventory differences,there's 1200kg with total price rm5146. the qty suppose to be no value but why there's 1200kg in booking?
    Any idea? your help is much much appreciated..

    Hi Pardeep,
    I still can't solve this problem.. Please help me.
    My client did stock count for vendor consignment stock. The problem is the system pick up value when she  did that. It suppose to be no value since it's not their stocks. but then i notice that there's a posting via mvt type 702 at the same day. i suspect she did not freez the invetory book during stock count. So now she doesn't want the value to be picked up. What can i do to solve this? Should i advise her to do reverse mvt type - 701? Please help me ASAP..

  • Need to run the report for All Values when Null is passed in parameter

    Hi All,
    In my BIP report, I am using a parameter :asset with Type as Text, which means user will type the values for the parameter in the text box.
    Now, this parameter can take multiple comma separated values. I have a requirement to run the report for All Values when user doesn't enter any value in the parameter text box and if user enters any value(s) then the report will run for those values . The way, I tried to handle that in the query using couple of ways was :
    IMP : My Database is SQL Server
    where
    (table.asset = isnull((:asset), table.asset) or table.asset in (:asset))
    Now this works fine when I give a single asset number but when I give multiple values separated by comma like 123, 345 in the text box, then the statement fails saying 'encountered ,'
    I also tried simply
    table.asset in isnull((:asset),table.asset) -- but this doesn't work as it doesn't allow me to use in operater while using isnull and if i will use = operater then it won't work in case of multiple values
    Any suggestions on how can I handle this? Any help would be highly appreciated.
    Thanks,
    Ronny

    thanks for replying, but i tried this option too, it did not work for me, neither isnull nor coalesce. I mean, the solution work for single value but when i pass multiple values then separated by a comma then it doesn't work and shows me an error like "Incorrect Syntax ','". I am using SQL server as DB and bip is 10.1.3.4.1
    also please share the SR number, so i can also check the same.
    can there be any other work around to this?
    thanks,
    ronny

  • How to fix 'Unexpected error: Incorrect value: Location URL' in WSDL

    Hi All,
    Using SOAMANAGER  transaction, I created a service ECC_CUSTOMERQUOTEERPCRTRC and its binding 'ECC_CUSTOMERQUOTEERPCRTRC_binding' using the Create Service option under the tab Configurations and using the web service definition 'ECC_CUSTOMERQUOTEERPCRTRC'.  When I click on the link "Open WSDL document for selected binding" under the tab 'Overview', I get the following XML code in the popup window for the WSDL.
    - <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    - <soap:Body>
    - <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>Unexpected error: Incorrect value: Location URL for subject IF {http</faultstring>
    - <detail xmlns:slibfault="http://xml.sap.com/2005/11/esi/slib/fault/">
      <slibfault:timestamp>Wed, 17 Nov 2010 22:29:02 GMT</slibfault:timestamp>
    - <slibfault:exception>
      <slibfault:text>Incorrect value: Location URL for subject IF {http://sap.com/xi/APPL/Global2}:CustomerQuoteERPCreateRequestConfirmation_In not found</slibfault:text>
      <slibfault:position program="CL_SIDL_SUBJECT_ADAPTER=======CP" include="CL_SIDL_SUBJECT_ADAPTER=======CM006" line="47" />
      </slibfault:exception>
      </detail>
      </soap:Fault>
      </soap:Body>
      </soap:Envelope>
    The XML code for nthe WSDL displays an error 'Unexpected error: Incorrect value: Location URL for subject IF '. It looks like the code could find the required URL. Please let me know how to fix this error.
    Thanks in advance.
    --R D

    Hello.
    In SOAMANAGER delete your "unexpected" service (endpoint).
    Then create it again.
    If same error will occurs - try to delete all definitions of this service (include sicf-transaction) and then create it completely again.
    Hope it helps.

  • Java returning incorrect values for width and height of a Tiff image

    I have some TIFF images (sorry, I cannot post them b/c of there confidential nature) that are returning the incorrect values for the width and height. I am using Image.getWidth(null) and have tried the relevant methods from BufferedImage. When I open the same files in external viewers (Irfanview, MS Office Document Imaging) they look fine and report the "correct" dimensions. When I re-save the files, my code works fine. Obviously, there is something wrong with the files, but why would the Java code fail and not the external viewers? Is there some way I can detect file problems?
    Here is the code, the relevant section is in the print() routine.
    * ImagePrinter.java
    * Created on Feb 27, 2008
    * Created by tso1207
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.print.PageFormat;
    import java.awt.print.PrinterException;
    import java.io.File;
    import java.io.IOException;
    import java.util.Iterator;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageReader;
    import javax.imageio.stream.FileImageInputStream;
    import javax.imageio.stream.ImageInputStream;
    import com.shelter.io.FileTypeIdentifier;
    public class ImagePrinter extends FilePrintable
       private final ImageReader _reader;
       private final int _pageCount;
       private final boolean _isTiff;
       //for speed we will hold current page info in memory
       private Image _image = null;
       private int _imgWidth = 0;
       private int _imgHeight = 0;
       private int _currentPage = -1;
       public ImagePrinter(File imageFile) throws IOException
          super(imageFile);
          ImageInputStream fis = new FileImageInputStream(getFile());
          Iterator readerIter = ImageIO.getImageReaders(fis);
          ImageReader reader = null;
          while (readerIter.hasNext())
             reader = (ImageReader) readerIter.next();
          reader.setInput(fis);
          _reader = reader;
          int pageCount = 1;
          String mimeType = FileTypeIdentifier.getMimeType(imageFile, true);
          if (mimeType.equalsIgnoreCase("image/tiff"))
             _isTiff = true;
             pageCount = reader.getNumImages(true);
          else
             _isTiff = false;
          _pageCount = pageCount;
       public int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          throws java.awt.print.PrinterException
          int drawX = 0, drawY = 0;
          double scaleRatio = 1;
          if (getCurrentPage() != (pageIndex - getPageOffset()))
             try
                setCurrentPage(pageIndex - getPageOffset());
                setImage(_reader.read(getCurrentPage()));
                setImgWidth(getImage().getWidth(null));
                setImgHeight(getImage().getHeight(null));
             catch (IndexOutOfBoundsException e)
                return NO_SUCH_PAGE;
             catch (IOException e)
                throw new PrinterException(e.getLocalizedMessage());
             if (!_isTiff && getImgWidth() > getImgHeight())
                pf.setOrientation(PageFormat.LANDSCAPE);
             else
                pf.setOrientation(PageFormat.PORTRAIT);
          Graphics2D g2 = (Graphics2D) g;
          g2.translate(pf.getImageableX(), pf.getImageableY());
          g2.setClip(0, 0, (int) pf.getImageableWidth(), (int) pf.getImageableHeight());
          scaleRatio =
             (double) ((getImgWidth() > getImgHeight())
                ? (pf.getImageableWidth() / getImgWidth())
                : (pf.getImageableHeight() / getImgHeight()));
          //check the scale ratio to make sure that we will not write something off the page
          if ((getImgWidth() * scaleRatio) > pf.getImageableWidth())
             scaleRatio = (pf.getImageableWidth() / getImgWidth());
          else if ((getImgHeight() * scaleRatio) > pf.getImageableHeight())
             scaleRatio = (pf.getImageableHeight() / getImgHeight());
          int drawWidth = getImgWidth();
          int drawHeight = getImgHeight();
          //center image
          if (scaleRatio < 1)
             drawX = (int) ((pf.getImageableWidth() - (getImgWidth() * scaleRatio)) / 2);
             drawY = (int) ((pf.getImageableHeight() - (getImgHeight() * scaleRatio)) / 2);
             drawWidth = (int) (getImgWidth() * scaleRatio);
             drawHeight = (int) (getImgHeight() * scaleRatio);
          else
             drawX = (int) (pf.getImageableWidth() - getImgWidth()) / 2;
             drawY = (int) (pf.getImageableHeight() - getImgHeight()) / 2;
          g2.drawImage(getImage(), drawX, drawY, drawWidth, drawHeight, null);
          g2.dispose();
          return PAGE_EXISTS;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since version XXX
        * @return
       public int getPageCount()
          return _pageCount;
       public void destroy()
          setImage(null);
          try
             _reader.reset();
             _reader.dispose();
          catch (Exception e)
          System.gc();
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public Image getImage()
          return _image;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getImgHeight()
          return _imgHeight;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getImgWidth()
          return _imgWidth;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param image
       public void setImage(Image image)
          _image = image;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setImgHeight(int i)
          _imgHeight = i;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setImgWidth(int i)
          _imgWidth = i;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getCurrentPage()
          return _currentPage;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setCurrentPage(int i)
          _currentPage = i;
    }Edited by: jloyd01 on Jul 3, 2008 8:26 AM

    Figured it out. The files have a different vertical and horizontal resolutions. In this case the horizontal resolution is 200 DPI and the vertical is 100 DPI. The imgage width and height values are based on those resolution values. I wrote a section of code to take care of the problem (at least for TIFF 6.0)
       private void setPageSize(int pageNum) throws IOException
          IIOMetadata imageMetadata = _reader.getImageMetadata(pageNum);
          //Get the IFD (Image File Directory) which is the root of all the tags
          //for this image. From here we can get all the tags in the image.
          TIFFDirectory ifd = TIFFDirectory.createFromMetadata(imageMetadata);
          double xPixles = ifd.getTIFFField(256).getAsDouble(0);
          double yPixles = ifd.getTIFFField(257).getAsDouble(0);
          double xRes = ifd.getTIFFField(282).getAsDouble(0);
          double yres = ifd.getTIFFField(283).getAsDouble(0);
          int resUnits = ifd.getTIFFField(296).getAsInt(0);
          double imageWidth = xPixles / xRes;
          double imageHeight = yPixles / yres;
          //if units are in CM convert ot inches
          if (resUnits == 3)
             imageWidth = imageWidth * 0.3937;
             imageHeight = imageHeight * 0.3937;
          //convert to pixles in 72 DPI
          imageWidth = imageWidth * 72;
          imageHeight = imageHeight * 72;
          setImgWidth((int) Math.round(imageWidth));
          setImgHeight((int) Math.round(imageHeight));
          setImgAspectRatio(imageWidth / imageHeight);
       }

  • Error "XML tag Main/@versionMinor has incorrect value 001; expected value."

    I'm going to describe our scenario.
    We have created an Abap proxy in a BW system to run a XI interface. The abap proxy in BW is connected to the IE of a XI 3.0 system. That scenario runs without problems with BW 3.5 (basis 6.40). Now, we are migrating the release of BW to 7.30. we have created the Abap proxy in the migrated BW system but when we run the interface the next message is returned:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Call Integration Server
      -->
    - <SAP:Error SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <SAP:Category>XIProtocol</SAP:Category>
      <SAP:Code area="PARSER">UNEXPECTED_VALUE</SAP:Code>
      <SAP:P1>Main/@versionMinor</SAP:P1>
      <SAP:P2>001</SAP:P2>
      <SAP:P3>000</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:Stack>XML tag Main/@versionMinor has the incorrect value 001. Value 000 expected</SAP:Stack>
      <SAP:Retry>N</SAP:Retry>
      </SAP:Error>
    does anyone know what the problem is? is there a version conflict between BW 7.3 and XI 3.0?
    Thanks very much

    Hi,
    I'm not an expert, but it might be that you would also need to update the XI content to match the new release and then regenerate the proxy.
    It does indeed seem to be a difference in the version of the proxies between BW 3.5 and BW 7.3.
    Regards,
    Horia

  • XML tag Main/@versionMajor has incorrect value 002; expected value is 003

    Dear experts!
    I have created a file to proxy scenario. When sent out of XI the following message occurs:
    O, btw, I have tried both XI 2.0 and 3.0 in the comm. channel and a fault message is present.
    What's the matter???
    - <!--  Call Adapter
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIProtocol</SAP:Category>
      <SAP:Code area="PARSER">UNEXPECTED_VALUE</SAP:Code>
      <SAP:P1>Main/@versionMajor</SAP:P1>
      <SAP:P2>002</SAP:P2>
      <SAP:P3>003</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>XML tag Main/@versionMajor has incorrect value 002; expected value is 003</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Thanks for your suggestions!
    <i>Will reward points if answers are helpful</i>

    Hi.
    Can you copy past your xml input payload...
    Check out this thread...he has same issue...n its resolved..
    XI 3.0 and external Java client/web service
    Use the url:
    http://hostname:port/XISOAPAdapter/MessageServlet?version=3.0&channel=:SOAPRequest:SOAPIn
    Nilesh
    Message was edited by:
            Nilesh Kshirsagar

  • Key Figures With Hide can be shown showing wrong values when displayed in a query

    Hi Experts,
    I have a qiery with two structures in the column(cell Definition) three key figures are displayed and the rest are all hide can be displayed. However whenever i display one of the hidden key figures along with one displayed key figures it initially shoes incorrect values. Once i add another key figure (which has status always show) the hidden jey figure value gets corrected. Is it a problem with the structure? Kindly assist.For example  when i display the actuals(always show) and actuals rate(hide can be shown) the values for actuals rate are wrong , however when i add the plan rate(always ahow) the values for actual rate gets corrected. Screenshots for structures below.

    Hi Sayanto,
    For this I would recommend you to check the Key figure definition in all 3 situations.
    1. original display
    2. display of hidden KF
    3. Display of existing KF
    I suspect that cell references may have some effect on the calculation as you are adding the hidden KF in analyzer directly. You can prove this only by checking  Key figure definition.
    Please let me know if you are facing any issue in getting the Key figure definition itself.
    Also, as Cornelia suggested check if you have any constant selection applied to any of your KFs.
    Hope this helps.
    -Swati.

  • Black & White Adjustment that retains same Greyscale values (when in Color)

    Hi all,
    I noticed that when I apply a simple Black&White Adjustment layer to my colored layers, the 'Greyscale values' either via LAB sliders /HSb brightness changes drastically.:
    http://i57.tinypic.com/16ifm8n.png
    eg the L slider for the turquoisy color jumps so much
    I've tried the Hue/Saturation & Black&White adjustment layers with default settings. Can someone tell me a quick B&W workaround conversion that adheres as close as possible to sliders values when the adjustment layer is off?  I used it for digital coloring to check my composition 'values' regularly, so complex grayscale conversions would be less preferable. Also, I do not need it to be perfect to human vision, just hopefully adhere roughly to the 'L' or 'B' slider values when the B&W adjustment is turned on/off
    thanks alot!

    I believe the tone shift to which you are referring is caused by the B&W adjustment layer as demonstrated here. This is the basic file (Adobe RGB):
    Add a duplicate layer and change its Blending Mode to Luminosity. The colors will not change. Then add a Black & White Adjustment Layer and it will modify the resultant color like this:
    For a clearer comparison, the image below shows the beginning image with the altered luminosity of the B&W Adjustment layer in the center circle
    (Notice Clipping Mask)
    So, the default setting of the sliders that appear in the B&W drop-down menu must be adjusted so that, at the start, this Adjustment layer of the Luminosity does not alter the color. To do that, I had to change the settings to:
    Reds     33
    Yellows 90
    Greens     60
    Cyans     72
    Blues     14
    Magentas 46
    You may save these settings as a Preset. so that they do not require resetting each time. The practical application of this is that it allows you to lighten and darken specific colors in a scene without resorting to selections. I have found this to be most useful in landscape images. (I overdid the changes in the sample below for demonstration purposes only.)

  • Incorrect value: Namespace prefix q1 of QName q1:RequestArray is undeclared

    Can someone please help me understand this error message?
    Incorrect value: Namespace prefix q1 of QName q1:RequestArray is undeclared
    Exception of class CX_SLIB
    I get this error when generating the Proxy Class.
    The URL of the Web Service WSDL is:
    https://addresscheck.melissadata.net/v2/SOAP/Service.svc?wsdl
    I found an OSS note which looked promising, but even after implementing the note I still get the error.
    OSS Note # 0001229799  -  "Workaround for kernel bug with xml namespace context"
    Thank you very much !
    -Chris

    Hope you would get everything from this link
    http://www.saphelp.com/ERP/archive/index.php?f-118.html
    regards
    nag

  • Incorrect value with Script Logic

    Hello,
    From initial value called 2008.ORC we want to calculate for each month the percentage , from child DIASMES.
    Now, with the script logic ( I´ll put down later) we have an incorrect value in the column 2008.TOTAL.
    In other words, I´m sure I´m wrong with "WHAT" or "WHERE sentence or maybe the operation "FACTOR=USING/TOTAL" fails because the crossing between dimensions it´s incorrect.
    *RUNALLOCATION
    *FACTOR = USING/TOTAL
    *DIM FABRICA_MAQ WHAT=BAS(FABRICAFF); WHERE=BAS(FABRICAFF); USING=BAS(FABRICAFF);
    *DIM PRODUTOS WHAT=BAS(TOTALPROD); WHERE=BAS(TOTALPROD); USING=SP;
    *DIM TIME WHAT=2008.ORC;WHERE=BAS(2008.TOTAL); USING=BAS(2008.TOTAL);
    *DIM TIPO WHAT=BAS(TOT); WHERE=BAS(TOT); USING=ST;
    *DIM VARIAVEIS WHAT=MIXACABADA; WHERE=MIXACABADA; USING=DIASMES;
    *DIM DATASRC WHAT=INPUT; WHERE=INPUT; USING=INPUT;
    *DIM VERSAO WHAT=BUDGET; WHERE=BUDGET; USING=BUDGET;
    *ENDALLOCATION
    *COMMIT
    The Key is to see in the column 2008.TOTAL ( when we selected  "BAS") the value of parent divided into "DIASMES" !
    Thanks !! 

    Your factor statment references a TOTAL, but you don't reference the total in your DIM statements. If you look at the debug log carefully, you should notice that there's no calculation of a TOTAL value.
    Try something like this. The only reason I move some dimensions from the *RUNALLOCATION up to the *XDIM's is for legibility, since the allocation makes no shifts to these dimensions. The logic should produce the same results, either way.
    // These dimensions have no shift of data.
    *XDIM_MEMBER VERSAO=BUDGET
    *XDIM_MEMBER DATASRC=INPUT
    // I'm assuming here that FACRICAFF is the top member of this dimension.
    *XDIM_MEMBERSET FABRICA_MAQ = <ALL>
    *RUNALLOCATION
    *FACTOR = USING/TOTAL
    *DIM PRODUTOS WHAT=BAS(TOTALPROD); WHERE=BAS(TOTALPROD); USING=SP; TOTAL=<<<
    *DIM TIME WHAT=2008.ORC;WHERE=BAS(2008.TOTAL); USING=BAS(2008.TOTAL); TOTAL=<<<
    *DIM TIPO WHAT=BAS(TOT); WHERE=BAS(TOT); USING=ST; TOTAL=<<<
    *DIM VARIAVEIS WHAT=MIXACABADA; WHERE=MIXACABADA; USING=DIASMES;  TOTAL=<<<
    *ENDALLOCATION
    *COMMIT

Maybe you are looking for

  • Having issues with Importing packages

    Hi Can someone help me with the behaviour i am noticing with jdk1.3.1 Say i have a directory by name test in c:\ so i have c:\test say i have Add.java Test.java files in it. The contents of these files are as follows /** Add.java file */ package mypa

  • Screen sharing not exactly the same as the host computer's screen

    Hi all I am using a mac mini as a media server connected via HDMI to my big TV downstairs.  I am using screen sharing from my macbook air to do little tasks while not downstairs.  This has been a very good setup. One thing I wanted to do is maintain

  • Cant Find Edge Settings On My Iphone

    Please help i can only access the internet through wifi edge isnt working so i decided to configure the settings only to find out i cant find edge on my phone. I have an E on my phones homepage. My phone is a factory unlocked 32gb 3.1.3

  • Generating a digital waveform sequence

    I am trying to generate two 8-bit digital sequences and send them as an output command over two channels simultaneously. Sequence length of 80 microsecs. 1 Bit length of 10 microsecs. The first sequence is high on all the 8-bits its role is to trigge

  • Multiple birthdays in Address Book on one card

    Hi. I am trying to figure out how to list multiple birthdays for an entire family on one card in AddressBook. For example... My sister has 3 children. I have her name in AddressBook that synchs with I-Cal. I have her birthday listed but I want to fin