Application Development and Automation 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: 
Read only

inserting blank line in internal table

Former Member
0 Likes
10,634

Hi

I am inserting a report from a internal table for eg the content of my internal table is

data : abc

event initialization.

perform read_data.

Now I want 1 blank line after every line in the internal table for eg

data:abc

event initialization

perform read_data.

How to insert a blank line in an internal table?

Edited by: priya singh on Feb 4, 2009 9:37 AM

Hi

I am inserting a report from a internal table for eg the content of my internal table is

data : abc

event initialization.

perform read_data.

Now I want 1 blank line after every line in the internal table for eg

data:abc

event initialization

perform read_data.

How to insert a blank line in an internal table?

Edited by: priya singh on Feb 4, 2009 9:37 AM

12 REPLIES 12
Read only

Former Member
0 Likes
4,672

hi...

you can go for following code.

take one more table t_table1 of type standard table.

loop at t_table into workarea.

insert workarea into table t_table1.

clear workarea.

insert workarea into table t_table1

endloop.

thank you.

Read only

Former Member
0 Likes
4,672

try this:

DATA: WA_tab TYPE somestructure.

append WA_tab TO itab.

u can insert bank line in this way.

Read only

Former Member
0 Likes
4,672

Hi,

Please refer the Link Below,

Thanks,

Kalyan B

Read only

Former Member
0 Likes
4,672

Use APPEND INITIAL LINE TO ITAB

Read only

Former Member
0 Likes
4,672

Hi,

Try this way..

Describe table itab lines l_lines.
do l_lines times.
l_taxix = sy-index * 2 .
 INSERT INITIAL LINE INTO  lt_objhead INDEX l_taxix.
Enddo.

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
4,672

hi,


DATA: BEGIN OF i_pernr OCCURS 1 ,
 pernr TYPE pa0002-pernr,
 vorna TYPE pa0002-vorna,
 nachn TYPE pa0002-nachn,
 END OF i_pernr.


TYPES : BEGIN OF string1  ,
     a TYPE char100,
    END OF string1.

DATA : wa_string TYPE string1,
       it_stirng TYPE TABLE OF string1.


START-OF-SELECTION.

  SELECT pernr vorna nachn FROM pa0002 INTO TABLE i_pernr UP TO 20 ROWS.


  LOOP AT i_pernr.

    CONCATENATE i_pernr-pernr i_pernr-vorna i_pernr-nachn INTO wa_string-a SEPARATED BY '|'.
    APPEND wa_string TO it_stirng.
    APPEND INITIAL LINE TO it_stirng.
  ENDLOOP.

  BREAK-POINT.

Thanks

Read only

Former Member
0 Likes
4,672

Hi,

APPEND INITIAL LINE TO ITAB " itab is the internal table

Thanks

Arun kayal

Read only

dp_prasad
Participant
0 Likes
4,672

If your internal table is laready filled , now if you wanted to add new blank line after each record, here is a sample code.



REPORT  ztestdp1112                             .
DATA: BEGIN OF itab OCCURS 0,
       f1(3) TYPE c , " filed 1
       f2(3) TYPE c,  " field 2
  END OF itab.
* fill the main internal table
DO 10 TIMES.
  itab-f1 = itab-f1 + 1.
  itab-f2 = itab-f1 + 1.
  APPEND itab.
ENDDO.

*-->"you need this part 
* "now add new blank lines after each line
DATA: l_tab LIKE sy-tabix.
LOOP AT itab WHERE  f1 IS not INITIAL.
  l_tab = sy-tabix + 1.
  INSERT INITIAL LINE INTO itab INDEX l_tab.
ENDLOOP.

Read only

Former Member
0 Likes
4,672

Hi,

while inserting records into the table use a blank workarea and append it to your internal table.

It Will create a blank line.

Thank U,

Ravi

Read only

faisalatsap
Active Contributor
0 Likes
4,672

Hi,

Have a Look at the following Thread it will solve out your problem, test the sample code send by me.

[Insert Blank Line|;

Please Reply if any Issue,

Kind Regards,

Faisal

Read only

Former Member
0 Likes
4,672
Read only

Former Member
0 Likes
4,672

Hi Priya Singh,

Check the below code :


DATA :  BEGIN OF t_data OCCURS 0,
           matnr TYPE mara-matnr,
           mtart TYPE mara-mtart,
        END OF t_data.
DATA : w_data LIKE LINE OF t_data,
       t_data1 LIKE t_data OCCURS 0 .

START-OF-SELECTION.
  SELECT matnr
         mtart FROM mara INTO TABLE t_data
         UP TO 20 ROWS.

END-OF-SELECTION.

  LOOP AT t_data .
    APPEND t_data TO t_data1.
    APPEND INITIAL LINE TO t_data1.
  ENDLOOP.

-Kumar M