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

Problem in table control.second row getting errased if not pressed enter after first row

Former Member
0 Likes
954

Hello All,

I am designing a table control,in that if I am not pressing 'enter' key after first row and directly giving data in second row,the second row is getting erased,automatically.

I am putting the piece of my code.

IN PBO.
LOOP AT it_item INTO zlc_items WITH CONTROL tabctrl.
    FIELD: zlc_items-mark,
           zlc_items-posting_key,
           zlc_items-account_number,
           zlc_items-special_gl,
           zlc_items-amount,
           zlc_items-cost_center,
           zlc_items-wbs_element,
           zlc_items-text,
           zlc_items-vendor,
           zlc_items-tax_code,
           zlc_items-profit_center.
  ENDLOOP.
IN PAI-
MODULE read_table.
MODULE read_table INPUT.
CLEAR ok_code.

  zlc_items-mark           = wa_item-mark.
  zlc_items-posting_key    = wa_item-posting_key.
  zlc_items-account_number = wa_item-account_number.
  zlc_items-special_gl     = wa_item-special_gl.
  zlc_items-amount         = wa_item-amount.
  zlc_items-cost_center    = wa_item-cost_center.
  zlc_items-wbs_element    = wa_item-wbs_element.
  zlc_items-text           = wa_item-text.
  zlc_items-vendor         = wa_item-vendor.
  zlc_items-tax_code       = wa_item-tax_code.
  zlc_items-profit_center  = wa_item-profit_center.
  APPEND wa_item TO it_item.
  CLEAR wa_item.
ENDMODULE.
LOOP AT it_item.
    MODULE modify_table.
  ENDLOOP.
MODULE modify_table INPUT.

  MODIFY it_item FROM zlc_items
            INDEX tabctrl-current_line.
ENDMODULE.
Kindly help in this regard

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
920

Thank you all,i got the solution,I did like this.

MODULE modify INPUT.

       MODIFY it_item FROM zlc_items INDEX tabctrl-current_line.

       if sy-subrc =  0.

          APPEND it_item.

       endif.

     ENDMODULE.

Hello All,

I am designing a table control,in that if I am not pressing 'enter' key after first row and directly giving data in second row,the second row is getting erased,automatically.

I am putting the piece of my code.

IN PBO.
LOOP AT it_item INTO zlc_items WITH CONTROL tabctrl.
    FIELD: zlc_items-mark,
           zlc_items-posting_key,
           zlc_items-account_number,
           zlc_items-special_gl,
           zlc_items-amount,
           zlc_items-cost_center,
           zlc_items-wbs_element,
           zlc_items-text,
           zlc_items-vendor,
           zlc_items-tax_code,
           zlc_items-profit_center.
  ENDLOOP.
IN PAI-
MODULE read_table.
MODULE read_table INPUT.
CLEAR ok_code.

  zlc_items-mark           = wa_item-mark.
  zlc_items-posting_key    = wa_item-posting_key.
  zlc_items-account_number = wa_item-account_number.
  zlc_items-special_gl     = wa_item-special_gl.
  zlc_items-amount         = wa_item-amount.
  zlc_items-cost_center    = wa_item-cost_center.
  zlc_items-wbs_element    = wa_item-wbs_element.
  zlc_items-text           = wa_item-text.
  zlc_items-vendor         = wa_item-vendor.
  zlc_items-tax_code       = wa_item-tax_code.
  zlc_items-profit_center  = wa_item-profit_center.
  APPEND wa_item TO it_item.
  CLEAR wa_item.
ENDMODULE.
LOOP AT it_item.
    MODULE modify_table.
  ENDLOOP.
MODULE modify_table INPUT.

  MODIFY it_item FROM zlc_items
            INDEX tabctrl-current_line.
ENDMODULE.
Kindly help in this regard

4 REPLIES 4
Read only

Former Member
0 Likes
920

What is code in Module read_table and read_table input.

Read only

0 Likes
920

In read table I have wriiten following code as already mentioned

MODULE read_table INPUT.
CLEAR ok_code.

  zlc_items-mark           = wa_item-mark.
  zlc_items-posting_key    = wa_item-posting_key.
  zlc_items-account_number = wa_item-account_number.
  zlc_items-special_gl     = wa_item-special_gl.
  zlc_items-amount         = wa_item-amount.
  zlc_items-cost_center    = wa_item-cost_center.
  zlc_items-wbs_element    = wa_item-wbs_element.
  zlc_items-text           = wa_item-text.
  zlc_items-vendor         = wa_item-vendor.
  zlc_items-tax_code       = wa_item-tax_code.
  zlc_items-profit_center  = wa_item-profit_center.
  APPEND wa_item TO it_item.
  CLEAR wa_item.
ENDMODULE.
Read only

Arun_Prabhu_K
Active Contributor
0 Likes
920

Hello Ritika.

     What is the significance of read_table module?

     Just add the following logic (in italicised) in your MODIFY module.

     MODULE modify INPUT.

       MODIFY it_item FROM zlc_items INDEX tabctrl-current_line.

       if sy-subrc <> 0.

          APPEND it_item.

       endif.

     ENDMODULE.

Regards.

Read only

Former Member
0 Likes
921

Thank you all,i got the solution,I did like this.

MODULE modify INPUT.

       MODIFY it_item FROM zlc_items INDEX tabctrl-current_line.

       if sy-subrc =  0.

          APPEND it_item.

       endif.

     ENDMODULE.