Get the records number from internal table with conditon.

Internal table itab got more than 1000 records,now i need to get the number of records with condition that itab-field1 = 'XXXX'.
actully, i got an inefficient logic to count the number in a loop statement. is there better way to implement it?

Hi,
One alternative solution, which may be useful for other parts of your program, is to have an aditional itab1 with a single column/field (field1), which acts like a index or shadow table, and which is filled simultaneously with itab. Then you can use DESCRIBE TABLE itab1 LINES lv_lines.
Atb

Similar Messages

  • Get records number from internal table with condition.

    Internal table itab got more than 1000 records,now i need to get the number of records with condition that itab-field1 = 'XXXX'.
    actully, i got an inefficient logic to count the number in a loop statement. is there better way to implement it?

    hello,
    Every time assigning data into temp table and delete may that may not be much efficient. You can check in loop logic how much time is taken. You can check the below code. here I am trying to check the numbers of plant for for one material.
    In this logic material is the first field. So if there is option to make the required field in to the 1 st position then it will be nice.
    TYPES: BEGIN OF x_count,
            matnr TYPE matnr,
            count TYPE i,
           BEGIN OF x_count.
    DATA: i_marc  TYPE STANDARD TABLE OF marc,
          i_count TYPE STANDARD TABLE OF x_count,
          wa_count TYPE x_count.
    FIELD-SYMBOLS: <wa_marc> TYPE marc.
    SELECT * UP TO 1000 ROWS
      FROM marc
      INTO TABLE i_marc.
    IF sy-subrc = 0.
      SORT i_marc BY matnr.
      LOOP AT i_marc ASSIGNING <wa_marc>.
        wa_count-count = wa_count-count + 1.
        AT END OF matnr.
          wa_count-matnr = <wa_marc>-matnr.
          APPEND wa_count TO i_count.
        ENDAT.
      ENDLOOP.
    ENDIF.
    Thanks
    Subhanakr

  • HT1349 My Ipad was stolen, How can I get the serial Number from Apple. It was registered with them

    I had  2 Ipads, a mac book pro and a Mac Air stolen 2 weeks ago
    I am trying to locate one of the serial numbers, but cant find the last box.  Can I get the serial number from Apple. It was registered and now it is not showing up as one of my products.
    Thanks

    The easiest way to find your serial number is this Open Itunes...click help... run diagnostics.....(tick or untick as necessary) so that you just have ticked the last two,  device connectivity and device sync.  run these tests. it will say no ipod/ipad found but will give results of test....scroll down to bottom of results... here you will find the serial number of your last attached devices.

  • Gettıng record number of all tables

    how can get the record number(count(*) ) of all the tables of the specıfıc user.

    u can query user_tables and see the num_rows column
    of that table of a corresponding schema."U" can but you would you would not being doing it the best way if you do.
    SQL> select table_name, num_rows from user_tables;
    TABLE_NAME                       NUM_ROWS
    EMP                                    15
    TEST                                    2
    SQL> select count(*) from test;
      COUNT(*)
             6
    SQL>It only works if the stats have been gathered on the tables and you don't really want to be gathering stats every time you want to know how many rows there are on your tables.
    The best and most accurate way to count the number of rows on tables is to use count(*).

  • Get the record count from a query

    Hi,
    does anyone know how to get the record count from a sql query?
    e.g: I've got a ResultSet from the Statement.excuteQuery(), and I want to know how many records this ResultSet contains, how to get this?
    I'd read thoughout the documents of Statement and ResultSet, but couldn't find a solution, do I have to use another seperate query such as "select count(*)" to do this?
    thanks.
    Yang Liu

    If you are not using a scrollable result set then the following is the best way to do it.
    there are several key words in SQL that can be used, the one you are interested in is count();
    so if your query at the moment is
    "select col1, col2, col3 from my_table where col2=? and col3=?"you can work out how many rows will be returned by executing this command first
    "select count(col1) from my_table where col2=? and col3=?"this will return a result set with one row and one column, you can get the row count as follows:
    ResultSet rs = ps.executeQuery();
    int rowCount = rs.getInt(1);I hope this helps :)

  • Where do I get the serial number from for Photoshop Elements

    Where do I get the serial number from for Photoshop Elements?  I need to use on a new computer as my old computer crashed.  Orignally the program was loaded with a download application online.

    If you registered PSE, go to the main page of adobe.com and look for My Adobe, then work through the links there and you will find a list of your adobe products and their serial numbers.

  • My iPod touch was stolen. Can you tell me how I can get the serial number from my iTunes account?, My iPod touch was stolen. Can you tell me how I can get the serial number from my iTunes account?

    My iPod touch was stolen. Can I get the serial number from my iTunes account?

    See the end of:
    - If you previously turned on FIndMyiPod on the iPod in Settings>iCloud and wifi is on and connected go to iCloud: Find My iPhone, sign in and go to FIndMyiPhone. If the iPod has been restored it will never show up.
    - You can also wipe/erase the iPod and have the iPod play a sound via iCloud.
    - If not shown, then you will have to use the old fashioned way, like if you lost a wallet or purse.
    - Change the passwords for all accounts used on the iPod and report to police
    - There is no way to prevent someone from restoring the iPod (it erases it) using it.
    - Apple will do nothing without a court order                                                
    Reporting a lost or stolen Apple product                                        
    - iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number

  • Is There Anyway I Can Get The Serial Number From My iPod Without Actually Having The iPod?

    Is There Anyway I Can Get The Serial Number From My iPod Without Actually Having The iPod?

    - Sign in hee and look:
    My Support Profile
    - On your syncing computer go to iTunes>Preferences>Devices and hover the mouse pointer over the iPod backup and the SN will pop up in a box.

  • Count the Records in  an internal table without a loop.

    How do i count the number of records in an internal table without using the loop  statement.
    The Describe statement give the total no. of records in the internal table.But i want the count of the key fields in the internal table
    For eg
    Row Field
    1       A
    2       A
    3       A
    4       B
    5       B
    6       C
    Count of A = 3
    Count of B = 2
    Count of C = 1

    Dilip,
      I think isn't posible. Only 3 ideas:
    1ª, make other table "table2", similar to your actual table.
         table2[] = yourtable[].
         delete table2 where key <> 'A'.
         describe table table2 lines contA.
        But depending the amount of data, you may have problems in performance or memory consumption...
    2ª, make other table, only with the keys fields and a count field,
        data begin table2
           key_field1,
           cont type i.
        end data.
       when you append lines to yourdata, make a collect to this table:
        table2-keys = yourtable-keys.
        table2-cont = 1.
       collect table2.
       But only works if you can modify the program where data is appended, and you may be carefull when data is deleted :-(...
    3ª if your data if filled in a select, you may fill the table2 of point 2ª, making a similar select but:
       select keyfields count( * ) into table table2
      from ...
      where (the same you have to fill your original table...)
       group by keys.
    But you have the same problem is data is deleted later...
    I hope that any of the three is useful for you...
    Edited by: Diego Alvarez on Jan 5, 2010 5:09 PM

  • Hwo to get the spool number from report output

    Hi,
    I am displaying some output in the report using write statements and within my program I need to collect the output written by write statements and send it as an email.So for that I need to generate the spool number and I am using the below code to do that
    CONSTANTS:
        l_linsz TYPE sy-linsz VALUE 201, " Line size
        l_paart TYPE sy-paart VALUE 'X_65_132'.  " Paper Format
      l_uname = sy-uname .
      l_repid = sy-repid .
    *-- Setup the Print Parmaters
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          authority              = space
          copies                 = '1'
          cover_page             = space
          data_set               = space
          department             = space
          destination            = space
          expiration             = '1'
          immediately            = space
          new_list_id            = k_x
          no_dialog              = k_x
          user                   = l_uname
        IMPORTING
          out_parameters         = l_mstr_print_parms
          valid                  = l_mc_valid
        EXCEPTIONS
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          OTHERS                 = 4.
    *-- Make sure that a printer destination has been set up
    *-- If this is not done the PDF function module ABENDS
      IF l_mstr_print_parms-pdest = space.
        l_mstr_print_parms-pdest = k_lp01.
      ENDIF.
    *-- Explicitly set line width, and output format so that
    *-- the PDF conversion comes out OK
      l_mstr_print_parms-linsz = l_linsz.
      l_mstr_print_parms-paart = l_paart.
      l_variante = sy-slset.
    * submitting the spool request
      *SUBMIT (l_repid) TO SAP-SPOOL*
                       *SPOOL PARAMETERS l_mstr_print_parms*
                       *WITHOUT SPOOL DYNPRO*
                       *AND RETURN.*
    *Calculating the lenth of report name
      lv_len = STRLEN( l_repid ) .
    *consutrucing the database variable  rq2name to search the spool
    *request
      IF lv_len >= 9 .
        CONCATENATE l_repid+0(9)
                    l_uname+0(3) INTO lc_rq2name .
      ELSE.
        lv_len = 9 - lv_len .
        DO lv_len TIMES .
          CONCATENATE lv_temp '_' INTO lv_temp .
        ENDDO.
        CONCATENATE l_repid lv_temp
                    l_uname INTO lc_rq2name .
      ENDIF.
    *selecting the spool request using the above consructed varibale
      SELECT   * FROM tsp01 INTO TABLE lt_tsp01
              WHERE rq2name = lc_rq2name .
    *sorting the interbla table
      SORT  lt_tsp01 BY rqcretime DESCENDING .
    *reading the first spool request
      READ TABLE lt_tsp01 INTO ls_tsp01 INDEX 1.
    but the problem with the above code is I am using variants to execute the report but when the above piece of code is getting executed it is clearing all the variant values on the selection screen and it is defaulting the values on the selection screen.
    Is there any way i can execute the above code without any problem in the selection screen.
    Thanks
    Bala Duvvuri

    Hello Bala,
    I wouldn't SUBMIT the same program to get the Spool number. You can achieve the same by [NEW-PAGE PRINT ON|http://help.sap.com/abapdocu_702/en/abapnew-page_print.htm#!ABAP_ADDITION_1@1@] command.
    Check the code snippet i've provided below:
    DATA: spfli_wa         TYPE spfli,
          print_parameters TYPE pri_params,
          valid_flag       TYPE c LENGTH 1.
    START-OF-SELECTION.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          no_dialog            = 'X'
        IMPORTING
          out_parameters       = print_parameters
          valid                = valid_flag
        EXCEPTIONS
          invalid_print_params = 2
          OTHERS               = 4.
      IF valid_flag = 'X' AND sy-subrc = 0.
    *   1. Write the output to the output list(no spool is generated)
        SELECT carrid connid
               FROM spfli
               INTO CORRESPONDING FIELDS OF spfli_wa.
          WRITE: / spfli_wa-carrid, spfli_wa-connid.
        ENDSELECT.
    *   2. Write the output to SAP spool(no list is displayed)
        NEW-PAGE PRINT ON PARAMETERS print_parameters NO DIALOG.
        SELECT carrid connid
               FROM spfli
               INTO CORRESPONDING FIELDS OF spfli_wa.
          WRITE: / spfli_wa-carrid, spfli_wa-connid.
        ENDSELECT.
        NEW-PAGE PRINT OFF.
        MESSAGE i000(zibi027) WITH 'Spool' sy-spono 'is generated!!!'.
        "You can use the spool number (SY-SPONO) to email the list output
      ENDIF.
    Hope this helps.
    BR,
    Suhas

  • Get FI Documet number from BKPF table using CO document number in COVP tabl

    Hi,
    In  datasource 0CO_OM_CCA_9 , we have written a code in CMOD to get the FI Document Number from CO document Number.
    The flow of code is:
    1) From the CO document number, get reference document number  (REFBNfield) from, COVP table
    2) Pass this REFBN in AWKEY(10) field of BKPF table.
    3) We have created new field in datasource named 'ZBELRE' which gets populated with BELNR field obtained from BKPF table.
    This ZBELNR is the FI Document number.
    But somehow wrong FI Document number is getting populated.
    After analyzing code, we found that the AWKEY which we passed in BKPF table is incomplete and the full AWKEY is
    COVP-REFBN+COVP-AWORG
    Is this condition always remains true in all the cases? Also, is the selection criterion which we have used to find the FI document number from BKPF table is sufficient?
    Our CO Consultant says that we should also pass AWTYP along with AWKEY in BKPF table.
    Please suggest a solution.
    Following is the code :
    ***********Datasource Modification for0CO_OM_CCA_9*******************
      WHEN '0CO_OM_CCA_9'." Data Source
        TYPES:BEGIN OF ty_bkpf,
        belnr TYPE bkpf-belnr,
        xblnr TYPE bkpf-xblnr,
        bktxt TYPE bkpf-bktxt,
        awkey TYPE bkpf-awkey,
        bukrs TYPE bkpf-bukrs,
        gjahr TYPE bkpf-gjahr,
        END OF ty_bkpf.
        TYPES : BEGIN OF ty_bseg1,
        lifnr TYPE bseg-lifnr,
        belnr TYPE bseg-belnr,
        bukrs TYPE bseg-bukrs,
        gjahr TYPE bseg-gjahr,
        END OF ty_bseg1.
        DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf,
        wa_bkpf TYPE ty_bkpf,
        it_bseg1 TYPE STANDARD TABLE OF ty_bseg1,
        wa_bseg1 TYPE ty_bseg1,
        l_s_icctrcsta1 TYPE icctrcsta1.
        "Extract structure for Datasoure 0co_om_cca_9.
        DATA: l_awkey TYPE bkpf-awkey.
        DATA: l_gjahr1 TYPE gjahr.
        DATA: len TYPE i,
        l_cnt TYPE i.
        l_cnt = 10.
        SELECT lifnr
        belnr
        bukrs
        gjahr
        FROM bseg
        INTO TABLE it_bseg1.
        DELETE ADJACENT DUPLICATES FROM it_bseg1 COMPARING belnr gjahr .
        SELECT belnr
        xblnr
        bktxt
        awkey
        bukrs
        gjahr
        FROM bkpf
        INTO TABLE it_bkpf.
        IF sy-subrc EQ 0.
          CLEAR: l_s_icctrcsta1,
          wa_bkpf,
          l_awkey,
          wa_bseg1.
          LOOP AT c_t_data INTO l_s_icctrcsta1.
            MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
            READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
            l_s_icctrcsta1-refbn
            gjahr = l_gjahr1.
            IF sy-subrc EQ 0.
              MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
              MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
              MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
              MODIFY c_t_data FROM l_s_icctrcsta1.
              READ TABLE it_bseg1 INTO wa_bseg1
              WITH KEY
              belnr = wa_bkpf-belnr
              bukrs = wa_bkpf-bukrs
              gjahr = wa_bkpf-gjahr.
              IF sy-subrc EQ 0.
                MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
                MODIFY c_t_data FROM l_s_icctrcsta1.
                CLEAR: l_s_icctrcsta1,
                wa_bseg1,
                l_gjahr1.
              ENDIF.
            ENDIF.
            CLEAR: l_s_icctrcsta1.
          ENDLOOP.
        ENDIF.
    ***End of Datasource Modification for 0CO_OM_CCA_9*******************

    Hi,
    this forum is for the SAP BusinessObjects BI Solution Architecture. Please post your question into the corresponding product forum for SPA BW
    regards
    Ingo Hilgefort

  • How to get the BP number from OBJECT ID or ID rel.Object taken from HRP1001

    Hi Gurus
    I am trying to find the BP number from the OBJECT ID or ID rel.Object which i got from the table HRP1001 in CRM  but i am not able to find the link straightaway to get that details
    Kindly help me to find out the table where i can simply put the OBJECT ID or ID rel.Object to get the BP number for ROLE EMPLOYEE
    Thanks a lot
    Regards
    Soni

    Hi Soni,
    I found this in a different thread:
    first you get the all connected partners to a position by selecting SOBID from hrp1001 (with OTYPE / OBJID of position, RELAT = 008, SCLAS = CP).
    With this SOBID go again to HRP1001 and fill the SOBID into OBJID (with OTYPE = CP, SCLAS = BP) and the SOBID of the result is the connected partner number.
    You can also use FM 'CRM_CENTRALPERSON_GET' instead of the last SELECT-Statement. Here IV_PERSON_ID = SOBID (of first select). You get the partner guid and can get data of the partner from but000.
    In this thread:
    Help needed...Infotype HRP1001--Getting details OF Position Users...
    Hope it helps.
    regards,
    Wim

  • How to get the Personal Number from Address Number

    Hi,
    I have one requirement which is as follows.
    I have one Customer. I am fetching Address Number(ADRNR) of this customer number from table KNA1.
    I want to find the Personal number linked to this Address number and Customer.
    Is there is any table or FM from where i will get the Personal number of the Customer using Customer number and Address number?
    Kindly Help

    Hi Sachin,
    Check this FM BUP_PARTNER_PERSNUMBER_GET
    " Check KNB1 and the Field name is PERNR, Most of the times this is not maintianed.
    " This refers to the Employees who are assigned as Customers
    " In XD03 go to the Company Code Data there you can find this Value
    " For more info contact your Functional Consultant
    " This is to the Best of my knowledge
    Also Check KNB1 but000 Tables
    Cheerz
    Ram

  • Need Functional help to get the MIRO  Number from deferent seanario.

    Hai All
    I developed One report to get the Accounting document number by using PO number.
    CASE 1. In My Case One single PO is having Multiple GRN each GRN amy Have Single MIRO number or Multiple MIRO Number.
    I ll get this By Using PO with Line Item Number this is not an Issue.
    CASE2.  In One PO Multiple GRN is there and One Single ITEM is having Two GRN Number, Each GRN is having single Accounting Number (MIRO) number.
    Tell me how can i do this
    actually I am using RSEG and BKPF table to get accounting Number.
    Which table i have to use to get the Accounting number by using GRN number.
    Please Help me.
    Jagadish.

    iText. PdfReader.getNumberOfPages()

  • ¿How can I to get the selected index from a table in sapui5?

    I have a multiselect table for each item I need to open a Dialog and bind then the table.
    How Can I to obtain the index position from my table?
    var myTable = sap.ui.getCore().byId(this.sId);
    var myItem = sap.ui.getCore().byId(myTable.getSelectedItem());
    Thanks in advance.

    Hi,
    You can also use getSelectedContexts of table instance to get the selected indices of sap.m.Table
    var aContexts = myTable.getSelectedContexts(true);
    for(var i = 0 ; i < aContexts.length ; i++)
    var selectedIndex = parseInt(aContexts[i].sPath .split("/")[2]);
    Thanks,
    Rumeshbabu S

