0% found this document useful (0 votes)
105 views

METHOD Quantity

This document describes the revision history of the GET_ZZEND_DATE method. It was initially created on 25/10/2013 by Mahak Jain and has since been revised multiple times, with the most recent revision on 24/06/2015 by Songole to address change request CRDK925297 and update the method to version 1.6. The method retrieves the end date value for an item from the item's related date entities.

Uploaded by

Venki Kasa
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)
105 views

METHOD Quantity

This document describes the revision history of the GET_ZZEND_DATE method. It was initially created on 25/10/2013 by Mahak Jain and has since been revised multiple times, with the most recent revision on 24/06/2015 by Songole to address change request CRDK925297 and update the method to version 1.6. The method retrieves the end date value for an item from the item's related date entities.

Uploaded by

Venki Kasa
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/ 13

METHOD get_zzend_date.

*****************************************************************************
******
* METHOD Name : GET_ZZEND_DATE
* Author : Mahak Jain
* Date : 25.10.2013
* Developer ID : GBHATIA
* Object Code : E168
*&---------------------------------------------------------------------*
*& Modification History
*&---------------------------------------------------------------------*
*& Date(DD/MM/YYYY) RICEFWID USER ID Change Req. Release
*& 25/10/2013 E168 GBHATIA CRDK901884 Initial versio
n
*&---------------------------------------------------------------------*
* * * *&-------------------------------------------------------------------
------*
*& Date(DD/MM/YYYY) RICEFWID USER ID Change Req. Version
*& 29/10/2014 D8947 SONGOLE CRDK911167 1.1
*& 139/03/2015 D13914 aparnap CRDK918947 1.3
*&-------------------------------------------------------------------------*
* * *& Date(DD/MM/YYYY) RICEFWID USER ID Change Req. Ver
sion
*& 19/03/2015 D13914 SONGOLE CRDK918946 1.3
*& 25/03.2015 D14134/D14069 Songole CRDK919507 1.4
*& 20/04/2015 D15543 nmangal CRDK921421 1.5
*& 24/06/2015 D19980 Songole CRDK925297 1.6
*& 17/07/2015 D20528 JOJYG CRDK926706 1.7
*&-------------------------------------------------------------------------*
* Begin of cahnges by Mahak Jain for copying Requested start date
* from Item Detail page
* DATA: current TYPE REF TO if_bol_bo_property_access.
DATA: dref TYPE REF TO data.

DATA: lr_entity TYPE REF TO cl_crm_bol_entity,


lr_ent TYPE REF TO cl_crm_bol_entity,
lr_parent TYPE REF TO cl_crm_bol_entity,
v_itmno TYPE string,
lr_entity1 TYPE REF TO cl_crm_bol_entity,
lr_entity_sev_cust TYPE REF TO cl_crm_bol_entity,
lr_col TYPE REF TO if_bol_entity_col,
lt_selected_rows TYPE int4_table,
lv_index TYPE sy-tabix,
lv_item_no TYPE string,
lv_bool TYPE bool,
lv_timefrom TYPE string,
lv_empty_date TYPE string,
lv_service_end TYPE boolean,
lv_date TYPE string,
lv_value TYPE string,
lv_value1 TYPE string,
v_enddat TYPE sy-datum,
lr_mssg_disp TYPE REF TO cl_bsp_wd_message_service,
v_strtdat TYPE sy-datum,
lw_selected_rows LIKE LINE OF lt_selected_rows,
lv_apptype TYPE string.

DATA : v_date TYPE datum,


lv_temp TYPE char10.
DATA: lr_core TYPE REF TO cl_crm_bol_core,
lr_global_messages TYPE REF TO cl_crm_genil_global_mess_cont.
CONSTANTS: c_id_message TYPE symsgid VALUE 'ZITR_ERR
OR'.

CONSTANTS: lv_empty(30) TYPE c VALUE '00/00/0000',


lv_zero(30) TYPE c VALUE '00000000'.

lr_core = cl_crm_bol_core=>get_instance( ).
IF lr_core IS BOUND.
lr_global_messages = lr_core->get_global_message_cont( ).
ENDIF.
* CONSTANTS:lv_temp_value(30) TYPE c VALUE '00.00.0000'. "Commented by n
mangal for D15543 on 20/04/2015
* value =
*'BTAdminI not bound'. "#EC NOTEXT

CLEAR: v_enddat, v_strtdat, lv_value1, v_itmno.


