You are on page 1of 32

SAPYard “SAP ABAP for HANA” Sample TDD

Technical Specification – Report

Allocation Report

Date Created : 14-Mar-2015

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Document Information
Business Area Product & Service Delivery

GAP/CR ID WBS_RDD0001

FS Definition Form ID RDD0001

Type of development Report

SAP R/3 Version ECC 6.0

Global / Local R1

Approval
Approved by Name Role Signature Date

Tower Lead J Nandi Tower Lead

Development Rashaan P Development


Team Lead – Team Lead –
SAPYARD SAPYARD

Process Team K Vinay Process


Lead – Team Lead –
SAPYARD SAPYARD

Process Team E Pho Process


Lead - SY Team Lead –
SY

Development P Thomas Development


Team Lead - Team Lead –
SY SY

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Document History
Version Author Reason for change Date

1.1 C Roy Final Version 07-Mar-2016

1.2 B Das Remaining Qty. to be Allocated Fix 22-Apr-2016

1.3 A Shrestha CR 181314Changes 16-May-2016

1.4 A Shrestha Changes for Allocated quantity fix 13-Jun-2016

Related Documents
SCM_FSR_MM_Allocation Report_RDD0001.docx

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Table of Contents

1. GENERAL INFORMATION ....................................................................................................................................................... 5


2. DESCRIPTION AND PURPOSE ............................................................................................................................................... 6
3. ASSUMPTIONS ........................................................................................................................................................................ 6
4. ISSUES ..................................................................................................................................................................................... 6
5. SELECTION SCREEN .............................................................................................................................................................. 6
6. TECHNICAL DETAILS ............................................................................................................................................................. 8
7. INTERACTIVE REPORT FLOW ............................................................................................................................................. 19
8. ALV OPTIONS ........................................................................................................................................................................ 19
9. SORT CRITERIA DETAILS .................................................................................................................................................... 19
10. CALCULATIONS AND PAGE BREAK RELATED INFORMATION ....................................................................................... 19
11. ERROR HANDLING ............................................................................................................................................................... 20
12. SECURITY REQUIREMENTS/AUTHORIZATION DETAILS .................................................................................................. 20
13. ADDITIONAL INFORMATION AND ATTACHMENTS .......................................................................................................... 20
14. HANA ARTEFACTS:............................................................................................................................................................. 21
15. UNIT TEST PLAN ................................................................................................................................................................. 26

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

1. General Information
WRICEF ID RDD0001
Description Allocation Report
Implementation Phase ITT-SAP Transformation/ Release 1
Transaction(s) (if applicable) ZSCM_ALLOC
Package ZSCM
Message Class (if applicable) ZSCM
Develop. Class ZSCM
Module SCM – SAP PS - Design Job-Job Initiation
Report User/User Group NA
Execution Mode On-line / Background
Run Frequency On-Demand Language English

Transport Information

Object Identifier Object Type


Change Request # Task # (Program ID, (Program, Transaction,
Layout Set ID, etc) Layout Set)
SY1DV909706 Include ZSCMN_ALLOCATION_REPORT
_F01

SY1DV909706 Include ZSCMN_DEMAND_FULFILMENT


_SCR

SY1DV909706 Include ZSCMN_ALLOCATION_REPORT


_TOP

SY1DV909706 Program ZSCMR_DEMAND_FULFILMENT


_REPORT

SY1DV909706 Class ZSCMCL_AMDP_MM_ALLOC_RE


PORT

SY1DV913892 Class ZSCMCL_AMDP_MM_ALLOC_RE


PORT
SY1DV913892 Include ZSCMN_ALLOCATION_REPORT
_F01
SY1DV913892 Include ZSCMN_ALLOCATION_REPORT
_TOP
Begin of CR#180314

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

SY1DV915026 Include ZSCMN_ALLOCATION_REPORT


_F01
SY1DV915026 Include ZSCMN_ALLOCATION_REPORT
_TOP
SY1DV915026 Report Texts ZSCMR_ALLOCATION_REPORT

SY1DV915026 Class ZSCMCL_AMDP_MM_ALLOC_RE


PORT ( CR 181314Changes )
SY1DV916230 Method (ABAP ZSCMCL_AMDP_MM_ALLOC_RE
Objects) PORT
METH_AMDP_PUB_GET_DATA
SY1DV916230 Include ZSCMN_ALLOCATION_REPORT
_F01
SY1DV916230 Report Source Code ZSCMN_ALLOCATION_REPORT
_SCR
SY1DV916230 Class ZSCMCL_WBS_MAT_STOCK

End of CR#180314

2. Description and Purpose


Allocation report will provide Job Specific material and equipment Allocation requirements. This report will
allow user to execute report with project / WBS, Material and Plant Selection and provide output with a list
of materials to be allocated to a particular project on a particular date. An option to close the reservation
will also be provided to the user as a part of this report.

3. Assumptions
Allocation quantity to be added in ALV so that user can choose to display the field in ALV but
should not be displayed in Default layout.

4. Issues
NA

5. Selection Screen

5.1 Selection Prototype


The following fields will be provided as an input to run the Allocation Report