Maybe you are looking for

  • Sound cards macbook air

    I am looking at buying the newly released macbook Air for travel. I am heavily into audio recording and presently use a MOTU sound card with my home i Mac. I was wondering if any one has a specific recommendation for a sound card that is portable yet

  • Upload historical material consumption data

    I have my material master up and running. Now I need to update the material master with the historical material consumption data. Can someone help me out as to how to carry out this exercise. I need to upload monthly consumption data of past 5 years

  • Command line update of 9.1.3 to 9.2?

    OK, I downloaded the MUI updater to 9.2 (the only one I could find), unzipped it, but the AdbeRdrUpd920_mui_cum.msp file tells me I don't have an updatable product installed.  I've used the 9.1.1 9.1.2 9.1.3 msp's to patch my 9.1 installs up to this

  • Error when modify several times a column -- CHANGED_GLOBAL_INSYNC

    Hello, i have a problem. I have sync in background, i´m modifying a column several times, the first modify work fine, the second work fine too, but sometimes, appear problems from the third time. Why? The error in console is: "Creation on Field cZSBO

  • Using imessage between devices

    My son has an ipod touch, me an iphone4. I want to be able to use imessage to 'text' between us, but since he's only 8 I'm not happy for him to have his own apple account so we share itunes etc. But I can't seem to work out how to message between the