Tuesday, May 13, 2008

ABAP Code For a Progress BAR

ABAP Code For a Progress BAR

Please find below code for displaying a progress bar in ABAP. Once you execute this code a progress bar will be displayed in the status bar. You need to manipulate the code in such a way so that it can be displayed in your program.

REPORT ZEX_PROGRESSIND .



DATA: A LIKE SY-UCOMM.

DO 100 TIMES.
  DO 300 TIMES.
    GET TIME.
  ENDDO.
  A(3) = SY-INDEX.A+3 = '%'.
  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
            PERCENTAGE = SY-INDEX
            TEXT       = A.
ENDDO.

WRITE: / 'Complete'.


Function Module: SAP Logged in USERS to Application Server.

Function Module: SAP Logged in USERS to Application Server

To get a list of users logged in to SAP, to a particular application server use the following function module.

TH_USER_LIST

The above mentioned function module gives a complete list of the users logged in  to the desired Application Server. Apart from the user list it also gives information related to the user such as.





Please find below sample code for executing this function Module.

REPORT ZEX_GETUSERLIST .


Parameters: p_server like MSXXLIST-NAME.

Data: int_list like UINFO occurs 0 with header line.


CALL FUNCTION 'TH_USER_LIST'
 EXPORTING
   APSERVER       = p_server
  TABLES
    LIST           = int_list.


    Loop at int_list.
    write: int_list-BNAME, int_list-TCODE.
    ENDLOOP.



 

Create Directory from SAP ABAP

Create Directory from SAP ABAP

In case you want to create a directory from within SAP on the presentation server you can use the following function module.


GUI_CREATE_DIRECTORY

This function module creates a directory on the presentation server. You need to mention the complete path. Please find below some sample code.


REPORT ZEX_CREATEDIRPRE .

Parameters: p_dirnm like RLGRAP-FILENAME.


CALL FUNCTION 'GUI_CREATE_DIRECTORY'
  EXPORTING
    DIRNAME       =  p_dirnm
 EXCEPTIONS
   FAILED        = 1
   OTHERS        = 2
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.