* IF iterator IS BOUND.
* current = iterator->get_current( ).
* ELSE.
* current = collection_wrapper->get_current( ).
* ENDIF.
*
** if gv_comp_implreference is BOUND.
*** CALL METHOD gv_comp_implreference->get_attribute
*** EXPORTING
*** name = 'GT_SELECTED_ROWS'
*** IMPORTING value = lt_selected_rows.
***
** CALL METHOD gv_comp_implreference->get_attribute
** EXPORTING
** name = 'GV_MASSCHANGE'
** IMPORTING value = lv_date.
** endif.
** me->collection_wrapper-
>get_current_index( RECEIVING rv_index = lv_index ).
*
* IF current IS BOUND.
* lr_entity ?= current.
* TRY.
* CALL METHOD lr_entity->get_related_entity
* EXPORTING
* iv_relation_name = 'BTItemDatesSet'
** iv_mode = NORMAL
* RECEIVING
* rv_result = lr_entity1.
*
* CATCH cx_crm_genil_model_error .
* ENDTRY.
*
** *************************songole d3538***********************
** IF lr_entity1 IS BOUND.
** TRY.
** CALL METHOD lr_entity1->get_related_entity
** EXPORTING
** iv_relation_name = 'BTDate_T_SRV_CUST_END'
*** iv_mode = NORMAL
** RECEIVING
** rv_result = lr_entity_SEV_CUST.
**
** CATCH cx_crm_genil_model_error .
** ENDTRY.
** ENDIF.
** IF lr_entity_SEV_CUST IS BOUND AND lv_bool eq 'X'.
** READ TABLE lt_selected_rows into lw_selected_rows with key table_li
ne = lv_index.
** if sy-subrc eq 0.
** CALL METHOD lr_entity_SEV_CUST->get_property_as_VALUE
** EXPORTING
** iv_attr_name = 'TIMESTAMP_FROM'
** IMPORTING
** Ev_result = value.
** endif.
** ELSE.
*
*
**************************************D3538*************************
* IF lr_entity1 IS BOUND.
*
* TRY.
* CALL METHOD lr_entity1->get_related_entities
* EXPORTING
* iv_relation_name = 'BTDatesAll'
* RECEIVING
* rv_result = lr_col.
* CATCH cx_crm_genil_model_error .
* ENDTRY.
*
* IF lr_col IS BOUND.
* CLEAR lr_entity.
* lr_entity = lr_col->get_first( ).
* WHILE lr_entity IS BOUND.
*
* CALL METHOD lr_entity->get_property_as_string
* EXPORTING
* iv_attr_name = 'APPT_TYPE'
* RECEIVING
* rv_result = lv_apptype.
** Defect 3538***************
**
** IF lv_apptype = 'SRV_CUST_END'.
** CALL METHOD lr_entity->get_property_as_string
** EXPORTING
** iv_attr_name = 'FROMDATE'
** RECEIVING
** rv_result = value.
**
** endif.
*
* IF lv_apptype = 'ZSERVICE_END'. "'SRV_CUST_EN
D'.
* CALL METHOD lr_entity->get_property_as_string
* EXPORTING
* iv_attr_name = 'FROMDATE'
* RECEIVING
* rv_result = value.
* lv_service_end = 'X'.
* ENDIF.
*
*
** *****************************d3538
*
* lr_entity = lr_col->get_next( ).
* ENDWHILE.
* ENDIF.
*
* ENDIF.
*
** **************************Songole D8947 SOC**********
***********SOC 139/03/2015 D13914 aparnap CRDK918947
* IF value IS INITIAL . "OR ( value CA '0' )
). "Added by nmangal on 20/04/2015
* IF zl_bt116qit_bspwdcomponen_impl=>gv_onclick NE 'X'. "D14134 D1406
9
*** IF lv_service_end NE 'X'.
* IF lr_entity1 IS BOUND.
* TRY.
* CALL METHOD lr_entity1->get_related_entity
* EXPORTING
* iv_relation_name = 'BTDate_T_SRV_CUST_END'
** iv_mode = NORMAL
* RECEIVING
* rv_result = lr_entity_sev_cust.
*
* CATCH cx_crm_genil_model_error .
* ENDTRY.
*
* IF sy-subrc EQ 0.
* CALL METHOD lr_entity_sev_cust->get_property_as_string
* EXPORTING
* iv_attr_name = 'FROMDATE'
* RECEIVING
* rv_result = value.
***
**** "SOC by nmangal for D15543 on 17/04/2015
"Commented by nmangal for D15543 on 20/04/2015
**** CALL METHOD lr_entity_sev_cust->get_property_as_value
**** EXPORTING
**** iv_attr_name = 'FROMDATE'
**** IMPORTING
**** ev_result = v_date.
****
**** IF ( ( v_date IS NOT INITIAL ) AND ( v_date CN '0' ) ).
****
**** WRITE v_date TO lv_temp.
**** value = lv_temp.
****
**** ENDIF.
**** CLEAR : v_date , lv_temp.
****
**** "EOC by nmangal for D15543 on 17/04/2015
***
***
***
**** IF value IS NOT INITIAL.
**** lr_entity_sev_cust-
>set_property( iv_attr_name = 'FROMDATE' iv_value = ' ' ).
**** ENDIF.
*** ENDIF.
* ENDIF.
* ENDIF.
* ENDIF.
* ENDIF.
**SOC 139/03/2015 D13914 aparnap CRDK918947
*
*
* IF value = lv_empty OR value = 'BTAdminI not bound' OR value = '00000000
' . "OR value = lv_temp_value. "Added by nmangal on 20/04/2015
* value = ' '.
* ENDIF.
***************************Songole D8947* EOC *********
*
*
*
*
* ENDIF.
***ENDIF. "3538

