0% found this document useful (0 votes)
40 views7 pages

Routines

This document contains a DTP routine to restrict the calendar month field CALMONTH to a range from -1 to +3 months. It uses ABAP functions to calculate the from and to dates for the range and updates the selection table accordingly. Comments in the code provide instructions for fixing issues like invalid characters or requests in an infoCube.

Uploaded by

sudhaker153
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views7 pages

Routines

This document contains a DTP routine to restrict the calendar month field CALMONTH to a range from -1 to +3 months. It uses ABAP functions to calculate the from and to dates for the range and updates the selection table accordingly. Comments in the code provide instructions for fixing issues like invalid characters or requests in an infoCube.

Uploaded by

sudhaker153
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

DTP routine to restrict calmonth for -1 to +3

*&---------------------------------------------------------------------*
*& Include RSBC_SEL_ROUTINE_TPL
*&---------------------------------------------------------------------*

program conversion_routine.
* Type pools used by conversion program
type-pools: rsarc, rsarr, rssm.
tables: rssdlrange.
* Global code used by conversion rules
*$*$ begin of global - insert your declaration only below this line *-*
* TABLES: ...
* DATA: ...
*$*$ end of global - insert your declaration only before this line *-*
* -------------------------------------------------------------------
* Fieldname = CALMONTH
* data type = NUMC
* length = 000006
* -------------------------------------------------------------------
form c_CALMONTH
tables l_t_range structure rssdlrange
using i_r_request type ref to IF_RSBK_REQUEST_ADMINTAB_VIEW
i_fieldnm type RSFIELDNM
changing p_subrc like sy-subrc.
* Insert source code to current selection field
*$*$ begin of routine - insert your code only below this line *-*
DATA: l_idx LIKE sy-tabix.
READ TABLE l_t_range WITH KEY
fieldname = 'CALMONTH'.
l_idx = sy-tabix.
*....
DATA: v_datefrm TYPE sy-datum.
DATA: v_dateto TYPE sy-datum.

CALL FUNCTION 'UJD_ADD_MONTH_TO_DATE'


EXPORTING
i_months = '-1' " pass months to adjust
i_old_date = sy-datum "pass date here
IMPORTING
e_new_date = v_datefrm. "get new date

CALL FUNCTION 'UJD_ADD_MONTH_TO_DATE'


EXPORTING
i_months = '3' " pass months to adjust
i_old_date = sy-datum "pass date here
IMPORTING
e_new_date = v_dateto. "get new date

l_t_range-sign = 'I'.
l_t_range-fieldname = 'CALMONTH'.
l_t_range-iobjnm = '0CALMONTH'.
l_t_range-option = 'BT'.
l_t_range-low = v_datefrm+0(6).
l_t_range-high = v_dateto+0(6).

p_subrc = 0.
IF l_idx <> 0.
MODIFY l_t_range INDEX l_idx.
ELSE.
APPEND l_t_range.
ENDIF.
p_subrc = 0.

*$*$ end of routine - insert your code only before this line *-*
endform.

2) fix invalid char in New table of DSO

Create info pack on comp code

program conversion_routine.
* Type pools used by conversion program
type-pools: rsarc, rsarr, rssm.
tables: rssdlrange.
* Global code used by conversion rules
*$*$ begin of global - insert your declaration only below this line *-*
* TABLES: ...
* DATA: ...
data: begin of i_doc occurs 0,
comp_code like /bi0/pcomp_code-comp_code,
end of i_doc.
constants c_all_capital(11) type c value 'ALL_CAPITAL'.
data: s_errorlog type rssm_s_errorlog_int,
s_monitor type rsmonitor,
* t_errorlog TYPE STANDARD TABLE OF rssm_s_errorlog_int,
t_monitor type standard table of rsmonitor,
v_allowed_char type char200,
v_index type sytabix,
v_recno type i.
*$*$ end of global - insert your declaration only before this line *-*
* -------------------------------------------------------------------
* InfoObject = 0COUNTRY
* Fieldname = LAND1
* data type = CHAR
* length = 000003
* convexit =
* -------------------------------------------------------------------
form compute_LAND1
tables l_t_range structure rssdlrange
using p_infopackage type rslogdpid
p_fieldname type rsfnm
changing p_subrc like sy-subrc.
* Insert source code to current selection field
*$*$ begin of routine - insert your code only below this line *-*
data: l_idx like sy-tabix.
refresh t_monitor.
clear v_index.
v_allowed_char = 'ALL_CAPITAL'.