Report Input Selection for Allocation Report

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Field Labels Table/ Field Name Format Table Value/ Select Option or Mandatory
Structure Checkbox/ Parameter or Optional
Name Radio Button/
Radio Button
Group
Allocation
Requirement ZZ_EST_OP Select Option
RSADD DATS Table Value (Multi Selection) Mandatory
Date S_BSE_DT1

Project WBS Select Option Selective


# PRPS POSID CHAR Table Value (Multi Selection)
Mandatory

Material Select Option


RESB MATNR CHAR Table Value (Multi Selection) Optional

Select Option Selective


Plant RESB WERKS CHAR Table Value
(Multi Selection) Mandatory
Storage Select Option
RESB LGORT CHAR Table Value Optional
Location (Multi Selection)
Technically
CHAR Check Box Parameter Optional
Complete
DISVARI CHAR1
Layout VARIANT Table Value Parameter Optional
ANT 2

5.2 Selection Screen Validation


1. The material details will be fetched per network activity. Material Network will be identified with
control key value
a. Material Network – ZPS2
2. The selection screen will have validation placed for each field entered.
a. Valid ‘Allocation Req Date’
b. Valid WBS Element - PRPS-POSID
c. Valid Material – MARA-MATN]
d. Valid Plant value – T001W-WERKS
3. Report should be executed for P&SD project , perform validation for project profile contain
ZSCM* , if non P&SD project throw error message “Report execution can be performed for P&SD
projects only’.
4. Add Validation to check Plant selected in report with Project plant, if different display validation
error message “ Plant Selected Different from Project Plant”
5. Following will be the mandatory fields for the selection screen
• Allocation Requirement Date
• Either Plant or WBS element
• The system should check that along with Allocation Requirement Date we also enter
either Plant or WBS element. If none of these 2 fields are entered then system should
display an error message.

5.3 Details

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

6. Technical Details
6.1 Flow Diagram

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

START

Get Reservation details from RSADD based upon selection-criteria


using Method AMDP_METH_PUB_GET_DATA Of class
ZPSDCL_AMDP_MM_ALLOC_REPORT

Get Batch Indicator, Serial from Mara based


upon the material fetched from earlier step.

Call Method AMDP_METH_PUB_CAL_TOTRETN_QTY


of Class ZPSDCL_AMDP_MAT_SER_BAT_DETAIL to
fetch Total Return quantity.

Call Method METH_GET_ALLOC_STOCK of Class


ZPSDCL_WBS_MAT_STOCK to fetch the Total Allocated
Quantity based upon WBS and Material fetched in above
step.

Remaining Qty. to be Allocated = Requirement Qty. – Total


Allocated Qty.

Display Report

END

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Psuedo Code
1. Create a new report ZSCMR_ALLOCATION_REPORT via t-code SE38

2. Create Selection screen as per the section 5.1.

Allocation Requirement date is Mandatory but checks / Validations will be carried out as per
section 5.2.

3. Report will be executed for P&SD project , perform validation for project profile contain ZSCM* , if
non P&SD project throw error message “Report execution can be performed for P&SD
projects only’. Refer to the field PROJ-PROFL = ZSCM*.

4. Fetch CCD entries by calling method METH_FETCH_VALUES of class ZCRSCL_CCD_FETCH


for the function code ‘Z_SCM_RDD0001*’ and get movement type, special stock indicator,
background user list and material profile into global variables.

5. The reservation details is fetched from Method AMDP_METH_PUB_GET_DATA Of class


ZSCMCL_AMDP_MM_ALLOC_REPORT based upon selection criteria entered on the screen.

6. Dynamic Where Clause is built for the fields in selection-screen and passed to Importing
parameter IV_WHERE of Method AMDP_METH_PUB_GET_DATA.

7. Pass SY-LANGU to IM_LANGU, IM_STAT as ‘E0010’ and IM_CLIENT as SY-MANDT to Method


AMDP_METH_PUB_GET_DATA.

Begin of CR#180314
8. Check if technically complete check box (P_TECO) is checked from selection screen, if yes then
delete reservation lines from LI_DATA table where component system status is DEL (I0013). If
this is unchecked then delete the reservation lines from LI_DATA table where project status is
TECO or CLSD (JEST Status).

End of CR#180314
9. Get material stock information from storage location table MARD. Calculate all plant inventory
values by adding Valuated Unrestricted-Use Stock value (MARD-LABST) for all common material
components in all plants.

10. The below fields are filled with the table data fetched from above AMDP method.

Customer
Fetch PARNR from IHPA by passing the Object number (Level 3 WBS) and Partner Function =
SP. Get description by passing KNA1-PARNR and get KNA1-NAME1

RIG
Fetch PARNR from IHPA by passing the Object number (Level 3 WBS) and Partner Function =
Z7.Get description by passing KNA1-PARNR and get KNA1-NAME1

Well
Fetch PARNR from IHPA by passing the Object number (Level 3 WBS) and Partner Function =
ZW.Get description by passing KNA1-PARNR and get KNA1-NAME1

Network
Fetch from CAUFV-AUFNR by passing WBS

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Item
Fetch from RESB-RSPOS by passing Network (AUFNR)

