‎2008 Aug 05 6:01 AM
Hi all,
I have created a program in which i have used table control now what i want to do is..
1- insert a new line above the row selected by the user...
how could i do this...please suggest..
Thanks & Regards
Ashu Singh
‎2008 Aug 05 6:19 AM
Hi....
1. As we know that table control enries maintain by one internal table.
2. we hav to insert new line in to that internal table.
3. where we hav to insert??
that index is exactly equals to the selected line number...
4. So here we hav to to capture that selected line number, this can be done in number of ways.
I: we can capture in chain and end chain operater...( Get back if you dont know the procedure )
II: we can capture with internal table entries
III: Or you can write any logic for that.
IV: better way is the Chain End cahin.. because you are using the selecteion indicater anyway.
5. Once you capture that number... you can go for logic in the PAI module....
> if OK_CODE = <name of push button>.
> if itab-selkz = 'X'. ( This is to check the condition either line is selected or not.)
>
> read table ITAB with key <check the condition>.
>
> WA_ITAB-SELKZ = 'X'.
> WA_ITAB-f1 = <new entry> .
> WA_ITAB-f2 = <new entry>.
> WA_ITAB-f3 = <new entry> .
> insert WA_ITAB into ITAB index <line number where you want to insert new line>.
>
> endif.
> endif.
And get back again if you got any problem....
All the best,
Thanks,
Naveen Inuganti.
‎2008 Aug 05 6:15 AM
Hi Ashu,
Table control can be created in tow ways either by selecting the table control
icon from the elements toolbar or by using table control wizard in SE51 and drawing a table control area on the screen..
If Line selection column is to be used than the name of the Line Selection Column field is specified. This field is of type C(1) and can be used to determine which record(s) were selected by the user in PAI. A field of this name and type is generally the part of the internal table which will be used to display the data if multiple row selection has been checked in the attribute box,for a single line row selection a declaration in ABAP program with the same name and type is sufficient.
The number of fixed columns can be specified.They can be changed dynamically in ABAP program using tab_con-FIXED_COLS attribute.
Columns on Table Control
The columns on table control are generally taken from the structure which is of same type as internal table used for displaying values in the ABAP program.
Hope this helps,
regards,
Vijay Duvvada
‎2008 Aug 05 6:17 AM
Hi,
I would suggest you to use a table control wizard in these situations..it is lot easy and insertion , deletion of lines you will automatically get there...
Regards,
Nishant
‎2008 Aug 05 6:19 AM
Hi....
1. As we know that table control enries maintain by one internal table.
2. we hav to insert new line in to that internal table.
3. where we hav to insert??
that index is exactly equals to the selected line number...
4. So here we hav to to capture that selected line number, this can be done in number of ways.
I: we can capture in chain and end chain operater...( Get back if you dont know the procedure )
II: we can capture with internal table entries
III: Or you can write any logic for that.
IV: better way is the Chain End cahin.. because you are using the selecteion indicater anyway.
5. Once you capture that number... you can go for logic in the PAI module....
> if OK_CODE = <name of push button>.
> if itab-selkz = 'X'. ( This is to check the condition either line is selected or not.)
>
> read table ITAB with key <check the condition>.
>
> WA_ITAB-SELKZ = 'X'.
> WA_ITAB-f1 = <new entry> .
> WA_ITAB-f2 = <new entry>.
> WA_ITAB-f3 = <new entry> .
> insert WA_ITAB into ITAB index <line number where you want to insert new line>.
>
> endif.
> endif.
And get back again if you got any problem....
All the best,
Thanks,
Naveen Inuganti.
‎2008 Aug 05 6:20 AM
‎2008 Aug 05 6:30 AM