‎2007 Jun 08 10:27 AM
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.
‎2007 Jun 08 10:37 AM
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 ...)
‎2007 Jun 08 10:30 AM
Hi
Check the below link:
http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
http://www.geocities.com/ZSAPcHAT
http://www.allsaplinks.com/files/using_table_in_screen.pdf
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
You can also check the transaction ABAPDOCU which gives you lot of sample programs.
Also you can see the below examples...
Go to se38 and give demodynpro and press F4.
YOu will get a list of demo module pool programs.
One more T-Code is ABAPDOCU.
YOu can find more examples there.
See the prgrams:
DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement
DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB
http://www.geocities.com/ZSAPcHAT
http://www.allsaplinks.com/files/using_table_in_screen.pdf
Reward points for useful Answers
Regards
Anji
‎2007 Jun 08 10:37 AM
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 ...)
‎2007 Jun 08 10:38 AM
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.
‎2007 Jun 08 10:39 AM
‎2007 Jun 08 10:44 AM
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.