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 programming

Former Member
0 Likes
737

hi friends,

i created a employee table in which i gave the fields as empno,empname,empcountry.now i placed buttons like insert,update,delete,display

in the screen painter.now i want to write a code for each of these buttons like when i click on insert it should insert some data,when delete

it should delete.like that i want to write a code for all buttons.

please helpme.

points will be rewarded.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
706

Hi Mahesh,

I have written some logic for ur requirement....

Just try it...

Module Input.

Case SY-UCOMM.

When 'DISP'.

Select Single * from zstudent where Employeetable = empno.

When 'INSE'.

INSERT Employeetable.

IF SY-DBCNT <> 0.

Msg 'Records Added' type 's'.

endif.

When 'DELE'.

Delete Employeetable where employeetable = empno.

When 'UPDA'.

UPDATE Employeetable.

Endcase.

Regards..

Balaji (Assign points if this helps u ...)

5 REPLIES 5
Read only

Former Member
Read only

Former Member
0 Likes
707

Hi Mahesh,

I have written some logic for ur requirement....

Just try it...

Module Input.

Case SY-UCOMM.

When 'DISP'.

Select Single * from zstudent where Employeetable = empno.

When 'INSE'.

INSERT Employeetable.

IF SY-DBCNT <> 0.

Msg 'Records Added' type 's'.

endif.

When 'DELE'.

Delete Employeetable where employeetable = empno.

When 'UPDA'.

UPDATE Employeetable.

Endcase.

Regards..

Balaji (Assign points if this helps u ...)

Read only

Former Member
0 Likes
706

hi simhadri,

at pai u can write this code,

case sy-ucomm.

select item material amount from zekpo into corresponding fields of table

g_itab_pur where porder = zekko-porder.

case sy-ucomm.

when 'DISPLAY'.

read table g_itab_pur with key porder = zekko-porder.

if g_itab_pur[] is initial.

message i000(zsmpbv).

endif.

when 'INSERT'.

if g_itab_pur-item = 'X'.

g_itab_pur-item = ''.

move-corresponding zekpo to g_itab_pur.

insert into zekpo values g_itab_pur.

else.

move-corresponding zekpo to g_itab_pur.

insert into zekpo values g_itab_pur.

  • IF sy-subrc = 4.

  • MESSAGE i020(zsmpbv).

  • ENDIF.

  • ENDLOOP.

  • l_upd_flag = 'X'.

endif.

when 'UPDATE'.

move-corresponding zekpo to g_itab_pur.

append g_itab_pur.

update zekpo from table g_itab_pur.

l_upd_flag = 'X'.

when 'DELETE'.

read table g_itab_pur index tcontrol-current_line.

if sy-subrc eq 0.

call function 'POPUP_TO_CONFIRM'

exporting

titlebar = 'DELETE'

text_question = 'TEXT-001'

text_button_1 = 'YES'

text_button_2 = 'NO'

display_cancel_button = 'X'

importing

answer = l_ans

exceptions

text_not_found = 1

others = 2.

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

if l_ans = '1'.

delete from zekpo where porder = zekko-porder.

else.

exit.

endif.

endif.

endcase.

regrard,

seshu.

Read only

Former Member
0 Likes
706

Hi,

U can write coding in the PAI of that Particular Screen using Function Code.

For More Info on Dialog Programming go thru the Following Threads,

Regards,

Padmam.

Read only

Former Member
0 Likes
706

hi,

while creating fields in screen follow this navigation goto -> select dictionary fileds -> give table name -> select required fields -> drag n drop on screen.

in FLOW LOGIC

TABLES:zstudent.

data: itab like zstudent occurs 0 with header line.

in pbo event,

case sy-ucomm.

when 'INSERT'.

itab-empname = ' '.

itab-empno = ' '.

.............

.............

append itab.

modify zstudent from itab.

when 'DELETE'.

loop at itab where itab-empno = ' '.

delete zstudent from itab.

endloop.

when 'DISPLAY'.

select * from zstudent into table itab.

loop at itab.

write: itab-empno,

...............

.............

endloop.

when 'EXIT'.

leave program.

endcase.

if useful reward some points.

with regards,

suresh.