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

Former Member
0 Likes
427

Hi Friends,

I am doing an object on table control i have doubt in logic which i have listed below

a. When insert Button is Pressed Blank record should be created in the next line of the Current Cursor position. User can enter a New record and SAVE, while saving 2 validations need to be done.

1.Finished Good should not be the repeated one.

2.Flag Value should be in the Range of 00 to 99 or Y. Else error message.

b. When user selects one or more records and Press Delete button, POP UP should show asking, u2018Are you sure for Deletion of Selected Recordsu2019 ,if he Press Yes ,we can Delete the records.

this all should be done table control without wizard. Please help me with code.

Thanks & Regards,

Gayathri S

4 REPLIES 4
Read only

Former Member
0 Likes
387

Hi,

1. While designing set the table control as input field.

2. In ur program create an internal table, with the same structure as your table control.

3. Whenever an entry is made in the table control, modify your internal table.

4. While saving use the internal table data to update the custom table.

If internal table name is same in both screen painter(table control) and in the program then the values will automatically come into the internal table in the program with out programming.

Otherwise we have programtically transfer the values.

In the PAI event using move or move-corresponding statement.

this program will help you

Check the program RSDEMO02

loop at itab and check wheather is there any duplicates for Finished Good, then display message.

for popup use popup_to_confirm module

Yogesh N

Read only

Former Member
0 Likes
387

while inserting use

GET CURSOR Line line

if tc-top_line > 1.

LINE = LINE + ( TC-TOP_LINE - 1 ).

endif.

now clear wa_itab.

now insert wa_itab to itab index line.

this will ionsert blank line next to selected line.

Read only

Former Member
0 Likes
387

Hi,

try like this...

1.for inserting a row.

case ok_code.
when 'INSERT'.
if v_index is  initial.
   get cursor line  v_line.
   move : v_line to v_index.
   v_index = v_index + 1.
   insert initial line into itab index v_index.
endif.
   tc-lines = v_lines + 1.
endcase.

2.for validating.

process after input.
  loop at itab.
   field  itab-field1 module check.
   field  itab-field2 module check1.
  endloop.

in the modules write the code for validating.

3. for deleting.

when 'DELETE'. 
 
call function popup_to_confirm.

Regards,

Sathish Reddy.

Read only

Former Member
0 Likes
387

Hi Gayitri,

I am giving the logic for your second point ie for deleting the records:

Before implementing this code define a variable 'MARK' in the table control properties in the w/selcolumn input field.

This below module must be placed inside the Loop of the PAI module.

MODULE READ_TABLE_CONTROL INPUT.

DATA : MARK ,

L_ANSWER1 TYPE C.

IF SY-UCOMM EQ 'DELETE'.

IF MARK <> 'X' .

READ TABLE GIT_TAB_CTRL_102 INTO GWA_TAB_CTRL_102 INDEX TAB_CTRL-CURRENT_LINE.

APPEND GWA_TAB_CTRL_102 TO GIT_TAB_CTRL_12.

ENDIF.

ENDIF.

ENDMODULE. " READ_TABLE_CONTROL INPUT

This below module must be placed outside the Loop in the PAI module.

Constants: GC_1(1) TYPE C VALUE '1',

MODULE DELETE_OPTION INPUT.

IF SY-UCOMM = 'DELETE'.

*To display a popup screen

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = Delete Entries

TEXT_QUESTION = 'Do you want to Delete the selected Row?

TEXT_BUTTON_1 = Yes "(004)

TEXT_BUTTON_2 = No "'No'(005)

DEFAULT_BUTTON = GC_1

DISPLAY_CANCEL_BUTTON = ' '

START_COLUMN = 20

START_ROW = 6

IMPORTING

ANSWER = L_ANSWER1.

IF L_ANSWER1 = 1.

REFRESH : GIT_TAB_CTRL_102.

LOOP AT GIT_TAB_CTRL_12 INTO GWA_TAB_CTRL_102.

APPEND GWA_TAB_CTRL_102 TO GIT_TAB_CTRL_102.

ENDLOOP.

ENDIF.

REFRESH : GIT_TAB_CTRL_12.

ENDIF.

ENDMODULE. " DELETE_OPTION INPUT