DATA:
T_DOC_NUMBER TYPE /BI0/OIDOC_NUMBER,
T_BILL_ITEM TYPE /BI0/OIBILL_ITEM,
T_ACT_GI_DATE TYPE /BI0/OIACT_GI_DTE.

****IMPORTANT*************
** Do not change data in active or change log table.
**Use this info-pack to fix records in PSA and new table of DSO or any Z
**table or master data table
*
*** If a DSO activation failed due to bad SID..follow steps as below:
*
**1. Do not delete the request from DSO. It will be red on activation
**failure
**2. Just change the field value as using update code below for NEW
*table
**name in DSO
**3. Repeat DSO activation step in process chain or manually activate in
**DSO.
** 4. No need to change data in PSA.
** 5. Comment the code after change is complete.
*
*************************
***Test***
** update /bic/azic_d1000
** set doc_year = '2015'
** where mat_doc = '0100007723'.
****End Test********
*** Write your code below to update table fields. After update, please
**comment the code.
*****SD_O03 to SD_O07***********
*** Change all KFs to 0 before updating delivery header data (char to
**populate blank delivery types)
*** Zeroing KFs required bcoz of additive KF updates***********
** Update /BIC/B0000328000 " 8SD_O03 PSA
**set
** DEL_GR_WT = 0
** NO_SHPUN = 0
** NO_DEL = 0
**where
**REQUEST = 'REQU_1S9CEP7Y98XVGSQBPST0QQMUF' .
************************************************************
**** QM_O07 ZREFNUM DSO data activation error fix.
**if DSO data activation fails, uncomment below and execute IP, followed
**by repeat of DSO activation step in the process chain.
*** Once done, please comment the below code.
**update /BIC/AQM_O0740
**set
**/bic/zrefnum = 'BID SGP ISSUE'
**where
**/bic/zrefnum like 'BID SGP%'.
**************************************************
**** PUR_O08 DSO activation---Bad Batch #**********
**Update /bic/apur_o0840
**set
**batch = '201110030' where
**mat_doc = '5020640986'.
**********************************************
** Fix SD_O06 data (high level material) = 02/15/2021
** Set KFs to 0 in PSA
**Update /BIC/B0000329000
**set GRS_WGT_DL = 0
**INV_QTY = 0
**BILL_QTY = 0
**REQ_QTY = 0
**NET_WGT_DL = 0
**SCALE_QTY = 0
**VOLUME_DL = 0
**NO_INV_IT = 0
**NO_INV = 0
**REBATE_BAS = 0
**CSHDSC_BAS = 0
**GROSS_VAL = 0
**/BIC/SDBVCOST = 0
**TAX_AMOUNT = 0
**/BIC/SDBVNET = 0
**/BIC/SDBVSUB1 = 0
**/BIC/SDBVSUB2 = 0
**/BIC/SDBVSUB3 = 0
**/BIC/SDBVSUB4 = 0
**/BIC/SDBVSUB5 = 0
**/BIC/SDBVSUB6 = 0
**DOCUMENTS = 0
**WHERE REQUEST = 'REQU_B7LSVP52LWWPGM44T95N0CEG7'.
******
**** Change In-transit inventory quantity in IM_O03
**STO 5400000305 was suppose to be deleted many years back but never
**taken care.
**Change Stock qty from 693,382,601.833- to 0 for this stock from
*posting
**date 2019 onwards.
**Ideally it should be changed for all dates but it will be decided by
**Matthias.
*

*******************
** 05/06/2021 - OTC_DATA_LOAD_ECC6 Process Chain error. SID activation.
*
** VASCL psa bad char (白包) - 05/24/2021
**Update
**/bic/asd_o0140
**set /BIC/sdship_po = '' where
** DOC_NUMBER = '0002489719' AND
** S_ORD_ITEM = '000010'.
**********************************************