Material
Fetch from RESB-MATNR

Material Description
Fetch from MAKT-MAKTX based upon RESB-MATNR fetched above.

UOM
Fetch from RESB-MEINS

Plant
Fetch from RESB-WERKS.

Storage Location
Fetch from RESB-LGORT.

Requirement Qty.
Fetch from RESB-BDMNG.

Allocation Required Date


Fetched from RSADD-ZZ_EST_OPS_BSE_DT1.

Job Site Requirement Date


Fetched from RSADD-ZZ_TIME_RQ_ST_DT1

Valuation Type Preference


Fetch from RSADD-ZZ_VAL_TYPE

Comments
Fetch from RESBD –POTX1 based upon RSNUM and RSPOS.

For Selection of Batch Indicator and Serial Indicator

Select Batch Indicator, Serial profile from MARC based upon Material & Plant fetched from above
method.

Serialized
If Serial profile is not initial, Field is marked ‘X’ in ALV output.

Batch
if MARC-XCHPF is not Blank, Mark Batch field as ‘X’.

Begin of CR#180314

Create object of class ZSCMCL_WBS_MAT_STOCK to fetch all stock data to calculate total
allocation quantity. This constructor will fetch Current Stock from QBEW table for the material
and WBS, Consumption Quantity from MSEG, WBS transfer Quantity from MSEG, Deallocation
Quantity from MSEG and Calculate total allocated stock.

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Class Name ZSCMCL_WBS_MAT_STOCK

Class Description Material Stock Determination

Method Name CONSTRUCTOR

Package ZSCM

Import Parameters

IM_T_WBS_MAT TYPE GTT_WBS_MAT Project and Material data

IM_T_CCD_ENTRIES TYPE ZCRST_EXPCCD Structure for CCD data retireval

Pseudo Code
This Method is for retrieving stock data from database tables and for allocated quantity calculations:
Move records of importing project and material data table IM_T_WBS_MAT to global internal table
GI_WBS_MAT.

Check if importing parameter IM_T_CCD_ENTRIES table have background user name if found call
below methods to get stock data:

METH_GET_CURRENT_STOCK - Get current stock data from QBEW table

METH_GET_MSEG_CONSUMPTION – Get Consumption Quantity from MSEG

METH_GET_MSEG_WBS_TRANS_QTY – Get WBS transfer Quantity from MSEG

METH_GET_MSEG_DEALLOCATION – Get Deallocation Quantity from MSEG

METH_CALC_TOTAL_ALLOC_STOCK - Calculate Total Allocated Stock

Class Name ZSCMCL_WBS_MAT_STOCK

Class Description Material Stock Determination

Method Name METH_GET_CURRENT_STOCK

Package ZSCM

Export Parameters

EX_T_WBS_MAT_STOCK TYPE GTT_WBS_MAT_STOCK Stock

Pseudo Code
This Method is for retrieving current stock data from QBEW table:

Fetch project stock from table QBEW for material and WBS for all GI_WBS_MAT records. Add
retrieved data records to exporting stock data table EX_T_WBS_MAT_STOCK.

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Class Name ZSCMCL_WBS_MAT_STOCK

Class Description Material Stock Determination

Method Name METH_GET_MSEG_CONSUMPTION

Package ZSCM

Export Parameters

EX_T_WBS_MAT_STOCK TYPE GTT_WBS_MAT_STOCK Stock

Pseudo Code
This Method is for retrieving consumption stock data from MSEG table:

Fetch consumption stock from table MSEG for material and WBS for all GI_WBS_MAT records,
movement types 281/282 and special stock indicator ‘Q’. Subtract 282 Movement Type Quantity data
from Movement Type 281 Quantity data, add all the entries based on WBS and Material Number to
exporting stock data table EX_T_WBS_MAT_STOCK.

Class Name ZSCMCL_WBS_MAT_STOCK

Class Description Material Stock Determination

Method Name METH_GET_MSEG_WBS_TRANS_QTY

Package ZSCM

Export Parameters

EX_T_WBS_MAT_STOCK TYPE GTT_WBS_MAT_STOCK Stock

Pseudo Code
This Method is for retrieving WBS transfer Quantity data from MSEG table:

Fetch 415 movement type stock from table MSEG for material and WBS for all GI_WBS_MAT records,
movement types 415, Debit indicator 'S' and special stock indicator ‘Q’. Add retrieved data records to
exporting stock data table EX_T_WBS_MAT_STOCK. (Check whether it's a transfer from same WBS or
not - If it is transfer in between same WBS - do not consider that entry)

Class Name ZSCMCL_WBS_MAT_STOCK

Class Description Material Stock Determination

Method Name METH_GET_MSEG_DEALLOCATION

Package ZSCM

Export Parameters

EX_T_WBS_MAT_STOCK TYPE GTT_WBS_MAT_STOCK Stock

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Pseudo Code
This Method is for retrieving Deallocation quantity data from MSEG table:

Fetch 416 movement type stock from table MSEG for material and WBS for all GI_WBS_MAT records
and movement types 416.

For the MSEG entries which are created by the System User (maintained in CCD table) are directly
considered for adding based on WBS and Material Number and pass it to EX_T_WBS_MAT_STOCK.