DATA: current TYPE REF TO cl_crm_bol_entity.


DATA: descr TYPE string.
DATA: text TYPE string.
DATA: v_itm_num TYPE string.
DATA: lv_contend_value TYPE string.
* lr_col TYPE REF TO if_bol_entity_col.

* get current entity


IF iterator IS BOUND.
current ?= iterator->get_current( ).
ELSE.
current ?= collection_wrapper->get_current( ).
ENDIF.
CHECK current IS BOUND.

CLEAR v_itm_num.
CALL METHOD current->if_bol_bo_property_access~get_property_as_string
EXPORTING
iv_attr_name = 'NUMBER_INT'
RECEIVING
rv_result = v_itm_num.

current = current-
>get_related_entity( iv_relation_name = 'BTItemDatesSet' ). "#EC NOTEXT
CHECK current IS BOUND.
* current = current-
>get_related_entity( iv_relation_name = 'BTDatesSet' ). "#EC NOTEXT
* CHECK current IS BOUND.
CALL METHOD current->get_related_entities
EXPORTING
iv_relation_name = 'BTDatesAllCust_SERVICE'
RECEIVING
rv_result = lr_col.
* current = current-
>get_related_entity( iv_relation_name = 'BTDatesAllCust_SERVICE' ). "#EC NOTE
XT
* CHECK current IS BOUND.

IF lr_col IS BOUND.
CLEAR lr_ent.
lr_ent ?= lr_col->get_first( ).
WHILE lr_ent IS BOUND.
* Checking if application type is Customer Begin date
* then getting the corresponding from date

CALL METHOD lr_ent->get_property_as_string


EXPORTING
iv_attr_name = 'APPT_TYPE'
RECEIVING
rv_result = lv_apptype.

IF lv_apptype = 'ZSERVICE_END'. "'SRV_CUST_END'.

CALL METHOD lr_ent->get_property_as_value


EXPORTING
iv_attr_name = 'FROMDATE'
IMPORTING
ev_result = lv_value.

*********************************************************************
* SOC BY JOJY TR : CRDK926706 D20528 DT : JULY/17/2015 *
*********************************************************************
CLEAR v_enddat.
IF lv_value IS NOT INITIAL.
v_enddat = lv_value.
ENDIF.
*********************************************************************
* EOC BY JOJY TR : CRDK926706 D20528 DT : JULY/17/2015 *
*********************************************************************

CALL METHOD lr_ent->get_property_as_string


EXPORTING
iv_attr_name = 'FROMDATE'
RECEIVING
rv_result = value.

ENDIF.

IF lv_value EQ '00000000' AND lv_apptype = 'CONTEND'.


"'SRV_CUST_END'.

CALL METHOD lr_ent->get_property_as_string


EXPORTING
iv_attr_name = 'FROMDATE'
RECEIVING
rv_result = lv_contend_value.

ENDIF.

*********************************************************************
* SOC BY JOJY TR : CRDK926706 D20528 DT : JULY/17/2015 *
*********************************************************************
* D20528: In Renewal Quote - Start Date > End Date is allowed by the system

IF lv_apptype = 'Z1SERVICE_ST'. "SERVICE START DATE


CALL METHOD lr_ent->get_property_as_value
EXPORTING
iv_attr_name = 'FROMDATE'
IMPORTING
ev_result = lv_value1.

