Category Archives: Downloads

ABAP Program to do mass deletion of Process Chains

The following small program allows you to do a mass deletion of process chains.

I tried to remove all popup messages that occur during PC deletion, but there is stil some problem with that and you have to press OK at each process chain.

You can download the code of the programhere in Saplink format.
Download – PROG_ZBW_RSPC_MASS_DELETE.slnk – 3.3 kB – 408   downloads

BW Inactive Objects Checker – ZBI_INACTIVE_OBJECTS

ZBI_INACTIVE_OBJECTS is a tool that I adapted from a program found on SCN that checks for inactive BW objects. In addition it stores a snapshot of the inactive objects. This way you can execute it before and after a transport operation. A ‘diff’ option will display

  • new or activted objects (that either did not exist or were inactive at the previous execution)
  • inactivated objects (that were active at the previous execution)

In the future I plan to adapt the tool so as to integrate it to the CTS import mechanism. In this way, when a transport contains BW objects, a diff on inactive objects would be automatically be performed and the result inserted in the log and/or mailed to the owner of the transport request.

Download – [NUGG_ZBI_INACTIVE_OBJECTS.nugg] –  34.6 kB – 474   downloads

FM to modify DTP filters

The article: Three Ways to Dynamically Update “Data Transfer Process” Filter Values describes different methods to determine DTP filters dynamically. In particular there is a method that sets the DTP in change mode, modifies the DTP filter then reactivates the DTP.

You can download the code of the function here in Saplink format.
Download – FUGR_ZBW_CHANGE_DTP_FILTERS.slnk – 9.8 kB – 449   downloads

SAP PM Table Relations

PMTables
SAP PM Table relationships map in PDF format.
Produced by Camilo Veloso (camiloveloso@hotmail.com).

Download – [SAP-PM Tables.pdf] – 117.0 kB – 1,892   downloads

Erratas:

1) The link between AFVC/AFVV and AFPO/AFKO
See in the attachment and also following post http://scn.sap.com/thread/1435014

SAP_PM_Tables_Errata1

2) Add a link between MPOS and CRHD (main work centre of a Maintenance Item).
MPOS-GEWRK = CRHD-OBJID and CRHD-OBJTY = ‘A’

Find which parent Process Chains call a given local child Process Chain

ParentChild

During the course of BW daily load maintenance I often need to figure out which Process Chains are calling a given Process Chain.

One way to locate all the parent Process Chains that contain a Process Step of type “Local Process Chain” that start a given ‘child”  Process Chain is to look up the information in table RSPCCHAIN. (Please let me know if there is a standard RSA1 approach to do the same that I missed out). 

First identify the  name of the start process variant in PC you want to locate. This is the technical name of the topmost step (start chain) in your child process chain.

Once you have found the name of the start process variant, do a SE16 search on table RSPCCHAIN with the following field selections
TYPE = CHAIN
VARIANTE = Start process variant technical name
OBJVERS  = ‘A’

All the resulting CHAIN_ID values correspond to the names of the parent process chains

The following very simple program does just what is described above.
Download – NUGG_ZBI_PROCESS_CHAINS_PARENTS.nugg –   6.3 kB – Invalid download ID.   downloads

Source code (1 program + 2 FM):

.
*&---------------------------------------------------------------------*
*& Report  ZBI_PROCESS_CHAINS_PARENTS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report  zbi_process_chains_parents.

data:
      lt_chains type bapiret2_t,
      ls_chain type bapiret2,
      ls_rspcchain type rspcchain,
      lt_rspcchain type standard table of rspcchain.

select-options s_pc for ls_rspcchain-chain_id.
select * from rspcchain into table lt_rspcchain
  where objvers = 'A'
    and type = 'TRIGGER'
    and chain_id in s_pc.

loop at lt_rspcchain into ls_rspcchain.
  ls_chain-message_v1 = ls_rspcchain-chain_id.
  append ls_chain to lt_chains.
endloop.

call function 'ZBW_PC_ANCESTORS_GET'
  changing
    ct_chains = lt_chains.

loop at lt_chains into ls_chain.
  if ls_chain-row = '0'.
    new-line.skip.
  endif.
    write: / '  '.
  do ls_chain-row times.
    write: '  '.
  enddo.
  if ls_chain-row > 0.
    write: '<=='.
  endif.
  write: ls_chain-message_v1. "', '|'.
