Sum of all the values in a field

I have a report which needs to sum all the values of KONV-KBETR where KONV-kinak NE 'A'.
How do i write the code.
Can anyone help me in wrting the code..
This value i have to finally display in my internal table as one value.

data: sumf type i.
select sum( kbetr ) from  konv into sumf where kinak <> 'A' group by konv.
write: sumf.
Message was edited by:
        Ramu

Similar Messages

  • Finding the average of all the values stored in a two dimentional array

    public int avg(int[][] numbers2){
        int sum = 0;
        float avg = 0;
        for(int r = 0; r < numbers2.length; r++)
          for(int c = 0; c < numbers2[r].length; c++){
              sum += numbers2[r][c];
          }So I have this code that of course finds the sum of all the values stored in the array int[][] numbers. What I am having an issue with is finding the average of the numbers. When I attempt to use:
    avg = sum / numbers2.length; I get the sum / 3 because my array looks like:
    int[][] numbers2 = {{1, 2, 3},
                                {4, 5, 6},
                                {7, 8, 9}
                                          };Any ideas on what I should do or where I could find information on this process?

    2 dimensional arrays have 2 lengths:
    myArray.length and myArray[0].length
    The first one I believe is fixed, the second one may vary from row to row. But if you know that it won't vary, then you can just use the [0] row length.

  • Report - to show sum of all the fields in a table

    Hi,
    I have a requirement that for a particular materil ex: SALT i should show the sum of  qunatity i.e TMENGE , LMENGE, MMENGE.
    for a particular material  there is a condition on bais of  which the values will be divided.
    IF IT_PROD2-BWART  = '103','104','
    IT_PROD2-MENE GOES TO TMENGE,
    SIMILARLY FOR  201','202','261','262',
    IT_PORD2-MENGE GOES TO LMENGE
    FOR IT-PROD2-BWART = 551','562'
    IT_PROD2-MENGE GOES TO MMENGE.
    So i should insert sum of all the qunatiy lmege, tmenge, mmenge into it_prod3 and display it.
    i should disply only single reocrd for a particular material.
    but i am getting all the reocrods for mutiple dates i.e for date 2007.05.01 i am getting 10 records for SALT and for date 2007.05.02 again different records whre single date is repeating and materil is repating and so on   i want only single material and all the values should be sum.
    below is my code.
    SELECT werks_i AS werks
             SUM( menge_i ) AS menge
             matnr_i AS matnr
             budat  bwart_i AS bwart
             FROM  wb2_v_mkpf_mseg2
             INTO CORRESPONDING FIELDS OF TABLE it_prod2
             WHERE budat IN s_budat
             AND matnr_i IN ('PULPIMPORT','PULPLOCAL','SULPHUR','ZINC',
    'ZINCOXIDE','CHARCOAL','SALT','LIGNITE','STEAMCOALLCV','STEAMCOALHCV',
    'LDO','FURNACEOIL')
             AND bwart_i IN ('103','104','201','202','261','262','551',
    '552')
             GROUP BY werks_i menge_i matnr_i budat  bwart_i.
    SORT it_prod2 BY budat matnr.
      date1 = s_budat-low.
      date2 = s_budat-high.
      WHILE date1 LE date2.
        it_totstk1-month1 = date1.
        date1 = date1 + 1.
        APPEND it_totstk1.
      ENDWHILE.
    sort it_prod2 by matnr budat.
    LOOP AT it_totstk1.
        LOOP AT it_prod2. " WHERE budat EQ it_totstk1-month1.
          tdat = it_prod2-budat.
       if ( it_prod2-matnr = 'PULPIMPORT' OR it_prod2-matnr = 'PULPLOCAL') .
    elseif ( it_prod2-matnr ='STEAMCOALLCV' OR it_prod2-matnr =
    'STEAMCOALHCV' ).
            tmatnr = 'STEAM COAL HCV'.
          else. tmatnr = it_prod2-matnr.
          endif.
          IF it_prod2-bwart EQ '103'.
            tmenge = tmenge + it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '104'.
            tmenge = tmenge - it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '201'.
            Lmenge = Lmenge + it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '202'.
            Lmenge = Lmenge - it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '261'.
            Lmenge = Lmenge + it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '262'.
            Lmenge = Lmenge - it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '551'.
            Mmenge = Mmenge + it_prod2-menge.
          ELSEIF it_prod2-bwart EQ '552'.
            Mmenge = Mmenge - it_prod2-menge.
          ENDIF.
       ENDLOOP.
        it_prod3-budat = tdat.
        it_prod3-matnr = tmatnr.
        it_prod3-tmenge = tmenge.
        it_prod3-lmenge = lmenge.
        it_prod3-mmenge = mmenge.
        APPEND it_prod3.
        CLEAR : tmenge,tdat,tmatnr,lmenge, mmenge.
      ENDLOOP.
    <b>points will be rewarded</b>
    Thanks & Regards,
    Sunil kumar.

    data: sumf type i.
    select sum( kbetr ) from  konv into sumf where kinak <> 'A' group by konv.
    write: sumf.
    Message was edited by:
            Ramu

  • How to get all the values in the Select-option.

    Hi,
    I got the select-option field so_week, for eg. If I give 200923 to 200926 (year and week)  in the selection screen and then I need to pass this value (200923) to the FM 'ZWEEK_GET_FIRST_DAY' to get the first day of the week.
    My question is how can i get all the values from the select option, (i.e) i need to get 200923, 200924,200925, 200926.
    Regards,
    Anbu.

    Hello,
    I will prefer Max's solution. But just for the sake of this req.
    i need to get 200923, 200924,200925, 200926
    i am proposing my soln:
    DATA: V_WEEK TYPE RSCALWEEK.
    SELECT-OPTIONS: S_WEEK FOR V_WEEK NO-EXTENSION OBLIGATORY.
    AT SELECTION-SCREEN.
      DATA:
      V_COUNT TYPE I,
      V_ADD   TYPE I,
      RT_WEEK TYPE RANGE OF RSCALWEEK,
      RS_WEEK LIKE LINE OF RT_WEEK.
      V_COUNT = ( S_WEEK-HIGH - S_WEEK-LOW ) + 1.
      DO V_COUNT TIMES.
        RS_WEEK-SIGN = 'I'.
        RS_WEEK-OPTION = 'EQ'.
        RS_WEEK-LOW = S_WEEK-LOW + V_ADD.
        APPEND RS_WEEK TO RT_WEEK. "RT_WEEK--> Will contain the week values
        CLEAR RS_WEEK.
        V_ADD = V_ADD + 1.
      ENDDO.
    @Max: I was stupid enough not to think of your solution. Need to leave office
    Cheers,
    Suhas

  • Get all the values of optionset

    Hi
    My requirement is to retrieve all the values of an optionset field using javascript.How can i do this

    Hello,
    I believe getOptions method of attribute is what you need. Recheck following -
    https://msdn.microsoft.com/en-us/library/gg334409.aspx#BKMK_getOptions
    Dynamics CRM MVP/ Technical Evangelist at
    SlickData LLC
    My blog

  • Holding the value in screen-field

    Dear All,
    I m facing the problem ,while i m putting the value in screen-field and then pressing enter,
    value in that screen-field is becoming null automatically.
    wht shld i do for holding the value even after PAI.
    Thanks in advance.

    Hi,
    You should define a corresponding variable for that screen field in your program.
    data: my_input_field type ... "same name and type as the one used in screen for field
    so when you enter data to that field and press ENTER, the data will be transported to that variable and in PAI you have its value there.
    Regards
    Marcin

  • How to access the value of a field of a field symbol.

    Hello All,
    i need to access the value of a field in a field symbol. But when i am trying to get the value like <FS>-POSNR, it's showing that that the <FS> has no structure.
    In my program, the field itself that i need to check should be dynamic. ie i'll get the field in a variable and i need to find the value of that field.
    Am pasting my code below, please tell me what needs to be done.
    here in my sample code i am moving the entry of the <FS> into a work area structure. But in my actual program, i gets the structure as a parameter. So is there any way i can declare a work area dynamically...
    FUNCTION z_39181_dyn_fs_60758.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(PARAMETER) TYPE  VBELN
    *"  TABLES
    *"      DATA_TAB
      BREAK-POINT.
      FIELD-SYMBOLS <fs> TYPE ANY.
      FIELD-SYMBOLS <fs1> TYPE ANY.
      FIELD-SYMBOLS <fstab> TYPE ANY TABLE.
      DATA name(5) VALUE 'POSNR'.
      FIELD-SYMBOLS <f> TYPE ANY.
      DATA: dref TYPE REF TO data,
            dref1 TYPE REF TO data,
            dref2 TYPE REF TO data.
      DATA: lv_lips TYPE string.
      DATA: lv_lipsfld TYPE string,
                lv_fld TYPE string,
                lw_lips TYPE lips.
                lv_lips = 'LIPS'.
                lv_fld = 'LW_lips-POSNR'.
      CREATE DATA dref1 TYPE (lv_lips).
      CREATE DATA dref TYPE STANDARD TABLE OF (lv_lips).
      CREATE DATA dref2 LIKE LINE OF data_tab.
      ASSIGN dref->* TO <fstab>.
      ASSIGN dref1->* TO <fs>.
    assign dref2->* to <fs
      <fstab> = data_tab[].
      LOOP AT <fstab> INTO <fs>.
        lw_lips = <fs>.
        WRITE lw_lips-vbeln.
        ASSIGN (lv_fld) TO <fs1>.
       write <fs>
      ENDLOOP.
    Helpful answers will be rewarded...

    Use syntax
    ASSIGN COMPONENT name OF STRUCTURE struc TO <fs>.

  • When the combobox is rendered all the values displayed look like [object Object].

    I wasn't sure where to post this so please forgive me.
    I am trying to populate a combobox with a series of values
    returned from a Coldfusion method that retrives a resault froma
    database. Basically all the data from a table of staff.
    <cffunction name="getUsers" access="remote"
    returntype="array">
    <cfquery name="q" datasource="#datasource#">
    SELECT *
    FROM STAFF_CHARTS_STAFF_TEMP
    </cfquery>
    <cfset aRecordset= querytoarray(q)>
    <cfset flash.result=aRecordset>
    <cfreturn flash.result>
    </cffunction>
    <cffunction name="querytoarray" returntype="array"
    output="No">
    <cfargument name="q" required="Yes" type="query">
    <cfset var aTmp = arraynew(1)>
    <cfif q.recordcount>
    <cfloop query="q">
    <cfset stTmp = structNew()>
    <cfloop list="#lcase(q.columnlist)#" index="col">
    <cfset stTmp[col] = q[col][currentRow]>
    </cfloop>
    <cfset arrayAppend(aTmp,stTmp)>
    </cfloop>
    <cfelse>
    <cfset stTmp = structNew()>
    <cfloop list="#lcase(q.columnlist)#" index="col">
    <cfset stTmp[col] = "">
    </cfloop>
    <cfset arrayAppend(aTmp,stTmp)>
    </cfif>
    <cfreturn aTmp>
    </cffunction>
    The result from a call of CF method getUsers is set as the
    data provider to ComboBox with id = "cb"
    <mx:RemoteObject
    id="myService"
    destination="ColdFusion"
    source="staff_ratings.staff_Ratings-debug.staff"
    showBusyCursor="true">
    <mx:method name="getUsers" result="handleResult(event)"
    fault="Alert.show(event.fault.message)"/>
    </mx:RemoteObject>
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    import mx.controls.Alert;
    [Bindable]
    public var sResult:Array;
    public function handleResult(event:ResultEvent):void{
    sResult=event.result as Array;
    cb.dataProvider=sResult;
    ]]>
    </mx:Script>
    However when the combobox is rendered all the values
    displayed look like [object Object].
    I think the problem is that the result is a array of arrays
    so I need to find away to ectract a particular colun of data into
    the combobox
    How do I fix this?

    This is what I did for a single field.
    If you were wanting the to have muliple fields in the
    dropdown, I would concatenate them in the query.
    something like
    select fname + ' ' + lname + ' ' + anotherfield as tech from
    dbo.table
    <cffunction name="getTech" output="no" access="remote"
    returntype="query">
    <cfset var qTech="">
    <cfquery name="qTech" datasource="datasource">
    select tech
    from dbo.table
    group by tech
    order by tech
    </cfquery>
    <cfreturn qTech>
    </cffunction>
    <mx:RemoteObject
    id="dataManager"
    showBusyCursor="true"
    destination="ColdFusion"
    source="cust.components.cfgenerated.Records">
    <mx:method name="getMasterQuery"
    result="getMasterQuery_result(event)" fault="server_fault(event)"
    />
    <mx:method name="deleteItem"
    result="deleteItem_result(event)" fault="server_fault(event)" />
    </mx:RemoteObject>
    <mx:ComboBox id="TECH"
    dataProvider="{dataManager.getTech.lastResult}" labelField="tech"
    />

  • How to hide a field based on the value of a field in a different subform - null check doesn't work!

    I'm using Javascript to set the actions. I need to hide a text field if the value of a field in another sub-form is null.
    - tried checking the value of the other field for null - doesn't work
    - tried setting a variable str2 where I know the value of the other field is available then checking that variable when I initialize the text field - doesn't work
    What am I missing?

    Hi.
    Try this in the originating sub form referring to the text field (X). 
    if (this.rawValue = 1)
              X.presence = "visible";
    else if (this.rawValue = null)
              X.presence = "hidden";

  • Get all the values from a multiple select in a multipart form

    Hi there!
    I am using a form with enctype="multipart/form-data" in order to upload files from the form.
    I have read this page: http://commons.apache.org/fileupload/using.html and everything works well for my form.
    The only problem is that I can't get all the values from a "multiple select" html object. I get only one value.
    Using servlets I have used this method:
    public java.lang.String[] getParameterValues(java.lang.String name) But now I have enctype="multipart/form-data" in my form and I can't use this way...
    Is there a way to get all the values of a multi-valued parameter?
    Thanks a lot!
    Stefano

    Hi
    I have got solution for this problem so, I am listing here logic
    assume tag name of html
    <select name="moption" multiple="multiple">
    iterate it in as
    String moption="";
    boolean cnt=true;
    while(itr.hasNext())
    FileItem fi=(FileItem)itr.next();
    if(fi.isFormField())
    if(fi.getFieldName().equals("moption"))
    if(cnt==true)
    moption=fi.getString();
    cnt=false;
    else
    moption=moption+","+fi.getString();
    If wants more help then mail me your problem
    at [email protected]
    Thanks!
    Anand Shankar
    Edited by: AnandShankar on 6 Nov, 2009 12:54 PM

  • How Can I get all the values of a DBMS package?

    Hi all
    I'm using this "dbms_output.put_line(DBMS_DB_VERSION.VERSION || '.' ||DBMS_DB_VERSION.RELEASE);" to show the version. But how Can I get the all the values from DBMS_DB_VERSION ? Is there a common way ?
    Thanks .
    Best
    Laurence

    Hi,
    Don't think that's possible. Even if it were, you wouldn't be able to use/display BOOLEAN type in SQL.
    If you just aim to see what they are, you could do something like this
    select text
      from all_source
    where owner = 'SYS'
       and name = 'DBMS_DB_VERSION'
       and type = 'PACKAGE';Or even
    select dbms_metadata.get_ddl('PACKAGE', 'DBMS_DB_VERSION', 'SYS') from dual;My version is:
    SQL> select * from v$version where rownum = 1;
    BANNER                                                         
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    1 row selectedIn 11g you also have [PL/SCOPE|http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_plscope.htm#ADFNS02203] which might help you even more.
    Regards
    Peter

  • How to get all the values from the dropdown menu

    How to get all the values from the dropdown menu
    I need to be able to extract all values from the dropdown menu; I know how to get all those values as a string, but I need to be able to access each item; (the value in a dropdown menu will change dynamically)
    How do I get number of item is selection dropdown?
    How do I extract a ?name? for each value, one by one?
    How do I change a selection by referring to particular index of the item in a dropdown menu?
    Here is the Path to dropdown menu that I'm trying to access (form contains number of similar dropdowns)
    RSWApp.om.GetElementByPath "window(index=0).form(id=""aspnetForm"" | action=""advancedsearch.aspx"" | index=0).formelement[SELECT](name=""ctl00$MainContent$hardwareBrand"" | id=""ctl00_MainContent_hardwareBrand"" | index=16)", element
    Message was edited by: testtest

    The findElement method allows various attributes to be used to search. Take the following two examples for the element below:
    <Select Name=ProdType ID=testProd>
    </Select>
    I can find the element based on its name or any other attribute, I just need to specify what I am looking for. To find it by name I would do the following:
    Set x = RSWApp.om.FindElement("ProdType","SELECT","Name")
    If I want to search by id I could do the following:
    Set x = RSWApp.om.FindElement("testProd","SELECT","ID")
    Usually you will use whatever is available. Since the select element has no name or ID on the Empirix home page, I used the onChange attribute. You can use any attribute as long as you specify which one you are using (last argument in these examples)
    You can use the FindElement to grab links, text boxes, etc.
    The next example grabs from a link on a page
    Home
    Set x = RSWApp.om.FindElement("Home","A","innerText")
    I hope this helps clear it up.

  • Need to get the values from "Signed" field from PDF form.

    Hi,
    This is Dinesh. I am PHP Developer. My issue is "I am not able to get the value of "signed" field from the PDF form when the form has been submitted.". I want to get the Digital Signature value of that field and i need to store it in the DB.
    Please help me here Or Please forward this issue to any of the PHP developer who solved this issue and let me know.
    Thanks & Regards
    Dinesh

    Hi Vikas,
    you can use this badi MRM_WT_SPLIT_UPDATE, the method will be WHTAX_SPLIT_UPDATE
    in this badi please see the importing and exporting parameters, you will get the  values of withholding tax code  as TE_RBWS in export parameters.
    Please search in google or SCN you will get how to use it.

  • Getting all the values from a JList

    Hi,
    I want to get all the values from a JList and store it into an array. Any method is available to perform this task? Pls help me out with this task.

    Use getModel() on the list to get the ListModel and then call getSize() and getElementAt(int) to loop over the elements
    HTH
    Mike

  • How to get all the values in one column of a JTable

    How to get all the values in one column of a JTable as a Collection of String.
    I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column.

    I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column. You could always write a custom TableModel that stores the data in the format you want it. It would probably be about 50 lines of code. Or you could write a loop in 3 lines of code. I'll let you decide which approach you want to take.

Maybe you are looking for