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

Table Control - Adding rows

Former Member
0 Likes
625

Hi!

I've made a dynpro, which contains a table control. I've added the column fields to the table control.

During the activation i've got an error, which sais One of the fields is not assigned to a "LOOP", "LOOP" and "ENDLOOP" have to set in PBO or PAI.

What's the solution for this?

For further usage I would like to know how can I to the table control

- adding rows

- deleting rows

- changing rows

- completely delete (REFRESH)

Thank you in advance, most detailfully comments will be greatly rewarded

Tamá

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
581

refer to sap example RSDEMO_TABLE_CONTROL.

4 REPLIES 4
Read only

Former Member
0 Likes
582

refer to sap example RSDEMO_TABLE_CONTROL.

Read only

0 Likes
581

Check this out

For Inserting a Row

For Deletion of a Row

Read only

Former Member
0 Likes
581

hi

good

We have to use LOOP ... ENDLOOP in PAI so that data can transfer fro table control to ABAP program. If we want to write changes to the data we should

call a module between the LOOP ... ENDLOOP. The MODULE call to process user commands (SY-UCOM) should be called after the ENDLOOP statement.

e.g.

PROCESS AFTER INPUT

MODULE mod AT EXIT-COMMAND.

LOOP AT itab_table or LOOP "depending on whether we are using AT int_table

MODULE modify_int_table.

ENDLOOP.

MODULE user_command.

In the MODULE call modify_int_table we can use

MODIFY int_table FROM workarea INDEX tab_con-CURRENT_LINE

or we can use

int_table-field_name = screen_field_name.

go through this link

http://sap.niraj.tripod.com/id29.html

thanks

mrutyun^

Read only

former_member632991
Active Contributor
0 Likes
581

Hi

the problem is that u have not mentioned the loop and endloop stamnt in the PAI and PBO. since table contro is used...write this statement.

see the below code for addding and updating the rows.

Similarly for deleting..use delete instead of insert.

----


***INCLUDE MZ_TABLECONTROL1_USER_COMMAI01 .

----


&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE SY-UCOMM.

WHEN 'CANCEL'.

LEAVE PROGRAM.

WHEN 'UPDATE'.

PERFORM UPDATE.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Form UPDATE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM UPDATE .

MODIFY ZTABLE FROM ITAB.

ENDFORM. " UPDATE

&----


*& Module DATA_FROM_CTRL INPUT

&----


  • text

----


MODULE DATA_FROM_CTRL INPUT.

ITAB-BUKRS = ZTABLE-BUKRS.

ITAB-KUNNR = ZTABLE-KUNNR.

ITAB-NAME = ZTABLE-NAME.

MODIFY ITAB INDEX TAB_CTRL-CURRENT_LINE.

IF SY-SUBRC <> 0.

APPEND ITAB.

ENDIF.

ENDMODULE. " DATA_FROM_CTRL INPUT

----


***INCLUDE MZ_TABLECONTROL1_DATA_TO_CTO01 .

----


&----


*& Module DATA_TO_CTRL OUTPUT

&----


  • text

----


MODULE DATA_TO_CTRL OUTPUT.

READ TABLE ITAB INDEX TAB_CTRL-CURRENT_LINE.

IF SY-SUBRC = 0.

ZTABLE-KUNNR = ITAB-KUNNR.

ZTABLE-NAME = ITAB-NAME.

ENDIF.

ENDMODULE. " DATA_TO_CTRL OUTPUT

----


***INCLUDE MZ_TABLECONTROL1_SELECTO01 .

----


&----


*& Module SELECT OUTPUT

&----


  • text

----


MODULE SELECT OUTPUT.

SELECT * FROM ZTABLE INTO TABLE ITAB WHERE BUKRS = ZTABLE-BUKRS.

ENDMODULE. " SELECT OUTPUT

----


***INCLUDE MZ_TABLECONTROL1_STATUS_010O01 .

----


&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GUI'.

SET TITLEBAR 'ABC'.

ENDMODULE. " STATUS_0100 OUTPUT

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

MODULE SELECT.

LOOP WITH CONTROL TAB_CTRL.

MODULE DATA_TO_CTRL.

ENDLOOP.

*

PROCESS AFTER INPUT.

LOOP WITH CONTROL TAB_CTRL.

MODULE DATA_FROM_CTRL.

ENDLOOP.

MODULE USER_COMMAND_0100.