Monday, May 18, 2009

Printing ALV along with Page numbers

By Joyjit Ghosh

Expected Layout of the ALV report (when printing):

Step 1: Display each new document in a new page

To achieve this below routine is written to populate the IT_SORT table parameter of ALV function module REUSE_ALV_GRID_DISPLAY. And ALV will automatically insert page break whenever a new document is encountered.
CONSTANTS:    
c_spos TYPE SLIS_SPOS VALUE '01', " Column position
c_up TYPE SLIS_SOUP VALUE 'X', " Sorting order
c_table TYPE tabname VALUE 'I_FINAL'," Name of o/p table
c_group TYPE SLIS_CTRLS VALUE '*', " Sorting group
c_fld2 TYPE fieldname VALUE 'IDCNGA04-IDCN037'." Field name(Document no)
* Prepare sort table
PERFORM prepare_sort_table CHANGING i_sort[].
FORM prepare_sort_table CHANGING pi_sort TYPE slis_t_sortinfo_alv.
  CLEAR st_sort.
st_sort-spos = c_spos. " Sort sequence
st_sort-fieldname = c_fld2. " Document no
st_sort-tabname = c_table. " Table name
st_sort-up = c_up. " Ascending
st_sort-group = c_group. " Group
* Populate sort table
APPEND st_sort TO pi_sort.
ENDFORM.                    "prepare_sort_table

Step 2: Reset page number to 1 for each new document

From ALV function module we cannot control the page numbers as it will automatically increment the page counter whenever a new page is printed. So to achieve this we have written our custom code within the TOP_OF_PAGE routine.

Register TOP_OF_PAGE routine with the TOP_OF_PAGE event in IT_EVENTS table parameter of the ALV function module.
* Prepare event table
PERFORM prepare_event_table.
FORM prepare_event_table .
* Populate top-of-page event
st_event-name = slis_ev_top_of_page.
st_event-form = slis_ev_top_of_page.
APPEND st_event TO i_event.
  CLEAR st_event.
ENDFORM.                    " prepare_event_table

Custom code to control the page number in TOP_OF_PAGE routine

Code block marked in bold are used to control the page number. As in our case we are using ALV grid to display the report so during report display page number is not visible. It is only visible in print preview or at the time of printing.

FORM top_of_page.
* Local variable declaration
STATICS: l_comm TYPE syucomm. " Store user command
* Declaration of local variables
DATA: l_line_size TYPE sylinsz, " Line size
l_line TYPE slis_listheader, " Hold list header
l_currdoc TYPE idcn037, " Current doc.
l_currtabix TYPE sytabix. " Current index
* Check for print or print preview
IF ( sy-ucomm = c_prin OR
sy-ucomm = c_rnt_prev OR
sy-ucomm = c_rnt ).
    IF l_comm <> sy-ucomm.
CLEAR : g_page_cnt.
    ENDIF. " l_comm <> sy-ucomm
*   Store current table index
l_currtabix = sy-tabix.
CLEAR st_final.
*   If current index is 1 then start page numbering from 1
IF l_currtabix = 1.
*     Read 1st record and store the document no
READ TABLE i_final INDEX l_currtabix INTO st_final.
g_prevdoc = st_final-idcnga04-idcn037.
*     Start page numbering from 1
g_page_cnt = 1.
g_prevtabix = 1.
    ELSE.
*     Read the table line
READ TABLE i_final INDEX l_currtabix INTO st_final.
*     Store the current document
l_currdoc = st_final-idcnga04-idcn037.
*     If the current doc. is same as previou doc.
* increament the page no, otherwise start it from 1
IF l_currdoc = g_prevdoc.
*       Increament the page no
g_page_cnt = g_page_cnt + 1.
ELSE.
*       Start page from 1
g_page_cnt = 1.
*       Store current doc. as previous doc.
g_prevdoc = l_currdoc.
      ENDIF. " l_currdoc = g_prevdoc
    ENDIF. " l_currtabix = 1
  ENDIF. " sy-ucomm = c_prin OR
  IF g_page_cnt = 1.
*   Store the user command
l_comm = sy-ucomm.
  ENDIF. " g_page_cnt = 1
