Thursday, 26 September 2019

Find the variant of a program causing dump

Introduction


In the area of SAP interfaces, particularly report programs having complex selection screens; it practically becomes impossible to remember the screen values, every time the user run the report.

Thus to solve, this problem, SAP came up with the concept of variants long ago, which enables the user to store the selection screen value combinations into a logical object.

But, what if the report contains several selection screen variants and one of them is running into a run time dump/exception. And sometimes it becomes very difficult and crucial to know the selection screen variant in such case, particularly when the report is executed in the background.

In this blog post you, especially the beginners will learn how to find the selection screen variant of a program causing dump by navigating through transaction ST22.

Prerequisite


◈ Create a test program for example “ZTEST_VARIANT_DUMP” containing as less as 2 parameters of integer type. Please find below the code for the above program used in this blog.

REPORT  ZTEST_VARIANT_DUMP.
*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: v_result TYPE p DECIMALS 2.

*&---------------------------------------------------------------------*
*& Selection Screen Declaration
*&---------------------------------------------------------------------*
PARAMETERS: p_num1 TYPE i, "Text: Num-1
            p_num2 TYPE i. "Text: Num-2

*&---------------------------------------------------------------------*
*& Perform calculation and print the result
*&---------------------------------------------------------------------*
v_result = p_num1 / p_num2.

"Result
WRITE: v_result.

Now if you will execute this report with a variant such that v_result should calculate (1 / 0 ), we will get a dump “COMPUTE_INT_ZERODIVIDE with exception: CX_SY_ZERODIVIDE”.

Please find below the screenshot of the selection screen:

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

You can maintain at least 2 selection screen variant for this report as follows:

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

Values in respective variants:

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

In case you straightaway want to check your program variant for background job, then you can save your variant for background job.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

Steps


1. Run your report and select the variant2(which will give us a dump)

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

2. Execute the report in foreground and expect a dump

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

Ladies and gentlemen, let me have the honor to introduce you to the best friend of an ABAPer(or a software developer in generic :-P)….. Errorrrr!!

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

3. Now, if you want to see, for which variant we got this dump, then you can go to transaction ST22 and first find the error corresponding to your report.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

Navigate to your respective error:

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

Double click on it.

Here you will see the details of the dump you got:

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

4. Now navigate to the left hand side panel Runtime Error -> BASIS developer view -> Directory of Application Tables

and here you will find the variant for which you got the dump. In our case it is VARIANT2.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Guides

No comments:

Post a Comment