‎2007 Sep 17 11:02 AM
hi freinds ,
my requirement is create one screen and allow user to enter data
entered data should be stored in ztable .
can any one give sample program for the above.
thanks®ards,
soorya
‎2007 Sep 17 12:09 PM
Hi Soorya,
The strategy is to create a screen and provide a table control/tabstrip or simple screen structures like fields and buttons or a combination of all to allow users to enter data for the Ztable...then on save(button click) the data needs to be passed to the ztable...
in basic there will be a screen...created using call screen screen-number.
in the screen the relevent data structure or screen fields are placed...
in PBO of the screen we can provide the user default values and in PAI..we capture data from the user(using button clicks) and do necessary manipulations like validations,saving,updating,deleting etc by capturing the sy-ucomm or user command..on clicking the save you need to do a select query on the Ztable and see if the key fields entered by the user is not already present...if so..give a message..otherwise save the data to the Ztable using an insert command
for sample programs..
go to SE38 -> check the flow of data in the code for programs
demo_dynpro_module.
demo_dynpro_value_select
demo_dynpro_modify_simple
demo_dynpro_tabcont_loop_at
consider the example:
PROGRAM demo_dynpro_module.
TABLES demo_conn.
DATA: ok_code TYPE sy-ucomm,
save_ok LIKE ok_code,
wa_spfli TYPE spfli.
CALL SCREEN 100.
MODULE init_screen_100 OUTPUT.
MOVE-CORRESPONDING wa_spfli TO demo_conn.
ENDMODULE.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_100'.
SET TITLEBAR '100'.
ENDMODULE.
MODULE clear_ok_code INPUT.
save_ok = ok_code.
CLEAR ok_code.
ENDMODULE.
MODULE get_data INPUT.
MOVE-CORRESPONDING demo_conn TO wa_spfli.
CLEAR demo_conn.
ENDMODULE.
MODULE user_command_0100 INPUT.
CASE sy-dynnr.
WHEN 0100.
CASE save_ok.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN 'DISPLAY'.
PERFORM read_data.
WHEN 'CLEAR'.
CLEAR wa_spfli.
ENDCASE.
...
ENDCASE.
ENDMODULE.
FORM read_data.
SELECT SINGLE
cityfrom airpfrom cityto
airpto fltime deptime arrtime
INTO CORRESPONDING FIELDS OF wa_spfli
FROM spfli
WHERE carrid = wa_spfli-carrid AND
connid = wa_spfli-connid.
ENDFORM.
Pls revert back if you are stuck with a specific problem..and reward if helpful..
Regards
Byju
‎2007 Sep 17 11:05 AM
hi
PROGRAM YVTRANS.
TABLES : ZEMP.
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module USER_COMMAND_0100 input.
case sy-ucomm.
when 'INSERT'.
insert zemp.
if sy-subrc <> 0.
message i000(0) with 'record not inserted'.
else.
message i000(0) with 'record inserted'.
endif.
when 'EXIT'.
leave program.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
reward for use ful answerss
regarsds
Nagesh.Paruchuri
‎2007 Sep 17 12:09 PM
Hi Soorya,
The strategy is to create a screen and provide a table control/tabstrip or simple screen structures like fields and buttons or a combination of all to allow users to enter data for the Ztable...then on save(button click) the data needs to be passed to the ztable...
in basic there will be a screen...created using call screen screen-number.
in the screen the relevent data structure or screen fields are placed...
in PBO of the screen we can provide the user default values and in PAI..we capture data from the user(using button clicks) and do necessary manipulations like validations,saving,updating,deleting etc by capturing the sy-ucomm or user command..on clicking the save you need to do a select query on the Ztable and see if the key fields entered by the user is not already present...if so..give a message..otherwise save the data to the Ztable using an insert command
for sample programs..
go to SE38 -> check the flow of data in the code for programs
demo_dynpro_module.
demo_dynpro_value_select
demo_dynpro_modify_simple
demo_dynpro_tabcont_loop_at
consider the example:
PROGRAM demo_dynpro_module.
TABLES demo_conn.
DATA: ok_code TYPE sy-ucomm,
save_ok LIKE ok_code,
wa_spfli TYPE spfli.
CALL SCREEN 100.
MODULE init_screen_100 OUTPUT.
MOVE-CORRESPONDING wa_spfli TO demo_conn.
ENDMODULE.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_100'.
SET TITLEBAR '100'.
ENDMODULE.
MODULE clear_ok_code INPUT.
save_ok = ok_code.
CLEAR ok_code.
ENDMODULE.
MODULE get_data INPUT.
MOVE-CORRESPONDING demo_conn TO wa_spfli.
CLEAR demo_conn.
ENDMODULE.
MODULE user_command_0100 INPUT.
CASE sy-dynnr.
WHEN 0100.
CASE save_ok.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN 'DISPLAY'.
PERFORM read_data.
WHEN 'CLEAR'.
CLEAR wa_spfli.
ENDCASE.
...
ENDCASE.
ENDMODULE.
FORM read_data.
SELECT SINGLE
cityfrom airpfrom cityto
airpto fltime deptime arrtime
INTO CORRESPONDING FIELDS OF wa_spfli
FROM spfli
WHERE carrid = wa_spfli-carrid AND
connid = wa_spfli-connid.
ENDFORM.
Pls revert back if you are stuck with a specific problem..and reward if helpful..
Regards
Byju
‎2007 Sep 17 2:57 PM
hi friends,
i tried to modify ztable in module pool
between module and end module
but it gives me error '"THE WORK AREA ISNOT LONG ENOUGH".
plz can some one suggest me any idea.
regards
soorya
‎2007 Sep 18 11:14 AM
hi Soorya ,
Make sure the structure of the work area and the table structure are same .
Please cross varify the same .
Regards,
Ranjita
‎2007 Sep 17 1:23 PM
HI
You can get code from anywhere, but it wouldn't help to your learning. Please first have a look on the complete process of Module pool programming.
sapmaterial.com has good source of all topics...
http://www.sapmaterial.com/dialog_programming.html
Regards
Dinesh