For the MSEG entries which are not created by System User, Fetch document flow data from table
LEDSPD_FLOW for deliveries found in above records. Fetch user names from LIKP for deliveries found
in MSEG and LEDSPD_FLOW.

Check MSEG records where USER_NAME not matches with system users (maintained in CCD table),
then check if User of its delivery matches with system users. If Delivery creator is system user
consider such records for addition.

Add all retrieved data records to exporting stock data table EX_T_WBS_MAT_STOCK.

Class Name ZSCMCL_WBS_MAT_STOCK

Class Description Material Stock Determination

Method Name METH_CALC_TOTAL_ALLOC_STOCK

Package ZSCM

Export Parameters

EX_T_WBS_MAT_STOCK TYPE GTT_WBS_MAT_STOCK Stock

Pseudo Code
This Method is for adds up all type of movements and calculates final allocation quantity:
Sum up all QBEW, consumption, 415 and 416 stock and add calculated data records to exporting
stock data table EX_T_WBS_MAT_STOCK.

Remaining Qty. to be allocated

o Step 1:Get total allocated stock for that material and WBS from Method
AMDP_METH_PUB_GET_MSEG_DATA Of class
ZSCMCL_AMDP_MM_ALLOC_REPORT. In method
AMDP_METH_PUB_GET_MSEG_DATA querying is done on MSEG by summing Menge
for Debit/Credit (SHKZG) = ‘H’ for movement type 415 (CCD value) with either special
indicator ‘Q’ (CCD value) or with blank and subtract the sum of Quantity (Menge) for
movement type 416 (CCD value) with Debit/Credit (SHKZG) = ‘S’ and for user Id’s not
equal to background user table IM_T_USER (CCD value) based upon Material Number
(MATNR), WBS (PS_PSP_PNR).

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Call method METH_GET_ALLOC_STOCK of class ZSCMCL_WBS_MAT_STOCK to get


allocated quantity.
Sum up below quantities for the material to get total allocated stock:
- Quantity from QBEW for the material and WBS
- Quantity from MSEG for movement type 415 with Debit indicator ‘S’ for
the material and WBS where WBS is not matching with MAT_PSPNR
(Same site)
- Quantity from MSEG for movement type 416 with debit indicator ‘S’ for
the material and WBS where user is ‘BATCH_PS’. If such record not
found then check Delivery and its user. If ‘BATCH_PS’ found, use the
quantity.
- Consumption quantity

o Step 2: Remaining Qty. to be Allocated as per the formula below for that material/item:
Remaining Qty. to be Allocated = Requirement Qty. – Total Allocated Qty. (From Step 2)

o In case where same material is planned more than once then the Total Allocated
Quantity calculated in Step 2 should be distributed based on FIFO logic based on the
Requirement Date.
▪ Total Allocated Qty column is supposed to be a hidden column in default layout.
▪ In cases where Requirement date is same, consider the Component Number as
a FIFO criteria.

If Remaining Qty. to be Allocated < 0.


Remaining Qty. to be Allocated = 0.

Keep remaining quantity negative if remains.

Quantity in SLoc

Get from LI_QTY_SLOC table (Storage location wise Data fetched from MARD)

Available in SLoc

Check if ‘Quantity in Sloc’ is negative, zero or less than ‘Remaining Qty to be Allocated’ display
as False otherwise display as ‘True’

All Plants inventory

Get from LI_QTY_PLANT table (all plant wise Data fetched from MARD)

Available in all Plants

Check if ‘All Plant Inventory’ is negative, zero or less than ‘Remaining Qty to be Allocated’ display
as False otherwise display as ‘True’. Set hyperlink to All Plants inventory field by calling
set_cell_type ( if_salv_c_cell_type=>hotspot ) of class object cl_salv_column_table and handle
click event by setting event handler for events of class cl_salv_table. Call transaction MMBE by
passing material number from gi_disp_tab table on row index.
<Begin of CR 181314Changes>

Project Status

Fetch from ACTCMB_TEXT_TAB- ACTCMBDESC_TEXT

Segment

Fetch from PRPS-USR00

Sub Segment
www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Fetch from PRPS-USR01

Status

Fetch from TJ30T-TXT30

Mobilize Quantity

Fetch Sum of EKPO-MENGE for all SHIP STO’s for the reservation item.

PGI Quantity

Fetch sum of EKBE-MENGE with transaction type ‘6’ for all SHIP STO’s for the reservation item.

GR Quantity

Fetch sum of EKBE-MENGE with transaction type ‘1’ for all SHIP STO’s for the reservation item.

Consumed Quantity

Fetch the sum of MSEG-MENGE with movement type 281 and special stoke indicator ‘Q’ for all
reservation items

Demobilize Quantity

Fetch Sum of EKPO-MENGE for all RETN STO’s for the reservation item.

Return PGI Quantity

Fetch sum of EKBE-MENGE with transaction type ‘6’ for all RETN STO’s for the reservation item.

Return GR Quantity

Fetch sum of EKBE-MENGE with transaction type ‘1’ for all RETN STO’s for the reservation item.

