06-09-2008 11:12 AM
Hello,
Can we do field validations using SM30?
If yes then please suggest....How can I do that..Plz explain me with an example...
ANy suggestions would be appreciated...
Regards,
Kittu
06-09-2008 11:45 AM
hi,
you can do validations
make use of events in the TMG
create subroutienes and write the code there
the below link gives steps to create events
example
if matnr is initial.
message 'ENTER A VALUE' type 'E'.
endif.
regards
prasanth
06-09-2008 11:45 AM
hi,
you can do validations
make use of events in the TMG
create subroutienes and write the code there
the below link gives steps to create events
example
if matnr is initial.
message 'ENTER A VALUE' type 'E'.
endif.
regards
prasanth
06-09-2008 12:07 PM
Hi,
sm30 is used to view the ' Call Up View Maintenance
Use one ofthe following concepts (Priority wise)
1. check Table.
2. Search Help .
3. Set the values in the attribute to some constant values.
when you go into the Events There is a Informatio ICON(ctrlshiftf1).this will take you to the SAP Documentatio and there you can see the Additional Events and the replaceme events.the one i was refering to is in Additional Events Cod 01-before saving.Following Code is For 01
FORM abc.
DATA: F_INDEX LIKE SY-TABIX. "Index to note the lines found
LOOP AT TOTAL.
IF <ACTION> = desired constant.
READ TABLE EXTRACT WITH KEY <vim_xtotal_key>.
IF SY-SUBRC EQ 0.
F_INDEX = SY-TABIX.
ELSE.
CLEAR F_INDX.
ENDIF.
(make desired changes to the line TOTAL)
MODIFY TOTAL.
CHECK F_INDX GT 0.
EXTRACT = TOTAL.
MODIFY EXTRACT INDEX F_INDX.
ENDIF.
ENDLOOP.
SY-SUBRC = 0.
ENDFORM.
here <Action>
GELOESCHT : flagged for deletion
NEUER_EINTRAG : New entry
AENDERN : changed entry
UPDATE_GELOESCHT : entry first changed and then flagged fo deletion
NEUER_GELOESCHT : entry first newly created, not yet saved, an then flagged for deletion
ORIGINAL : the same as the database status
so like above u can do validation.
thanks
abdul
06-10-2008 5:34 AM
Hello prasanth kasturi, shaik abdul
As mentioned in the link....
I had cretaed a Z table and in step 3 --> I had clicked on Events --> After that NEW Entries
Here in this screen : I had selected 05 - Creating a NEw Entry.
After that when I click on Editor, it is not responding. If it allows me to write the source code then I will be done with the validations PLz Help.
ANy suggestions will be appreciated...
Regards,
Kittu
06-10-2008 7:52 AM
Hi Kittu
After you select 05 and enter your routiene name
press enter
then in the editor tab a symbole like doc appears
double click on it
then in the include write the code
hope i am clear
reward if helpful
prasanth
06-10-2008 7:36 AM
Hi,
You can as well validate the fields in SM30. For that u need to code in the Function group created for that Z table.
If u have maintained the Table maintenance generator, u would have created the Function Group.
Goto SE80 and give the Function group created for that table in change mode. In that goto Screens.
In the screens, in PAI, please follow the code given below
+process after input.
module detail_exit_command at exit-command.
module detail_set_pfstatus.
chain.
field zxxx-zvkorg module keycombine.
module set_update_flag on chain-request.
endchain.
chain.
field zxxx-zvkorg .
module detail_pai.
endchain.+
Add the MODULE after the field for which u need to add the logic for validation (given in Bold above). and put the logic u want in the module as given below.
+module keycombine input.
data: begin of t_key occurs 0,
vkorg type tvko-vkorg,
bukrs type t001-bukrs,
end of t_key.
select single vkorg bukrs from tvko
into gt_key where
vkorg = zxxx-zvkorg and
bukrs = zxxx-zbukrs.
if sy-subrc ne 0.
message 'Company code and Sales org combination does not exist'
type 'E'.
endif.
endmodule. " KEYCOMBINE INPUT+
Please reward if useful.
Regards,
Asif Ali Khan
06-10-2008 12:30 PM
Hello Prasanth kasturi, Shaik abdul,
Thank you for your response!
I apprecaite it!
Regards,
Kittu
Edited by: Kittu on Jun 11, 2008 2:21 PM
06-10-2008 1:07 PM
hi,
go to SE80
then open the FG inside which u have created the table maintenance for the table for which u want to put the condition
now to go the view on the left handside down corner i.e. Object Name
u can ur FG name drill down and then click on then screens
then u can see the table maintenance screen number click on that
on the right hand side u will see the code.....
Under PROCESS AFTER INPUT.
u will see bunch f code inside
LOOP AT EXTRACT.
CHAIN.
FIELD ZARK_ALV_TEST-EMPLOYEE .
FIELD ZARK_ALV_TEST-LOCATION .
perform F_validate.
FIELD ZARK_ALV_TEST-QUOTA .
FIELD ZARK_ALV_TEST-GRADE .
ENDCHAIN.
ENDLOOP.
say in my case i need to validate LOCATION field
so i write a perform and declare that in any include in my FG
and code will be as follows :
if ZARK_ALV_TEST-EMPLOYEE = ' '.
if ZARK_ALV_TEST-LOCATION = ' '.
message E000(38) with " Enployee is null so loaction cant be null. plz enter value i location." .
endif.
endif.
06-11-2008 5:19 AM
hi....
The code for your table maintainenece can be viewed through the function group you give while generating table maintainennece.
Go to se80,gie the name of the function group and then make changes in the code for your validation or else you can create a new screen an code for that screen by creating a new table control for your exixting table.
Then write the logic for validatiing.
06-11-2008 1:23 PM
Hello Guys,
Thank you for your response and for your great help!
Points are rewarded.
My issue is fixed!
Have a great evening!
Regards,
Kittu