Putting Text in SO10 and saving it to a transport and moving it to Quality and Production is a common requirement. It is a two step process. First save the text and then move the text to transport using program RSTXTRAN. But many times, developer or the person saving the text, forgets to save the text in the transport as it does not prompt for a transport while saving.
If you want to know the regular two step process to move the SO10 text to a transport, check this sap blog.
In our current project, we had a human error and we did not move the text to production. And Security Team did not allow us to save text directly in the production system.
Our manager asked us to find a way so that this issue does not repeat. After some brain storming session, we along with other architects, came up with a solution to prompt users to save the text in transport while saving the text in t-code SO10. This way, we do not forget.
The solution was to put an Implicit Enhancement in the Include program LSTXXFTE (Form TE_SAVE_TEXT). We programmed it to prompt for the transport number, the move the Save button is hit.
Note : There might be many opponents of Implicit Enhancement. If you have a better way to meet the same requirement, please do let us know. We would be happy to apply it.
A short Youtube link which goes through our enhanced functionality and design.
Also check our Free Video Courses on SAP HANA, OData and New Syntaxes of SAP ABAP 7.40.
Implicit Enhancement in Include Program LSTXXFTE. At the end of the Sub routine TE_SAVE_TEXT.
Source Code Snippet.
DATA : lo_utlities TYPE REF TO zcl_utilities, ls_input TYPE zsavetextinput, lo_subrc TYPE REF TO sy-subrc. FIELD-SYMBOLS: <lfs_any> TYPE any. ** Get instance lo_utlities = zcl_utilities=>factory( ). IF lo_utlities IS BOUND. ** FIll input ls_input-tdname = tename. ls_input-tdid = teid. ls_input-tdspras = tespras. ** Call save method lo_subrc = lo_utlities->save_standradtext( is_input = ls_input ). ASSIGN lo_subrc->* TO <lfs_any>. IF <lfs_any> = 0. ** Success ENDIF. ENDIF. ENDIF.
Also Read – SAP Calculator using New Syntax
ZCL_UTILITY class is created and all logic are handled in it.
class ZCL_UTILITIES definition public final create private . public section. *"* public components of class ZCL_UTILITIES *"* do not include other source files here!!! class-methods FACTORY returning value(RT_REF) type ref to ZCL_UTILITIES . methods SAVE_STANDRADTEXT importing !IS_INPUT type ZSAVETEXTINPUT returning value(LO_OUTPUT) type ref to SY-SUBRC . protected section. *"* protected components of class ZCL_UTILITIES *"* do not include other source files here!!! private section. *"* private components of class ZCL_UTILITIES *"* do not include other source files here!!! ENDCLASS. CLASS ZCL_UTILITIES IMPLEMENTATION. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Static Public Method ZCL_UTILITIES=>FACTORY * +-------------------------------------------------------------------------------------------------+ * | [<-()] RT_REF TYPE REF TO ZCL_UTILITIES * +--------------------------------------------------------------------------------------</SIGNATURE> method FACTORY. CREATE OBJECT rt_Ref. if rt_ref is bound. endif. endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method ZCL_UTILITIES->SAVE_STANDRADTEXT * +-------------------------------------------------------------------------------------------------+ * | [--->] IS_INPUT TYPE ZSAVETEXTINPUT * | [<-()] LO_OUTPUT TYPE REF TO SY-SUBRC * +--------------------------------------------------------------------------------------</SIGNATURE> METHOD save_standradtext. DATA: lv_tr_order_zz TYPE e070-trkorr, lv_tr_task_zz TYPE e070-trkorr, lv_textkey_zz(110), lv_len_zz TYPE i. DATA: lt_e071_zz TYPE TABLE OF e071, lt_e071k_zz TYPE TABLE OF e071k, ls_e071_zz TYPE e071, ls_e071k_zz TYPE e071k. FIELD-SYMBOLS: <lv_zz> TYPE any. IF sy-subrc = 0. CALL FUNCTION 'TR_ORDER_CHOICE_CORRECTION' EXPORTING iv_category = 'CUST' iv_cli_dep = 'X' IMPORTING ev_order = lv_tr_order_zz ev_task = lv_tr_task_zz EXCEPTIONS no_correction_selected = 1. IF sy-subrc = 0. lv_textkey_zz = '%,$,%,%'. REPLACE '%' WITH 'TEXT' INTO lv_textkey_zz. REPLACE '%' WITH is_input-tdid INTO lv_textkey_zz. REPLACE '%' WITH is_input-tdspras INTO lv_textkey_zz. CONDENSE lv_textkey_zz NO-GAPS. lv_len_zz = strlen( is_input-tdname ). ASSIGN is_input-tdname(lv_len_zz) TO <lv_zz>. REPLACE '$' WITH <lv_zz> INTO lv_textkey_zz. ls_e071_zz-obj_name = lv_textkey_zz. ls_e071_zz-trkorr = lv_tr_task_zz. ls_e071_zz-as4pos = 0. ls_e071_zz-pgmid = 'R3TR'. ls_e071_zz-object = 'TEXT'. * ls_e071_zz-objfunc = objfunc. APPEND ls_e071_zz TO lt_e071_zz. CALL FUNCTION 'TR_APPEND_TO_COMM_OBJS_KEYS' EXPORTING wi_trkorr = lv_tr_task_zz TABLES wt_e071 = lt_e071_zz wt_e071k = lt_e071k_zz EXCEPTIONS error_message = 99. IF sy-subrc = 0. GET REFERENCE OF sy-subrc INTO lo_output. ENDIF. ENDIF. ENDIF. ENDMETHOD. ENDCLASS.
Hope you liked this trick. If you have any tips or tweaks, please share them with us at mail@sapyard.com and we would be happy to publish them here.
We also have a 2550+ active SAP Consultants from 6 continents in our Telegram Group. Please join and be part of the largest knowledge sharing group in SAP Technical – SAPYard Technical Telegram Group.
Also check other Code Snippets.
- Dynamic Where Condition usage in Database queries
- UNIX Command in SAP ABAP
- Send e-mail with subject line greater than 50 characters
- Pop Up Screen with Selection Option using FM POPUP_WITH_TABLE_DISPLAY
- String wrap
- Write Application Log
- Sample program to attach any file from application server to any Business Object
- Sample program to unlock the editor of a program.
- Why are developers so fond of ‘REUSE_ALV_GRID_DISPLAY’?
- DELETING rows of the internal table within the LOOP. Is it a Taboo? A big NO NO?
- Creating Dynamic Internal Table
- Selection Screen in SAP
- How to update custom field of PRPS table
- Get Latitude and Longitude of any place using Google Map API in SAP
- GPS like tool in SAP using Google Map API
- Know Who is doing What in your SAP System
- OOPs Report Using Splitter and ALV Tree Combination
- ALV with an Editable Row
- Extensive Tips and Tricks for Interactive SAP ALV
- How to Get Accurate Pricing in SD for Customer and Material?
- T-Guard: Transport Dependency Validation Tool
- Utility Program to Auto Format the Texts into Meaningful Sentence
- ABAP for SAP HANA. Part XX. ALV Report On SAP HANA – Opportunities And Challenges
- Selective Handling of the Buttons in ALV Grid Toolbar
- Working with Shell Scripts in SAP ABAP Environment
- ABAP for SAP HANA. Part XXIV. Basic Expressions & Operations available for CDS View Part II
- Sudoku Solver and Generator Tool Using Vanilla SAP ABAP
- Calculator in SAP using New ABAP Syntax
- SO10 Enhancement to Add Texts to the Transport Request Automatically