Quantity at Well Site

Calculate by adding Consumption Quantity and Demobilize quantity and subtracting that from GR
quantity.

Remaining Project Quantity

Calculate by adding Consumption Quantity and Return GR quantity and subtracting that from
Allocated quantity.

Final Issue Indicator

Fetch from RESP-KZEAR.

End of CR#180314

Display ALV report using factory class - CL_SALV_TABLE=>FACTORY.

6.2 Report Field Details

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Field Name Field Output Output Format Position SAP


Description Length Type screen
No./ field
name
PROJ-PSPID Project# 24 CHAR Left 1
Justified

ACTCMB_TE Project Status 200 CHAR Left 2


XT_TAB- Justified
ACTCMBDES
C_TEXT

PRPS- Project WBS 24 CHAR Left 3


POSID/CAUF Justified
V-PSPEL

IHPA- PARNR Customer 35 CHAR Left 4


Justified

IHPA- PARNR Rig 35 CHAR Left 5


Justified

IHPA- PARNR Well 35 CHAR Left 6


Justified

PRPS-USR00 Segment 20 CHAR Left 7


Justified

PRPS-USR01 Sub Segment 20 CHAR Left 8


Justified

CAUFV- Network 12 CHAR Left 9


AUFNR Justified,
No leading
zeros

RESB- Item 4 NUMC Left 10


RSPOS Justified

RESB- Material 18 CHAR Left 11


MATNR Justified

MAKT-MAKTX Material 40 CHAR Left 12


Description Justified

TJ30T-TXT30 Status 30 CHAR Left 13


Justified

RESB- Plant 4 CHAR Left 14


WERKS Justified

RESB-LGORT Storage Location 4 CHAR Left 15


Justified

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

RESB- Requirement 13 QUAN Right 16


BDMNG Qty. Justified

Calculated Allocated Qty 13 QUAN Right 17


Justified

Calculated Remaining Qty. 13 QUAN Right 18


to be Allocated Justified

RESB-MEINS UOM 3 UNIT Left 19


Justified

Begin of CR#180314

Logic based – Available in 5 CHAR Left 20


True/False SLoc Justified

MARD- Quantity in Sloc 13 QUAN Left 21


LABST Justified

Logic based – Available in all 5 CHAR Left 22


True/False Plants Justified

Calculated All Plants 13 QUAN Left 23


inventory Justified

RSADD- Allocation 8 DATS Left 24


ZZ_EST_OPS Required Date Justified
_BSE_DT1

RSADD- Job Site 8 DATS Left 25


Requirement Justified
ZZ_TIME_RQ Date
_ST_DT1

Calculated Mobilize Qty 13 QUAN Left 26


Justified

Calculated PGI Qty 13 QUAN Left 27


Justified

Calculated GR Qty 13 QUAN Left 28


Justified

Calculated Consumed Qty 13 QUAN Left 29


Justified

Calculated Qty at well site 13 QUAN Left 30


Justified

Calculated Demob Qty 13 QUAN Left 31


Justified

Calculated Return PGI Qty 13 QUAN Left 32


Justified

Calculated Return GR Qty 13 QUAN Left 33


Justified

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Calculated Remaining 13 QUAN Left 34


Project Stock Justified

MARA- Serialized 1 CHAR Left 35


SERIAL Justified

MARA- Batch 1 CHAR Left 36


XCHPF Justified

RSADD- Valuation Type 10 CHAR Left 37


ZZ_VAL_TYP Preference Justified
E

RESB-KZEAR Final issue 1 CHAR Left 38


indicator Justified

End of CR#180314

RESBD – 40 CHAR Left 39


POTX1 Comments Justified

6.3 Desired Report Design

Allocation Report
Output.xlsx

7. Interactive Report Flow


NA

8. ALV Options
Call method cl_salv_table=>factory to display output.

9. Sort Criteria Details


NA

10. Calculations and Page Break related Information


NA
www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

11. Error Handling


NA

11.1 Error Conditions and Logging

Error handling will be performed as part of the Selection Screen Validations and Data
validations as per the provided logic.

11.2 Notification

NA

Error HOW ERROR MESSAGE Error Messages Corrective action


SHOULD BE REPORTED

11.3 Restart / Recovery

NA

12. Security Requirements/Authorization Details


SAP Role mapping and SOD will apply. Only users having role that provides access to Custom
Report Transaction for Allocation Report, will be able to trigger this enhancement.
Security team will require to identify separate Authorization Object to provide access to this
report. Report program will require to maintain this Authorization Object to control access plant
level access.

13. Additional Information and attachments


13.1 Reconciliation Reporting
NA

13.2 Attachments
www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Maintain the constant in the CCD tool


Below CCD entries have been maintained using transaction ZCRS_SAPYARDCCD in ECC.
These constants are getting used in ZSCMR_ALLOCATION_REPORT report for list of
background users, special stock indicator, movement types and material profile.

14. HANA Artifacts


14.1 Object List :
NA

Ref.
Object Object Object Delivery
ABAP Action Package Comments
Name Type Description Units
Object
Calculation
View/
Attribute
view/ Create/
Analytic
view/ Table/ Modify