Update
/bic/aSD_o0440
set /BIC/ZSTCEG = '91310115MA1K44N30Y' where
BILL_NUM = '0979071851'.

*$*$ end of routine - insert your code only before this line *-*
endform. "

3) delete old requests in cube (keep only last 2 requests)

Create below program and add it in the PC

IN THE VARIANT, GIVE CUBE NAME


*&---------------------------------------------------------------------*
*& Report Z_REQ_DELETE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT Z_REQ_DELETE.

DATA: IS_RSSTATMANPART TYPE RSSTATMANPART.


DATA: IT_RSSTATMANPART TYPE TABLE OF RSSTATMANPART.
DATA: IV_CUBE TYPE RSDCUBET-INFOCUBE.
DATA: IV_DATE TYPE SY-DATUM.

PARAMETERS: CUBE TYPE RSDCUBET-INFOCUBE.


SELECTION-SCREEN BEGIN OF BLOCK gen WITH FRAME TITLE text-002.
PARAMETERS:
p_days LIKE rspsadel-older_days DEFAULT 30.
SELECTION-SCREEN END OF BLOCK gen.
SELECTION-SCREEN BEGIN OF BLOCK mode WITH FRAME TITLE text-004.
PARAMETERS:
p_simul AS CHECKBOX .
SELECTION-SCREEN END OF BLOCK mode.
*determine date for selection
*all requests before will be deleted
IV_DATE = SY-DATUM - P_days .
SELECT * FROM RSSTATMANPART INTO TABLE IT_RSSTATMANPART
WHERE DTA = CUBE
AND DATUM_ANF LT IV_DATE.
IF P_SIMUL = 'X'.
WRITE: /,
/ 'SIMULATION OF THE ENTERED SELECTION ONLY!!!', /, /, sy-uline,
/ 'On execution following Requests will be processed From', CUBE,
sy-uline.
ENDIF.

LOOP AT IT_RSSTATMANPART INTO IS_RSSTATMANPART.


IV_CUBE = IS_RSSTATMANPART-DTA.
IF P_SIMUL = 'X'.
WRITE: /10 IS_RSSTATMANPART-RNR.
ELSE.

CALL FUNCTION 'RSSM_DELETE_REQUEST'


EXPORTING
REQUEST = IS_RSSTATMANPART-RNR
INFOCUBE = IV_CUBE
EXCEPTIONS
REQUEST_NOT_IN_CUBE = 1
INFOCUBE_NOT_FOUND = 2
REQUEST_ALREADY_AGGREGATED = 3
REQUEST_ALREADY_CONDENSED = 4
NO_ENQUEUE_POSSIBLE = 5
CUBE_IN_PLANNING_MODE = 6
OTHERS = 7.

CASE SY-SUBRC.

WHEN 0.
WRITE : /10 IS_RSSTATMANPART-RNR, 50 'DELETED'.
WHEN 1.
WRITE : /10 IS_RSSTATMANPART-RNR, 50 'REQUEST_NOT_IN_CUBE'.
WHEN 2.
WRITE : /10 IS_RSSTATMANPART-RNR, 50 'INFOCUBE_NOT_FOUND'.
WHEN 3.
WRITE : /10 IS_RSSTATMANPART-RNR, 50 ' REQUEST_ALREADY_AGGREGATED'.
WHEN 4.
WRITE : /10 IS_RSSTATMANPART-RNR, 50 'REQUEST_ALREADY_CONDENSEDD'.
WHEN 5.
WRITE : /10 IS_RSSTATMANPART-RNR, 50 'NO_ENQUEUE_POSSIBLE'.
WHEN 6.
WRITE : /10 IS_RSSTATMANPART-RNR, 50 'CUBE_IN_PLANNING_MODE'.
WHEN 7.
WRITE : /10 IS_RSSTATMANPART-RNR, 50 ' OTHER REASON'.

ENDCASE.
ENDIF.
ENDLOOP.

You might also like