How to get lists of logged user details in SAP ABAP

September 10, 2023

In below program I have used TH_USER_LIST function module to get lists of logged users in SAP server and also get the host address and other details.

Code :

REPORT zvp_th_user_list.

DATAuser_list TYPE STANDARD TABLE OF uinfo.

CALL FUNCTION 'TH_USER_LIST'
  TABLES
    list                user_list
*   USRLIST             =
 EXCEPTIONS
   auth_misssing       1
   OTHERS              2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

cl_demo_output=>displayuser_list ).

IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

Simple Try Catch Program in SAP ABAP

September 10, 2023

I have used CX_SY_ZERODIVIDE class to handle exception.

Code :

REPORT zvp_try_catch.

DATATYPE int4.

PARAMETERSp_a TYPE int4,
            p_b TYPE int4.

START-OF-SELECTION.

  TRY .
      p_a / p_b.
      WRITEc.
    CATCH cx_sy_zerodivide.
      WRITE:'Error!! Divided by zero'.
  ENDTRY.

IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

How to execute an external OS Commands in SAP ABAP

September 09, 2023

lv_command is command name which we can configure through tcode - SM69
lv_targetsystem refers to GWD / GWP.

Code :

DATA : lv_command      TYPE sxpglogcmd,
         lv_targetsystem TYPE rfchost_ext.

DATA: lv_status TYPE btcxpgstat,
          lv_txt    TYPE string.

    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
      EXPORTING
        commandname                   = im_commandname
        operatingsystem               = sy-opsys
        targetsystem                  = im_targetsystem
      IMPORTING
        status                        = lv_status
      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 <> 0.
      CONCATENATE sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_txt.
      WRITE: lv_txt.
    else.
      write: 'success'.
    ENDIF.

IDE Used To Test This Code : ABAP Editor.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

How to access one program data to another program without EXPORT IMPORT or GET SET?

September 09, 2023

First Program Code : 

REPORT zvp_a.

TYPESBEGIN OF ty_mara,
         matnr TYPE mara-matnr,
         mtart TYPE mara-mtart,
         matkl TYPE mara-matkl,
       END OF ty_mara.

DATAit TYPE STANDARD TABLE OF ty_mara.

SELECT matnr
       mtart
       matkl
  FROM mara INTO TABLE it
  UP TO 10 ROWS.

PERFORM display IN PROGRAM zvp_b IF FOUND

Second Program Code : 

REPORT zvp_b.

TYPESBEGIN OF ty_mara,
         matnr TYPE mara-matnr,
         mtart TYPE mara-mtart,
         matkl TYPE mara-matkl,
       END OF ty_mara.

DATAwa TYPE ty_mara.

PERFORM display.

FORM display.
  DATAlv_tname TYPE LENGTH 30.
  FIELD-SYMBOLS <table> TYPE ANY TABLE.
  MOVE '(ZVP_A)IT' TO lv_tname.
  ASSIGN (lv_tnameTO <table>.

  LOOP AT <table> INTO wa.
    write:/ wa-matnr,
            wa-mtart,
            wa-matkl.
  ENDLOOP.

ENDFORM.

Execute ZVP_A Program.

Output :




IDE Used To Test This Code : ABAP Editor.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

How to create semicircle progress using ProgressBar.js

July 09, 2023



Here I have used ProgressBar.js to create semicircle progress element.

Download the required file from this link - https://kimmobrunfeldt.github.io/progressbar.js/

1. Add the progressbar.min.js file to your head section of html file.
<script src="progressbar.min.js"></script>

2. Put the following code in body section in html 
<div id="halfcircle">
</div>

3. Then put the below JavaScript code in body section of your html project file -
<script>
        var a = 65.
        var out = a / 100.
        var bar = new ProgressBar.SemiCircle(halfcircle, {
            strokeWidth: 6,
            color: '#FFEA82',
            trailColor: '#eee',
            trailWidth: 1,
            easing: 'easeInOut',
            duration: 1400,
            svgStyle: null,
            text: {
                value: '',
                alignToBottom: false
            },
            from: {
                color: '#FFEA82'
            },
            to: {
                color: '#ED6A5A'
            },
            // Set default step function for all animate calls
            step: (state, bar) => {
                bar.path.setAttribute('stroke', state.color);
                var value = Math.round(bar.value() * 100);
                if (value === 0) {
                    bar.setText('');
                } else {
                    bar.setText(value);
                }
                bar.text.style.color = state.color;
            }
        });
        bar.text.style.fontSize = '1.5rem';
        bar.animate(out); // Number from 0.0 to 1.0
    </script>

4. Then add this CSS property to your CSS file - 
#halfcircle {
  margin: 20px;
  width: 200px;
  height: 100px;
}