DB
Procedure

14.2 DB Procedure Details:

Procedure Name:
NA

Paramete Parameter Parameter


Data Type Length Scale
r Name Type Data Type

IN/OUT

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Procedure Logic:
NA

14.3 DB Objects (View/Table) :

NA

View
Table Column SQL Data Type Dimension Not Null Default
Column

14.4 HANAtization :

Class Name ZSCMCL_AMDP_MM_ALLOC_REPORT

Class Description Get Allocation data

Method Name AMDP_METH_PUB_GET_DATA

Package ZSCM

Import Parameters

IM_WHERE TYPE CHAR2000 Where Clause String

IM_LANGU TYPE SY-LANGU System language

IM_STAT TYPE J_STATUS User Status

IM_CLIENT TYPE SY-MANDT User Status

Export Parameters

EX_T_DATA TYPE GTT_DATA Allocation data

Begin of CR#180314

EX_T_MOBQTY TYPE GTT_MOBQTY Mobilization Quantity

EX_T_PGIQTY TYPE GTT_PGIQTY PGI Quantity

EX_T_GRQTY TYPE GTT_GRQTY GR Quantity

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

EX_T_CONQTY TYPE GTT_CONQTY Consumption Quantity

EX_T_DEMOBQTY TYPE GTT_DEMOBQTY Demobilization Quantity

EX_T_RETNPGIQTY TYPE GTT_PGI_RETN PGI Return Quantity

EX_T_RETNGRQTY TYPE GTT_GR_RETN GR Return Quantity

EX_T_QTYS_DIS TYPE GTT_QTYS Final Quantities

EX_T_SYS_ST TYPE GTT_SYS_ST System Status

End of CR#180314

Pseudo Code
This AMDP Class ZSCMCL_AMDP_MM_ALLOC_REPORT and below AMDP Methods for retrieving
data from database tables and for calculations:

Method AMDP_METH_PUB_GET_DATA is used to retrieve data from Tables PROJ, PRPS,


RSADD, IHPA, CAUFV, JEST, AFVC, MAKT, KNA1, EKPO, EKBE, MSEG, TJ30T,
ACTCMB_TEXT_TAB, TJ02, TJ02T.

We have created Dynamic Where Clause having filter for Plant, WBS Element, Allocation Requirement
date and Storage Location.

Begin of CR#180314
This method will take import parameters as Dynamic Where Clause, Language for MAKT text, Status, Client and
provides T_DATA,T_MOBQTY, T_PGIQTY, T_GRQTY, T_CONQTY, T_DMOBQTY, T_RETNPGIQTY,
T_RETNGRQTY, T_QTYS_DIS and T_SYS_ST as exporting parameter.

Make a join select query on inner join RESB/CAUFV left outer join PRPS/PROJ/AFVC/IHPA/JEST/KNA1/MAKT
for selecting fields RESB-RSNUM,RESB-RSPOS,PROJ-PSPID,PROJ-PROJ_STATUS, ACTCMB_TEXT_TAB-
ACTCMBDESC_TEXT, PRPS-POSID,IPHP-PARVW,KNA-NAME1,RESB-AUFNR,RESB-MATNR,RESB-
MEINS,RESB-WERKS,RESB-LGORT,RESB-BDMNG,ENMNG,RSADD- ZZ_EST_OPS_BSE_DT1,RSADD-
ZZ_TIME_RQ_ST_DT1,RSADD-ZZ_VAL_TYPE,
RESB-POTX1,RESB-KZEARRESB-PSPEL,PROJ-PSPHI,PRPS-USR00, PRPS-USR01, RESB-AUFPL, RESB-
OBJNR, AFVC-STEUS,PROJ-OBJNR, TJ30T-TXT30, IPHP-PARNR,MAKT-MAKTX.

For Mobilize Quantity

Make a join on RSNUM, RSPOS, SUM ( MENGE ) as MOB_QTY from EKPO for ZZACTION equal to
SHIP – EX_T_MOBQTY

Make a join on RSNUM, RSPOS, SHKZG and MENGE for the RSNUM and RSPOS
From EKBE where VGABE = ‘6’ and compute for SHKZG = ‘S’ means MENGE * -1
Else SHKZG means MENGE – for table EX_T_PGI_QTY

Make a join on RSNUM, RSPOS, SHKZG and MENGE for the RSNUM and RSPOS
From EKBE where VGABE = ‘1’ and compute for SHKZG = ‘S’ means MENGE * -1
Else SHKZG means MENGE – for table EX_T_GR_QTY

Make a join on RSNUM , RSPOS, SHKZG for the RSNUM and RSPOS from MSEG where
For BWART 281 and 282 and compute for SHKZG = ‘S’ means MENGE * -1
Else SHKZG means MENGE – for table EX_T_CONQTY

Make internal table for PGI, GR CONSUMPTION.

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

For Demobilize Quantity

Make a join on RSNUM, RSPOS, SUM ( MENGE ) as MOB_QTY from EKPO for ZZACTION equal to
RETN – EX_T_DEMOBQTY

