‎2009 Jan 20 5:22 AM
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
‎2009 Jan 20 5:33 AM
‎2009 Jan 20 5:24 AM
default insert one colume value remaining null.
after insert time u can modify the value
‎2009 Jan 20 5:29 AM
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
‎2009 Jan 20 5:30 AM
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.
‎2009 Jan 20 5:30 AM
Hi,
Follow this link.
http://help.sap.com/saphelp_nw70/helpdata/EN/79/5b094ca0c211d3a6d80000e83dd863/frameset.htm
hope this will help you.
Regards:
Alok
‎2009 Jan 20 5:31 AM
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.
‎2009 Jan 20 5:31 AM
use the below piece of code.
loop at itab.
at new field1.
clear itab.
append itab to itab1.
endat.
endloop.
‎2009 Jan 20 5:33 AM
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
‎2009 Jan 20 5:33 AM
‎2009 Jan 20 5:37 AM
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
‎2009 Jan 20 5:41 AM
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
‎2009 Jan 20 5:48 AM
INSERT INITIAL LINE INTO <internal_table> INDEX <n>.A blank row will be inserted in the internal table according to the specified index.
‎2009 Jan 20 5:50 AM
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