IDE Used To Test This Code : Brackets.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

How to check SAP system running on HANA database or not?

June 09, 2023

There are several ways to check database running on SAP.

1. When you logged in to SAP system through SAP GUI , you can check the database from SYSTEM > STATUS.

2. Another way to check database, go to SE24 tcode and then put the class name CL_DB_SYS and run the class.

If HANA database is exist then in IS_IN_MEMORY_DB attribute will be 'X' and DBSYA_TYPE attribute will be DHB.

If HANA database is not exist then IS_IN_MEMORY_DB attribute will be blank and DBSYA_TYPE attribute will be showing the existing oracle database.

If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to enable or disable MS Word as Editor in SAPscript and Smart Forms

February 07, 2023

Step 1. Go to SE38 and type program name  - RSCPSETEDITOR and then execute it.
Step 2. Tick or Untick SAPscript / Smart Forms to enable or disable MS Word as Editor.
Step 3. After that activate the changes.


IDE Used To Test This Code : SAP ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

How to read AL11 files using ZSUBST_GET_FILE_LIST function module in ABAP program

January 31, 2023

Code :
REPORT zvp_read_all_files.

DATA r3_filepath(100TYPE c,
       it_filelists     TYPE TABLE OF rsfillst.

DATApath      TYPE rsmrgstr-path,
      filename  TYPE rsmrgstr-name,
      open_file TYPE rlgrap-filename.

r3_filepath 'Your Folder Path'.
path r3_filepath.

CALL FUNCTION 'ZSUBST_GET_FILE_LIST'
  EXPORTING
    dirname      path
    filenm       filename
    pattern      'HOLD_*.CSV'
  TABLES
    file_list    it_filelists
  EXCEPTIONS
    access_error 1
    OTHERS       2.

IF it_filelists[] IS INITIAL.
  MESSAGE 'No File in Application Layer Folder' TYPE 'I'.
  LEAVE LIST-PROCESSING.
ELSE.
  LOOP AT it_filelists INTO DATA(wa_filelists).
    CONCATENATE wa_filelists-dirname wa_filelists-name INTO open_file SEPARATED BY '/'.
    WRITEopen_file.
  ENDLOOP.
ENDIF.

Output :



IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

ABAP program to display table output using cl_demo_output class

January 30, 2023

Custom Table -  ZVP_TEST
Above table have following fields and their data types.

CLIENT         MANDT
ID                 INT4
NAME         CHAR50
COUNTRY CHAR30
PHONE         CHAR10
SALARY CHAR40

Code -
SELECT * FROM zvp_test INTO TABLE @data(it).
cl_demo_output=>display( it ).

Output -



IDE Used To Test This Code : ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

SAP ABAP Editor Lists of Shortcut Key

January 10, 2023

Copy a line of code - Ctrl + Shift + T
Comment a line - Ctrl + <
Comment out a line - Ctrl + >

How to show Internal Table last record using inline in SAP ABAP

February 08, 2022

Code :
REPORT ZSOUMYO_DEMO.

typesBEGIN OF ty_str,
        id  TYPE i,
        name TYPE char20,
        address TYPE char100,
       END OF ty_str.

DATAit_str TYPE STANDARD TABLE OF ty_str,
      wa_str TYPE ty_str.

wa_str-id '1'.
wa_str-name 'prasun'.
wa_str-address 'kolkata'.
APPEND wa_str to it_str.

wa_str-id '2'.
wa_str-name 'kalyan'.
wa_str-address 'delhi'.
APPEND wa_str to it_str.

wa_str-id '3'.
wa_str-name 'rita'.
wa_str-address 'Mumbai'.
APPEND wa_str to it_str.

wa_str-id '4'.
wa_str-name 'suman'.
wa_str-address 'pune'.
APPEND wa_str to it_str.

wa_str it_str[ linesit_str ].
write:/ wa_str-id,
        wa_str-name,
        wa_str-address.

Output :


IDE Used To Test This Code : SAP GUI.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

PRODUCTS

LISTS OF PRODUCTS

SERVICES

SKILLS
SOFTWARE DEVELOPMENT
WEBSITE DEVELOPMENT
WEB HOSTING
BULK SMS SERVICE
SEO SERVICE
ANDROID APPS
QR CODE / BARCODE
HARDWARE SERVICE
OUR WORK AREA