Make a join on RSNUM, RSPOS, SHKZG and MENGE for the RSNUM and RSPOS
From EKBE where VGABE = ‘6’ and compute for SHKZG = ‘S’ means MENGE * -1
Else SHKZG means MENGE – for table EX_T_RETNPGI_QTY

Make a join on RSNUM, RSPOS, SHKZG and MENGE for the RSNUM and RSPOS
From EKBE where VGABE = ‘1’ and compute for SHKZG = ‘S’ means MENGE * -1
Else SHKZG means MENGE – for table EX_T_RETNGR_QTY

Make internal table for Demobilization PGI, GR.

Join all the quantity tables and get the

PGI_S_QTY -- Mobilize quantity


GR_S_Qty --- GR Shipment quantity
MOB_QTY – Mobilize quantity
CONS_QTY – Consumption Quantity
DMOB_QTY – Demobilize Quantity
PGI_RETN_QTY – PGI return quantity
GR_RETN_QTY – GR return quantity

Order by RSNUM and RSPOS

Make a join on EX_T_DATA with RESB, JEST, TJ02T, TJ30T and PROJ to get all the system status and
populate it in Internal table EX_T_SYS_ST.

Final tables

EX_T_DATA,
EX_T_MOBQTY
EX_T_PGIQTY
EX_T_GRQTY
EX_T_CONQTY
EX_T_DEMOBQTY
EX_T_RETNPGIQTY
EX_T_RETNGRQTY
EX_T_QTYS_DIS
EX_T_SYS_ST
End of CR#180314

Class Name ZSCMCL_AMDP_MM_ALLOC_REPORT

Class Description Get Allocation data

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
SAPYard “SAP ABAP for HANA” Sample TDD

Method Name AMDP_METH_PUB_GET_MSEG_DATA

Package ZSCM

Import Parameters

IM_SHKZG_H TYPE SHKZG Debit Credit Indicator

IM_SHKZG_S TYPE SHKZG Debit Credit Indicator

IM_SPSTK_IND TYPE SOBKZ Special Stock indicator

IM_MVT_TF TYPE BWART Movement type

IM_MVT_TR TYPE BWART Movement type

IM_T_ALLOC_QTY TYPE GTT_ALLOC_QTY Based on this table allocated


quantity needs to be fetched.

IM_T_USER TYPE GTT_USER Users

Export Parameters

EX_T_MSEG TYPE GTT_MSEG Mseg Data

Pseudo Code
This AMDP Class ZSCMCL_AMDP_MM_ALLOC_REPORT and below AMDP Method for retrieving
data from database tables and for calculations:

Method AMDP_METH_PUB_GET_MSEG_DATA is used to retrieve data from table MSEG.

This method will take import parameters as SHKZG_H = ‘H’, SHKZG_S = ‘S’, IM_SPSTK_IND = ‘Q’,
IM_MVT_TF = ‘415’, IM_MVT_TR = ‘416’, IM_T_USER as list of background users and
IM_T_ALLOC_QTY and exporting parameter EX_T_MSEG of data fetched from MSEG.

Make a join select query on MSEG inner join IM_T_ALLOC_QTY for selecting field
MSEG-MATNR,MSEG-PS_PSP_PNR and SUM( MSEG-MENGE) for movement type ‘415’ and SUM(
MSEG-MENGE * -1) for movement type ‘416’ where MSEG-MATNR = IM_T_ALLOC_QTY-MATNR,
MSEG-PS_PSP_PNR = IM_T_ALLOC_QTY-PSPNR, Debit Credit Indicator as ‘H’, movement type
‘415’ with special indicator ‘Q’ or without any or for movement type ‘416’ with Debit Credit Indicator as
‘S’ and MSEG-USNAM_MKPF not in IM_T_USER into table EX_T_MSEG.

Final table EX_T_MSEG is passed by filtering out data with sum of MENGE using group by on MATNR
and PS_PSP_PNR.

www.SAPYard.com for ABAP for SAP HANA, SAPUI5, Fiori, OData & SAP Netweaver Gateway
GAP2018/CR181314 Technical Specification

15. Unit Test Plan


System - SY1D
Client - 130

Normal Functionality -

Test Step Step Description Test Data Expected Result Executed By/Date Remarks
Condition Actual Result

Check for the 1 Run the report for Allocation The ALV should be C Roy/ 11 Success
correct valid WBS and plant Requirement displayed with desired Mar’2016
report output combination. Date - columns filled.
Test Case1.doc
02/06/2016 and
04/30/2016.
Material-0540-
0010
Plant-1004 WBS -
J.15.001563.01.0
1

http://www.sapyard.com/ 14-Mar-2018 Page 26 of 32


s
RDD0001 Technical Specification

Test Step Step Description Test Data Expected Result Executed By/Date Remarks
Condition Actual Result

Check for the 2 Execute the report Project System will populate C Roy/ 11 Success
correct non-P&SD WBS and R.00000103 and Error message for the Mar’2016
report output plant combination. enter Allocation selection.
Test Case2.doc
Requirement
Date as
02/06/2016

Check for 3 Execute report for Enter allocation Report output as C Roy/ 11 Success
the correct WBS requirement desired. Mar’2016
report J.16.000220.01.01 date range
output 03/01/2016 and Test Case3.doc