*    WRITE: ls_chain-row, '|'.
endloop.
.

.

function zbw_pc_ancestors_get.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  CHANGING
*"     REFERENCE(CT_CHAINS) TYPE  BAPIRET2_T
*"----------------------------------------------------------------------

  data:
        ls_parent type rspc_chain,
        ls_child type rspc_chain,
        lt_parents type rsb_t_pcchain,
        l_recurse type flag,
        ls_chain type bapiret2,
        ls_maxlvl type bapiret2,
        ls_newlvl type bapiret2,
        lt_chains_new type bapiret2_t,
        lt_chains_oldest type bapiret2_t.

  lt_chains_oldest = ct_chains.
  sort lt_chains_oldest by row descending.
  read table lt_chains_oldest into ls_maxlvl index 1.
  ls_newlvl-row = ls_maxlvl-row + 1.
  loop at ct_chains into ls_chain.
    append ls_chain to lt_chains_new.
    if ls_chain-row = ls_maxlvl-row.
      ls_child = ls_chain-message_v1.
      call function 'ZBW_PC_PARENTS_GET'
        exporting
          i_chain_id = ls_child
        importing
          et_parents = lt_parents.
      loop at lt_parents into ls_parent.
        ls_chain-message_v1 = ls_parent.
        ls_chain-row = ls_newlvl-row.
        append ls_chain to lt_chains_new.
        l_recurse = 'X'.
      endloop.
    endif.
  endloop.

  if l_recurse = 'X'.
    call function 'ZBW_PC_ANCESTORS_GET'
      changing
        ct_chains = lt_chains_new.
  endif.
    ct_chains = lt_chains_new.
endfunction.

.

function zbw_pc_parents_get.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_CHAIN_ID) TYPE  RSPC_CHAIN
*"  EXPORTING
*"     REFERENCE(ET_PARENTS) TYPE  RSB_T_PCCHAIN
*"----------------------------------------------------------------------

data:
      lt_rspcchain type standard table of rspcchain,
      ls_rspcchain_trigger type rspcchain,
      ls_rspcchain type rspcchain.

refresh et_parents.

" 1st get the corresponding Start Process variants

select * from rspcchain into table lt_rspcchain
  where objvers = 'A'
    and type = 'TRIGGER'
    and chain_id = i_chain_id.

loop at lt_rspcchain into ls_rspcchain_trigger.

  select * from rspcchain into ls_rspcchain
    where objvers = 'A'
      and type = 'CHAIN'
      and variante = ls_rspcchain_trigger-variante.

    append ls_rspcchain-chain_id to et_parents.
  endselect.
endloop.

endfunction.

Program to check the start conditions of your Process Chains

The programs below list the start conditions of the selected Process Chains, and provide a list of the Process Chains scheduled as background jobs.

List the start conditions of the Process Chains: Download – NUGG_ZBI_PROCESS_CHAINS_STARTCOND.nugg –  3.1 kB – 359   downloads

List the scheduled Process Chains: Download – NUGG_ZBI_SCH_PROCESS_CHAINS.nugg –  2.8 kB – 348   downloads

Get size of database table via ABAP

Check program Check program RSTABLESIZE
or following code.

Update for BW74: FM ‘EM_GET_NUMBER_OF_ENTRIES’ import parameter has changed. see new code below.

Code up to BW 73

REPORT ZTEST_ILESH.

TABLES : DD02L.

SELECT-OPTIONS : S_TABLES FOR DD02L-TABNAME.

DATA : GT_TABROWS LIKE STANDARD TABLE OF DDCDIM,
       WA_TABROWS LIKE DDCDIM.

SELECT TABNAME
  FROM DD02L
  INTO CORRESPONDING FIELDS OF TABLE GT_TABROWS
  WHERE TABNAME IN S_TABLES.

CALL FUNCTION 'EM_GET_NUMBER_OF_ENTRIES'
  TABLES
    IT_TABLES = GT_TABROWS.

LOOP AT GT_TABROWS INTO WA_TABROWS.
  WRITE : / WA_TABROWS-TABNAME , WA_TABROWS-TABROWS.
ENDLOOP.

Code from BW74

