Otr

8
1. Web Dynpro ABAP OTR Text Translation Tool for Web Dynpro ABAP Skip to end of metadata Attachments:3 Added by Alessandro Lavazzi , last edited by Craig Cmehil on Dec 28, 2009 (view change ) show comment Go to start of metadata Applies to: SAP NetWeaver WebAS 7.00 or higher. Summary A tool to easy translate OTR Texts in Web Dynpro ABAP Component. Author: Author: Alessandro Lavazzi Company: Techedge Created on: 03/07/2009 Author(s) Bio I'm a software engineer and I have started to work on SAP environment on february 2004. I have designed many SAP applications using Web Dynpro ABAP technology. Scope The Online Text Repository (OTR) is a central storage location for texts, and services for editing and administering these texts. In BSP applications, you can work with OTR and the ABAP Workbench provide a translation tool to translate the BSP pages and views. In Web Dynpro components every text that you insert in the layout of the views is saved in the system as an OTR text but there isn't a tool to easily translate all created text in the views. I have written a program to facilitate the translation of the OTR text created in view's layout of the web dynpro abap component. Tool usage

description

OTR

Transcript of Otr

1. Web Dynpro ABAPOTR Text Translation Tool for Web Dynpro ABAPSkip to end of metadata Attachments! Added by Alessandro "a#a$$i% last edited by &rai' &mehil on Dec ()% (**+,#ie- chan'e. sho- comment/o to start of metadataApplies to:SAP 0etWea#er WebAS 1.** or hi'her.SummaryA tool to easy translate OTR Texts in Web Dynpro ABAP &omponent.Author:A2thor Alessandro "a#a$$i Company:Teched'eCreated on:*!3*13(**+Author(s) Bio45m a soft-are en'ineer and 4 ha#e started to -ork on SAP en#ironment on febr2ary (**6. 4 ha#e desi'ned many SAP applications 2sin' Web Dynpro ABAP technolo'y.ScopeThe Online Text Repository ,OTR. is a central stora'e location for texts% and ser#ices for editin' and administerin' these texts.4n BSP applications% yo2 can -ork -ith OTR and the ABAP Workbench pro#ide a translation tool to translate the BSP pa'es and #ie-s.4n Web Dynpro components e#ery text that yo2 insert in the layo2t of the #ie-s is sa#ed in the system as an OTR text b2t there isn5t a tool to easily translateall created text in the #ie-s.4 ha#e -ritten a pro'ram to facilitate the translation of the OTR text created in #ie-5s layo2t of the -eb dynpro abap component.Tool 2sa'eWhen the pro'ram starts% select one or more -eb dynpro components that contain the #ie- to translate tho2'ht the search help % the so2rce lan'2a'e and the destination lan'2a'e then exec2te it.The pro'ram sho-s all #ie-s of the selected -eb dynpro component. By clickin' on 7Translate7 the translation screen ,like the one 2sed for translatin' BSP pa'e. is sho-n. This screen is sho-n tho2'ht the f2nction SOTR8AP48WB8TRA0S"AT9. 4nstallationTo install the translation tool on yo2r system copy the follo-in' tool in an S9!) pro'ram.ZSDN_WDY_OT_!D"TO*&---------------------------------------------------------------------**& Report ZSDN_WDY_OTR_EDITOR*&*&---------------------------------------------------------------------* REPORT zsdn_wdy_otr_translator. T!"ES# wdy_$o%ponent.*********************************************************************** &lo'al Types De$larat(on ***********************************************************************TYPES# !E&IN O) *sty_wd_o+t_ta','tn_-. TYPE $ "EN&T/ .-,$o%ponent_na%e TYPE wdy_$o%ponent_na%e,0(ew_na%e TYPE wdy_0(ew_na%e,END O) *sty_wd_o+t_ta'. TYPES# *tty_wd_o+t_ta' TYPE T!"E O) *sty_wd_o+t_ta'. TYPES# !E&IN O) *sty_wdy_$na%e_12,$o%ponent_na%e TYPE wdy_$o%ponent_na%e,des$r(pt(on TYPE wdy_%d_des$r(pt(on,END O) *sty_wdy_$na%e_12.*********************************************************************** 3"SS l$l_4andle_e0ents DE)INITION*********************************************************************************************************************************************3"SS l$l_4andle_e0ents DE)INITION.P5!"I3 SE3TION. 6ET/ODS# on_l(n7_$l($7 )OR E8ENT l(n7_$l($7 O) $l_sal0_e0ents_ta'le I6PORTIN& row $ol+%n.END3"SS. 9l$l_4andle_e0ents DE)INITION *********************************************************************** &lo'al Data De$larat(on ***********************************************************************DT# *t_wd_otr TYPE *tty_wd_o+t_ta'.DT# *o_e0ent_4andler TYPE RE) TO l$l_4andle_e0ents. *********************************************************************** SE"E3TION S3REEN *********************************************************************** SE"E3TION-S3REEN# !E&IN O) !"O3: '..SE"E3T-OPTIONS# p$na%e )OR wdy_$o%ponent-$o%ponent_na%e O!"I&TORY.PR6ETERS# pslan*+ TYPE sylan*+ 6T3/3ODE O!;E3T 4_t--< O!"I&TORY.PR6ETERS# pdlan*+ TYPE sylan*+ 6T3/3ODE O!;E3T 4_t--< O!"I&TORY.SE"E3TION-S3REEN# END O) !"O3: '.. *********************************************************************** SER3/ /E"P ***********************************************************************T SE"E3TION-S3REEN ON 8"5E-RE=5EST )OR p$na%e-low.* 3reate Sear$4 /elpDT# lt_wdy_$o%ponent TYPE T!"E O) *sty_wdy_$na%e_12.)IE"D-SY6!O"S#>lw_wdy_$o%ponent? TYPE *sty_wdy_$na%e_12. SE"E3T * INTO 3ORRESPONDIN& )IE"DS O) T!"E lt_wdy_$o%ponent)RO6 wdy_$o%ponentW/ERE $o%ponent_na%e IN p$na%e. "OOP T lt_wdy_$o%ponent SSI&NIN& >lw_wdy_$o%ponent?.SE"E3T SIN&"E * INTO 3ORRESPONDIN& )IE"DS O) >lw_wdy_$o%ponent?)RO6 wdy_$o%ponenttW/ERE $o%ponent_na%e @ >lw_wdy_$o%ponent?-$o%ponent_na%eND lan*+ @ sy-lan*+.END"OOP. 3"" )5N3TION A)2I)_INT_T!"E_8"5E_RE=5ESTAEBPORTIN&ret1(eld @ A3O6PONENT_N6EAdynpro1(eld @ AP3N6EAdynppro* @ sy-$pro*dynpnr @ sy-dynnr0al+e_or* @ ASAT!"ES0al+e_ta' @ lt_wdy_$o%ponent. *********************************************************************** TeCt In(t(al(zat(on ***********************************************************************INITI"IZTION.D_p$na%e_D_app_D-teCt @ AWD 3o%ponent Na%eA.D_pslan*+_D_app_D @ ASo+r$e "an*+a*eA.D_pdlan*+_D_app_D @ ADest(nat(on "an*+a*eA. *********************************************************************** STRT o1 SE"E3TION ***********************************************************************STRT-O)-SE"E3TION. DT# *r_ta'le TYPE RE) TO $l_sal0_ta'le,*r_d(splay TYPE RE) TO $l_sal0_d(splay_sett(n*s,*r_1+n$t(ons TYPE RE) TO $l_sal0_1+n$t(ons,*r_e0ents TYPE RE) TO $l_sal0_e0ents_ta'le,*r_$ol+%ns TYPE RE) TO $l_sal0_$ol+%ns_ta'le,*r_$ol+%n TYPE RE) TO $l_sal0_$ol+%n_ta'le,l_$olor TYPE l0$_s_$olo. )IE"D-SY6!O"S#>lw_wd_otr? TYPE *sty_wd_o+t_ta'. SE"E3T * INTO 3ORRESPONDIN& )IE"DS O) T!"E *t_wd_otr)RO6 wdy_0(ewW/ERE $o%ponent_na%e IN p$na%eND 0ers(on @ AAND type @ A3"_WDY_6D_8IEWA. "OOP T *t_wd_otr SSI&NIN& >lw_wd_otr?.>lw_wd_otr?-'tn_-. @ ATranslateA.END"OOP. * 3reate "8 ta'le$l_sal0_ta'le@?1a$toryE I6PORTIN& r_sal0_ta'le @ *r_ta'le 3/N&IN& t_ta'le @ *t_wd_otr F. * Set ze'ra layo+t*r_d(splay @ *r_ta'le-?*et_d(splay_sett(n*sE F.*r_d(splay-?set_str(ped_patternE $l_sal0_d(splay_sett(n*s@?tr+e F. * D(splay all standard 1+n$t(on*r_1+n$t(ons @ *r_ta'le-?*et_1+n$t(onsE F.*r_1+n$t(ons-?set_allE a'ap_tr+e F. * Set t4e $ol+%n !TN_-. as a l(n7 to tranlate*r_$ol+%ns @ *r_ta'le-?*et_$ol+%nsE F.*r_$ol+%n G@ *r_$ol+%ns-?*et_$ol+%nE A!TN_-.A F.l_$olor-$ol @ A2A.l_$olor-(nt @ A.A.l_$olor-(n0 @ A-A.*r_$ol+%n-?set_$olorE l_$olor F.*r_$ol+%n-?set_$ell_typeE H F. * Set e0ent 4adler*r_e0ents @ *r_ta'le-?*et_e0entE F.3RETE O!;E3T *o_e0ent_4andler.SET /ND"ER *o_e0ent_4andler-?on_l(n7_$l($7 )OR *r_e0ents. * Set e0ent 4adler*r_ta'le-?d(splayE F. *********************************************************************** 3"SS l$l_4andle_e0ents I6P"E6ENTTION*********************************************************************************************************************************************3"SS l$l_4andle_e0ents I6P"E6ENTTION.6ET/OD on_l(n7_$l($7.DT# l_o'Ie$t_na%e TYPE tro'I_na%e.DT# lw_wd_$o%p0(ew TYPE *sty_wd_o+t_ta'. I) $ol+%n @ A!TN_-.A. RED T!"E *t_wd_otr INDEB row INTO lw_wd_$o%p0(ew. 3ON3TENTE lw_wd_$o%p0(ew-$o%ponent_na%e ADA lw_wd_$o%p0(ew-0(ew_na%e INTO l_o'Ie$t_na%e. 3ONDENSE l_o'Ie$t_na%e NO-&PS. 3"" )5N3TION ASOTR_PI_W!_TRNS"TEA EBPORTIN& so+r$e_lan*+ @ pslan*+ tar*et_lan*+ @ pdlan*+ p*%(d @ A"I65A o'Ie$t @ AWDY8A o'I_na%e @ l_o'Ie$t_na%e EB3EPTIONS no_entry_1o+nd @ . (nternal_error @ < no_a+t4or(zat(on @ J error_(n_$onteCt @ 2 +ser_$an$elled @ H error_(n_transport_reK+est @ L OT/ERS @ M . I) sy-s+'r$ >? -. 6ESS&E ID sy-%s*(d TYPE sy-%s*ty N56!ER sy-%s*no WIT/ sy-%s*0. sy-%s*0< sy-%s*0J sy-%s*02. ENDI). ENDI).END6ET/OD. 9on_s(n*le_$l($7END3"SS. 9l$l_4andle_e0ents I6P"E6ENTTION9on_do+'le_$l($7