upper limit
04/30/2016

Check for 4 Report Execute in Enter allocation Background Job C Roy/ 04 Success
the correct Background requirement Successfully Mar’2016
report date range completed.
output 03/01/2016 and Test Case 4.doc

upper limit
04/30/2016

http://www.SAPYard.com/ 14-Mar-2018 Page 27 of 32


s
RDD0001 Technical Specification

Test Step Step Description Test Data Expected Result Executed By/Date Remarks
Condition Actual Result

Check for 5 Execute report for Allocation Report out as C Roy/ 11 Success
the correct WBS Requirement desired. Mar’2016
report J.15.001563.01.01 Date -
output 03/01/2016 and Test Case 5.doc

04/30/2016.
Material - 0540-
0010
WBS -
J.15.001563.01.
01

Begin of CR#180314

Remaining 6 New logic for Execute report Right calculation on A Shrestha/22 Success
Qty. to be Remaining Qty. to for WBS Remaining Qty. to be Apr 2016
Allocated be Allocated J.16.000785.01. Allocated Test Case 6.doc

value calculation 01, Date-


04/01/2016
06/20/2016,
Plant- 1004

http://www.SAPYard.com/ 14-Mar-2018 Page 28 of 32


s
RDD0001 Technical Specification

Test Step Step Description Test Data Expected Result Executed By/Date Remarks
Condition Actual Result

New fields 7 Check new fields- Execute report New fields should be A Shrestha/17 Success
in the report for WBS visible. Click on All May 2016
Available in SLoc, Test Case 7.doc
output, J.16.000772.01. Plants inventory
Quantity in Sloc,
hyperlink on 01, Date- value should show
Available in all
All plant 04/01/2016 MMBE for selected
Plants and All 06/20/2016,
inventory material and any
Plants inventory
and PLAN status material
Plant- 1004
Exclusion of Check Hyperlink on component should
PLAN status All Plants inventory not come in report
material to MMBE and output
components Exclusion of PLAN
status material
components

New 8 Check new fields on Execute report New quantity fields A Shrestha/23 Success
Quantity report output- for WBS should be correctly May 2016
related J.16.000897.01. calculated and
Mob Qty, PGI Qty, Test Case 8.docx
fields in 01, Date- displayed in report
GR Qty, output
report 04/01/2016
output Consumption Qty, 12/20/2016,
Demob Qty, return
PHI qty, return GR Plant- 1004
qty, Qty at well site
and remaining
project stock

http://www.SAPYard.com/ 14-Mar-2018 Page 29 of 32


s
RDD0001 Technical Specification

Test Step Step Description Test Data Expected Result Executed By/Date Remarks
Condition Actual Result

Teco/Close 9 Default uncheck the Execute report TECO/CLSD status A Shrestha/23 Success
project check box. On for WBS project will be include May 2016
check box check report will J.16.000899.01. in the report output
Test Case 9.docx
on selection include TECO or 01, Date-
screen CLSD status 04/01/2016
projects also 12/20/2016,
Plant- 1004

End of CR#180314

Exception - special logic or exceptions

NA

Test Step Step Description Test Data Expected Result Actual Result Executed By/Date Remarks
Condition

Error Handling - functionality in case of errors

http://www.SAPYard.com/ 14-Mar-2018 Page 30 of 32


s
RDD0001 Technical Specification

Test Step Step Description Test Data Expected Result Actual Result Executed By/Date Remarks
Condition

1 Execute report Enter Allocation Error message will be C Roy/ 05


invalid/no plant Requirement populated on Mar’2016
Error Case Error Case 1.doc
details. Date as selection screen.
03.01/2016
WBS as
J.16.000220.01.0
1, Material
A962XP.

Error Case 2 Execute report with Allocation Error message will be C Roy/ 05
no WBS and Plant Requirement populated on Mar’2016
and allocation selection screen. Error Case 2.doc
Date as
requirement date 03/08/2016
entered. Material A962XP.

Error Case 3 Execute report with Allocation Error message will be C Roy/ 05
Plant and WBS Requirement populated on Mar’2016
with different plant selection screen. Error Case 3.doc
Date as
03/08/2016
Material A962XP,
WBS
J.16.000220.01.0
1 and Plant 1006

http://www.SAPYard.com/ 14-Mar-2018 Page 31 of 32


s
RDD0001 Technical Specification

Test Step Step Description Test Data Expected Result Actual Result Executed By/Date Remarks
Condition

Error Case 4 Execute report with Allocation Error message will be C Roy/ 05
WBS and invalid Requirement populated on Mar’2016
Material. selection screen. Error Case 4.doc
Date as
03/08/2016
Material
TEST123HTTII,
WBS
‘J.16.000220.01.0
1’.

Error Case 5 Execute report with Allocation Error message will be C Roy/ 05
invalid WBS. Requirement populated on Mar’2016
selection screen. Error Case
Date as 5.doc.docx
03/08/2016
Material A962XP,
WBS
‘J.16.010022.01.0
1’.

http://www.SAPYard.com/ 14-Mar-2018 Page 32 of 32

You might also like