Académique Documents
Professionnel Documents
Culture Documents
Solutions
Partner
Support
About
Community
Training
Community
Developer
Blogs
UpdateOrderuserstatus
uponSaveofNotification
orOrder
May31,2016
| 86Views |
JogeswaraRaoK
morebythisauthor
PLMEnterpriseAssetManagement(EAM)/PlantMaintenance(PM)
Solution
share
0
share
0
tweet
Follow
DearFriends,
TomyapproximationIgavearound150enhancementsolutions sofar
whileansweringthequeries.AmongtheseIfeltlikedocumentingfew(7
sofar)becauseoftheircomplexandinterestingnature.Ifeltthatthe
presentonetooisofsimilarnatureandforumwillbebenefitedifitis
presentedintheformofatechnicalblog.
share
0
1
like
Actions
Sohereitis:.
Itisaboutarecentcallforhelp,wherethememberwasseekingsolutionfor
herrequirementwhichwasexpressedas:WhenparticularTaskisopenin
theNotification,howtoupdatetheuserstatusinIW31/32onServiceOrder
.PleaseSuggest..
Ifeltthisisanotheropportunitytocontributefewlinesofenhancement
codetotheforum.Igavethesolutionie.,theuserexitandthecode.
ThecodereadstheSystemstatusoftheNotification,ifitfindsOSTS
(outstandingtask)thenitsetsaspecificuserstatus(sayABCD)tothe
Order,obviouslyduringSave(ofOrderastherequirementsounded).
The member then clarifies like: No no, I do not want during Order
Save, It to happen while Notification Save. Then I gave that solution
too,otheruserexit,andcorrespondingcodeobviously.
Soherewearegoingtoseeboththesolutionsfor
1.Updating Order Userstatus during Order Save if Notification has
outstanding
tasks.
(userexit
IWO10009,
F/exit
EXIT_SAPLCOIH_009)
Beforeweseetheindividualsolutioncodesforbothofthese,letsfirst
lookatthelogic.
ThestartpointistoknowwhetheranyoutstandingTaskisthere
in the Notification. This means Notification system status will
haveOSTSvalue.
To know this we need to use function module STATUS_READ.
The input to this fm is Notification OBJNRvalue which we get
fromQMELorVIQMELtable.
But the output from the above fm will be in code (not in text
formatOSTS).Weneedtoknowthiscodeforourcoding.This
isknownfromtableTJ02T when we input value OSTS in the
field TXT04 and E in field SPRAS. We get the value as
I0158.(Thiscommonforyou,meandforallothers)
Andthecodeis:
DATA:i_statLIKEjstatOCCURS0WITHHEADERLINE,
l_objnrTYPEj_objnr.
SELECTSINGLEobjnrFROMviqmelINTOl_objnrWHEREqmnum=caufvd_impqmnum.
CALLFUNCTIONSTATUS_READ
EXPORTING
objnr=l_objnr
only_active=X
TABLES
status=i_stat.
LOOPATi_stat.
IFi_statstat=I0158.
CALLFUNCTIONSTATUS_CHANGE_EXTERN
EXPORTING
objnr=caufvd_impobjnr
user_status=E0004
set_inact=.
ENDIF.
ENDLOOP.
Ifitiscase2:UpdatingtheOrderUserstatusduringNotificationSaveif
Notificationhasoutstandingtasks,weneedtousethecodebelowinthe
includeZXQQMU20.
Thecodeis:
DATA:i_statLIKEjstatOCCURS0WITHHEADERLINE,
l_objnrTYPEj_objnr.
SELECTSINGLEobjnrFROMaufkINTOl_objnrWHEREaufnr=i_viqmelaufnr.
CALLFUNCTIONSTATUS_READ
EXPORTING
objnr=i_viqmelobjnr
only_active=X
TABLES
status=i_stat.
LOOPATi_stat.
IFi_statstat=I0158.
CALLFUNCTIONSTATUS_CHANGE_EXTERN
EXPORTING
objnr=l_objnr
user_status=E0004
set_inact=.
ENDIF.
ENDLOOP.
Note:
Thoughalreadymentionedinthelogicpointsabove,Iwanttoremind
abouttheE0004codeusedinthecodesabove.youhavetogetthis
valuefromtableTJ30TbyinputtingyourOrderstatusprofile in field
STSMA,theuserstatustobesetinOrderinfieldTXT04andEin
fieldSPRAS.
BoththecodesItestedbeforepostingtothatdiscussion.Ifyouare
going to use, test well for its satisfactory working in the Dev
servers.
..Andthuswearriveattheendofthispost..
ThankyouandRegards
KJogeswaraRao
AlertModerator
Bethefirsttoleaveacomment
AddComment
Privacy
TermsofUse
LegalDisclosure
Copyright
Trademark
Sitemap
Newsletter