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

Insert blank row in interal table

Former Member
0 Likes
5,633

Hi all,

I have one internal table wherein I have several records. I want to insert a blank row to group the records based on vendor code.

thns in advance,

Salman

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,416

HI.

APPEND INITIAL LINE TO ITAB.

Regards.

Jay

12 REPLIES 12
Read only

Former Member
0 Likes
2,416

default insert one colume value remaining null.

after insert time u can modify the value

Read only

Former Member
0 Likes
2,416

try this

first sort your table on vendore code

SORT itab BY vendore_code.

then use control structure AT NEW ....ENDAT inside the loop on internal table

Loop at itab

AT NEW vendore_code

use insert command to insert a blank record.

ENDAT

endloop

Read only

Former Member
0 Likes
2,416

Hi,

A row can be added only when you have value for atleast one key field.

For your problem ,instead of adding one blank row, you can add one more field in your internal table and you can set different values according to different vendors and then you can group them based on this field.

Hope this will help.

Regards,

Mukesh J.

Read only

Former Member
0 Likes
2,416
Read only

Former Member
0 Likes
2,416

Hello,

In you case you need to loop at the final table which has all the vendor codes (final table must be sorted by vendor code). You need to compare the current record in the loop with the previous record, if it is different then append a blank work area in internal table. This way you can seperate the internal table with grouping of vendor code separated by blank lines.

Thanks,

Jayant Sahu.

Read only

Former Member
0 Likes
2,416

use the below piece of code.

loop at itab.

at new field1.

clear itab.

append itab to itab1.

endat.

endloop.

Read only

Former Member
0 Likes
2,416

Hi

Instead of inserting a blank row in itab, use the SORT and AT..ENDAT stmt suggested above to display the contents of your itab as a group.

Regards,

Jayanthi.K

Read only

Former Member
0 Likes
2,417

HI.

APPEND INITIAL LINE TO ITAB.

Regards.

Jay

Read only

Former Member
0 Likes
2,416

Hi Salman,

suppose ur internal table has 5 records,

 loop at itab into wa_tab.
             if sy-tabix eq 3 .
               clear wa_tab.
               append wa_tab to itab.     " Adds 6 th row to itab.
             endif. 
           endloop.
  

After executing this ,check in debugging mode , 6 records are available now.

or check sy-tabix for the empty record.

Reagrds,

Aby

Read only

Former Member
0 Likes
2,416

Hi,

As per my Knowledge emply row canot be added. Column can be possible. Try to add any additional field and add some value make rest of field empty.

Hope this will help.

Regards

Md.MahaboobKhan

Read only

Former Member
0 Likes
2,416
INSERT INITIAL LINE INTO <internal_table> INDEX <n>.

A blank row will be inserted in the internal table according to the specified index.

Read only

faisalatsap
Active Contributor
0 Likes
2,416

Hi, Salman Zahir

Please test the following program it will solve out your problem,

REPORT zfsl_test_search_help NO STANDARD PAGE HEADING.


TYPES: BEGIN OF t_type,
  name(10),
  sale TYPE p,
  END OF t_type.

DATA: it1 TYPE STANDARD TABLE OF t_type WITH HEADER LINE,
      it2 TYPE STANDARD TABLE OF t_type WITH HEADER LINE,
      wa_it1 TYPE t_type,
      wa_it2 TYPE t_type.

DO 10 TIMES.
  wa_it1-name = 'Faisal'.
  wa_it1-sale = sy-index.
  APPEND wa_it1 TO it1.
ENDDO.
DO 10 TIMES.
  wa_it1-name = 'Altaf'.
  wa_it1-sale = sy-index.
  APPEND wa_it1 TO it1.
ENDDO.

SORT it1 BY name sale.
clear: wa_it2.
LOOP AT it1 INTO wa_it1.

  APPEND wa_it1 TO it2.

  AT END OF name.
    SUM.
    wa_it1-name = 'Name Sum'.
    APPEND wa_it1 TO it2.  " Here I am Inserting the SUM of Sale
    APPEND wa_it2 to it2.    " Here I am inserting Blank Line
  ENDAT.

ENDLOOP.

Please Reply if any problem

Kind Regards,

Faisal

Edited by: Faisal Altaf on Jan 20, 2009 10:50 AM