How delete payroll run in 1 single step

Do you know how to delete payroll run in SAP? Seems to be easy, just open PU01 transaction and hit ‘Delete’ button. Basically, yes. But usually no.

When preDME and payroll postings were made there is no way to delete payroll run from payroll cluster. But there is a trick to do it with just one single step.

Read More


Mass document printing in SAP

Here is a secret way how you can save thousands of dollars on print form development.

Printing Documents

Here is an issue. Customer needs to print hundreds of the same form documents for employees. Like notices, orders or whatever.

First of all we need to create basic SAP Query report. For example I’ve created this one that includes name and company. For real doc you’ll possible need many other fields like amount from infotype 0015, address from sixth and etc. All this you can extract from the system with standard fields within SAP Query or create additional fields in Customizing.

Read More


ABAP Unit Test

And don’t tell me I’m a bore. ABAP unit test worth it!

Here how it was. Once I told you about Test Driven Development methodology, but today I decided to try it in practice how it works in SAP. I created basic OData Service and decided to test it automatically.

Now I want to test it automatically. Earlier I told about SECATT. Today let’s talk about Unit testing. It such a thing which is developed in ABAP and allows to test logic inside of a program. It does not simulate user input but verifies internal procedures, methods, functions for a supposed result. For example, it should always save correct data but never allows to save incorrect data. To implement we create two methods – positive result test and negative result test.

Read More


SAP ABAP Quality

Life throws me interesting tasks. The other day I was thinking about ABAP code quality automation. There is a tool to control ABAP quality and it’s called ATC – ABAP Test Cockpit. Guess, we can setup system to verify ABAP code for quality in ABAP Code Inspector where we set rules for naming, code blocks, conventions, etc. We can ask the system to schedule code checks before any transport request moves forward to quality or production. The system will stop any transfer in case there are mistakes in code or even variables naming.

 

Testing ABAP Code in SAP

testing ABAP code in SAP (image owner/author is unknown)

Read More


Right way to organize SAP testing

Why pay for 3rd party test tools and software?

I don’t see any reason and willingness to do that. We have paid enough to SAP to have these tools for free and already integrated into our workflows. Here is a way to organize SAP testing in SAP ERP system. it’s free as already covered by your professional licenses. Solution Manager could be a great extension but even without it classic SAP ERP already has all required tools. It’s just best practice from SAP how to build test plans, test cases, organize testing itself and control every single step. Hundreds of users? User Acceptance Test, Unit-Test, Automated Testing – no problem at all!

Step by step guide how to organize SAP testing

Transaction STWB_1. Create test catalog. There are three main options. Creating manual tests (a-la MS Excel, MS Word), automated eCATT, external (through an external program).

For example, I’ve created two simple tests.

Read More


LSMW errors when you work with files

Sometimes when you load file in LSMW (Read Data step) system throws an error with a code without any human explanation. To understand this I advise you to look at this ABAP code from the standard LSMW program. Having this function module return codes (the same time error codes for LSMW) it would be easier to understand what’s wrong. Here is the list of LSMW errors when you work with text files. This step occurs just before you run convert data in legacy workbench. These return codes represent errors SAP shows us during file read step.

program /SAPDMC/SAP_LSMW_READ_FORMS:
CALL FUNCTION ‘GUI_UPLOAD’
EXPORTING
filename                      = l_filename
filetype                      = l_filetype
codepage                      = l_codepage
*     HAS_FIELD_SEPARATOR           = ‘ ‘
*     HEADER_LENGTH                 = 0
*     READ_BY_LINE                  = ‘X’
*   IMPORTING
*     FILELENGTH                    =
*     HEADER                        =
TABLES
data_tab                      = “l_upload_table”
EXCEPTIONS
file_open_error               = 1
file_read_error               = 2
no_batch                      = 3
gui_refuse_filetransfer       = 4
invalid_type                  = 5
no_authority                  = 6
unknown_error                 = 7
bad_data_format               = 8
header_not_allowed            = 9
separator_not_allowed         = 10
header_too_long               = 11
unknown_dp_error              = 12
access_denied                 = 13
dp_out_of_memory              = 14
disk_full                     = 15
dp_timeout                    = 16
OTHERS                        = 17


Customizing Enterprise Portal theme

This is the best doc regarding portal theme customizing I’ve seen so far. Recommended.

Portal theme customizing


Unlock tables in SAP

My students have found really good way to solve problem when two or more consultants want to work with the same table in edit mode.

Author is unknown.