* Display page no
IF g_page_cnt > 0 .
*  Store the report width
l_line_size = sy-linsz.
*  Calculate position
l_line_size = l_line_size - 10.
*  Display page no
WRITE AT l_line_size 'Page no:'(021).
*  Calculate position
l_line_size = l_line_size + 5.
    WRITE AT l_line_size g_page_cnt.
  ENDIF. " g_page_cnt > 0
  REFRESH st_list_top_of_page.
* Populate company name
CLEAR l_line.
l_line-typ = c_typ.
l_line-info = g_comp_name.
APPEND l_line TO st_list_top_of_page.
* Populate heading
CLEAR l_line.
l_line-typ = c_typ.
l_line-info = text-020.
APPEND l_line TO st_list_top_of_page.
* At the time of printing or print preview display additional info
* on 1st page
IF g_page_cnt = 1 AND
( sy-ucomm = c_prin OR
sy-ucomm = c_rnt_prev OR
sy-ucomm = c_rnt ).
    CLEAR l_line.
l_line-typ = 'A'.
*   Populate Staff name
CONCATENATE text-017
st_final-idcnga04-idcn053
INTO l_line-info
SEPARATED BY ':'.
APPEND l_line TO st_list_top_of_page.
    CLEAR l_line.
l_line-typ = 'A'.
*   Populate Accountant
CONCATENATE text-018
'______________________'
INTO l_line-info
SEPARATED BY ':'.
    APPEND l_line TO st_list_top_of_page.
    CLEAR l_line.
l_line-typ = 'A'.
*   Populate Book keeper
CONCATENATE text-019
'______________________'
INTO l_line-info
SEPARATED BY ':'.
    APPEND l_line TO st_list_top_of_page.
    l_line-typ  = 'A'.
l_line-info = space.
APPEND l_line TO st_list_top_of_page.
  ENDIF.
* Display list header
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = space
it_list_commentary = st_list_top_of_page.
* No sy-subrc check is required
ENDFORM.                    " top_of_page

Step 3: Display report

Display the ALV report using 'REUSE_ALV_GRID_DISPLAY' function module.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_prog " Call back progrm
it_fieldcat = i_fieldcat_msg " Field catalog
is_layout = st_layout " Layout
it_sort = i_sort[] " Sort table
i_save = c_save " 'A'
is_variant = l_variant " ALV variant
it_events = i_event " ALV events
is_print = st_print " Print parameters
TABLES
t_outtab = i_final " Output table
EXCEPTIONS
program_error = 1
OTHERS = 2.

Result:

Report is displayed in ALV grid. Note that no page number is displayed. Now press the print preview button

Report is displayed in print preview with page numbers.

Limitations:

  1. For positioning the page number in the report we have to calculate the position based on the list width. As in this case we are using the formula

Page number position = sy-linsz – 10. But if you want you can change it.

2. In print preview only 1st page number is visible for every document i.e. if a document spreading multiple pages
only the 1st page number will be visible. You can see all the page numbers at the time of actual printing.

ALV with EDIT and SAVE functionality

By Joyjit Ghosh.

Code:
REPORT z_demo_alv_jg.
*******************************************************************
* TYPE-POOLS *
*******************************************************************
TYPE-POOLS: slis.
*******************************************************************
* INTERNAL TABLES/WORK AREAS/VARIABLES *
*******************************************************************
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.
*******************************************************************
* FIELD-SYMBOLS *
*******************************************************************
FIELD-SYMBOLS: TYPE STANDARD TABLE,
TYPE ANY,
TYPE ANY,
TYPE STANDARD TABLE.
*******************************************************************
* SELECTION SCREEN *
*******************************************************************
PARAMETERS: tabname(30) TYPE c,
lines(5) TYPE n.
*******************************************************************
* START-OF-SELECTION *
*******************************************************************
START-OF-SELECTION.
* Storing table name
p_table = tabname.
* Create internal table dynamically with the stucture of table name
* entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO .
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
    LEAVE TO LIST-PROCESSING.
ENDIF.
* Create workarea for the table
CREATE DATA dy_line LIKE LINE OF .
ASSIGN dy_line->* TO .
* Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO .
  SORT i_fieldcat BY col_pos.
* Select data from table
SELECT * FROM (p_table)
INTO TABLE
UP TO lines ROWS.
  REFRESH .
* Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab =
EXCEPTIONS
program_error = 1
OTHERS = 2.
  IF sy-subrc <> 0.
  ENDIF.
*&-----------------------------------------------------------------*
*& Form SET_PF_STATUS
*&-----------------------------------------------------------------*
* Setting custom PF-Status
*------------------------------------------------------------------*
* -->RT_EXTAB Excluding table
*------------------------------------------------------------------*
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'Z_STANDARD'.
ENDFORM.                    "SET_PF_STATUS
*&----------------------------------------------------------------*
*& Form user_command
*&-----------------------------------------------------------------*
* Handling custom function codes
*------------------------------------------------------------------*
* -->R_UCOMM Function code value
* -->RS_SELFIELD Info. of cursor position in ALV
*------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.
* Local field-symbols
FIELD-SYMBOLS: TYPE table,
TYPE ANY.
* Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO .
* Create workarea
CREATE DATA l_line LIKE LINE OF .
ASSIGN l_line->* TO .
  CASE r_ucomm.
*   When a record is selected
WHEN '&IC1'.
*     Read the selected record
READ TABLE ASSIGNING INDEX
rs_selfield-tabindex.
      IF sy-subrc = 0.
*       Store the record in an internal table
APPEND TO .
*       Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'Z_DEMO_PDF_JG'
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
*         Make all the fields input enabled except key fields
w_field-input = 'X'.
          MODIFY i_fieldcat FROM w_field TRANSPORTING input
WHERE key IS INITIAL.
        ENDIF.
*       Display the record for editing purpose
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab =
EXCEPTIONS
program_error = 1
OTHERS = 2.
        IF sy-subrc = 0.
*         Read the modified data
READ TABLE INDEX 1 INTO .
*         If the record is changed then track its index no.
* and populate it in an internal table for future
* action
IF sy-subrc = 0 AND <> .
= .
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF.
      ENDIF.
*   When save button is pressed
WHEN 'SAVE'.
*     Sort the index table
SORT i_index.
*     Delete all duplicate records
DELETE ADJACENT DUPLICATES FROM i_index.
      LOOP AT i_index.
*       Find out the changes in the internal table
* and populate these changes in another internal table
READ TABLE ASSIGNING INDEX i_index.
IF sy-subrc = 0.
APPEND TO .
ENDIF.
      ENDLOOP.
*     Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
      IF sy-subrc = 0.
*       Modify the database table with these changes
MODIFY (p_table) FROM TABLE .
        REFRESH .
*       Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table.
      ENDIF.
ENDCASE.
  rs_selfield-refresh = 'X'.
ENDFORM.                    "user_command

Selection screen:

Output:

Passing table data to the layout without changing the driver program

By Joyjit Ghosh

I have seen a typical requirement from client that SAP script layout need to be changed (additional data need to be displayed) without modifying the driver program (mainly standard SAP program). This tip will show us how to pass table data (multiple records at a time) to layout without changing the driver program.

Step1. Create a standard text from SO10.

Create a blank standard text. This will store the table data

Step2. Create a subroutine pool and a routine in it that can be called from SAP script.

From transaction SE38 create a subroutine pool.

Now create subroutine with proper interface to fetch the data from the table.

Step3. Within this routine write the logic to fetch the table data and populate the standard text.

***************************************************************
* Fetch table data and upload the data in proper format to the
* standard text
***************************************************************
DATA: i_zemployee TYPE STANDARD TABLE OF zemployee INITIAL SIZE 0,
w_zemployee TYPE zemployee,
i_text TYPE STANDARD TABLE OF tline INITIAL SIZE 0,
w_header LIKE thead,
w_text TYPE tline.
CONSTANTS: c_par TYPE char2 VALUE ',,'. " Sign for tabs
* Fetch data for employee
SELECT * FROM zemployee
INTO TABLE i_zemployee.
  IF sy-subrc = 0.
*  Create text table
LOOP AT i_zemployee INTO w_zemployee.
*     Store default paragraph format
w_text-tdformat = '*'.
*     Add all the required fields separated by tab
CONCATENATE w_zemployee-empno w_zemployee-empname
INTO w_text-tdline
SEPARATED BY c_par.
*     Store table data
APPEND w_text TO i_text.
    ENDLOOP.
    check sy-subrc = 0.
