Tagarchief: ABAP

How to transport a locked ABAP object

Sometimes you need to have an ABAP Workbench object transported to another environment, but it is locked with other objects in transport requests that you do not want to release, yet. How could this be solved?

  1.  Release the tasks that contain the object that you want to transport, but do not release the transport request.
  2. Create a new transport request with the object you want to transport to the other environment. This could be done by creating a new transport request with e.g. SE01, but it could also be done from within the editor, editing the object concerning. Make sure any changes you do not want to go with this transport request are set to comment.
  3. Release the newly created task and transport request, and import it into the desired environment / system. Check the log; if any errors come up, go to step 2, and correct the mistakes.
  4. Unrelease the tasks that have been released in step 1. This could be done using SE16(N), or with a ’tool’, like described here below. Pick up your development work; do not forget to uncomment the lines you possibly have set to comment at step 2.

Here is the essential part of the ’tool’. Indentation is not picked up by WordPress, so you have to redo that (at least partially, Pretty Printer will take care of that). And, of course, you have to write the code piece with the parameter that should be transferred to IV_TRKORR.


*&———————————————————————*
*&      Form  UNRELEASE_TASK
*&———————————————————————*
FORM unrelease_task
USING    iv_trkor           TYPE e070trkorr.

DATA:
ls_e070 TYPE e070.

CONSTANTS:
lc_trfunction_cust TYPE e070trfunction VALUE ‘Q’,
lc_trfunction_dev  TYPE e070trfunction VALUE ‘S’,
lc_trfunction_rep  TYPE e070trfunction VALUE ‘R’,
lc_trstatus_mod    TYPE e070trstatus   VALUE ‘D’,
lc_trstatus_rel    TYPE e070trstatus   VALUE ‘R’.

* Processing
* ==========

SELECT SINGLE *
FROM e070
WHERE trkorr EQ @pa_trkor
AND   trfunction EQ @lc_trfunction_cust OR
trfunction EQ @lc_trfunction_rep  OR
trfunction EQ @lc_trfunction_dev )
AND   trstatus EQ @lc_trstatus_rel
INTO @ls_e070.
IF sysubrc NE 0.

WRITE‘Task’(002),
pa_trkor,
‘not found.’(001).

RETURN.
ENDIF.

ls_e070trstatus :lc_trstatus_mod.

UPDATE e070
FROM ls_e070.
IF sysubrc EQ 0.

WRITE‘Task’(002),
pa_trkor,
‘has been reset to Modifiable.’(003).
ELSE.
WRITE‘Task’(002),
pa_trkor,
‘could not be reset to Modifiable.’(004).
ENDIF.

ENDFORM.                    ” UNRELEASE_TASK

smartforms – deactivate Word as editor

The company I am working with works with SAP_BASIS 740 and SAP_ABA 740. For older versions, and for S4/HANA, it is possible to deactivate Microsoft Word as editor in smartforms – you could find lots of information about that using a search engine. But not for 740.

Why do I want to do that in 740 as well? Because every time when I tick a ’text’ in smartforms, and I forgot to choose another ’tab’, e.g. Conditions, it lasts some 10 seconds (I do not want to exaggerate…) before I have access to the ’text’; and usually, I just have to click through to the details editor. All together, a lot of time lost.

Hence, I was very eager to find a solution for 740, since I couldn’t find one out on the internet. And, I would not have written this post if I hadn’t found one myself.

Solution

Display SAPLSTXB, form CREATE_EDITOR_CONTROL.

Choose Program -> Enhance, then Edit -> Enhancement Operations -> Show Implicit Enhancement Operations.

Just under ‘form create_editor_control’, create your enhancement, name it e.g. ‘Z_EDITOR_NOT_WORD’.

Copy the text of the original form into your enhancement. Rename the fields l_* to lv_*, to prevent double definitions, adapt your code accordingly (fields l_adjustment and l_ret aren’t used…). Note the arrows (⇐) for the changes w.r.t. original code. Do not forget the ‘return’ at the end of your code. You could also just download my code and paste it at the correct place.

(Download the code.)

data: lv_adjustment type i,
lv_repid  like sy-repid,
lv_dynnr  like sy-dynnr,
lv_ret(1).

* initialization of control variables
lv_repid = sy-repid.
lv_dynnr = sy-dynnr.
noflush = true.

* create custom container object in dynpro
create object textedit_custom_container
exporting  container_name             = ‘EDITOR_CUSTOM_CONTROL’
exceptions cntl_error                  = 1
cntl_system_error           = 2
create_error                = 3
lifetime_error              = 4
lifetime_dynpro_dynpro_link = 5.
if sy-subrc <> 0.
message e101.
endif.

clear: word_error. “⇐

* check if Word must be used
if oi_ed_checked eq false or
word_error    eq true.
oi_editor  = false.
word_error = false.
try.
call function ‘NLS_WORD_ENABLE’
exporting
langu        = language
importing
ex_oi_editor = oi_editor.
catch cx_sy_dyn_call_illegal_func.
endtry.
oi_ed_checked = true.
endif.

clear: oi_editor, “⇐
word_error. “⇐
if oi_editor = true.
try.
create object word_editor
exporting
editor_container = textedit_custom_container
toolbar_visible  = true.

catch cx_word_sapscript_editor.
*      message e101.
*      screen_invisible ‘EDITOR_CUSTOM_CONTROL’.

endtry.
* TODO          Error handling
else.      ” PC Editor
*   create editor object and link the control to the custom container
create object text_editor
exporting
parent                 = textedit_custom_container
caption_list           = g_appl_captionlist
use_caption            = g_appl_use_caption
*       lifetime               =
*       style                  =
exceptions
error_cntl_create      = 1
others                 = 2.

if sy-subrc <> 0.
message e101.
endif.

*   Set drop handler for editor
set handler h_application->handle_symbol_drop for text_editor.
endif.
return. “⇐