REPORT ZSENQOFF MESSAGE-ID MT.
CALL ‘C_ENQUEUE’ ID ‘OPCODE’ FIELD ‘F’.
CALL ‘C_WRITE_SYSLOG_ENTRY’ ID ‘TYP’ FIELD ‘C’
ID ‘KEY’ FIELD ‘GES’.
MESSAGE S900 WITH ‘Table locking turned off’.

***
REPORT ZSENQON MESSAGE-ID MT.
CALL ‘C_ENQUEUE’ ID ‘OPCODE’ FIELD ‘T’.
CALL ‘C_WRITE_SYSLOG_ENTRY’ ID ‘TYP’ FIELD ‘C’
ID ‘KEY’ FIELD ‘GER’.
MESSAGE S900 WITH ‘Table locking turned on’.

Don’t use in production system. Only for trainings!


Customize HR Process Workbench (PUST)

Hi.

I hope most of you have heard about PUST transaction. This is convinient  tool to build payroll close process. It’s idea is a chain of steps build from programms that we use in payroll close procedure. We can set variants for each program, build them in a sequence and run all at once (or step by step autmatically). User all needs is to hit Run button and watch it. While it’s running it will show logs for each step/programm and user will understand possible issues with easy.

There is no need to explain all customizing in detail as it’s pretty simple. At first setup Workflow as some particular elements use it for notifications. To do this run though SAP Note 133182 – Process Manager: No process is started.  Program starts – event fires. Program stops – event fires. It allows to run several programms in parallel and use workflows for example to payroll agreements.

For a user it will look like.

pust_2

Read More


SAP Scripting

Small instruction about SAP scripting.

Activate SAP Scripting in GUI settings (SAP Logon settings).

Open SAP and hit “Record macro” in GUI menu. Run all needed steps and stop recording.

As a result you’ll get file with script. For example I’ve a script of creating 0015 infotype record:

If Not IsObject(application) Then
Set SapGuiAuto = GetObject(“SAPGUI”)
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, “on”
WScript.ConnectObject application, “on”
End If
session.findById(“wnd[0]”).maximize
session.findById(“wnd[0]/tbar[0]/okcd”).text = “pa30”
session.findById(“wnd[0]”).sendVKey 0
session.findById(“wnd[0]/usr/subSUBSCR_PERNR:SAPMP50A:0110/ctxtRP50G-PERNR”).text = “609”
session.findById(“wnd[0]”).sendVKey 0
session.findById(“wnd[0]/usr/tabsMENU_TABSTRIP/tabpTAB01/ssubSUBSCR_MENU:SAPMP50A:0400/subSUBSCR_ITKEYS:SAPMP50A:0350/ctxtRP50G-CHOIC”).text = “15”
session.findById(“wnd[0]/usr/tabsMENU_TABSTRIP/tabpTAB01/ssubSUBSCR_MENU:SAPMP50A:0400/subSUBSCR_ITKEYS:SAPMP50A:0350/ctxtRP50G-SUBTY”).text = “0030”
session.findById(“wnd[0]/usr/tabsMENU_TABSTRIP/tabpTAB01/ssubSUBSCR_MENU:SAPMP50A:0400/subSUBSCR_TIME:SAPMP50A:0330/ctxtRP50G-BEGDA”).text = “100914”
session.findById(“wnd[0]/usr/tabsMENU_TABSTRIP/tabpTAB01/ssubSUBSCR_MENU:SAPMP50A:0400/subSUBSCR_ITKEYS:SAPMP50A:0350/ctxtRP50G-SUBTY”).setFocus
session.findById(“wnd[0]/usr/tabsMENU_TABSTRIP/tabpTAB01/ssubSUBSCR_MENU:SAPMP50A:0400/subSUBSCR_ITKEYS:SAPMP50A:0350/ctxtRP50G-SUBTY”).caretPosition = 4
session.findById(“wnd[0]/tbar[1]/btn[5]”).press
session.findById(“wnd[0]/usr/txtQ0015-BETRG”).text = “11”
session.findById(“wnd[0]/usr/txtQ0015-BETRG”).setFocus
session.findById(“wnd[0]/usr/txtQ0015-BETRG”).caretPosition = 18
session.findById(“wnd[0]”).sendVKey 11

Then you can put this script as VBA macro into MS Excel, handle it in a right manner (i.e. make a cycle) and automate you regular tasks or data upload/ mass change.

Important: scripting doesn’t understand system errors, system messages. eCATT and SAP Personas understand.