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: 

Module pool using table control

Former Member
0 Kudos

Hi Friends,

I am working on a module pool program using table control. In this when insert Button is Pressed Blank record should be created in the next line of the Current Cursor position and it should be editable. When we select a row and press delete button it should delete that record.

Please help how to solve this.

Thanks & regards

Gayathri.

8 REPLIES 8

Former Member
0 Kudos

Hi,

Gothrough the following links,

I hope the above links will help you,

Regards,

Harish

Edited by: Harish Kumar on Sep 10, 2008 3:53 PM

Former Member
0 Kudos

Hi,

Making individual row editable in Table Control is not possible...

Use Editable ALV Grid as the functionality you are looking for is by-default available and you need not code for the same...

Regards,

Kunjal

Former Member
0 Kudos

Refer to this program,

DEMO_DYNPRO_TABCONT_LOOP

Regards

Indu

Former Member
0 Kudos

Hi Gayathri,

Here lineitem -


> Internal table.

Flag is a variable type c.

IN your internal table you should include a character field mark of type c.

CASE ok_code1.

  • when add button is pressed we add a new line to the table control

WHEN 'ADD'.

LOOP AT lineitem.

IF lineitem-mark = 'X'.

INSERT initial line INTO lineitem.

flag = '1'.

ENDIF.

ENDLOOP.

IF flag <> '1'.

APPEND INITIAL LINE TO lineitem.

ENDIF.

LOOP AT lineitem.

IF lineitem-ebelp IS INITIAL.

lineitem-ebelp = sy-tabix.

MODIFY lineitem .

ENDIF.

ENDLOOP.

CLEAR ok_code1.

  • When delete button is clicked delete the line

WHEN 'DELETE'.

LOOP AT lineitem.

IF lineitem-mark = 'X'.

MOVE-CORRESPONDING lineitem TO lineitem_delete.

APPEND lineitem_delete.

CLEAR lineitem_delete.

CLEAR lineitem.

DELETE lineitem.

ENDIF.

ENDLOOP.

CLEAR ok_code1.

Example inside your Top Include.

DATA: BEGIN OF lineitem OCCURS 0,

ebeln LIKE z01_ekpo-ebeln,

ebelp LIKE z01_ekpo-ebelp,

matnr LIKE z01_ekpo-matnr,

menge LIKE z01_ekpo-menge,

maktx LIKE makt-maktx,

netpr LIKE z01_price-netpr,

pwaers LIKE z01_price-waers,

meins LIKE z01_price-meinh,

netvalue LIKE z01_ekpo-netpr,

waers LIKE z01_ekko-waers,

mark TYPE c ,

END OF lineitem.

DATA : BEGIN OF lineitem_delete OCCURS 0.

INCLUDE STRUCTURE z01_ekpo.

DATA END OF lineitem_delete.

Regards,

Amit.

Former Member
0 Kudos

Hi,

In the PAI of the screen, for pushbutton event, write

For inserting a row.

CASE SY-UCOMM.

When 'INSERT'.

APPEND INITIAL LINE TO <workarea of tablecontrol(WA) >

For deleting a row,

When 'DELETE'.

LOOP AT <workarea of tablecontrol(WA)>.

IF WA-MARK = 'X'.

CLEAR WA.

DELETE WA.

ENDIF.

ENDLOOP.

ENDCASE.

IF WA-MARK here is for selecting a particular row and then deleting it.

If you know about this, you can use it or else I can explain on this.

Hope this helps you.

Regards

Natasha Garg

.

0 Kudos

Hi Natasha,

I didnt explain this logic will u explain me.

and i not using table control with wizard it is simple table control.

0 Kudos

Hi,

Yes its for simple table control only.

You can select rows in a table control. For that

Declare a variable of type char in the top include.

TYPES: BEGIN OF TY_LINE_TC,

EBELN TYPE ZG3_EKKO-EBELN,

EBELP TYPE ZG3_EKPO1-EBELP,

MATNR TYPE ZG3_EKPO1-MATNR,

MENGE TYPE ZG3_EKPO1-MENGE,

MAKTX TYPE MAKT-MAKTX,

PEINH TYPE ZG3_PRICE-PEINH,

WAERS TYPE ZG3_PRICE-WAERS,

MEINS TYPE ZG3_PRICE-MEINS,

NETPR TYPE EKPO-NETPR,

WAERS1 TYPE ZG3_EKKO-WAERS,

SELECT TYPE C, '' This is the variable

END OF TY_LINE_TC.

Go to screen painter of the screen in which table control is there.

Click on the table control. A window will appear. In the attributes, Line sel and Col sel Radiobuttons are there.

Choose multiple in both.

A checkbox is also there below the radiobuttons named w/ selcolumn.

Check that and put a variable name in the text box against that.

In the PAI, write

CASE SY-UCOMM.

WHEN 'ADD'.

APPEND INITIAL LINE TO <workarea of tablecontrol>.

WHEN 'DELETE'.

LOOP AT <workarea of tablecontrol>.

IF WA-SELECT = 'X'.

CLEAR WA.

DELETE WA.

ENDIF.

ENDLOOP.

ENDCASE.

I hope you got this now.

Revert back in case of issues.

Regards

Natasha Garg

0 Kudos

Hi Natasha,

I got the logic it was very helpful thanks a lot.

Regards,

Gayathri