IF lv_value1 IS NOT INITIAL.


v_strtdat = lv_value1.
ENDIF.
ENDIF.

*********************************************************************
* EOC BY JOJY TR : CRDK926706 D20528 DT : JULY/17/2015 *
*********************************************************************

lr_ent ?= lr_col->get_next( ).
ENDWHILE.
ENDIF.

*********************************************************************
* SOC BY JOJY TR : CRDK926706 D20528 DT : JULY/17/2015 *
*********************************************************************
IF v_strtdat > v_enddat.

SHIFT v_itm_num LEFT DELETING LEADING '0'.

* THROW ERROR MESSAGE IN UI


lr_mssg_disp = cl_bsp_wd_message_service=>get_instance( ).
IF lr_mssg_disp IS BOUND.
lr_mssg_disp->add_message(
iv_msg_type = 'E'
iv_msg_id = 'ZITR_ERROR'
iv_msg_number = '042' "Item & : Service Start date is greater tha
n the Service end date
iv_msg_v1 = v_itm_num
).
ENDIF.
ENDIF.
*********************************************************************
* EOC BY JOJY TR : CRDK926706 D20528 DT : JULY/17/2015 *
*********************************************************************

IF lv_value = '00000000' AND lv_contend_value NE value AND lv_contend_value


NE ''.

value = lv_contend_value.

set_zzend_date(
EXPORTING
attribute_path = 'table[1].zzend_date'
iterator = iterator
value = lv_contend_value
).

ENDIF.
*pass date value

* CALL METHOD cl_crm_uiu_bt_date_tools=>set_date


* EXPORTING
* iv_attribute_path = attribute_path
* ir_btdate = current
* ir_model_util = me
* value = value
* EXCEPTIONS
* conversion_error = 1
* OTHERS = 2.
*
* IF sy-subrc <> 0.
*
*
* ENDIF.
CLEAR : lv_empty_date.
lv_empty_date = value.

REPLACE ALL OCCURRENCES OF '/' IN lv_empty_date WITH ' '.


REPLACE ALL OCCURRENCES OF '.' IN lv_empty_date WITH ' '.
CONDENSE lv_empty_date NO-GAPS.

* IF value = lv_empty OR value = 'BTAdminI not bound' OR value = '00000000


' . "OR value = lv_temp_value . "Added by nmangal on 20/04/2015
* value = ' '.
* ENDIF.

IF current IS BOUND.

lr_parent = current->get_parent( ).
IF lr_parent IS BOUND..
lr_parent-
>get_property_as_string( EXPORTING iv_attr_name = 'NUMBER_INT' RECEIVING rv_r
esult = lv_item_no ).
ENDIF.

ENDIF.

IF lv_empty_date = lv_zero OR value = 'BTAdminI not bound' .


value = ' '.
** *** *****************Raise error message if its not entered. Songo
le SOc 19980

IF lr_global_messages IS BOUND.

lr_global_messages->add_message(
iv_msg_type = 'E'
iv_msg_id = c_id_message
iv_msg_number = '041' "'036'
iv_msg_v1 = lv_item_no
iv_show_only_once = 'X' ).

ENDIF.

****** *****************Raise error message if its not entered. Songole SO


c 19980
ENDIF.

**** *****************songole 20748************

DATA: lv_product_guid TYPE string,


lv_guid_set TYPE comt_frgtype_guid32,
lv_product TYPE crmt_ordered_prod,
lv_msg_typ TYPE symsgty,
lv_value2 TYPE string,
lv_frg_guid TYPE comt_frg_guid,
lv_eos_date TYPE zeos_date.

SELECT SINGLE frgtype_guid


FROM comc_settype
INTO lv_guid_set
WHERE frgtype_id = 'ZPRODUCTFLDS'.

lr_parent-
>get_property_as_string( EXPORTING iv_attr_name = 'PRODUCT' RECEIVING rv_res
ult = lv_product_guid ).
lr_parent-
>get_property_as_string( EXPORTING iv_attr_name = 'ORDERED_PROD' RECEIVING rv
_result = lv_product ).

SELECT SINGLE fragment_guid


FROM comm_pr_frg_rel
INTO lv_frg_guid
WHERE fragment_type = lv_guid_set
AND product_guid = lv_product_guid.

SELECT SINGLE zz0014 FROM zproductflds INTO lv_eos_date


WHERE frg_guid = lv_frg_guid.

IF lv_eos_date NE '00000000'.

IF v_enddat GT lv_eos_date.

