Supply Chain Management Blogs by Members
Learn about SAP SCM software from firsthand experiences of community members. Share your own post and join the conversation about supply chain management.
cancel
Showing results for 
Search instead for 
Did you mean: 
martin_gill
Discoverer
217

Issue

The Comparison/Reconciliation of Transaction Data indicates that reservations created for components sent to a subcontracting MRP are inconsistent in ePPDS.  However, the dates are consistent, so resending the orders will not resolve the false inconsistencies.

Cause

Since the requirement in ePPDS is a time stamp (i.e., date and time) but the reservation only has a date, when the system searches for inconsistencies.

SAP confirmed ‘Since S/4 can schedule with days only we have to handover a certain time when converting times using FM TZ_LOCAL_TO_GLOBAL.  It was decided to use 12:00:00’.  Of course, SAP means noon UTC time, and that would be fine for most customers. 

However, that does not work everywhere.  For example, in South Australia (time zone AUSSA, UTC+10:30), noon + 10:30 = 10:30 p.m. tonight.  In New Zealand (NZST is UTC+13), noon today + 13 hours = 1 am tomorrow.  Since the same CIF user is used for all locations, the converted times incorrectly suggest the dates are inconsistent.

The difference in date creates an inconsistency for subcontracting reservations.  The message class is /SAPAPO/CIF (Message class for core interface), number 423 (Manual reservation &1 differs in Requirement Dates; ECC:&2 <-> APO:&3).

Perhaps the time could be converted to noon local time in function module CIF_RESERVATION_SELECT like the logic that sends reservations between systems, but SAP has opted to stick with UTC.

SAP recommended we implement BAdI definition /SAPAPO/CIF_DELTA3 (P2P Enhancements Compare & Refresh Report) method RELEVANT_FOR_COMPARE_R3_RSV.  Unfortunately, SAP have not given the method a description, but it is used for reservations.

Sample Logic

I am not a Developer so please don’t judge me!  Here is the logic I prototyped for my client, and although it does work, I strongly recommend it is only a starting point for your Developer.

We also use a TVARVC parameter for CIF variant names, but you probably use programs RCIFVARIANTCH (Change Logical System in CIF Variants) and /SAPAPO/CIF_VARIANTCHANGE (Change Logical System in CIF Report Variants) to update variants after a system copy.

Custom Class Attributes

 

Attribute

Level

Visibility

Typing

Associated Type

Description

Initial Value

MC_CIF_LOGICAL_SYS_PARAMETER

Constant

Public

Type

RVARI_VNAM

Logical System TVARVC Parameter

'ZPTP_LOGICAL_SYSTEM_OWN'

MC_TIMEZONE_UTC

Constant

Public

Type

TZNZONE

UTC Time Zone

'UTC'

MV_CIF_TIMEZONE

Instance Attribute

Public

Type

TZNZONE

Default CIF User Time Zone

                                                                                                                                    

 

Read CIF User Method

There are probably easier ways to do this, and most organizations could set the time zone directly and avoid this method.

Method: GET_CIF_USER (Get CIF User, RFC Destination, Logical System)

 

 

  METHOD get_cif_user.
    DATA:
      lt_tvarvc TYPE STANDARD TABLE OF tvarvc,
      lv_var1   TYPE string,
      lv_var2   TYPE string.

* Get logical system from parameter used for CIF selection variants
    lt_tvarvc = zcl_zutl_abap_utility=>get_tvarvc( i_name = me->mc_cif_logical_sys_parameter ).
    READ TABLE lt_tvarvc
      INTO DATA(ls_tvarvc)
      INDEX 1.
    me->mv_cif_logsys = ls_tvarvc-low.

* Get system logical system if someone deletes the parameter
    IF me->mv_cif_logsys IS INITIAL.
      CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
        IMPORTING
          own_logical_system             = me->mv_cif_logsys
        EXCEPTIONS
          own_logical_system_not_defined = 1
          OTHERS                         = 2.
*      IF sy-subrc NE 0.
** Implement suitable error handling here
*      ENDIF.
    ENDIF.

* Get RFC destination from logical system
    SELECT SINGLE rfcdest
      FROM tblsysdest
      INTO @ME->mv_cif_rfc_dest
      WHERE logsys = @ME->mv_cif_logsys.
    IF sy-subrc IS NOT INITIAL.
      me->mv_cif_rfc_dest = me->mv_cif_logsys.
    ENDIF.

