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

DIALOG WITH TABLE CONTROL

Former Member
0 Likes
935

Hi,

I have problem in making dialog using table control, I have genrated the tablecontrol using its wizard. can any one send me the code , how to delete a line in tablecontrol and validate the record already exists

thanks

pankaj

6 REPLIES 6
Read only

Former Member
0 Likes
884

HI Bobby,

Could you try this.

MODULE populate_screen OUTPUT.

DATA: ld_line TYPE i.

  • Set which line of itab is at the top of the table control

IF sy-stepl = 1.

tc100-lines =

tc100-top_line + sy-loopc - 1.

ENDIF.

  • move fields from work area to scrren fields

MOVE-CORRESPONDING wa_ekko TO ztc_ekko.

ld_line = sy-stepl + tc100-top_line - 1.

  • Changes individual field attributes of table control,

  • Sets EBELN field on 3rd row of TC to not be an input field!

LOOP AT SCREEN.

IF ld_line EQ 3.

IF screen-name EQ 'ZTC_EKKO-EBELN'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

ENDMODULE. " populate_screen OUTPUT

Thanks & Regards,

YJR.

Read only

Former Member
0 Likes
884

HI

GOOD

GO THROUGH THSE LINKS WHICH WILL GIVE YOU BETTER IDEA ABOUT HOW TO CREATE A DIALOG IN THE TABLE CONTROL.

http://help.sap.com/saphelp_nw04/helpdata/en/d1/802338454211d189710000e8322d00/content.htm

http://www.sappoint.com/abap/its2.pdf

THANKS

MRUTYUN

Read only

Former Member
0 Likes
884

hi bobby,

MODULE modify INPUT.

IF v_check = 'X'.(is the name given to the checkbox in table control)

it_knbk-chk = 'X'.

MODIFY itab index tc1-current_line.

ELSE.

CLEAR itab.

ENDIF.

ENDMODULE.

MODULE user_command_0200 INPUT.

CASE v_ucomm.

WHEN 'DELE'.

DELETE itab where chk eq 'X'.

DESCRIBE TABLE itab LINES tc1-lines.

endcase.

endmodule.

hope this helps,

do reward if it helps,

priya.

Read only

Former Member
0 Likes
884

hi,

check this sample code.

controls tc1 type tableview using screen 0200.

data: v_kunnr like knbk-kunnr,

v_ucomm like sy-ucomm,

sno type c.

DATA: BEGIN OF IT_KNBK occurs 0,

BANKS LIKE KNBK-BANKS,

BANKL LIKE KNBK-BANKL,

BANKN LIKE KNBK-BANKN,

BKONT LIKE KNBK-BKONT,

KOINH LIKE KNBK-KOINH,

chk type c,

END OF IT_KNBK.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'XXX'.

SET TITLEBAR 'NAM'.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case sy-ucomm.

WHEN 'DISP' OR 'CHNG'.

IF V_KUNNR <> ''.

SELECT BANKS

BANKL

BANKN

BKONT

KOINH

FROM KNBK INTO TABLE IT_KNBK

WHERE KUNNR = V_KUNNR.

ENDIF.

V_UCOMM = SY-UCOMM.

LEAVE TO SCREEN 0200.

**call screen 200.

*WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.

*LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module STATUS_0200 OUTPUT

&----


  • text

----


MODULE STATUS_0200 OUTPUT.

  • SET PF-STATUS 'KKK'.

  • SET TITLEBAR 'TIT'.

IF V_UCOMM = 'DISP'.

LOOP AT SCREEN.

SCREEN-INPUT = 0.

modify screen.

ENDLOOP.

ENDIF.

ENDMODULE. " STATUS_0200 OUTPUT

&----


*& MODule MOD INPUT

&----


  • text

----


MODULE MOD INPUT.

IF SNO = 'X'.

IT_KNBK-CHK = 'X'.

MODIFY IT_KNBK INDEX TC1-CURRENT_LINE.

ELSE.

CLEAR IT_KNBK-CHK.

ENDIF.

ENDMODULE. " MOD INPUT

&----


*& Module USER_COMMAND_0200 INPUT

&----


  • text

----


MODULE USER_COMMAND_0200 INPUT.

CASE SY-UCOMM.

WHEN 'DEL'.

DELETE IT_KNBK WHERE CHK = 'X'.

CLEAR IT_KNBK-CHK.

DESCRIBE TABLE IT_KNBK LINES TC1-LINES.

WHEN 'SAVE'.

MODIFY IT_KNBK INDEX TC1-CURRENT_LINE.

DESCRIBE TABLE it_knbk LINES tc1-lines.

when 'INS'.

CLEAR IT_KNBK.

APPEND IT_KNBK.

DESCRIBE TABLE IT_KNBK LINES TC1-LINES.

when 'BACK'.

leave TO screen 100 .

*when 'EXIT' or 'CANCEL'.

*leave to screen 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_0200 INPUT

&----


*& Module exit INPUT

&----


  • text

regards,

keerthi.

Read only

Former Member
0 Likes
884

Hi,

see this progs:

DEMO_DYNPRO_TABLE_CONTROL_1

DEMO_DYNPRO_TABLE_CONTROL_2

<b>For deleting records</b> - Here, I display all records in the TC and allow user to select whcih record he wants to delete by selecting the particular line. For this, in the PAI event, check which reocrds have mark set to 'x'. These records are the ones that have been selected for deletion.(This is one of the reasons why the line selection option needs to be set)

loop at itab into wa where mark = 'X'.

move itab to wa.

delete zak_presc from wa.

delete itab.

endloop.

rgds,

latheesh

Message was edited by: Latheesh Kaduthara

Read only

Former Member
0 Likes
884

hI,

CHECK THIS DEMO<b> RSDEMO02</b>

Regards

vijay