Stuck up with Formatted Search. Help needed!

Hello All,
As a part of customization, I wrote a FMS on the Unit Price of the Sales Order field but I am getting data type conversion error. Since the client is of Chemical Industry, their calculations work in the reverse way and I had to write this FMS on the Unit Price.
Here is the FMS  i have written:
Declare @Total numeric (19,6)
Declare @Unit numeric (19,6)
Declare @Price numeric (19,6)
Set @Total = (Select Case when $[$38.21.0] = 0 then 1 else $[$38.21.0] end)
Set @Unit = (Select Case when $[$38.11.0] = 0 then 1 else $[$38.11.0] end)
Set @Price = (@Total/@Unit)
Select @Price
Since The LineTotal and Quantity fields are defined as numeric(19,6), I defined the vriables also as Numeric(19,6).
a) When I try to run the FMS, I am getting an error "Conversion failed when converting nvarchar value to int".
b) When I replace .0 with .NUMBER, the FMS is calculating wrongly. Why?
Where is the problem with the FMS?
Edited by: Bharath Kumar on Nov 26, 2010 10:05 AM

Hi Bharath...........
Declare @Total Float
Declare @Unit Float
Declare @Price Float
Declare @var1 as Float
Declare @var2 as Float
Declare @var3 as Float
Declare @var4 as Float
Set @Total=$[$38.21.0]
Set @Unit=$[$38.11.0]
Set @var1=cast( substring(replace(@Total,',',''),0,len(replace(@Total,',',''))-1) as float)
Set @var2=cast( substring(replace(@Unit,',',''),0,len(replace(@Unit,',',''))-1) as float)
Set @var3=(Select Case when @var1 = 0 then 1 else @var1 end)
Set @var4=(Select Case when @var2 = 0 then 1 else @var2 end)
Set @Price = (@var3/@var4)
Select @Price
Try above........
Regards,
Rahul

