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

Reg: Module pool table control fields updation into z data base table

Former Member
0 Likes
610

Hi all,

My requirment is i am entering the data into screen fields of table control when iam click save button then that data is saving 4 times.

Scenario is based on the field if field = 'y' i need to display the fields of table control in diable mode.i have write the query for this but the i have write append to this this append is reflecting in loop at table control itab.i think for that only i am getting four records in my table control.

when i am deleting also same 4 records are displaying in table control.

With Regards,

saroja.

4 REPLIES 4
Read only

Former Member
0 Likes
564

Dear saroja,

Please,make to some fields as primary key in your z-table.In table control,PAI (update / insert) dont write your code in nested loop,if you have used.

if you are declaring as structure in table control,use chain...field...endchain logic,then move to your z-table.if not,you are using like internal table in table control,just check the values when you are passing to another ITAB.

<<=< Sharing knowledge is a way to innovative >=>>

By,

Yoga

Read only

Former Member
0 Likes
564

Hi,

saroja ponnam

In ZTABLE atleast you will have one primary KEY.

So only if you have different key, record will saved in Ztable.

If 4 Record is displayed in table control , it will be from Internal Table.

Look at the code where you added a record in IT.

May be the record added 4 times in IT.

Check It and Reply.

Read only

venkat_o
Active Contributor
0 Likes
564

Hi Saroja, <li> try to use the below kind of check before your SELECT statement.

*----------------------------------------------------------------------*
*  MODULE get_data OUTPUT
*----------------------------------------------------------------------*
MODULE get_data OUTPUT.
  IF it_data[] IS INITIAL.
    "Write select query here.
    "This avoids execution of select query eachtime whenever cursor comes to this place
  ENDIF.
ENDMODULE.                    "get_data OUTPUT
Thanks Venkat.O

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
564

Hi,

Refer:-

it_zekpo is my internal table w/o header line,

wa_zekpo is work area.

Name of input/output fields on screen are:-

wa_zekpo-field1,

wa_zekpo-field2, and so on...

Take a button on the screen with function-code SAVE or in the pf-status take the function code of the standard save button as SAVE.

Use code:-

At screen logic:-


PROCESS BEFORE OUTPUT.
*  MODULE status_8003.
 
  LOOP WITH CONTROL po_tab. "po_tab is table control on screen 8003
    MODULE read_data.
  ENDLOOP.
 
PROCESS AFTER INPUT.
*  MODULE user_command_8003.
 
  LOOP WITH CONTROL po_tab.
    MODULE modify_data.
  ENDLOOP.

  MODULE SAVE_DATA.

In PBO:-


*&---------------------------------------------------------------------*
*&      Module  READ_DATA  OUTPUT
*&---------------------------------------------------------------------*
MODULE read_data OUTPUT.
  READ TABLE it_zekpo INTO wa_zekpo INDEX po_tab-current_line. "po_tab is table control name
 
  data : line_count type i.
 
  describe it_zekpo
  lines line_count.
 
  po_tab-lines = line_count + 10.
  "to increase the number of lines in table control dynamically
 
ENDMODULE.                 " READ_DATA  OUTPUT

In PAI:-


*&---------------------------------------------------------------------*
*&      Module  MODIFY_DATA  INPUT
*&---------------------------------------------------------------------*
MODULE MODIFY_DATA INPUT.
  MODIFY IT_ZEKPO FROM WA_ZEKPO INDEX po_tab-currentline.
  "this will modify the contents of existing line
ENDMODULE.                 " MODIFY_DATA  INPUT

*&---------------------------------------------------------------------*
*&      Module  SAVE_DATA  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE SAVE_DATA INPUT.

  DATA : A LIKE SY-DBCNT.
  OK_CODE = SY-UCOMM.
  CASE OK_CODE.
    WHEN 'SAVE'. "function code for SAVE button
      MODIFY ZEKPO FROM TABLE IT_ZEKPO.
      A = SY-DBCNT.
      IF SY-SUBRC = 0.
        MESSAGE S008 WITH A.
      ENDIF.
  ENDCASE.

ENDMODULE.                 " SAVE_DATA  INPUT

Hope this helps you.

Regards,

Tarun