Counting no of records

Hi,
i need urgent help on this.
i am opening a file in binary mode. how will i know how many records are there in that file.
data: l_buffer_in type xstring.
  OPEN DATASET P_TEMP IN BINARY MODE FOR INPUT.
    READ DATASET P_TEMP INTO L_BUFFER_IN .
I wanted to know how many records are there now in l_buffer_in.
Thanks in Advance.
Neha.

Hi,
could you please send me a sample code about using the function module to convert string to binary
lets say i have an internal table itab
which have folowing entries.
123       a        b
456       c        d
789       e        f
now first i will download that itab
and then open it in binary format
open dataset p_file for input in binary mode.
read dataset p_file into l_buffer_in.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = L_buffer_in
APPEND_TO_TABLE = ' '
IMPORTING
OUTPUT_LENGTH =
TABLES
BINARY_TAB = lt_binary
so now when i say.
describe table lt_binary lines l_lines.
will it return L_lines = 3.?

Similar Messages

  • Count number of records in a internal table

    hi
    i want to count number of records in internal table
    pls let me know how to count the number of records in a internal table.
    regards
    Arora

    hi
    one way is
    data field type i.
    Decribe table itab lines field.
    write: / field.
    displays the no of records in tha internal table
    or if u want to write logic.
    data:
      w_count type i.
    loop at itab.
    w_count = w_count + 1.
    endloop.
    write: / w_count.
    displays the no of records.
    reward points if useful.

  • Need Count of Displayed records after suprresion

    Hi All,
    My question is looks very simple but it made me very tough to get it. pls help me if you have any clue.
    I have a report having 20 detail records from Database.
    I used some condition at Section expert to suppress some data, after that I have only 10 records as report out put.
    Now, at the report footer I need the count of the records.So, when I use count function its showing 20 instead of 10.
    How to get the count of available records after suppressing.
    Thank you,
    Krishna Pingali

    Hi Krishna!
    I would try using a conditional Running Total formula to add each record that does not fit the suppression criteria, and then a display formula to display the final total.
    Ex -
    @Non-Suppressed Count Calc
    WhilePrintingRecords;
    NumberVar NSC;
    If <> <suppression criteria> Then NSC := NSC + 1
    Else NSC := NSC
    @Non-Suppressed Count Display
    WhilePrintingRecords;
    NumberVar NSC;
    NSC
    Place the first formula in your Details Section and the Second in the appropriate Footer Section.
    Hope that helps!  

  • Counting number of records in a data block

    hi folks,
    Simple question for you guys: How can I count number of records in a data block.
    In other words, say I have 10 detail records listed on a data block (one of my columns is a non-database item for entering a number). Now I just want to do somethin like:
    Select count(*) From <data_block> into lnRecCount
    Where <non-database column> <> 0 ;
    Can I do this in a button trigger? I can't get it to work?
    Thanks,
    bob

    You should make a routine that go through records of the block and count the records that agree with your condition.

  • To count number of records in an internal table for a condition

    Hello All,
            I want to count number of records in an internal table for a condition.
    For e.g. -- I have one internal table IT which having fields F1, F2, F3, F4, F5.
                     Now, I want number of records in itnternal table IT where F1 = 'ABC'.
    Is it possible to do..?? If yes, then how.??
    Thanks in advance...!!
    Regards,
    Poonam.

    Hi,
    If you mean an internal table, there are a few ways to do this.
    1 One would be to loop over the table with a WHERE clause and increment a counter.
    data: lv_counter type i.
    clear lv_counter.
    loop at itab where fld1 = 'ABC'.
    lv_counter = lv_counter + 1.
    endloop.
    lv_counter now has the number of rows per the condiction.
    2  Well, you may want to try this as well, and compare to the LOOP way. Not sure what kind of overhead you may get doing this way. Here ITAB is our main internal table, and ITAB_TMP is a copy of it. Again I think there may be some overhead in doing the copy. Next, delete out all records which are the reverse of your condition. Then whatever is left is the rows that you want to count. Then simply do a LINES operator on the internal table, passing the number of lines to LV_COUNT.
    data: itab type table of ttab.
    data: itab_tmp type table of ttab.
    itab_tmp[] = itab[].
    delete table itab_tmp where fld1  'ABC'.
    lv_count = lines( itab_tmp ).
    Thanks & Regards,
    ShreeMohan

  • Running Total Issue:  How to calculate counts excluding suppressed records

    Post Author: benny
    CA Forum: Formula
    Hello All:
    I have a current report that gives the total counts of work requests.   However, in my section expert, there are some records in the detail that are suppressed (if there isn't any backlog). The current running totals are counting all the records including the suppressed records. I think I need three formulas:1. Calculate the counts2. Calculate the counts excluding suppressed records3. Reseting the counts by group
    May I ask if someone can give me an example of what I should do?
    Thanks so much!
    Benny

    Post Author: benny
    CA Forum: Formula
    Bettername,
    Actually, I should have been more specific.  This report is actually a PM backlog report.  It displays all the work requests (PM) issued including the backlogged. There are 9 columns (including one called Backlog) for the different counts of the pm's based from the status codes (Issued, Material on Order, Completed, Cancelled, etc) of the work requests. The detail records of worke requests are grouped by shop and PM end date.  The running totals are calculated at the pm date group level (group footer#2). Then based from those at the shop group level (group footer#1) there is a grand total of counts of the running totals. The detail records and pm end date group header (group header #2) are suppressed.
    Now the foremen would like the report to just display all the backlogged PMs. Using the section expert, I suppressed all the PM issued that have no back log ({@ backlog = 0}) and just display the back logged pm's.  This is where I run into the running total issue.
    This is very involved report and I will use the column PM Issued as an example.  I can still use the same logic as you suggested?
    1. declaration formula:
    whileprintingrecords;numbervar pmissued := 0;
    2. Suppression formula that uses the variable:
    whileprintingrecords;
    numbervar pmissued;
    if ({@ backlog = 0}) then pmissued:= pmissed else pmissued:=pmissuedr+1
    3. Display formula:whileprintingrecords;
    numbervar pmissued;
    If this is the right track, then I can use the same example for the other columns. 
    Thanks so much.
    Benny

  • Query in SQL to display count of all records but where condition is present

    Hi All,
    I have situation where I need to display count of all records all particular period but in where condition type condition has to be present :
    Please find the below sample data :
    PERIOD_ID     TYPE     MV_COUNT     IS_FLAG
    20110401     AM     1     0
    20110401     AM     1     0
    20110401     MS     29     0
    20110501     MS     1     0
    20110601     MS     14     0
    20110701     MS     2     0
    20110401     MS     1     0
    20110401     AM     2     0
    20110401     AM     69     0
    20110401     AM     2     0
    finally I need for type = MS
    i) total is_flag count for all the periods
    ii) for period=20110501 what is the mv_count
    I need to use the table single time (ie not self join outer joins )
    I have tried to use partition by clause but it will filter out the data .
    Cheers,
    Sp

    842106 wrote:
    finally I need for type = MS
    i) total is_flag count for all the periods
    ii) for period=20110501 what is the mv_count
    I need to use the table single time (ie not self join outer joins )
    I have tried to use partition by clause but it will filter out the data .
    select sum(is_flag) is_flg_count,
             sum
                 case when period = 20110501 then mv_count else 0 end
                ) mv_cnt_for_20110501
    from your_table
    where type = 'MS';

  • How to get count of all records of all entities in CRM Online

    Hi,
     I want to get count of all records entitywise in dynamics CRM 2013 online. I know we can count the records in CRM on-premise using a SQL query in report. Earlier I wrote a SSRS report to count the records in a CRM entity wise  as displayed in
    the screenshot below..
    Can someone suggest me a good approach to implement the same in CRM Online. 
    Thanks
    Pratibha Singh

    Hello,
    In a CRM Online environment, you need to create reports based on Fetch XML. Take a look at this link to create a Fetch XML query with aggregates: https://msdn.microsoft.com/en-us/library/gg309565.aspx?f=255&MSPPError=-2147217396#count .
    Here is an example to create a report in an online environment: http://edwardsdna.com/2012/12/03/crmonline-report/
    Hope it helps,
    Kind regards

  • Count for item records reaches 999 the second idoc gets triggered!

    Hi Experts,
         I have an issue. Sender is file and receiver is idoc with a header and item  level records. Only one header and n number of records can be there.
    Now we want to make  this way that as soon as the count for item records reaches 999 the second idoc gets triggered.
      Hints / Solutions Pls.
    Regards,
    Arnab .

    incorporate mapping logic such that for every 999 item records create new IDoc node
    check with this UDF for IDoc node mapping, item records will be input to UDF
    int count = a.length;
    int k=999;
    result.addValue("");
    for(int i=0;i<count;i++)
          if (i>=k){
              result.addValue(""); // if records > 999, add IDoc node
              k=k+999;     
    Do rest of the mapping accordingly

  • Reg: how to count no.of records in flat file

    Hi,
    Very god morning to all, i faced a one problem like this, i am new to jython code.my problem is i want count the no.of records flat file before loading to the table, is there any easiest way to count the number records in file rather than jython ?
    please share immediately.
    Regards,
    sh

    Hi actdi,
    Thanks for giving reply, i am working in windows environment, and my previous project developers use the coding like
    below:
    filesrc = open('#filename','r')
    first=filesrc.readline()
    lines = 0
    while first:
    lines+=1
    first=filesrc.readline()
    s1=str(lines)
    s2= ' in the file ------'
    s3='#filename'
    final = s1 + s2 + s3
    raise ' \n\n The Number of Lines in the File are ---' , final
    see this code they are wrote in a procedure but i have a doubt with this , where it finally stores the row count.
    Kindly share if u have any solutions reg this in windows env.
    Regards,
    sh.

  • How to get a count of unique records

    How do you get a count of unique records? Looking only for one number, not a list..so if the data is:
    ID
    ===
    1234
    1234
    1234
    1236
    1236
    1237
    Then, the count total will be one field called 'ID' with the value '3' in it..
    All I know how to do is get a count that will count all records, or do it in two queries. Looking to do this in one query statment..
    Thanks..

    Just a small clarification...
    Concatenation could potentially give wrong result, depending on the data.
    For example...
    sudhakar@ORCL>ed
    Wrote file afiedt.buf
      1  with t1 as
      2  (select 'AA' c1, '101' c2 from dual union
      3  select 'AA1' c1, '01' c2 from dual union
      4  select 'AA101' c1, null c2 from dual union
      5  select 'BB2' c1, '345' c2 from dual union
      6  select 'AA101' c1, null c2 from dual union
      7  select 'BB2' c1, '345' c2 from dual union
      8  select 'BB234' c1, '5' c2 from dual
      9  )
    10* select count(distinct c1 || c2) from t1
    sudhakar@ORCL>/
                        2IMHO, the required answer will be...
    sudhakar@ORCL>ed
    Wrote file afiedt.buf
      1  with t1 as
      2  (select 'AA' c1, '101' c2 from dual union
      3  select 'AA1' c1, '01' c2 from dual union
      4  select 'AA101' c1, null c2 from dual union
      5  select 'BB2' c1, '345' c2 from dual union
      6  select 'AA101' c1, null c2 from dual union
      7  select 'BB2' c1, '345' c2 from dual union
      8  select 'BB234' c1, '5' c2 from dual
      9  )
    10* select count(distinct c1 ||'.'|| c2) from t1
    sudhakar@ORCL>/
                             5
    sudhakar@ORCL>vr,
    Sudhakar B.

  • Number Count Beside Each Record?

    How do you get a number count beside each record such as:
    1. record 1 content
    2. record 2 content
    3. record 3 content

    If they are coming from a query, the currentrow variable will
    work.

  • Count-in for recording audio in Premiere

    Hello,
    I want to provide a narration for some tutorial videos I am making. It may sound crazy, but I am currently doing all the video in Premiere Pro CC (because it is great), but I am adding the narration in the free iMovie app from Apple.
    The reason for this is because iMovie has a great "count-in" before recording starts. This counts down three seconds once you start recording and allows for preperation to make the clip and most importantly, the mic is switched on, but the "pop" and other sounds are not recorded. The result is perfect, fluidity when recording narration sequences.
    I don't want to do this on iMovie as it is a hassle loading in a second project in a different app. But for the life of me I can't figure out how to do this on Premiere. Is there a way to set up a count-in, or is does Premiere have something different but just as good?

    Actually, your count-in will also come in handy for something else I am planning, so I appreciate it as well.
    The count-in Mark showed works just as needed, so a big thanks for that Mark.
    One last thing... I know I shouldn't keep referring to that iMovie software, but it does have another related neat feature which would be cool if I could replicate here. While recording my narration, if I don't like the section I just recorded, I can hop the timeline point to where the recording began with one key press, then through each section of recording (so it is like each block recorded has a beginning marker). It is a bit hard to explain.
    Is there a way to do this via keyboard shortcuts or the mouse without manually creating markers everywhere? I know if I hold the shift and drag the timeline poiint, it will "attach" itself to the beginning of each recording, but I am hoping for something a little quicker and more fluid.

  • Adjusting count-in for recording???

    Is it possible to adjust the count-in when recording (e.g. electric guitar)? If so, how???
    Thanks.

    cauchy wrote:
    Is it possible to adjust the count-in when recording
    no, the "count-in" is fixed length
    what you can do is make your own click track, and make that as long or short as you'd like:
    http://www.bulletsandbones.com/GB/GBFAQ.html#makeclicktrack
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • How to count number  of records for a field based on condition?

    Hi guys,
    I want to know how to find count of records coming from the database for a particular field based on some condition.
    I need to use this count to suppress some headers. Because of this i am not able to use running totals. Is there any other way?
    Ex scenario:
    I have account number and currency fields, those are coming from database. And i need to count the number of accounts whose currency is not Euro.
    Thanks in advance,
    Vijay.

    A simple formula can do that:
    //Formula begin
    if {your account field}<>"Euro" then 1
    //Formula end
    This formula can be summarized. (by group or report)
    Bryan Tsou@Taiwan

  • Count No of records in an internal table using 4 fields

    Hi All,
    I have an internal table with about 50,000 records. I need to group these (sort) based on 4 fields and then provide the count for each combination of the 4 fields.
    For eg, if I have 3 records in the table which have the same values for all the 4 fields - say A,B,C,D, then the count is to be taken as 3 for that combination.
    So my output will be
    A B C D - COUNT -4 and so on.
    I am looking for a efficient technique (good performance) to meet the above requirements given without too many loops. Please advise if you have a good method.
    Thanks as always!
    Liz

    You can use SORT and DELETE ADJACENT DUPLICATES FROM.
    SORT itab by field1 field2 field3 field4.
    DELETE ADJACENT DUPLICATES FROM itab COMPARING field1 field2 field3 field4.
    you will be left with the unique combinations of the 4 fields.
    LINES( itab ) will give you the number of records.
    Thanks,
    Sai Ramesh.

Maybe you are looking for