Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Tables with 10 records

Former Member
0 Kudos

Hi, i need to create a table just with 10 lines of record.

I have this code in my program :


DATA: BEGIN OF it_lines occurs 10,
        tdformat TYPE tline-tdformat,
        tdline TYPE tline-tdline,
      END OF it_lines.

DATA : str_lines like tline.

DATA: name type THEAD-TDNAME.

clear wa.
clear it_poste.


name = IS_BIL_INVOICE-HD_GEN-BIL_NUMBER.
clear STXH.
clear it_lines.
clear str_lines.

select * from STXH into STXH
  where TDOBJECT = 'VBBK'
  and TDNAME = name
  and tdid = 'Z008'.
  Endselect.



if stxh-tdname = ''.
  ELSE.
CALL FUNCTION 'READ_TEXT'
  EXPORTING
    id                            = 'Z008'
    language                      = SY-LANGU
    name                          = name
    object                        = 'VBBK'
  tables
    lines                         = it_lines.
 .
loop at it_lines.
 wa-designation = it_lines-tdline.
 append wa to it_poste.
 clear wa.
endloop.
endif.

But in the end, it_lines have 12 records. How can i do for limits the lines record at 10 please?

thanks for your help.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try

loop at it_lines from 1 to 10.

wa-designation = it_lines-tdline.

append wa to it_poste.

clear wa.

endloop.

Darren

3 REPLIES 3

Former Member
0 Kudos

Hi,

Try

loop at it_lines from 1 to 10.

wa-designation = it_lines-tdline.

append wa to it_poste.

clear wa.

endloop.

Darren

former_member188685
Active Contributor
0 Kudos

if you Define itab like this Doesn't mean that it limits the records to 10.

DATA: BEGIN OF it_lines occurs 10,
        tdformat TYPE tline-tdformat,
        tdline TYPE tline-tdline,
      END OF it_lines.

if you don't want more than 10 lines then you have to Delete the extra lines from the internal table.

Former Member
0 Kudos

thanks for your reply that's work