Skip to Content
author's profile photo Former Member
Former Member

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 02:54 PM

    Hi,

    Move the data to an internal table and by using DESCRIBE statement you can find the number of records as below

    DATA: LV_LINES TYPE I.

    DESCRIBE TABLE ITAB LINES LV_LINES.

    Now LV_LINES will have the No.of Records in ITAB.

    Regards,

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 02:55 PM
    DATA: W_LINES TYPE I.
    
    OPEN DATASET P_TEMP IN BINARY MODE FOR INPUT.
    
    READ DATASET P_TEMP INTO L_BUFFER_IN .
    
    DESCRIBE TABLE L_BUFFER IN LINES W_LINES.
    

    Greetings,

    Blag.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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.?

      .

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 05:18 PM

    I think there is only one record in a binary file (no CRLF).

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.