SAP: Generating a Class Actor – CREATE_PERSISTENT
Been playing with the persistent objects and finally figured a part that involves generating a CREATE_PERSISTENT method in the Base agent class.
To do this
- Go to Persistence Representation

- Select Utilities – Generate – Class Agent – Class
- Click the Yes button
That’s all.
ABAP Runtime Analysis – variant setup
Runtime analysis can be used to quickly get to the bottom of which tables are referenced during a transaction/program/function-module call.
I like running SM30 over ST22 because you get a nicer presentation of what tables were hit. ST22 tends to bee too detailed in majority of my scenarios.
By default the report is initialized with the DEFAULT variant. This is limiting and will not give you as much information as you might want. Typically on a new system I set up my own variant that allows me to access more information.
Steps to set up your own variant:
Select the drop down option in the Variant selector panel- Click the green check-box on the next screen without changing the parameters of the Selection Criteria for Variants pop-up
- You will be presented with two default Variants – DEFAULT and TMP; ignore those and click on the Create button
- Type in the name and continue
Here’s the most important part of this trick. When you get to the main configuration page of the variant go to the third tab [Duratn/type] and in the Aggregation pick the None option.- Once done click Save as… button and you are ready to run your Analysis.
SAP: STMS transport stuck
When coming across a situation where thetransprts are stalling/hanging in the STMS queue there are a few things that you can do:
The fist and most obvious course of action is to contact your Basis support team.
Given that you are reading this article you probably wanted or were forced to figure this one out on your own so here are a few helpful actions that you can take to narrow down the problem:
TP processes:
Go to the SM51 and check if any of the TP processes are still running, you might be required to kill these before proceeding haulted imports.
Check the TP System Log:
You can do this by STMS – Overview – Imports – Select Queue System – Goto – tp system log – F5
This will show you a step by step log of what has occured in the system, you would be able to see which transports are being processed and what has completed.
Check the Import Monitor:
You can do this by STMS – Overview – Imports – Select Queue System – Goto – Import Monitor
This will show you the queue of active transports [if any], if you see that there is a collection of unprocessed imports then you need to flush the queue.
Check TMS background job:
You can also check if the background job RDDIMPDP is running.
From tim to time it happens that the import queue becomes inconsistent and the system stalls, as a result you can be stranded without any of your transports moving ot he next system.
Tables:
TMSTLOCKR: will unlock a given transport from the transport queue [the transport truck will dissapear after deleting of the entry int he table]
TRBAT: will contain values correspondign to active imports, if you have a stuck transport that is haulting a collection of other transports a simple delete from this table will re-initialize the queue and push the backed up imports forward.
TRJOB: should also be cleared in order to continue the regular flow of backe up transports
For any additonal information please refer to the following notes:
818065, 302859, 556941, 556946, 71353, 49242, 323726, 56311, 24800, 486991, 506771, 138200
SAP: Check the Passwords of Standard Users in All Clients
A quick way to check the status of all the standard users in your SAP system is to run a program RSUSR003.
ABAP cancelling an SD Billing Document
If you have access to a billing document number try executing the following function:
DATA: l_rtrn TYPE bapireturn1 OCCURS 0.
DATA: l_succ TYPE bapivbrksuccess OCCURS 0.
CALL FUNCTION 'BAPI_BILLINGDOC_CANCEL1'
EXPORTING
billingdocument =
* testrun =
* no_commit =
billingdate = sy-datum
TABLES
return = l_rtrn
success = l_succ.
This should create a cancellation document.
ABAP: execute OS level command
There are many things that one can do to execute a command in an Operating System from an ABAP report. I’ll explain one method that one can take to accomplish this.
- Using transactions SM49 and SM69 set up and test a new OS command that you wish to execute. For the purposes of this post I’ve set up an executable command ZSAPCAR32.
- When I was setting up the new command I’ve selected the option to add additional parameters to the command.
- Once tested and satisfied you can add a new function module [SXPG_COMMAND_EXECUTE] to your report that will call preset executable command.
data: g_rlog TYPE btcxpm OCCURS 0.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZSAPCAR32'
additional_parameters = <additional parameters>
operatingsystem = <system you specified in SM69>
TABLES
exec_protocol = g_rlog
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
if sy-subrc eq 0.
LOOP AT g_rlog INTO g_warlog.
* display command output
write g_warlog.
ENDLOOP.
endif.
The above code will execute your OS command and display the results.
ABAP: load file using pop-up window
When writing a program the simplest way to load a file from your client PC in to the server SAP syste is through a use of a regular text box. But if you want to get a little fancier try using the following function:
data: l_select TYPE sapb-sappfad.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = l_select
def_path = ' '
mask = ',*.*,*.*.'
mode = 'O'
title = 'Select filename to OPEN'(f05)
IMPORTING
filename = l_select
EXCEPTIONS
selection_cancel = 1
selection_error = 2
OTHERS = 3.
This function will open up a pop-up window [standard to windows] allowing the user to select a file somewhere on their local comptuer.
SAPGUI_PROGRESS_INDICATOR
A usefull little function that will allow you to display a status update on the bottom left corner of the screen when running your reports.
call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = 0
text = STATUS_TEXT.
Note: anything lower then 0 will be rounded up to 0 and anything greater then 100 will be rounded down to 100.
The sales order … is currently being processed by user …
An inbound IDOC was failing due to the error [described in the title]. Some research resulted in the following results:
TR: SM12 displayed a list of locked elements in the system.
TR: SM04 displayed a list of logged in users in the local system.
TR: SM08 displayed a list of logged in users in all the app-servers [not just the current system].
Unfortunately in my case non of the mentioned transactions above helped me narrow down where the user was locking the system – in the end I’ve requested for the user to log back in and kill his session with a TR: /nex.