* Get user
    SELECT SINGLE rfcoptions
      FROM rfcdes
      INTO @DATA(lv_rfcoptions)
      WHERE rfcdest = @ME->mv_cif_rfc_dest.
    SPLIT lv_rfcoptions AT 'U=' INTO lv_var1 lv_var2.
    SPLIT lv_var2 AT ',' INTO lv_var1 lv_var2.
    me->mv_cif_user = lv_var1.

* Get user time zone
    SELECT SINGLE tzone
      FROM usr02
      INTO @ME->mv_cif_timezone
      WHERE bname = @ME->mv_cif_user.
    IF sy-subrc IS NOT INITIAL.
      CLEAR: me->mv_cif_user.
    ELSEIF me->mv_cif_timezone IS INITIAL..
* Get system default if no time zone assigned to user
      SELECT SINGLE tzonesys
        FROM ttzcu
        INTO @ME->mv_cif_timezone.
    ENDIF.

* Set a time zone if nothing maintained
    IF me->mv_cif_timezone IS INITIAL AND sy-zonlo IS NOT INITIAL.
      me->mv_cif_timezone = sy-zonlo.
    ELSEIF me->mv_cif_timezone IS INITIAL.
* Get system default
      SELECT SINGLE tzonesys
        FROM ttzcu
        INTO @ME->mv_cif_timezone.
    ENDIF.

  ENDMETHOD.

 

 

Compare Reservations Method

Method: /SAPAPO/IF_EX_CIF_DELTA3~RELEVANT_FOR_COMPARE_R3_RSV

 

 

*&===========================================================================*
*& Logic:                                                                    *
*&   This code changes the time from the location time stamp to user's zone  *
*&   The user will be the CIF user, so a logic method finds the logical      *
*&   system, RFC destination, user, local time zone if used, or system zone  *
*&   A fixed time offset could be calculated for each location, but could    *
*&   get daylight savings errors                                             *
*&===========================================================================*                                       *
*&   Enable SE91 where used:                                                 *
     IF 1 EQ 2.  MESSAGE i423(/sapapo/cif). ENDIF.
*&===========================================================================*

    DATA:
      lv_timest_c TYPE char14.

* Check there are entries
    CHECK: ct_r3_order[] IS NOT INITIAL.

* Get time zone
    IF me->mv_cif_timezone IS INITIAL.
      me->get_cif_user( ).
    ENDIF.

* Get location time zones
    SELECT locid, locno, tzone
      FROM /sapapo/loc
      INTO TABLE @DATA(lt_loc)
      FOR ALL ENTRIES IN @CT_r3_order
      WHERE locno = @CT_r3_order-location.
    CHECK: sy-subrc IS INITIAL.
    SORT lt_loc BY locno.

* Offset time zone if needed
    LOOP AT ct_r3_order ASSIGNING FIELD-SYMBOL(<fs_r3_order>).
* No conversion required if user & location time zones match
      READ TABLE lt_loc INTO DATA(ls_loc)
        WITH KEY locno = <fs_r3_order>-location.

      CHECK: ls_loc-tzone IS NOT INITIAL.

* Convert time stamp into UTC time
      CALL FUNCTION '/SAPAPO/TIMESTAMP_ZONE_TO_UTC'
        EXPORTING
          iv_timezone  = ls_loc-tzone
          iv_timestamp = <fs_r3_order>-req_date
        IMPORTING
          ev_timestamp = <fs_r3_order>-req_date.

* Change time to noon (12:00:00) UTC like FM CIF_RESERVATION_SELECT
      lv_timest_c = <fs_r3_order>-req_date.
      CONVERT DATE lv_timest_c+0(8) TIME '120000'
        INTO TIME STAMP <fs_r3_order>-req_date TIME ZONE me->mc_timezone_utc.

* Convert into CIF user time zone
      CALL FUNCTION '/SAPAPO/TIMESTAMP_SHIFT_ZONE'
        EXPORTING
          iv_timezone  = me->mv_cif_timezone
          iv_timestamp = <fs_r3_order>-req_date
        IMPORTING
          ev_timestamp = <fs_r3_order>-req_date.
    ENDLOOP.
  ENDMETHOD.

 

 

Labels in this area