Application Development 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: 

table control modify

Former Member
0 Kudos
86

Hi all,

I have a question ie i have a treeview and if select a node the corresponding data for that node shd be placed in the table control.so iam fine with the creation, but in case of modification iam able to display the previous data but if i want to add another node from the tree view to the table control it's not getting the new value.

PBO

loop at g_CNT_TAB_FLDS_itab

into g_CNT_TAB_FLDS_wa

with control CNT_TAB_FLDS

cursor CNT_TAB_FLDS-current_line.

module CNT_TAB_FLDS_move.

endloop.

PAI

loop at g_CNT_TAB_FLDS_itab .

chain.

field ZGNX_FIELDS-TAB_NAME.

field ZGNX_FIELDS-FLD_NAME.

endchain.

endloop.

MODULE USER_COMMAND_1002.

module CNT_TAB_FLDS_move output.

move-corresponding g_CNT_TAB_FLDS_wa to ZGNX_FIELDS.

ZGNX_FIELDS-DD04T-DDTEXT = g_CNT_TAB_FLDS_wa-ddtext.

endmodule.

MODULE USER_COMMAND_1002 INPUT.

case ok_code.

when 'TAB_FLD_ADD'.

perform move_fields.

when 'DEL_FLD'.

perform remove_field_data.

endcase.

ENDMODULE. " USER_COMMAND_1002 INPUT

**********

FORM move_fields .

data temp_node_key type TV_NODEKEY.

DATA: node_key_table TYPE treev_nks.

DATA: node_key_wa type treev_nks with header line .

CALL METHOD G_TREE->GET_SELECTED_NODES

changing

NODE_KEY_TABLE = node_key_table

EXCEPTIONS

  • CNTL_SYSTEM_ERROR = 1

  • DP_ERROR = 2

  • FAILED = 3

  • MULTIPLE_NODE_SELECTION_ONLY = 4

others = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

refresh gl_node_key_table.

gl_node_key_table[] = node_key_table[].

*read table itab_fld with key key = node_key_table.

loop at node_key_table into node_key_wa.

read table itab_fld with key key = node_key_wa.

g_CNT_TAB_FLDS_wa-tab_name = itab_fld-tab_name.

g_CNT_TAB_FLDS_wa-fld_name = itab_fld-fld_name.

g_cnt_tab_flds_wa-fld_order = sy-tabix.

g_cnt_tab_flds_wa-ddtext = itab_fld-ddtext.

append g_CNT_TAB_FLDS_wa to g_CNT_TAB_FLDS_itab.

endloop.

SORT g_CNT_TAB_FLDS_itab.

CALL METHOD G_TREE->SELECT_NODES

exporting

NODE_KEY_TABLE = node_key_table

exceptions

others = 5.

*if sy-subrc = 0.

*endif.

ENDFORM. " move_fields

following is the code i was using.

can anybody help me.

1 ACCEPTED SOLUTION

former_member223537
Active Contributor
0 Kudos
47

Hi,

Yes, this is because when the values are modified, those are not reflected in the internal table. The internal table has the old values.

When User modifies the values, and clicks on a button to reflect those values in table control, REFRESH the data, before adding it to table control.

Include this logic here.

MODULE USER_COMMAND_1002 INPUT.

case ok_code.

when 'TAB_FLD_ADD'.

<b>

  • REFERSH</b> <u><b>The class which you are using will also have a REFRESH method. Please use that method here.</b></u>

perform move_fields.

when 'DEL_FLD'.

perform remove_field_data.

endcase.

ENDMODULE. " USER_COMMAND_1002 INPUT

Best regards,

Prashant

2 REPLIES 2

former_member223537
Active Contributor
0 Kudos
48

Hi,

Yes, this is because when the values are modified, those are not reflected in the internal table. The internal table has the old values.

When User modifies the values, and clicks on a button to reflect those values in table control, REFRESH the data, before adding it to table control.

Include this logic here.

MODULE USER_COMMAND_1002 INPUT.

case ok_code.

when 'TAB_FLD_ADD'.

<b>

  • REFERSH</b> <u><b>The class which you are using will also have a REFRESH method. Please use that method here.</b></u>

perform move_fields.

when 'DEL_FLD'.

perform remove_field_data.

endcase.

ENDMODULE. " USER_COMMAND_1002 INPUT

Best regards,

Prashant

Former Member
0 Kudos
47

thank u prashanth

it worked out for me

logic i have used is

MODULE USER_COMMAND_1002 INPUT.

case ok_code.

when 'TAB_FLD_ADD'.

perform move_fields.

refresh control 'cnt_tab_flds' from screen '1002'.

when 'DEL_FLD'.

perform remove_field_data.

endcase.

ENDMODULE. " USER_COMMAND_1002 INPUT