Similar Messages

  • Problem with ALV search help Dictionary Search Help

    Hello experts
    I have a problem with ALV search help.
    I use DDIC table ZXXX with text table ZXXX_T. I created DDIC search help form table ZXXX. In my WD application, in context on COMPONENTCONTROLLER i set on attribute: 'Input help mode' as 'Dictionary Search Help' and in 'Dictionary Search Help' I pass name of new created DDIC search help.
    I create a input field from that atrribute and search help works fine (there was a value and description for value from text table). So I created ALV witch contains that attribute too.
    Next I set column for this attribute in ALV as editable but on Serch help for this collumn I have only value. I DON'T HAVE TEXT DESCRIPTION FOR VALUE.
    Please help me and tell me what I do wrong?
    Miko

    Hello,
    Thank's for your help. I create DDic Search help for all fields from my ALV. Next I changed 'TYPE' for all ALV fields in COMPONENTCONTROLLER from ZXXX-Zfield to Zfield, and I changed 'Input help mode' from 'Automatic' to 'Dictionary Search Help'. Now I see Value and Description for value in Search Help in my ALV.
    Regards
    Miko

  • Problems with collective search help

    Hello SDNers,
    I was working with collective search help.
    Ex : zc_srch1 (Collective)
    In the 'Include search help' i have included 2 search elementary search
    help
    Ex : zsrc1 and zsrc2 (both elementary)
    I have also assigned the parameter assignment for each included search help.
    I have also mentioned the search help parameter under definition tab
    Ex field form zsrch1 and field1 from zsrch2
    and also checked the import and export checkboxes.
    Now i have used the search help in the abap program
    ex: tmp type field1 matchcode object zc_srch1.
    Now when i execute the program the collective search help is getting populated.  when i try to choose a value it is not getting selected to the parameter box.
    Regards,
    Ranjith N

    Hi,
    Once again check back your seach help creation by following the link below.
    http://help.sap.com/saphelp_erp2005/helpdata/en/cf/21ee86446011d189700000e8322d00/content.htm
    Cheers!!
    VEnk@

  • How can i get totals in columns with formated searches

    How can i do this with SDK if it isn´t posible since formated searches

    This is not possible with formated searches.
    With SDK, depends on if it is Matrix or Grid, on if it is a system form/your own form. But basically, loop throw the form or datasource, and do the sumatory.
    Regards,
    Ibai Peñ

  • Help with Formatted search involving a UDF

    I have a Formatted search which runns the following code:
    exec xsp_nssItemLookup $[$38.256.0]
    This search is on a udf of the Purchase order screen.  (256 is the item details field in the details.
    The above query runs fine.  What I really want to do is to pass the contents of another UDF to the stored procedure.  The USF is called U_NSSItemID.  If I change my stored procedure to read:
    exec xsp_nssItemLookup $[$38.U_NSSItemID.0] however it does not work.  I get blank results every time. 
    I have also tried exec xsp_nssItemLookup $[POR1.U_NSSItemID.0]  which doesn't work either. 
    I can't figure out what is wrong with my syntax.  I don't get any errors, just a blank value.
    Thanks
    don shields

    Suda,
    Thanks for answering so quickly.  To answer your question the data type is Alphanumber which I just figured out is the save as CHAR() in SQL.  My problem turned out to be that I needed to trim the spaces from my parameter.  I was getting values like "cover                         ", and I needted to get "cover".  Problem solved now.
    Don

  • Help needed with search help with ina search help

    Hi all,
    i have a field fld1 (non primary key )and to the dataelement of that field a search help is assigned in table ztable1.
    That search help is referring to a table in which fld1 is primary key in ztable2.
    I have created another search help with all the fileds in ztable1 and iam using this search help in a selection screen returning another field say fld2.
    in this search help i have drill down for fld2, which in turn gives the fields of ztable2.
    This is working fine.
    i have created another search help with the fields of ztable1 but this time its its returning the value of fld1. for some reason in this search i am not able to see the drill downn for fld1 .
    can anyone tell me how to get the drill down even the import parameteris fld1
    Thanks

    hi,
    any suggestions on this
    thanks

  • Problem With Formatted Search.

    Hi to all,
    I have linked a formatted search to a UDF that lies at row level in AP Invoice. This field is used to display the Sales  Order Price. The requirement is that from SO we create a purchase order and subsequently create a goods receipt and AP invoice.. Now in invoice it is showin perfectly fine whether it is copied from goods receipt or purchase order.. But in the purchase order and goods receipt screen this query will not work. And the same query used in AP invoice is being linked to these documents. Is there any work around for this?? Is it possible to run queries based on the form numbers?? If so ho do i pull the form number in the formatted search query??
    Please Help!!!!
    Regards
    Aris

    I recommend creating separate queries for each document.
    ie
    1 formatted search to lookup price on sales order from AP Invoice
    1 formatted search to lookup price on sales order from GRPO
    1 formatted search to lookup price on sales order from PO
    then change the lookup to pull fields from the document that you are using as a reference.
    when you are building the formatted searhes start by returning the values that are you are using as a reference. That way you are sure that you are pulling the correct information.
    Then layer in the lookup to the sales order.
    If you get stuck I recommend that you copy and paste the formatted search in SQL Server management studio and replace the variables refereces with real values.
    In my experience troubleshooting queries is more effective when using SQL Server management studio. (the error reporting is better).

  • Search help needs more records than 500 or 5000

    I have a requirement to create search help on a non primary key field . So I need to work on search help exit to remove all the repeating and blank values . The problem I am facing rite now is that search help gets only 500 records by default and 5000 if we leave the restriction field blank . I need to get all the records which is approx more than 100000 and get only the unique values .
    Please let me know how I can increase the number of record more than 5000
    Regards,
    Tashi

    Hi Tashi,
    The following approach might work out in y our case by overwriting the data fetch functionality of the standard Search help
    1. Define internal table of desired structure, in the way you get the data from DB table
    2. use your custom function module / class method or select statement to get the desired data into the newly
        defined   internal table
    3. apply required sorting / filtering / formatting as per the requirements
    3. loop through the resultant data in the internal table and append the records to standard internal
        table / parameter  RECORD_TAB of the Search help exit. Please make a note that RECORD_TAB has the
        structure field STRING which needs to be populated with the correct offsetting..for example, if the first field
         is of 10 characters and second field of 5 characters, it should be populated in the following way
    loop at itab into ls_itab.
    wa_record-string+0 = ls_itab-field1.
    wa_record-string+10 = ls_itab-field2.
    wa_record-string+15 = ls_itab-field3.
    append wa_record to record_tab.
    clear wa_record.
    endloop.
    EXIT.
    Please try this approach and let us know.
    hope this helps.
    -Sajan Joseph.

  • Formatted Search Help

    Hi,
    Kinda new to this formatted search. Can anyone help me with this question.
    I want to make a formatted search to make a column in sales order 'U_ItemType' so that if it is not null/if it is gift or sample, it will enter the value 'Y' in U_FOC. How do i do this?
    Also can anyone point me to any resource to learn up on formatted search.
    Thanks

    You will need to create a query something like:-
    [code]SELECT CASE $[$38.U_ItemType.0] WHEN 'Gift' THEN 'Y' ELSE 'N' END[/code]
    This will need to compare the value of the U_ItemType in the current row to any conditions you want (eg. = 'Gift'), and return appropriate Y/N value.
    Next you need to define the FS on the U_FOC field.  When defining it you probably want to set:-
    -Search By Saved Query (select query created above)
    -Auto Refresh = "Y"
    -When existing column altered
    -Column = "U_ItemType"
    -Display Saved Values
    You can find out more about formatted searches in some of the online training courses available on the service marketplace (http://service.sap.com/smb).  The training courses are available in the Education section under the heading "Learning Maps / Development Consultants".
    Regards,
    John.

  • Trouble with new G570 - help needed

    Dear All,
    I am a new, rather unhappy, customer of Lenovo UK as of this week, via a dealer called www.saveonlaptops.co.uk .
    I'm terribly disappointed to have had such a bad experience...
    I purchased a Lenovo G570 (product code M5143UK)  from the above vendor on their website using my credit card on 17th July 2011...
    I eagerly awaited delivery on 19th July 2011.
    Unfortunately, upon setting up the laptop and switching it on, it became quite clear that there are hardware issues with the laptop.
    It took me 3 hours to get the laptop working, after it repeatedly attempted to install/configure software and OS updates and repeatedly failed midway through often shutting down of its own accord too early to allow update to complete.
    3 hours after, I had got it working, but immediately noticed how SLOW the laptop is...The 3 year old Dell laptop I sold last week ran much much faster than this Lenovo ever has.
    The boot time averages over 2 minutes just to get to login screen, and applications are unacceptably slow loading/running.
    I had spoken with Lenovo UK support whom suggested that it should run no slower with a retail version of Windows 7 64-bit OS on it, which at the consent of them, I duly installed.  Unfortunately, a further 4 hours of waiting for repeatedly failing OS updates to install took place, before this version of Windows 7 (clean install) ran even worse than the original OS image. 
    Lenovo UK support have said that I need to return the laptop to the vendor to be assessed, but the vendor is currently refusing to accept any come back as such, and saying that due to the clean install carried out (at the consent of your support guys remember) that they will not return and swap for a brand new like-for-like laptop.
     I have been assured previously by Lenovo that clearing a partition off of the HDD and applying a fresh install will not invalidate warranty...!!!!!!!!!
    I have never received such poor service from a hardware vendor or a how manufacturer, especially seeing as I had fully researched the brand/model I was to purchase for weeks prior to final purchase.
    I am writing to your goodself in the hope that you can arrange for a brand new laptop of the same spec to be sent to me, and arrange for the courier to collect the faulty one at the same time to stop me being without a laptop.
    The vendor has been rude, unhelpful, dishonoring towards me and Lenovo and I wish I had not approached them to purchase this laptop.  The price though was £80 odd cheaper than with Lenovo direct.
    All I want is a non faulty laptop to last me 5 years before i change for a new Lenovo (if the service is good!) model.
    You will find a copy odf my order attached.
    I look forward to hearing from you soon.
    Kindest regards
    Invoice Date:
    18/07/2011
    Customer Name:
    Order Number:
    Invoice Address:
    Delivery Address:
    Stock Code
    Description
    Price
    Qty
    Sub Total
    M5143UK
    Lenovo G570, Intel® Core™ i5-2410M Dual Core Processor, 15.6" HD Screen, Windows 7 Home Premium Edition 64-bit, 6GB DDR3 RAM, 750GB HDD, Blu-Ray, Dedicated Graphics, M5143UK
    £563.78
    1
    £563.78
    DEL-000011
    £9.98 - Next Day (UK MAINLAND Mon-Fri) PARCEL NEXTDAY
    £9.98
    1
    £9.98
    Surcharge:1.50% Card Surcharge>>
    £8.62
    1
    £8.62
    Price (Exc):
    £485.32
    Price (Inc):
    £582.38

    welcome to the forum,
    It's regrettable to read about your experiences to date, obviously not an invigourating experience, reads very much like a pillar to post scenario
    Firstly; a clean windows install does not invalidate the warranty regardless of what the reseller says. The warranty covers the hardware, unless explicity stated and purchased there is no warranty on software whatsoever.
    IMHO your first point of contact should have been the retailer to ask if they were in a position to offer a possible solution. Should they then have at some point instructed you to contact Lenovo support you would be in a stronger position to argue that they should resolve the issue. Whatever, you did the right thing by contacting support. Did support issue you with a call number which you noted down and could share? Against the call number there will be notes logged by the service rep. and you could ask the retailer to call and validate the instructions you were given by support.
    As this is a peer to peer forum, provided by Lenovo in order that members may seek assistance from others and share their experiences, there is a Lenovo presence which deals with some of the broader issues, it's not always possible for them to assist on all individual issues. Members will certainly be glad to and be able to assist you diagnose any possible hardware fault with the system which would then hopefully provide you with the facts you need to hopefully reach a speedy resolution.
    You're probably pretty miffed at the moment and don't want to read the following, but it's meant well.
    As a first step I'd like to suggest downloading the mediacreator from this site and use the media you create to test the system's hard drive, please let us know the results.
    Best Regards
    edit; typo
    Andy  ______________________________________
    Please remember to come back and mark the post that you feel solved your question as the solution, it earns the member + points
    Did you find a post helpfull? You can thank the member by clicking on the star to the left awarding them Kudos Please add your type, model number and OS to your signature, it helps to help you. Forum Search Option T430 2347-G7U W8 x64, Yoga 10 HD+, Tablet 1838-2BG, T61p 6460-67G W7 x64, T43p 2668-G2G XP, T23 2647-9LG XP, plus a few more. FYI Unsolicited Personal Messages will be ignored.
      Deutsche Community     Comunidad en Español    English Community Русскоязычное Сообщество
    PepperonI blog 

  • Creating select option with the search help based on other select option

    Hi,
    I have displayed a selection screen with two select options S1 and S2.
    My requirement is that the values in the search help of S2 should get filled based on the values selected in S1.
    Note: User has option to select multiple values in S1.
    Does anybody know how to implement this?
    Thanks,
    Feroz

    >
    Sanjeeva wrote:
    > Hi,
    >
    > With standard f4 you cannot acheive this. You need to write customise with OVS or Simple value selector by reading S1 selected values.
    >
    > Thanks,
    > Sanjeev
    I'm getting fairly tired of seeing this completely incorrect information on this forum.  As stated before and already found out by this poster, you can map input and output values between multiple data dictionary search helps. You do NOT have to resort to using OVS for this option.

  • Search help - Need to read dynpro of the calling program

    Hello all,
    We have a requirement where we need to read the dynpro of the calling program of a search help.
    Say I have a screen (selection screen, module pool or ALV grid etc) where I have a field PARTNER with whom a custom search help is attached. But on this same screen there is another field RLTYP. What we want is that when an F4 is taken on PARTNER, the value of RLTYP should also be passed as value to the Search help exit.
    In short, we need to read the screen fields of the calling screen of a search help.
    Any ideas are appreciated.
    Regards
    Priyanka

    Check the sample code:
    FUNCTION F4IF_SHLP_EXIT_OFFRCONT.
    ""Local interface:
    *"  TABLES
    *"      SHLP_TAB TYPE  SHLP_DESCT
    *"      RECORD_TAB STRUCTURE  SEAHLPRES
    *"  CHANGING
    *"     VALUE(SHLP) TYPE  SHLP_DESCR
    *"     VALUE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL
      DATA : ws_flag(1) TYPE c,
             ws_rec(1)  TYPE c.
      DATA : i_dynpfields TYPE dynpread OCCURS 0 WITH HEADER LINE.
      DATA : ws_data TYPE ddshiface,
             i_data TYPE ddshifaces.
      ws_flag = 'X'.
      ws_rec = 'X'.
      IF ws_flag = 'X'.
        i_dynpfields-fieldname = 'P_CUST'.
        APPEND i_dynpfields.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            dyname               = sy-cprog
            dynumb               = '1000'
          TABLES
            dynpfields           = i_dynpfields
          EXCEPTIONS
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            invalid_parameter    = 7
            undefind_error       = 8
            double_conversion    = 9
            stepl_not_found      = 10
            OTHERS               = 11.
        READ TABLE i_dynpfields WITH KEY fieldname = 'P_CUST'.
        ws_data-shlpfield = 'ZCUSTOMER'.
        ws_data-valfield = 'G_SIMFIELDS-FIELDNAME'.
        ws_data-value = i_dynpfields-fieldvalue.
        APPEND ws_data TO i_data.
        ws_data-shlpfield = 'ZOFFRCONT'.
        ws_data-valfield = 'P_CONT'.
        ws_data-f4field =     'X'.
        APPEND ws_data TO i_data.
        LOOP AT shlp_tab.
          IF ws_rec = 'X'.
            shlp_tab-interface[] = i_data[].
            APPEND shlp_tab.
            ws_rec = ' '.
          ENDIF.
        ENDLOOP.
        DELETE shlp_tab INDEX 1.
        ws_flag = ' '.
      ENDIF.
    ENDFUNCTION.
    Regards,
    Prakash.

  • Read item code from Sales Order with formatted search

    hi,
    i'm tring to read tha values of the item or items of a sales order (before save it) with a formatted search.
    i have no problem to read the value of card code or cardname but i can't read the item's value.
    i tried with this [code]Select $[RDR1.ItemCode][/code]  (i found it on the forum) but it doesn't work.
    somebody can help me ?
    thank you

    Hi, Alessandro!
    I think the trouble is that you are trying to assign a FS to the header of the document. You are getting the information of the current row, so you have to bind a formatted search to some column of the "table - part" of the document.
    And also you can try:
    SELECT $[$38.1]
    38 - the value of "Item" (when you point a mouse to the cell, information you want from)
    1 - the value of "Column" (the same...)
    It will get an info of this cell in a current row.
    HTH!

  • Problem with formatted search in grid

    Hi all,
              I have a Grid with 3 columns in my user defind form. In that Grid,I used one one formatted search on column 2 based on the value of column 1.
               I mean when i was press 'SHFT+F2' on second column, it will execute the query based on value of  what we entered in the first column of the grid. How can i do this?? How can i fetch the value of first column in the formatted search??. Please help me.
    Thanx in Advance
      Oram.

    Hi
    write a query like this and assign formatted search on column2
    SELECT  ITEMNAME FROM OITM T0 WHERE T0.ITEMCODE = $[/$GRIDUID.COL1 UID.ROWNUM])
    regards
    Vishnu

  • Formatted Search Help required

    Dear All,
    I have a specific requirement by which I need to track out the Estimated Cost which is put in the Sales Order Row with a Udf vs the PO Cost been involved for a particular project in terms of Purchase Orders been raised in the system for that particular Sales Order No. Basically we want to know that if the Sales Order Estimated Cost is 100 then the PO should not be allowed to make for more than 100.
    In the Sales Order row I have an Udf called Estimated Cost U_ ESTCOST and users fill in every line item the Estimated Cost for that particular Sales Order.
    Now I have made the following Udf in Purchase Order Header as under :
    Sales Order Estimated Cost  as U_ORDESTCOST
    PO Cost U_ POESTCOST
    Now in the Sales Order Estimated Cost udf which is there in the PO header I want the sum up of the row which is been put in Sales Order Estimated Cost U_ ESTCOST for that particular BP project. Can formatted search be used wherein if while making the Purchase Order Sales Order Estimated Cost udf U_ORDESTCOST is updated when in the Purchase Order Accounting Tab BP Project Is put. The requirement is that if in the BP Project e.g 10001 is put then the formatted search should search the ORDR table which also has the same BP Project 10001 in the Accounting Tab selected and then from RDR1 its should sum up the Estimated Cost U_ ESTCOST.
    Now in PO Cost U_ POESTCOST field I want to have the total sum means Document Total of all the PO been made in the system till date for that Particular BP Project e.g 10001
    Kindly advise what best can be done so that we are properly able to control the system
    Regards,
    Venky

    Dear Gordon,
    Thanks for bearing with me.
    Let me just break the requirements.
    Now a New Sales Order is booked which is as under
    Sales Order Document Number - 10001
    Row Details as under :
    Items     Qty   Row Total  Estimated Cost (U_ ESTCOST)
    Item 1     1          100               20
    Item 2     1          200               30
    In Accounting Tab in BP Project its given 2000
    Hence the the sum of U_ ESTCOST is 50 for order number 10001 whose BP Project is 2000
    Now for the above Sales Order a Manual purchase Order is made in the system
    Purchase Order No 90000
    Row Detail as under :
    Items     Qty   Row Total 
    Item 1     1          100             
    Header has a udf named U_ORDESTCOST which means Sales Order Estimated Cost
    In Accounting Tab in BP Project its given 2000
    Now if you notice the common data which is there both in Sales Order and Purchase Order is the BP Project Number
    I want that whenever a Purchase Order is made in the U_ORDESTCOST field the Sum of Estimated Cost U_ ESTCOST should get filled automatically based on the BP Project which is been put in the Accounting Tab of Purchase Order.
    Means everytime 50 should be updated in U_ORDESTCOST because in the Sales Order where project code is 2000 theEstimated Cost (U_ ESTCOST) = 50.
    See if I want I can make a query but I am not able to use the same in the formatted Search. The query is as under :
    SELECT sum(T1.[U_ESTCOST]) FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.[Project] = [%0]
    The above query if attached is working fine in the Formated Search but due to [%0] its asking me to put the BP project which I want should automatically pick or refresh based on what is put in BP Project in Account Tab in Purchase Order. I think I need the BP Project $ some number....
    Regards,
    Venkat

Maybe you are looking for

  • CMS Layout in XI 3.0

    i've just installed the Xi 3.0 and i may need much of help about that, the first issue i faced, the layout of the CMS web appliaction. whenever i select universes,connections, users,,,,, etc i get everything in large fonts and i cant see anything. an

  • No Hyperlink in PDF after export from Crystal Reports 2008 SP2

    When I export a report from Crystal Reports 2008 Developer (as well as from the runtime) SP2 to PDF the Hyperlink to a file on hard disk is missing.

  • What does Videora do for me? What is this software good for?

    I am still having an issue with my export having no audio when i go to listen or watch it in my ipod? Someone please help????????????PLEASEEEEEEEEEEEEEEEEE My head continues to hurt because of this issue. Dee

  • Smartform print problem in vf03

    Hi friends,              This issue is very critical so kindly help me at ur earliest. 1>There are four invoices attached to my smartform. When i print preview my first invoice no. the o/p comes proper. But ,when i test next subsequent invoice and cl

  • [fixed on my side] Visited links in wiki grey instead of purple/violet

    At least for me they are and it makes damn hard to see the links. Links (wiki pages) not visited are blue as usual, non-existent pages are red. Is it a design decision? I don't recall changing any settings in the browser. Last edited by karol (2010-0