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 wizard

Former Member
0 Kudos

Hi Experts,

My requirement is to display one line by default in the table control. When the user selects the insert button, one more line should get inserted after the first line.

I am using table control wizard to display the table with insert and delete buttons. When I press insert button the line is getting inserted before the entered line instead of getting inserted after the entered line.

Please tell me how to restrict the number of lines in table control to 2. i.e one line should be displayed by default and the second line should get inserted after the first line when the user clicks on '+' button.

1 REPLY 1

former_member233090
Active Contributor
0 Kudos

Hi sharon,

Look at this example, you will get some idea....


REPORT  Z_DB_TABLECONTROL.TABLES: MARA.CONTROLS MATERIAL TYPE TABLEVIEW USING SCREEN 130.TYPES: BEGIN OF ST_MARA,
       MATNR TYPE MARA-MATNR,
       ERSDA TYPE MARA-ERSDA,
       ERNAM TYPE MARA-ERNAM,
       LAEDA TYPE MARA-LAEDA,
       END OF ST_MARA.DATA: IT_ST TYPE TABLE OF ST_MARA,
      WA_ST TYPE ST_MARA,
      IT_MARA TYPE MARA,
      WA_MARA TYPE MARA,
      OK_CODE LIKE SY-UCOMM.CALL SCREEN 130.*&---------------------------------------------------------------------*
*&      Module  V1  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE V1 INPUT.CASE OK_CODE.
WHEN 'SAVE'.WA_ST-MATNR = MARA-MATNR.
WA_ST-ERSDA = MARA-ERSDA.
WA_ST-ERNAM = MARA-ERNAM.
WA_ST-LAEDA = MARA-LAEDA.
MOVE-CORRESPONDING WA_ST TO WA_MARA.
INSERT INTO MARA VALUES WA_MARA.WHEN 'DELETE'.WA_ST-MATNR = MARA-MATNR.
WA_ST-ERSDA = MARA-ERSDA.
WA_ST-ERNAM = MARA-ERNAM.
WA_ST-LAEDA = MARA-LAEDA.MOVE-CORRESPONDING  WA_ST TO WA_MARA.DELETE MARA FROM WA_MARA.WHEN 'MODIFY'.WA_ST-MATNR = MARA-MATNR.
WA_ST-ERSDA = MARA-ERSDA.
WA_ST-ERNAM = MARA-ERNAM.
WA_ST-LAEDA = MARA-LAEDA.MOVE-CORRESPONDING  WA_ST TO WA_MARA.MODIFY MARA FROM WA_MARA.
ENDCASE.ENDMODULE.                 " V1  INPUT
*&---------------------------------------------------------------------*
*&      Module  EXIT  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE EXIT INPUT.
IF OK_CODE = 'EXIT'.
LEAVE PROGRAM.
ENDIF.ENDMODULE.                 " EXIT  INPUT

Edited by: Bhavana Amar on Mar 12, 2010 11:24 AM