*   Populate header info
*   Text object
w_header-tdobject = 'TEXT'.
*   Standard text name
w_header-tdname = 'Z_TABLE_DATA'.
*   Text id
w_header-tdid = 'ST'.
*   Language
w_header-tdspras = 'E'.
*  Populate the standard text with table data
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = w_header
insert = 'X'
savemode_direct = 'X'
TABLES
lines = i_text
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5
.
IF sy-subrc <> 0.
    ENDIF.
  ENDIF. 

Step4. Call the routine and standard text from the SAP script layout.

Note: For the sake of simplicity this tip is shown in a custom layout that is called from a custom report.

/*   Call the routine
/: PERFORM FETCH_TABLE_DATA IN PROGRAM Z_SUBROUTINE_POOL
/: USING &INVAR1&
/: CHANGING &OUTVAR1&
/: ENDPERFORM
/*   Now call the standard text
/: INCLUDE Z_TABLE_DATA OBJECT TEXT ID ST LANGUAGE EN

Step5. Test the SAP script form

Activate the SAP script debugger


Run the custom report to test the SAPscript layout.

*&---------------------------------------------------------------*
*& Report Z_TEST_SAPCSRIPT *
*&---------------------------------------------------------------*
REPORT  Z_TEST_SAPCSRIPT                        .
start-of-selection.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'Z_DEMO_LAYOUT'
LANGUAGE = SY-LANGU
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
.
IF sy-subrc = 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = '001'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
* IMPORTING
* PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
 CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.

After execution of this report SAPscript debugger is triggered.

As shown below layout is calling the code written in the routine

Standard text is populated with the data fetched from table

Output of SAP script:

Table entries:

Create Dynamic Patterns

By Joyjit Ghosh

Step1
. Create a pattern with only one line that contains *$&$EXIT.

Put this above expression and press save button.

Step2. Now from CMOD create a project and include enhancement SEUED001 in it.

Now select the user exit EXIT_SAPLLOCAL_EDT1_001 and create the include program in it.

Now insert the following code block in the include program and activate it.

*&---------------------------------------------------------------------*
*& Include ZXSEUU26 *
*&---------------------------------------------------------------------*
DATA: w_buffer TYPE string.
CASE keyword.
  WHEN 'DYNAMIC_PATTERN'.
    w_buffer =
'*********************************************************************'.
APPEND w_buffer TO buffer.
w_buffer = '*& Program :'.
APPEND w_buffer TO buffer.
w_buffer = '*& Module :'.
APPEND w_buffer TO buffer.
w_buffer = '*& Sub-Module :'.
APPEND w_buffer TO buffer.
w_buffer = '*& Functional Contact:'.
APPEND w_buffer TO buffer.
w_buffer = '*& Funct. Spec. Ref. :'.
APPEND w_buffer TO buffer.
w_buffer = '*& Developer(Company):'.
APPEND w_buffer TO buffer.
w_buffer = '*& Create Date :'.
APPEND w_buffer TO buffer.
w_buffer = '*& Program Type :'.
APPEND w_buffer TO buffer.
w_buffer = '*& Project Phase :'.
APPEND w_buffer TO buffer.
w_buffer = '*& Description :'.
APPEND w_buffer TO buffer.
w_buffer =
'*********************************************************************'.
APPEND w_buffer TO buffer.
  WHEN OTHERS.
* Do nothing
ENDCASE.

Lastly activate the project



Step3. Insert this newly created pattern in a program and test whether it is displaying the dynamic pattern or not.

SAP code to call the user-exit.

User-exit call

Dynamic pattern



Wednesday, February 11, 2009

Find transaction for table maintenance generator

By Joyjit Ghosh,
Kolkata
, India
.

Sometime we only know that a table has a table maintenance generator but does not have any idea whether any transaction is attached with it or not. To find that go to table TSTCP and in the selection screen against PARAM field give the following string:

*SM30 VIEWNAME=@Table in question@*

Here replace

@Table in question@ by actual table name.

For example if we are searching transaction for table T001CM then resultant string would be:

*SM30 VIEWNAME=T001CM*



Now press execute button, if any transaction is available then it will show the transaction name.

In our case it is “OBZK”.

Note: if you donot find the transaction by using above string then use the table name in lower case (t001cm)in the string and try to search again.

Ex: *SM30 VIEWNAME=t001cm*

Monday, January 26, 2009

Store internal table content in local file during debugging in 4.6c

By Joyjit Ghosh,
Kolkata, India.

In 4.6C there is no direct option provided in the debugger to store internal table content in local file as it is there from release 6.20 onwards (see the screen shot below).

This tip will show us how to achieve the same in release 4.6C.

Step1: When you are in debugging mode press the table push button. And enter the internal table name. Place the cursor on the table field.

Step 2: Go to the “Goto” menu. Choose ”Display data object” sub-menu. And from the Sub-menu Choose “Structure Editor”.

Step 3: When we press the ‘Structure editor’ sub-menu, screen with title “Structure editor: change [table name] from entry 1” is displayed, where all the contents of the internal table is displayed as a list. Here if we want we can add /delete/modify new rows.

Step 4: Here our main objective is to download the contents of the internal table. To accomplish this go to “Object” menu and select “Display entire list” sub-menu.

Step 5: Now go to System -> List -> Save -> Local file sub-menu.

Step 6: A pop-up screen is appeared to ask ’In which format should the list be saved?’ Just press OK button.

Step 7: When OK button is pressed again a pop-up screen is appeared where the file name has to be given. After providing the file name, press ‘Transfer’ button.

Step 8: Now if we open the file then we can see that the content of the internal table is stored in the following format. This facility will save us from tedious work of researching the internal table contents from within the ABAP debugger as we can now use a user-friendly tool (like Microsoft Excel, Notepad etc.) to check the data in the file itself.


Set up business events to update custom tables from a Standard Transaction

By Joyjit Ghosh,
Kolkata
, India
.

At times the business requirement demands that if the user changes some data from a standard SAP transaction, the same will be noted down in some form and subsequently a daily batch job will pick up that information and will send to another system. One way to achieve this type of requirement is to have the business events set up for this standard transaction in question (provided that transaction calls the business events in it). There are a number of business events declared in a SAP system that may be of use. The transaction is BF34 where we need to configure the business events.

Step-1

In the BF34 transaction, SAP provides the opportunity to configure the Business events and the corresponding function modules:

There is a F4 drop down help available for these business events as shown below:


One can easily choose the business events from this drop down box.

For every event number one corresponding function module exists.

Step-2

The function module SAMPLE_INTERFACE_00001340 is a function module template that needs to be copied as a Z-function module and then altered so that the desired functionality can be achieved. Please see the following screenshots for details:

The existing template:

Please note that this function module contains all the details about the relevant data as importing parameters. The example above is relevant to the event no. 00001340, which is ‘Customer Master data: Final checks’. All data corresponding to this transaction is available within this function module. The idea is to create a custom function module by copying this template function module and then add additional code in that to get the desired functionality.

A real life scenario:

A typical case can be monitoring the customer hierarchy (tcodeVDH1N) for any create/change/delete in the hierarchy relationship. This is important when the client decides that he/she will use non-SAP software (e.g. I-MANY) to monitor the rebate amount distribution. This is a primary requirement for the I-MANY software that the customer hierarchy relationship is in sync with SAP.

The business events for the customer hierarchy create/change/delete are as below: -

These events are configured in the BF34 transaction as below: -

Using transaction BF24 we can create the “Product” as shown below:

The requirement was to write down the create/change/delete information for the customer hierarchy in three different custom tables with the Higher-level customer number and the validity start, end dates. The Z_CS_LOG_CH_CREATE,Z_CS_LOG_CH_CHANGE, Z_CS_LOG_CH_DELETE function modules accomplishes the same.

How does this work?

In the standard SAP transaction VDH1N, the standard code issues outbound function calls as below: -

For the creationà the outbound call is made for the business event 00504004

For the change à the outbound call is made for the business event 00504005

For the deletionà the outbound call is made for the business event 00504006

These events have been set up in the configuration as shown above. So, whenever there is a change in the customer hierarchy by the standard SAP transaction, the same is being logged by these custom function modules via the business events.

There is a separate program, which is scheduled to run once daily, which picks up the information for the day it is running, from these custom tables and sends Idocs to the non-SAP system.