‎2009 Jan 07 7:46 AM
Hi every one,
I have 10 columns in my sub screen, i would like to add one more column in that, can any one help me, how to create a new column in the sub screen.
ex:
Columns: a b c d
1 2 3 4
2 3 4 5
Now i want to add "e" column.
Thanks in advance.
‎2009 Jan 07 11:32 AM
Hi,
Please find code for the same.
data: ispfli type table of spfli.
data: gr_table type ref to cl_salv_table.
data: gr_functions type ref to cl_salv_functions.
data: gr_display type ref to cl_salv_display_settings.
start-of-selection.
select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
gr_display = gr_table->get_display_settings( ).
gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
gr_display->set_list_header( 'This is the heading' ).
gr_table->display( )
Regards,
Ameet
‎2009 Jan 07 3:19 PM
Hi,
What you are displaying in your screen?
Could you please eloborate your requirement?
Regards'
Sandeep Reddy
‎2009 Jan 09 7:22 AM
Hi Sandeep,
In my sub screen table control is there. In that table already 5 text fields are there. Now i want add one more text field(different column).
Ex: columns
materialno description dept.. (nedds toadd here)
101 ddddd comp
102 sssss material
103 hhh finance
Now i want to display one more column along with us. that i need to add in table control.
I don't have any idea about MPP. Please help me.
Regards,
‎2009 Jan 09 3:40 PM
Hi,
You will have to add this new column to the definition of the itab that you are displaying through the table control.
current table:
types: begin of ty_disp,
a,
b,
c,
d,
end of ty_disp.
data: it_disp type table of ty_disp.
New definition
types: begin of ty_disp,
a,
b,
c,
d,
e,
end of ty_disp.
data: it_disp type table of ty_disp.
Once, you add the new field to the itab defenition, go to the screen painter and add this new field of the internal table to the table control.
Now, if you fill this field of the itab at runtime, it will get displayed on the screen.
Nikhil
‎2009 Jan 12 9:48 AM
Hi Nikhil,
THanks for the kind reply.
I added that new field in the internal table, Could you please tell me how to add that new field in the table control.(In the layout).
Thanks and regards,
‎2009 Jan 12 10:13 AM
hi,
use that internal table in table control to get all the fields of internal table
hope it helps you.
thanks
Sachin
‎2009 Jan 12 5:12 PM
After you complie the program with the new field in the itab, within the Screen Painter,
use the F6 key (Dictionary/Program fields window). Enter the itab name and push the
"Get From Program" Button. All the fields that are currently displayed will be blocked
from being selected. Select the field you want add to the Table Control, and hit the
green check. Then drop it on the Table control where you want it listed.
As for editing/chain-endchain stuff.. you'll need to do that on your own if it's to be editted.
Edited by: Paul Chapman on Jan 12, 2009 12:13 PM
‎2009 Jan 13 6:04 AM
Hi Paul,
I awarded points,Thanks for the help.
I added a field in table control. But iam not able to enter data in that field. Could you please help me, how to add data through that field.
Thanks and regards,
kumar.
‎2009 Jan 13 11:33 AM
The field should be tagged as Input on the parameter screen for that field. You can get there by
double clicking on the field in the first row of the table control. To get the values updated to the
actual internal table, there is a routine in the PAI that should look something like this.
*&spwizard: pai flow logic for tablecontrol 'TC_202'
LOOP AT mt_approvers.
CHAIN.
FIELD mt_approvers_rec-division.
FIELD mt_approvers_rec-branch.
FIELD mt_approvers_rec-appr_level.
FIELD mt_approvers_rec-userid.
FIELD mt_approvers_rec-name.
MODULE tc_202_modify ON CHAIN-REQUEST.
ENDCHAIN.
FIELD mt_approvers_rec-sel
MODULE tc_202_mark ON REQUEST.
ENDLOOP.
MODULE tc_202_user_command.
*&spwizard: module TC_202_change_tc_attr.
*&spwizard: module TC_202_change_col_attr.
You will need to add your field to the FIELD list.
The module it calles during that loop, will/should contain the code
MODIFY mt_approvers
FROM mt_approvers_rec
INDEX tc_202-current_line.
If after changing the parameter to allow Input, should it still not allow you to input, then in the PBO
routine there is likely code that sets the parameters to the table control to input = 0 and that would
need to change to allow input to the appropiate columns.