FMS Query for Calculation

Hi Experts,
I would like to write a FMS  query to allow for auto calculation based on the Inputs of 2 other fields before Adding the Sales Order.
For example. A query on Sales Order where I have Item ABCD  and Quantity 200.
I have a UDF named Abatement where the value is fixed 35%. And other is Assessable Value fixed with MRP Price say 350
And based on the result should be given in Assessable Value field.
Formula is  Assessable Value fixed  350 then Abatement  35 %  = 122.50 and then 350-122.50 =      227.50  should be displayed in the Assessable value field.
Kindly provide me the solution for the query.
Regards
Amol

Hi,
Try this:
SELECT  ((select $[RDR1.U_AssessableValue]) - ((select $[RDR1.U_Abatement]) * ((select $[RDR1.U_AssessableValue])/100)))
Please post screen shot sale order window with UDF filed and values.
Thanks & Regards,
Nagarajan

Similar Messages

  • FMS Query for Purchase Order

    Hi,
    I want to FMS Query for Purchase Order.
    I want to display the weight * price in one user define field.
    Please suggest me

    Hi Tushar.......
    Try this.......
    declare @var1_wt as varchar(255)
    declare @var2_Pr as varchar(255)
    declare @var3 as float
    declare @var4 as float
    set @var1_wt=$[$38.58.0]
    set @var2_Pr=$[$38.14.0]
    set @var3=cast( substring(replace(@var1_wt,',',''),0,len(replace(@var1_wt,',',''))-1) as float)
    set @var4=cast(substring(replace(@var2_Pr,',',''),0,len(replace(@var2_Pr,',',''))-3) as float)
    select @var3 * @var4
    Regards,
    Rahul

  • Query for calculating financialyear

    help me to write a query  which will check if the record createdon
    is within  the current financialyear  i.e. June 2014- July 2015
    RecordCreatedon
    logic
    2014-10-28
    yes
    2014- 12-15
    Yes
    2012- 01-19
    No
    Note  : query for calculating financialyear should be hardcoded .

    It looks like your sample data range is wrong "June 2014- July 2015"
    To get an idea, I consider June 2014 - May 2015 as financial year, try the below:
    create Table test_Table (RecordCreatedon date)
    Insert into test_table values('2014-10-28'),('2014- 12-15'),('2014- 06-01'),('2014- 05-30')
    ,('2015- 02-28'),('2015- 05-30'),('2015- 06-01')
    Select *,
    case when year(Dateadd(month,-5,RecordCreatedon) )=YEAR(getdate()) Then 'yes' else 'no' end Logic
    From test_Table
    Drop table test_Table

  • FMS Query for default Profit Center in SO

    Dear Experts,
    Can anybody help me by providing FMS query for getting default Profit  Center based on the default Warehouse in the user default settings.
    Regards
    Srini

    Hi Rahul,
    I created each Branch as a profit Centre and the filed name is OPRC.PrcCode . If the user at a particular branch logged in SAP by using his ID and when he is adding a SO the profit centres list should appear in Profit centre filed.
    And is there any provision to set the profit centre  (OPRC.Code) as default for the user at a branch by taking document no.series or location ID or User ID as consideration in the FMS query.
    Thanks
    Srinivas

  • FMS Query for Document Header UDF

    Hi,
    I have created an UDF in the header level of Marketing Document. I want to add FMS on it. UDF Value will be 4% of DocTotal Value and auto Refresh on DocTotal.
    What will be the query for Sales Order.

    I am saving this query
    Select ($[$29.0.number]) * 0.04
    and setting this query in the udf by.
    now when i am creating an order and pressing shift+f2 on it it's giving an error msg : internal error(3006) occured.
    Edited by: Sibasish Sengupta on Dec 8, 2008 1:11 PM

  • Query for calculating raw material requirements for the remaining quantities in sale order.

    Dear SAP Experts,
    Clients requirement :
                                         Client wish to know the quantities of raw materials needs to run the production order inorder to complete the remaining quantities in sale order.
    Need Clarification:
                                  I"m using the below query for this requirement. I wish to know whether this query suits for my clients requirement or not. If its so, I need to know how to group by T4.[Code] (Raw material Name)   and need to get the sum of    T4.[Quantity]  (BOM quantity)      and  (T1.[OpenQty]*T4.[Quantity]) as TOTALQTY under each raw material group
    SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode],T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity] as salesorderQty , T1.[OpenQty], T2.onhand, T4.[Code] as Raw material Name,T4.[Quantity] as BOMQTY,  (T1.[OpenQty]*T4.[Quantity]) as TOTALQTY FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] INNER JOIN OITT T3 ON T2.[ItemCode] = T3.[Code] INNER JOIN ITT1 T4 ON T3.[Code] = T4.[Father] WHERE  T0.[DocStatus] ='o' 

    You're posting in the Portuguese B1 space.
    You might want to post in the English one: SAP Business One Application

  • Query for calculation in ALV Total

    HI All,
    I am using Sub_tot = "X" & do_sum="X" to get the subtotals & Totals for different columns Using REUSE_ALV_LIST_DISPLAY.
    I am calculating percentage in column "C" depending on result of Column "A" & Column "B", which is also achieved.
    My requirement is, Percentage in Total column to be calculated with use of TOTAL OF COLUMN "A" & TOTAL OF COLUMN "B". Because simply totaling all the values of percentage column will not work.
    Any Pointers will be helpful.
    Thanks In advance.
    Regards,
    Siddhesh Sanghvi.

    hi ,
       this is another example  for displaying the subtotals in many times ...
    report  zvg_alv_slist2                          .
    type-pools: slis.
    G L O B A L   I N T E R N  A L   T A B L E S
    data: gt_fieldcat type slis_t_fieldcat_alv,
          gs_layout   type slis_layout_alv,
          gt_events   type slis_t_event.
    data: it_sort type slis_t_sortinfo_alv ,
          wa_sort type slis_sortinfo_alv .
    data: gs_print type slis_print_alv.
    data: begin of it_sflight occurs 0,
            carrid     like sflight-carrid,
            connid     like sflight-connid,
            fldate     like sflight-fldate,
            price      like sflight-price,
            planetype  like sflight-planetype,
            seatsmax   like sflight-seatsmax,
            seatsocc   like sflight-seatsocc,
            paymentsum like sflight-paymentsum,
         end of it_sflight.
    *DATA: GI_SFLIGHT LIKE STANDARD TABLE OF ST_SFLIGHT.
    data: g_repid like sy-repid.
    data: gt_list_top_of_page type slis_t_listheader.
    data: v_total(5).
    start-of-selection.
      g_repid = sy-repid.
      perform init_fieldcat  using gt_fieldcat[].
      perform build_eventtab using gt_events[].
      perform build_comment  using gt_list_top_of_page[].
      perform get_data.
      perform set_layout using gs_layout.
    SORTING
      clear wa_sort.
      wa_sort-fieldname = 'CARRID'.
      wa_sort-up = 'X'.
      wa_sort-group = '*'.
      wa_sort-subtot = 'X'.
      append wa_sort to it_sort.
      clear wa_sort.
      wa_sort-fieldname = 'CONNID'.
      wa_sort-up = 'X'.
      wa_sort-group = 'UL'.
      wa_sort-subtot = 'X'.
      append wa_sort to it_sort.
    DISPLAY LIST
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_interface_check       = ' '
          i_callback_program      = g_repid
          i_callback_user_command = 'USER_COMMAND'
          is_layout               = gs_layout
          it_fieldcat             = gt_fieldcat[]
          it_sort                 = it_sort[]
          it_events               = gt_events
          is_print                = gs_print
        tables
          t_outtab                = it_sflight
        exceptions
          program_error           = 1
          others                  = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    *&      Form  INIT_FIELDCAT
    form init_fieldcat using    p_gt_fieldcat type slis_t_fieldcat_alv.
      data: ls_fieldcat type slis_fieldcat_alv,
            l_index type sy-tabix.
      data :rep like sy-repid.
      rep = sy-repid.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
        exporting
          i_program_name         = rep
          i_internal_tabname     = 'IT_SFLIGHT'
          i_inclname             = rep
        changing
          ct_fieldcat            = gt_fieldcat
        exceptions
          inconsistent_interface = 1
          program_error          = 2
          others                 = 3.
      if sy-subrc <> 0.
        message id sy-msgid type 'S' number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-subrc.
      endif.
      sort gt_fieldcat by col_pos.
      loop at gt_fieldcat into ls_fieldcat.
        l_index = sy-tabix.
        if ls_fieldcat-fieldname = 'PRICE'.
          ls_fieldcat-do_sum = 'X'.
          ls_fieldcat-sp_group = 'X'.
          modify gt_fieldcat from ls_fieldcat index l_index .
        endif.
      endloop.
    endform.                    " INIT_FIELDCAT
    *&      Form  BUILD_EVENTTAB
    form build_eventtab using  p_gt_events type slis_t_event.
      data: ls_event type slis_alv_event.
      clear ls_event.
      ls_event-name = slis_ev_top_of_page.
      ls_event-form = 'XTOP_OF_PAGE'.
      append ls_event to p_gt_events.
      clear ls_event.
      ls_event-name = slis_ev_top_of_list.
      ls_event-form = 'XTOP_OF_LIST'.
      append ls_event to p_gt_events.
      clear ls_event.
      clear ls_event.
      ls_event-name = slis_ev_end_of_page.
      ls_event-form = 'XEND_OF_PAGE'.
      append ls_event to p_gt_events.
      ls_event-name = slis_ev_end_of_list.
      ls_event-form = 'XEND_OF_LIST'.
      append ls_event to p_gt_events.
      clear ls_event.
    endform.                    " BUILD_EVENTTAB
    *&      Form  BUILD_COMMENT
    form build_comment using   p_gt_list_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.
      ls_line-typ = 'H'." = Header, S = Selection, A = Action
      ls_line-key = 'KEY'.
      ls_line-info = 'INFO'.
      append ls_line to p_gt_list_top_of_page.
    endform.                    " BUILD_COMMENT
    *&      Form  SELECTION
    form get_data..
    data: l_rows type i value 3.
    Read data from table SFLIGHT
      select carrid
             connid
             fldate
             price
             planetype
             seatsmax
             seatsocc
             paymentsum
         from sflight
         into table it_sflight.
        up to l_rows rows.
      sort it_sflight.
    endform.                    " SELECTION
    *&      Form  SET_LAYOUT
    form set_layout using  p_gs_layout type slis_layout_alv.
    *  P_GS_LAYOUT-F2CODE            = P_F2CODE.
      p_gs_layout-zebra          = 'X'.
      p_gs_layout-colwidth_optimize = 'X'.
      p_gs_layout-no_input          = 'X'.
      p_gs_layout-no_colhead        = space.
      p_gs_layout-totals_text       = 'Total Price'.
      p_gs_layout-subtotals_text    = 'Sub Total'.
      p_gs_layout-totals_only       = 'X'.
      p_gs_layout-key_hotspot       = 'X'.
      p_gs_layout-detail_popup      = 'X'.
      p_gs_layout-no_subtotals      = space.
      p_gs_layout-expand_all        = 'X'.
      p_gs_layout-group_buttons     = 'X'."space.
    endform.                    " SET_LAYOUT
          FORM XTOP_OF_PAGE                                             *
    form xtop_of_page.
    data : lv_page(5),
            lv_text(20).
      MOVE SY-PAGNO TO LV_PAGE.
      write:/  'X_TOP_OF_PAGE'.
    endform.                    "xtop_of_page
          FORM XTOP_OF_LIST                                             *
    form xtop_of_list.
      write:/  'X_TOP_OF_LIST'.
    endform.                    "xtop_of_list
          FORM XEND_OF_PAGE                                             *
    form xend_of_page.
      write:/  'X_END_OF_PAGE'.
    endform.                    "xend_of_page
          FORM XEND_OF_LIST                                             *
    form xend_of_list.
      write:/  'X_END_OF_LIST'.
      data : lv_page(5),
             lv_text(20).
      data : l_lines type i,
             l_line  type i.
      clear v_total.
      write sy-pagno to v_total left-justified.
    export v_total to memory id 'V_TOTAL'.
      do sy-pagno times.
        lv_page = sy-index.
        concatenate 'Page' lv_page 'of' v_total
             into lv_text separated by space.
        if sy-index = 1.
          read line 2 of page sy-index.
        else.
          read line 1 of page sy-index.
       endif.
        sy-lisel+60(20) = lv_text.
          modify current line .
      enddo.
    endform.                    "xend_of_list
          USER_COMMAND                                             *
    form user_command  using r_ucomm like sy-ucomm
                              rs_selfield type slis_selfield.
      case r_ucomm.
        when 'EXIT'.
          leave to screen 0.
        when '&IC1'.
          data: text(256),text1(6),text2(5).
          move rs_selfield-tabindex to text1.
          move rs_selfield-sumindex to text2.
          concatenate  'Double clicked on (field:'
                        rs_selfield-fieldname
                        'Value:'
                        rs_selfield-value
                        text1
                        text2
                        into text
                        separated by space.
          call function 'POPUP_TO_DISPLAY_TEXT'
            exporting
              textline1 = text.
      endcase.
    endform.                    "user_command
    regards,
    venkat.

  • Currency Translation for Calculated Key figures

    Hello Friends I want to use the Currency Translation for Calculated Key figures.
    But when I go to Query and go to conversion tab it is always greyed out. Does that mean we can set the fixed conversion type for calculated key figures. like ZSAD Total debit - credit -flow value.
    What is the way to do fixed currency translation in query for calculated key figures.
    All the below is done now just want to specify this in query but I can'nt since it is greyed out.
    All the below is done
    I have created a Currency Translation Type " FiscperConversion" "ZVHGR" now this has Exchange Rate Type from Variable "ZVARN" (Which is a variable single value manual input on 0RTYPE Infoobject for exchange rate.)
    2. Now Currency Tab: Target Currency is selected from Variable placed in the Report. ZRPVAR.
    3. Now the Variable Time Reference is used. Standard Infoobject 0FISCPER
    which is beginning of period.

    Hi soniya
    Your calculated KF is result of some calculation ...so system will not allow u to do any translation on it...to get CT on CKF you should do it on base key figure...still if you wish to do then you can create a formula variable having processing type a customer exit...write code in cmod to rad exchange rate and multiply ur CKF by this formula variable....
    Thanks
    Tripple k

  • How to calculate and save planning data in bex input-ready query using keyfigures for calculation from different infoproviders

    Hi Dear All,
    We have two real time infocubes and two aggregation levels based on these cubes in one multiprovider
    first cube1 is like
    char1| char2| keyfig_coefficient(single value for each combination of char1 and char2)
    same aggregation level1
    (we have input query to fill coefficients by one responsible user)
    second cube2 is like
    char1| char2| keyfig_quantity| keyfig_result
    same aggregation level2
    Input ready query should be like (for all other users of different org units)
    char1|char2|keyfig_coeff| keyfig_quant(for input) | keyfig_result = keyfig_coeff*keyfig_quant(calculated value, should be saved to cube2)
    And we don't have pregenerated lines in cube2, users have to add new lines themselves by wad.
    Question is, what is the optimal (easiest) way to make calculation and save result data to cube2 where keyfigures for calculation should be used from different infoproviders. I need just a hint.
    Appreciate any help.
    Nadya.

    I found decision, agregation levels sould be based on multiprovider, not included.

  • Need a fms query on G/L account code for the AP Screen

    Hi SAP B1 Experts,
    Could somebody suggest a simple query I could run on the G/L account code field to select a particular account code when using a particular BP code.
    So for example I would like the user to be able to choose just 2/3 accounts instead of the mass list you get based on the BP partner he is looking at.
    Do I need to add a UDF field into the BP for the particular Account Code I want associated with him?
    Any suggestions would be appreicated as I want to cut down the time on search the g/l code list as it is quite long
    regards
    Paul

    Hi Rahul,
    I think I follow the below overall however I have setup the UDT and created the UDF's BP CODE and ACCOUNT as you suggested.
    How do you associate the BP Code with the Account Number in the Table?
    So for my example:
    I will setup a Supplier Code and two account codes with it.
    BP Code: S1234   Account 1234567
            S1234   Account 1234567
    I have tried setting up default values but they don't appear to work. I must be doing something wrong as nothing appear when I query the table. Have I missed a step here?
    Once the table is right I assume I then use the FMS Query below to look at the table based on my UDT vs the OPCH.Cardcode Field?
    If I can get the table right I think I follow your example from there
    thank you both for a quick response

  • Why is this FMS query not working for me?

    There is already a FMS query that works in Delivery Pane. The FMS field there is a user defined field called U_NWR_Bin, rom table DLN1. This works fine and it is alpha numeric 10 characters. This FMS is defined in Marketing Documents rows.
    I created another user defined field called U_Bin in table PKL1 for picklist row level. This user defined field shows up in FMS in PickList Pane.
    I created a query - SELECT $[DLN1.U_NWR_Bin].
    I then assigned above query through Shift F2 to Picklist Pane field U_Bin.
    The above query is not executed on clicking the lens it gives the error - Internal error -1004 occured message 131-183.
    What am I doing wrong? Please help. Thanks.

    Hi,
    FMS query can only access the current form. $[DLN1.U_NWR_Bin\] is not valid for PickList Pane.
    Thanks,
    Gordon

  • I need a Small FMS query.

    hi.
    i need a small fms query i am not able to do it.
    what is my requirement is
    i create one Udf field which is amount type at sales order rows.
    and in item master i enter some values at factor1 under sales data.
    when ever i pick the item at sales order row level..
    i need a calculation like
    row level i enter like this
    itemcode      manual price(udffield)
    001                  25
    001  is having factor1 value at item master is 5
    then i need calculation like
    select ((t2.SalFactor1 *100/100)*(t1.U_Manpric)) as ManualPrice from ordr t0 inner join rdr1 t1 on t0.docentry = t1.docentry inner join oitm t2 on t2.itemcode = t1.itemcode where t2.ItemCode ='00201010001'
    i need above calculation
    i tried
    select ((t2.SalFactor1 *100/100)*($[$t1.U_Manpric.0.0])) as ManualPrice from ordr t0 inner join rdr1 t1 on t0.docentry = t1.docentry inner join oitm t2 on t2.itemcode = t1.itemcode where t2.ItemCode ='00201010001'
    but not working
    Any information plz update me.

    hi.
    Kenady t
    thanks for your reply.
    if i press picker it is showing nothing i mean   no error is comming
    values is 0.0  is coming.
    if i press that line i mean i just put the cursor on the line empty line if i open the query at user defined query
    no data was found coming..
    may i know why it is comming
    if i see the item master it is having factor 1
    why it is comming i dont know.
    i am checking diff diff scenario
    i have some questins
    1) is the item should have instock
        i was thought earlier this is problem 
        but some items are having stock but still above problem is comming
    2) if the item is belongs to service , is above will work.
        i think it should work.
       but in that point also i am checking.
       plz update me what's wrong..

  • Help needed in query for Materialized View

    Hi,
    I want to create a materialized view which has some precalcultaed values.
    I have four dimension tables out of which one is a Time Dimension table with levels as Year->Quarter->Month.
    The precalculations are the moving averages and cummulative values of Sales Amt on the dimension values over a period of 4 Months.
    The dimension tables are Clients, Products, Channel, Time.
    Fact Table is Sales_Fact which will have the sales amount for different members of the dimension.
    Since my fact table is very huge, i want to create a materialized view where i could store the required calculated measures, here Moving Average of Sales Amt for each Client, Product, Channel dimensions over a period of 4 Months.
    Can anybody help with writing the query for this..Any help in this regard will be appreciated..
    Please give me suggestions for this..

    Check this link.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/aggreg.htm#sthref1612
    Regards
    Raj

  • Attributes to be used for calculation

    Hi Experts,
    I have a requirement for master data attribute calculation i.e. Vendor payment term's attributes like no of days. This needs to be used in a query for some calculation purpose. I wanted to know if the attributes of a master data can be used in the coulmns for calculation?
    Thanks.
    Points would be assigned

    Hi Shridevi,
    Thanks a lot this was very helpful and i am able to use the formula for calculation.
    I just wanted a simple information. I have three key fig f1 f2 & f3 and i want a formula to check
    if f1 is empty then
    formula = f3-f2
    else
    formula = f3-f1.
    Just wanted to know if this could be done in a formula or will i have to write some kind of exit?
    Thanks.

  • Query for formatted search

    Hi All,
    I have a line UDF called U_PO in the sales order documents that denotes our purchase order number that particular item is ordered on.
    I have another line UDF called U_XMill which I want to populate with the corresponding PO document due date.
    What would be my query for that?
    Basically, it should be something like:
    SELECT T0.DocDueDate FROM OPOR T0 WHERE T0.DocNum=$[$38.44.0] FOR BROWSE
    However, I am sure that "38.44" is wrong.
    It should denote my current document's UDF *.U_PO.
    And I am not sure what would be the correct notation for it.
    I was wondering if there was a help document I could refer to to figure out the corresponding field numbers for the cases like this.
    Thank you for your help.

    Hello
    use FMS on matrix (tables) as
    [ItemUID.ColumnUID.Type] or [TableName.FieldName]
    where itemUID is 38
    ColumnUID is U_XMill
    Type is 0 (general).
    There is a now-to guide on service.sap.com/smb/sbo where you can find how to us FMS.
    Regards
    J

Maybe you are looking for