Substitution User Exit
Substitution User Exit
Substitution User Exit
1.
2.
3.
4.
5.
ZRGGBS000
PROGRAM ZRGGBS000 .
*---------------------------------------------------------------------*
* Corrections/ repair
* wms092357 070703 Note 638886: template routines to be used for
* workaround to substitute bseg-bewar from bseg-xref1/2
*---------------------------------------------------------------------*
* *
* Substitutions: EXIT-Formpool for Uxxx-Exits *
* *
* This formpool is used by SAP for testing purposes only. *
* *
* Note: If you define a new user exit, you have to enter your *
* user exit in the form routine GET_EXIT_TITLES. *
* *
*---------------------------------------------------------------------*
INCLUDE FGBBGD00. "Standard data types
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
* PLEASE INCLUDE THE FOLLOWING "TYPE-POOL" AND "TABLES" COMMANDS *
* IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM *
TYPE-POOLS: GB002. " TO BE INCLUDED IN "wms092357
TABLES: BKPF, " ANY SYSTEM THAT "wms092357
BSEG, " HAS 'FI' INSTALLED "wms092357
COBL, "wms092357
CSKS, "wms092357
ANLZ, "wms092357
GLU1. "wms092357
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
*----------------------------------------------------------------------*
* FORM GET_EXIT_TITLES *
*----------------------------------------------------------------------*
* returns name and title of all available standard-exits *
* every exit in this formpool has to be added to this form. *
* You have to specify a parameter type in order to enable the *
* code generation program to determine correctly how to *
* generate the user exit call, i.e. how many and what kind of *
* parameter(s) are used in the user exit. *
* The following parameter types exist: *
* *
* TYPE Description Usage *
* ------------------------------------------------------------ *
* C_EXIT_PARAM_NONE Use no parameter Subst. and Valid. *
* except B_RESULT *
* C_EXIT_PARAM_FIELD Use one field as param. Only Substitution *
* C_EXIT_PARAM_CLASS Use a type as parameter Subst. and Valid *
* *
*----------------------------------------------------------------------*
* --> EXIT_TAB table with exit-name and exit-titles *
* structure: NAME(5), PARAM(1), TITEL(60)
*----------------------------------------------------------------------*
FORM GET_EXIT_TITLES TABLES ETAB.
EXITS-NAME = 'U100'.
EXITS-PARAM = C_EXIT_PARAM_NONE.
EXITS-TITLE = TEXT-100. "Cost center from CSKS
APPEND EXITS.
EXITS-NAME = 'U101'.
EXITS-PARAM = C_EXIT_PARAM_FIELD.
EXITS-TITLE = TEXT-101. "Cost center from CSKS
APPEND EXITS.
EXITS-NAME = 'RAMA'.
EXITS-PARAM = C_EXIT_PARAM_FIELD.
EXITS-TITLE = TEXT-
200. "Cons. transaction type
APPEND EXITS. "from xref1/2
************************************************************************
* PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES *
* IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM: *
* EXITS-NAME = 'U102'.
* EXITS-PARAM = C_EXIT_PARAM_CLASS.
* EXITS-TITLE = TEXT-102. "Sum is used for the reference.
* APPEND EXITS.
***********************************************************************
** EXIT EXAMPLES FROM PUBLIC SECTOR INDUSTRY SOLUTION
**
** PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINE
** TO ENABLE PUBLIC SECTOR EXAMPLE SUBSTITUTION EXITS
***********************************************************************
INCLUDE RGGBS_PS_TITLES.
REFRESH ETAB.
LOOP AT EXITS.
ETAB = EXITS.
APPEND ETAB.
ENDLOOP.
ENDFORM. "GET_EXIT_TITLES
*&---------------------------------------------------------------------*
*& Form U100
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->IM_PRCTR text
*----------------------------------------------------------------------*
FORM RAMA USING IM_PRCTR.
****************************************************************
****
*********************Declaring local Structure
TYPES: BEGIN OF TY_VBAK,
VBELN TYPE VBAK-VBELN,
VKORG TYPE VBAK-VKORG,
KUNNR TYPE VBAK-KUNNR,
NETWR TYPE VBAK-NETWR,
ERDAT TYPE VBAK-ERDAT,
END OF TY_VBAK,
BEGIN OF TY_CAN,
VBELN TYPE VBAK-VBELN,
VKORG TYPE VBAK-VKORG,
KUNNR TYPE VBAK-KUNNR,
VBTYP TYPE VBAK-VBTYP, "SD document categ.
AUART TYPE VBAK-AUART, "Sales Document Type
AUGRU TYPE VBAK-AUGRU, "Order reason
VGBEL TYPE VBAK-VGBEL,
ERDAT TYPE VBAK-ERDAT,
END OF TY_CAN.
****************************************************************
*******************
********Declaring Variable, interal table , work-
area******************************
DATA : LV_PRCTR TYPE PRCTR.
REFRESH:IT_SCLASS, IT_CLOBJDAT,R_VKORG,R_VKORG[].
R_VKORG-SIGN = 'I'.
R_VKORG-OPTION = 'EQ'.
R_VKORG-LOW = GV_GSBER.
APPEND R_VKORG.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CLEAR:WA_WBS-WBS, GW_PRPS, GV_SALESPHASE, OBJECT, GV_VBELN,
GV_KUNNR, GV_GSBER, GV_MATNR,IT_SCLASS, IT_CLOBJDAT.
REFRESH:IT_SCLASS, IT_CLOBJDAT.
ENDFORM. "U100
* eject
*---------------------------------------------------------------------*
* FORM U100 *
*---------------------------------------------------------------------*
* Reads the cost-center from the CSKS table . *
*---------------------------------------------------------------------*
FORM U100.
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES *
* IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM: *
* SELECT * FROM CSKS
* WHERE KOSTL EQ COBL-KOSTL
* AND KOKRS EQ COBL-KOKRS.
* IF CSKS-DATBI >= SY-DATUM AND
* CSKS-DATAB <= SY-DATUM.
*
* MOVE CSKS-ABTEI TO COBL-KOSTL.
*
* ENDIF.
* ENDSELECT.
ENDFORM. "U100
* eject
*---------------------------------------------------------------------*
* FORM U101 *
*---------------------------------------------------------------------*
* Reads the cost-center from the CSKS table for accounting *
* area '0001'. *
* This exit uses a parameter for the cost_center so it can *
* be used irrespective of the table used in the callup point. *
*---------------------------------------------------------------------*
FORM U101 USING COST_CENTER.
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES *
* IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM: *
* SELECT * FROM CSKS
* WHERE KOSTL EQ COST_CENTER
* AND KOKRS EQ '0001'.
* IF CSKS-DATBI >= SY-DATUM AND
* CSKS-DATAB <= SY-DATUM.
*
* MOVE CSKS-ABTEI TO COST_CENTER .
*
* ENDIF.
* ENDSELECT.
ENDFORM. "U101
* eject
*---------------------------------------------------------------------*
* FORM U102 *
*---------------------------------------------------------------------*
* Inserts the sum of the posting into the reference field. *
* This exit can be used in FI for the complete document. *
* The complete data is passed in one parameter. *
*---------------------------------------------------------------------*
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES *
* IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM: *
*FORM u102 USING bool_data TYPE gb002_015.
*DATA: SUM(10) TYPE C.
*
* LOOP AT BOOL_DATA-BSEG INTO BSEG
* WHERE SHKZG = 'S'.
* BSEG-ZUONR = 'Test'.
* MODIFY BOOL_DATA-BSEG FROM BSEG.
* ADD BSEG-DMBTR TO SUM.
* ENDLOOP.
*
* BKPF-XBLNR = TEXT-001.
* REPLACE '&' WITH SUM INTO BKPF-XBLNR.
*
*ENDFORM.
***********************************************************************
** EXIT EXAMPLES FROM PUBLIC SECTOR INDUSTRY SOLUTION
**
** PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINE
** TO ENABLE PUBLIC SECTOR EXAMPLE SUBSTITUTION EXITS
***********************************************************************
*INCLUDE rggbs_ps_forms.
*eject
* begin of insertion "wms092357
*&---------------------------------------------------------------------*
*& Form u200
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM U200 USING E_RMVCT TYPE BSEG-BEWAR.
PERFORM XREF_TO_RMVCT USING BKPF BSEG 1 CHANGING E_RMVCT.
ENDFORM. "u200
*&---------------------------------------------------------------------*
*& Form xref_to_rmvct
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM XREF_TO_RMVCT
USING IS_BKPF TYPE BKPF
IS_BSEG TYPE BSEG
I_XREF_FIELD TYPE I
CHANGING C_RMVCT TYPE RMVCT.
HINT: https://www.saptutorial.org/use-substitution-user-exit-change-fi-doc-field-migo/