SELECT SINGLE value1 FROM zcad_crossref INTO lv_value2 WHERE mastertype


= 'ITR' AND subtype = 'E171' AND key1 = 'EOS_DATE'.

IF lr_global_messages IS BOUND.

IF lv_value2 IS INITIAL.
lv_msg_typ = 'W'.
ELSE.
lv_msg_typ = lv_value2.
ENDIF.

lr_global_messages->add_message(
iv_msg_type = lv_msg_typ "'W'
iv_msg_id = c_id_message
iv_msg_number = '043'
iv_msg_v1 = lv_item_no
iv_msg_v2 = lv_product
iv_show_only_once = 'X').

ENDIF .

ENDIF.
ELSE. "if lv_eos_date is initial
* BOC SKGANDEM 10/08/2016 CHG644671
* Check EOS date is awailable on HW SKU if not avialble on Service SKU
DATA: lv_hw_prod TYPE REF TO data,
lr_entity_bo TYPE REF TO cl_crm_bol_entity,
lr_entity_a TYPE REF TO cl_crm_bol_entity,
lr_coll_ref TYPE REF TO if_bol_bo_col,
lv_size TYPE i,
lv_r3matid TYPE r3material_id,
lr_entity_ref TYPE REF TO if_bol_bo_property_access,
lv_hw_product_guid TYPE crmt_object_guid,
lv_r3ident_guid TYPE crmt_object_guid.

lr_entity_bo = lr_parent-
>get_related_entity( iv_relation_name = 'BTItemBOSSet' ).
IF lr_entity_bo IS BOUND.
lr_entity_a = lr_entity_bo-
>get_related_entity( iv_relation_name = 'BTRefObjSet_A' ).
ENDIF.
IF lr_entity_a IS BOUND.
lr_coll_ref = lr_entity_a-
>get_related_entities( iv_relation_name = 'BTRefObjectAll' ).
ENDIF.
CHECK lr_coll_ref IS BOUND.
lv_size = lr_coll_ref->size( ).

IF lv_size GE '2'.
lr_entity_ref ?= lr_coll_ref->find(
iv_index = '2'
).

ELSE.
lr_entity_ref ?= lr_coll_ref->find(
iv_index = '1'
).
ENDIF.

IF lr_entity_ref IS BOUND.
lr_entity_ref-
>get_property_as_string( EXPORTING iv_attr_name = 'GUID_OBJECT' RECEIVING rv_
result = lv_r3ident_guid ).

IF lv_r3ident_guid IS INITIAL.
lr_entity_ref ?= lr_coll_ref->find(
iv_index = '1'
).
IF lr_entity_ref IS BOUND.
lr_entity_ref-
>get_property_as_string( EXPORTING iv_attr_name = 'GUID_OBJECT' RECEIVING rv_
result = lv_r3ident_guid ).
ENDIF.
ENDIF.
IF lv_r3ident_guid IS NOT INITIAL.
SELECT SINGLE r3mat_id INTO lv_r3matid FROM com_ta_r3_id WHERE produc
t_guid = lv_r3ident_guid.
IF sy-subrc = 0.
SELECT SINGLE product_guid INTO lv_hw_product_guid FROM comm_produc
t WHERE product_id = lv_r3matid.
IF sy-subrc EQ 0.

SELECT SINGLE fragment_guid


FROM comm_pr_frg_rel
INTO lv_frg_guid
WHERE fragment_type = lv_guid_set
AND product_guid = lv_hw_product_guid.

IF sy-subrc EQ 0.
SELECT SINGLE zz0014 FROM zproductflds INTO lv_eos_date
WHERE frg_guid = lv_frg_guid.
IF lv_eos_date NE '00000000'.
IF v_enddat GT lv_eos_date.

SELECT SINGLE value1 FROM zcad_crossref INTO lv_value2 WHER


E mastertype = 'ITR' AND subtype = 'E171' AND key1 = 'EOS_DATE'.

IF lr_global_messages IS BOUND.

IF lv_value2 IS INITIAL.
lv_msg_typ = 'W'.
ELSE.
lv_msg_typ = lv_value2.
ENDIF.

lr_global_messages->add_message(
iv_msg_type = lv_msg_typ "'W'/E
iv_msg_id = c_id_message
iv_msg_number = '043'
iv_msg_v1 = lv_item_no
iv_msg_v2 = lv_r3matid
iv_show_only_once = 'X').

ENDIF .
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
* EOC SKGANDEM 10/08/2016 CHG644671

**** *****************songole 20748************

ENDMETHOD.

You might also like