2014 Apr 23 10:56 AM
Dear gurus,
can any 1 help me?
How to create module pool programming for application form?
i have created modulepool .
have look from the attachment.
i was stuck in saving the recordin z table.
can any 1 help mewith that how to proceed further.
Thanks
Reagrds
Prathmesh Rane.
2014 Apr 23 11:20 AM
hi Rane,
You should have assigned a function code to your button SAVE lets say F_SAV. So when a user presses the button, sy-ucomm/ok code is captured as F_SAV. In the PAI, write the logic for condition IF OK_CODE = F_SAV. save the data to database. ENDIF.
this is a very easy thing and you can find a lot of good examples.
Kindly revert of still in doubt.
Regards,
DN.
2014 Apr 23 11:52 AM
Hi,
Have you defined the function code for SAVE and also have you declared the sy-ucomm in element list of screen?
Regards
Anand
2014 Apr 23 11:54 AM
Hi,
try this code, it will helps you.
TYPES : BEGIN OF st_table,
name TYPE zztable2-name,
mobileno TYPE zztable2-mobileno,
dat TYPE zztable2-dat,
gender TYPE zztable2-gender,
education TYPE zztable2-education,
END OF st_table.
data : i_tab TYPE TABLE OF st_table,
w_tab TYPE st_table.
data : name TYPE char20<your datatype and length>,
MOBILENO TYPE numc10<your datatype and length>,
DAT TYPE dats.
data : male,<radiobutton name as per your screen>
female,<radiobutton name as per your screen>
hsc,<checkbox name as per your screen>
ssc,<checkbox name as per your screen>
degree.<checkbox name as per your screen>
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module STATUS_0100 output.
SET PF-STATUS 'ZSTAT'.
* SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
IF sy-ucomm = 'SAVE'.
clear w_tab.
w_tab-name = name.
w_tab-MOBILENO = MOBILENO.
w_tab-DAT = DAT.
IF male = 'X'.
w_tab-gender = 'MALE'.
elseif female = 'X'.
w_tab-gender = 'FEMALE'.
ENDIF.
IF HSC = 'X'.
w_tab-education = 'HSC'.
ELSEIF SSC = 'X'.
w_tab-education = 'SSC'.
ELSEIF DEGREE = 'X'.
w_tab-education = 'DEGREE'.
ENDIF.
APPEND w_tab to i_tab.
MODIFY zztable2 FROM table i_tab.
ENDIF.
IF sy-ucomm = 'BACK'.
leave to SCREEN 0.
ENDIF.
endmodule. " USER_COMMAND_0100 INPUT
2014 Apr 25 7:45 AM
hi
I create all those thing but my requirement is application num is no editable.
what should i do next?
help me
Thanks
Regards
Prathmesh Rane.
2014 Apr 25 7:50 AM
Hi,
Can you please explain more about Application No.
I can't understand exactly.
2014 Apr 25 8:41 AM
hello,
I have created a application form as u just see from the screen shot.
i want my application number to be Non Editable that means whenever i will be running my program so application number 1 should be generated.and then it should be save the records in the Z-Table,and the again when i will be running the program, it should generate automatically apllication number 2.
2014 Apr 25 8:53 AM
Hello Rane,
You have to create number range for application no to generate numbers sequentially.
Please go through the below link which shows how to create and use number range.
http://wiki.scn.sap.com/wiki/display/ABAP/How+to+Create+you+own+Number+Range++SNRO
Thanks
2014 Apr 25 9:26 AM
Hi,
Try this code,
i tried this code, it is working.
I will helps you.
*&---------------------------------------------------------------------*
*& Module Pool SAPMZMPP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
INCLUDE MZMPPTOP . " global Data
* INCLUDE MZMPPO01 . " PBO-Modules
* INCLUDE MZMPPI01 . " PAI-Modules
* INCLUDE MZMPPF01 . " FORM-Routines
TYPES : BEGIN OF st_table,
appno TYPE zztable2-appno,
name TYPE zztable2-name,
mobileno TYPE zztable2-mobileno,
dat TYPE zztable2-dat,
gender TYPE zztable2-gender,
education TYPE zztable2-education,
END OF st_table.
data : i_tab TYPE TABLE OF st_table,
w_tab TYPE st_table.
data : appno TYPE zztable2-appno,
name TYPE char20,
MOBILENO TYPE numc10,
DAT TYPE dats.
TABLES zztable2.
data : i_tab1 TYPE TABLE OF zztable2,
w_tab1 TYPE zztable2.
data v_num type zztable2-appno.
data : male,
female,
hsc,
ssc,
degree.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module STATUS_0100 output.
SELECT SINGLE MAX( appno ) FROM zztable2 INto w_tab1.
SET PF-STATUS 'ZSTAT'.
* SET TITLEBAR 'xxx'.
v_num = w_tab1-appno.
if appno NE v_num.
appno = v_num + 1.
endif.
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
IF sy-ucomm = 'SAVE'.
clear w_tab.
w_tab-appno = appno.
w_tab-name = name.
w_tab-MOBILENO = MOBILENO.
w_tab-DAT = DAT.
IF male = 'X'.
w_tab-gender = 'MALE'.
elseif female = 'X'.
w_tab-gender = 'FEMALE'.
ENDIF.
IF HSC = 'X'.
w_tab-education = 'HSC'.
ELSEIF SSC = 'X'.
w_tab-education = 'SSC'.
ELSEIF DEGREE = 'X'.
w_tab-education = 'DEGREE'.
ENDIF.
APPEND w_tab to i_tab.
clear w_tab1.
MODIFY zztable2 FROM table i_tab.
ENDIF.
IF sy-ucomm = 'BACK'.
leave to SCREEN 0.
ENDIF.
endmodule. " USER_COMMAND_0100 INPUT
2014 Apr 25 10:31 AM
Hello,
Thanku for helping me.
now my program is running.
if i got stuck any where u i ll contact u.
Thanks
Regards
Prathmesh Rane.
2014 Apr 25 10:55 AM
2014 Apr 25 11:27 AM
Hello
No i am not facing problem right now
but thanks a lot for helping me.
and if i got stuck in future i ll contacting u.
2014 Apr 25 11:32 AM
Hi rane,
if the reply is helpful for you requirement please close this, and mark as helpful answer or correct answer.
2014 Apr 28 5:43 AM
Hello,
I was stuck in save the the record in ztable?
what should i do?
means my half of the record is save but half of the record is not save?
i.e my redio button and education field is clicked but this field is not save in the record?
what should i do next?
Thanks
Regards
Prathmesh Rane.
2014 Apr 28 5:54 AM
Hi Rane,
Can you please paste your code, screen layout names (radio buttons and check boxs) and screen shot of your Ztable fields.
2014 Apr 28 6:16 AM
hello,
it is the code.
*&---------------------------------------------------------------------*
*& Module Pool ZAPP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
PROGRAM ZAPP.
*&---------------------------------------------------------------------*
*& Module STATUS_1000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
TYPES : BEGIN OF t_ztab,
appno TYPE ztable2-appno,
name TYPE ztable2-name,
mono TYPE ztable2-mono,
zdate TYPE ztable2-zdate,
male TYPE ztable2-male,
female TYPE ztable2-female,
ssc TYPE ztable2-ssc,
hsc TYPE ztable2-hsc,
degree TYPE ztable2-degree,
education TYPE ztable2-education,
End OF t_ztab.
DATA : it_ztab TYPE STANDARD TABLE OF t_ztab,
wa_ztab TYPE t_ztab.
DATA : OK_CODE LIKE SY-UCOMM.
DATA : W_ssc TYPE c,
W_hsc TYPE c,
W_degree TYPE c,
W_name1 TYPE c,
W_aapno TYPE c,
W_rad1 TYPE c,
W_rad2 TYPE c,
W_mono1 TYPE i,
W_date1 TYPE SY-DATUM,
W_save type c,
W_exit type c,
W_education type c,
W_v_num TYPE c.
DATA : appno(20) TYPE c,
name1(30) TYPE c,
mono1 TYPE ztable2-mono,
date1 TYPE SY-DATUM ,
rad1(10) TYPE c ,
rad2(10) TYPE c ,
ssc(10) TYPE c ,
hsc(10) TYPE c ,
degree(10) TYPE c ,
save(10) TYPE c ,
exit(10) TYPE c,
education(10) TYPE c,
v_num(10) TYPE c.
*DATA : date1 TYPE WORKFLDS-GKDAY.
START-OF-SELECTION.
*SELECT * from ztable2 into CORRESPONDING FIELDS OF TABLE it_ztab .
*----------------------------------------------------------------------*
* MODULE STATUS_1000 OUTPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE STATUS_1000 OUTPUT.
SELECT SINGLE MAX( appno ) FROM ztable2 INto wa_ztab.
SET PF-STATUS 'STATUS'.
v_num = wa_ztab-appno.
if appno NE v_num.
appno = appno + 1.
endif.
ENdmodule.
MODULE MODIFY_SCREEN.
SET TITLEBAR 'TITLE'.
*----------------------------------------------------------------------*
* MODULE CHECK_VALUES
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
*MODULE CHECK_VALUES .
ENDMODULE. " STATUS_1000 OUTPUT
MODULE USER_COMMAND_1000 INPUT.
IF SY-UCOMM = 'RADIO' AND RAD1 = 'X'.
MESSAGE 'male is clicked' TYPE 'c'.
ELSEIF SY-UCOMM = 'RADIO' AND RAD2 = 'X'.
MESSAGE 'female is clicked' TYPE 'c'.
ENDIF.
* IF sy-ucomm = 'SAVE'.
* clear w_tab.
* w_tab-name = name.
* w_tab-MOBILENO = MOBILENO.
* w_tab-DAT = DAT.
* IF male = 'X'.
* w_tab-gender = 'MALE'.
* elseif female = 'X'.
* w_tab-gender = 'FEMALE'.
* ENDIF.
IF HSC = 'X'.
Wa_ztab-education = 'HSC'.
ELSEIF SSC = 'X'.
Wa_ztab-education = 'SSC'.
ELSEIF DEGREE = 'X'.
WA_ztab-education = 'DEGREE'.
ENDIF.
MODIFY ztable2 FROM wa_ztab.
APPEND wa_ztab to it_ztab.
IF sy-ucomm = 'BACK'.
leave to SCREEN 0.
ENDIF.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'SAVE'.
PERFORM s1.
WHEN 'NEXT'.
call SCREEN 1002.
ENDCASE.
ENDMODULE. "USER_COMMAND_1000 INPUT
*&---------------------------------------------------------------------*
*& Form s1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*IF OK_CODE EQ 'DISPLAY'.
* LEAVE TO LIST-PROCESSING.
* SELECT SINGLE ssc hsc degree FROM education INTO (W_ssc, W_hsc, W_degree) WHERE education = education.
* IF ssc EQ 'X'.
* WRITE : W_ssc.
* ssc = W_ssc.
* ENDIF.
* IF hsc EQ 'X'.
* WRITE : W_hsc.
* hsc = W_hsc.
* ENDIF.
* IF degree EQ 'X'.
* degree = W_degree.
* WRITE : W_degree.
* ENDIF.
form s1.
wa_ztab-appno = appno.
wa_ztab-name = name1.
wa_ztab-mono = mono1.
*wa_ztab-date = date1.
*wa_ztab-male = male.
*wa_ztab-female = female.
* LOOP AT it_ztab INTO wa_ztab.
INSERT INTO ztable2 values wa_ztab.
* ENDLOOP.
ENDFORM. " USER_COMMAND_1000 INPUT
*&---------------------------------------------------------------------*
*& Module F4_DATE INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE F4_DATE INPUT.
CALL FUNCTION 'F4_DATE'
EXPORTING
DATE_FOR_FIRST_MONTH = date1
DISPLAY = ' '
* FACTORY_CALENDAR_ID = ' '
* GREGORIAN_CALENDAR_FLAG = ' '
* HOLIDAY_CALENDAR_ID = ' '
* PROGNAME_FOR_FIRST_MONTH = ' '
IMPORTING
SELECT_DATE = date1
* SELECT_WEEK =
* SELECT_WEEK_BEGIN =
* SELECT_WEEK_END =
EXCEPTIONS
* CALENDAR_BUFFER_NOT_LOADABLE = 1
* DATE_AFTER_RANGE = 2
* DATE_BEFORE_RANGE = 3
* DATE_INVALID = 4
* FACTORY_CALENDAR_NOT_FOUND = 5
* HOLIDAY_CALENDAR_NOT_FOUND = 6
* PARAMETER_CONFLICT = 7
OTHERS = 4
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDMODULE. " F4_DATE INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_1002 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_1002 OUTPUT.
SET PF-STATUS 'ZMENU'.
SET TITLEBAR 'TITLE'.
ENDMODULE.
" STATUS_1002 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_1002 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_1002 INPUT.
IF sy-ucomm = 'BACK'.
CALL SCREEN 1000.
ENDIF.
ENDMODULE.
" USER_COMMAND_1002 INPUT
Help me
2014 Apr 28 6:29 AM
Hi Rane,
Did you use this code for saving the radio button and check box data.
Actually this code is working properly.
IF male = 'X'.
w_tab-gender = 'MALE'.
elseif female = 'X'.
w_tab-gender = 'FEMALE'.
ENDIF.
IF HSC = 'X'.
w_tab-education = 'HSC'.
ELSEIF SSC = 'X'.
w_tab-education = 'SSC'.
ELSEIF DEGREE = 'X'.
w_tab-education = 'DEGREE'.
ENDIF.
APPEND w_tab to i_tab.
clear w_tab1.
MODIFY zztable2 FROM table i_tab.
ENDIF.
2014 Apr 28 6:56 AM
hello,
this code is not working.
when i save the record
my entry of ztable look like as
so what sould i do?
2014 Apr 28 7:08 AM
Hi,
Do you want to fill the details for Education and gender only or MALE, FEMALE, HSC, SSC, DEGREE also and I could not understand your code under SAVE Button ie. Data filling and data save to ztable.
2014 Apr 28 7:26 AM
hi,
i want
when i clicked male then my record will be save in ztable male.
same as female.
and
when i check ssc or hsc or degree then those field are save in ztable
means out of 3 field i check only 2 field and save button clicked then those 2 field should be display in ztable.
same also male and female.
2014 Apr 28 9:25 AM
2014 Apr 28 9:56 AM
hi.
Yes i want exactly this
so what should i do for this output.
2014 Apr 28 10:10 AM
Hi Rane,
first design your screen with these names
After that in your program try this code.
*&---------------------------------------------------------------------*
*& Module Pool SAPMZMPP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
INCLUDE MZMPPTOP . " global Data
* INCLUDE MZMPPO01 . " PBO-Modules
* INCLUDE MZMPPI01 . " PAI-Modules
* INCLUDE MZMPPF01 . " FORM-Routines
TYPES : BEGIN OF st_table,
appno TYPE zztable2-appno,
name TYPE zztable2-name,
mobileno TYPE zztable2-mobileno,
dat TYPE zztable2-dat,
gender TYPE zztable2-gender,
education TYPE zztable2-education,
MALE TYPE zztable2-male,
FEMALE TYPE zztable2-female,
SSC TYPE zztable2-hsc,
HSC TYPE zztable2-ssc,
DEGREE TYPE zztable2-degree,
END OF st_table.
data : i_tab TYPE TABLE OF st_table,
w_tab TYPE st_table.
data : appno TYPE zztable2-appno,
name TYPE char20,
MOBILENO TYPE numc10,
DAT TYPE dats.
data : i_tab1 TYPE TABLE OF zztable2,
w_tab1 TYPE zztable2.
data v_num type zztable2-appno.
data : male,
female,
hsc,
ssc,
degree.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module STATUS_0100 output.
SELECT SINGLE MAX( appno ) FROM zztable2 INto w_tab1.
SET PF-STATUS 'ZSTAT'.
* SET TITLEBAR 'xxx'.
IF w_tab1-appno is INITIAL.
w_tab1-appno = 1.
appno = w_tab1-appno.
else.
v_num = w_tab1-appno.
if appno NE v_num.
appno = v_num + 1.
endif.
endif.
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
IF sy-ucomm = 'SAVE'.
clear w_tab.
w_tab-appno = appno.
w_tab-name = name.
w_tab-MOBILENO = MOBILENO.
w_tab-DAT = DAT.
IF male = 'X'.
w_tab-gender = 'MALE'.
w_tab-male = 'MALE'.
elseif female = 'X'.
w_tab-gender = 'FEMALE'.
w_tab-female = 'FEMALE'.
ENDIF.
IF HSC = 'X' and SSC = 'X'.
w_tab-HSC = 'HSC'.
w_tab-SSC = 'SSC'.
ELSEIF SSC = 'X' and DEGREE = 'X'.
w_tab-SSC = 'SSC'.
w_tab-degree = 'DEGREEE'.
ELSEIF DEGREE = 'X' and HSC = 'X'.
w_tab-degree = 'DEGREE'.
w_tab-HSC = 'HSC'.
ENDIF.
APPEND w_tab to i_tab.
clear w_tab1.
MODIFY zztable2 FROM table i_tab.
ENDIF.
IF sy-ucomm = 'BACK'.
leave to SCREEN 0.
ENDIF.
endmodule. " USER_COMMAND_0100 INPUT.
2014 Apr 28 11:30 AM
Hi,
In ur opinion i tried but male an female fields are not save in the zatable.
all data is save in the ztable but only male or female not display in zatble
what should i do next?
2014 Apr 28 11:34 AM
can you paste the code for filling MALE and FEMALE tell me what is the data type of male and female in your table.
I declared char6.
I think you declared as char 10.
so once change the data type as char6 and try it.
2014 Apr 28 11:44 AM
2014 Apr 28 11:51 AM
Is there any error,
did you check the data type of male and female in your table.
and please paste the screen shot of your data in table.
Did you check in debugging mode if the radio button male or female values ' X' or not.
2014 Apr 28 12:06 PM
hi,
There is no error but male and female is not save in the ztable.
when i debugging there is male or female value is not fetching.
2014 Apr 28 12:11 PM
can you change the data type of gender, male and female data type as char6 in your ztable.
and once you check in layout the radio buttons male and female names as male and female.
2014 Apr 28 1:20 PM
hi,
Now
there is no error.in 1st screen.
all entry save in ztable.
my next requirment is
but igot stuck in second screen ie display screen means when i clicked next button then 2nd screen is open and that screen is application number is editable.whenever i have enter application num and i clicked submit thn this record will be display but there is no display in screen ?
what should i do?
2014 Apr 28 1:33 PM
Hi Rane,
If you solved previous requirement please mark as Helpful answer or correct answer.
2014 Apr 29 5:28 AM
Hello lakshmi,
I will definately do it.
but igot stuck in second screen ie display screen means when i clicked next button then 2nd screen is open and that
application number is editable.whenever i have enter application num and i clicked submit thn this record will be display but there is no display in screen ?
what should i do?
2014 Apr 29 8:25 AM
Hi Rane,
Try this Code for your second screen,
IF sy-ucomm = 'SUB'.
CLEAR w_tab.
SELECT SINGLE * FROM zztable2 INTO w_tab WHERE appno = APP1.
name1 = w_tab-name.
mobile1 = w_tab-mobileno.
dat1 = w_tab-dat.
IF w_tab-gender = 'MALE'.
male1 = 'X'.
else.
male1 = ' '.
ENDIF.
IF w_tab-gender = 'FEMALE'.
female1 = 'X'.
else.
female1 = ' '.
ENDIF.
clear : ssc1,hsc1,degree1.
if w_tab-ssc = 'SSC' and w_tab-hsc = 'HSC'.
ssc1 = 'X'.
hsc1 = 'X'.
ELSEIF w_tab-hsc = 'HSC' and w_tab-degree = 'DEGREE'.
hsc1 = 'X'.
degree1 = 'X'.
ELSEIF w_tab-degree = 'DEGREE' and w_tab-ssc = 'SSC'.
ssc1 = 'X'.
degree1 = 'X'.
endif.
ENDIF.
2014 Apr 29 10:01 AM
2014 Apr 29 10:08 AM
hi lakshmi,
in first screen when i click save button then all record should be save in ztable and that particular time status messege should be display on the screen?
so,what what should i do to get the status meesege?
2014 Apr 29 10:33 AM
Hi rane,
Try this syntax after modify statment.
MODIFY zztable2 FROM table i_tab.
MESSAGE 'DATA successfully saved in Ztable' TYPE 'I'.
2014 Apr 29 11:04 AM
HI Lakshmi,
now its working status message.
now my requriment is when i click save button then all record shold be clear
what should i do?
2014 Apr 29 11:07 AM
Hi Rane,
Once If you got your requirement please mark that reply as Helpful answer.
2014 Apr 29 11:18 AM
2014 Apr 28 7:28 AM
Hi Prathamesh,
Create Z Table for All Fields on Screen. say ZDATA -- Dictionary Table
Create Structure for the same in Module Pool ZSDATA with Type Dictionary Table ZDATA.
if u create Screen using this Structure or any other Structure in Program using (Begin of .... end of..) it will be OK.
For check box create 3 fields if Checked , Check which check box is ticked and update respective field of the structure.
for Eg, If check box SSC - then Declare field SSC type C. check whether check box with SSC is checked or Not, and Update SSC Field as 'X' in structure.
Regards
Pritesh Raut.