Download – PROG_ZBC_CHECK_SYSTEM_TABLES_74.slnk] – 1.3 kB – 273   downloads

REPORT  ZBC_CHECK_SYSTEM_TABLES.

TABLES : DD02L.

SELECT-OPTIONS : S_TABLES FOR DD02L-TABNAME.

DATA : GT_TABROWS LIKE STANDARD TABLE OF DDCDIM,
       WA_TABROWS LIKE DDCDIM.

SELECT TABNAME
  FROM DD02L
  INTO CORRESPONDING FIELDS OF TABLE GT_TABROWS
  WHERE TABNAME IN S_TABLES.

CALL FUNCTION 'EM_GET_NUMBER_OF_ENTRIES'
  TABLES
    IT_TABLES = GT_TABROWS.

LOOP AT GT_TABROWS INTO WA_TABROWS.
  WRITE : / WA_TABROWS-TABNAME , WA_TABROWS-TABROWS.
ENDLOOP.

BEX Workbook Size Analysis report

One element influencing the performance of a BEx Workbook is its size. Each time you open a BEX Workbook from your BEx Analyzer, the excel file corresponding to the BEx Workbook is retrieved from the BW servers (it is stored as blob format in table RSRWBSTORE) and transferred to the front end.

Thus, before even doing a first refresh, there might be a perceivable delay due to the workbook transfer.

You can monitor the sizes of all the workbooks in your BW system with the following report available in Saplink format:

Download – PROG_ZBI_WORKBOOK_SIZES.slnk –  2.4 kB – 253   downloads

The size displayed by the report is in lines in table RSRBWSTORE. The real size is about 2000kb multiplied by the number of lines.

(Note: The BEx Workbooks are also stored in temp directory on the PC when executed. I do not know however if this means that the entire workbook is not always transferred on opening. If you have any info on the subject, please leave a comment.)

The below code also displays the French and Dutch workbook title.  (Just change the F and N to E and D to have it in English and German for instance.

*&---------------------------------------------------------------------*
*& Report  ZBI_WORKBOOK_SIZES
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zbi_workbook_sizes.

TYPES:
   BEGIN OF ty_output,
     workbookid TYPE rsrwbindex-workbookid,
     lines TYPE i,
     title_n TYPE rsrwbindext-title,
     title_f TYPE rsrwbindext-title,
   END OF ty_output.

DATA:
      l_lines TYPE i,
      lt_output TYPE TABLE OF ty_output,
      ls_output TYPE ty_output,
      ls_rsrwbindex TYPE rsrwbindex,
      ls_rsrwbindext_n TYPE rsrwbindext,
      ls_rsrwbindext_f TYPE rsrwbindext,
      lt_rsrwbindex TYPE TABLE OF rsrwbindex.

" Selection parameters
SELECT-OPTIONS s_wbk FOR ls_rsrwbindex-workbookid.

" Get list of workbooks
SELECT * FROM rsrwbindex INTO TABLE lt_rsrwbindex
  WHERE workbookid IN s_wbk
    AND objvers = 'A'.

LOOP AT lt_rsrwbindex INTO ls_rsrwbindex.
  SELECT MAX( linenumber ) FROM rsrwbstore INTO l_lines
    WHERE objvers = 'A'
      AND workbookid = ls_rsrwbindex-workbookid.
  SELECT SINGLE * FROM rsrwbindext INTO ls_rsrwbindext_n
    WHERE objvers = 'A'
     AND langu = 'N'
     AND  workbookid = ls_rsrwbindex-workbookid.

  SELECT SINGLE * FROM rsrwbindext INTO ls_rsrwbindext_f
WHERE objvers = 'A'
 AND langu = 'F'
 AND  workbookid = ls_rsrwbindex-workbookid.
  ls_output-workbookid = ls_rsrwbindex-workbookid.
  ls_output-lines = l_lines.
  ls_output-title_n = ls_rsrwbindext_n-title.
  ls_output-title_f = ls_rsrwbindext_f-title.
  APPEND ls_output TO lt_output.
ENDLOOP.
SORT lt_output BY lines DESCENDING.
LOOP AT lt_output INTO ls_output.
  WRITE:  ls_output-title_n, ls_output-title_f, ls_output-lines, ls_output-workbookid .
  NEW-LINE.
ENDLOOP.