Friday, 22 June 2018

How to create calendar day ABAP CDS view with working day flag

Introduction


◈ With S/4HANA we have a standard CDS view I_CalendarDate based on SCAL_TT_DATE table, but there aren’t information about working days. However it could be important to have such flag, for example, when we need to count only working days or filtering something based on working dates only.

◈ Information about working days in stored in SAP system in table TFACS. Besides a year we need to define factory calendar (TFACS-IDENT) to select data. So in logic we need to ‘crop’ information about working day from TFACS-MONXX columns.

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Tutorials and Materials

Step-by-step


1.Create new ABAP CDS view Z_I_CALDAYWD based on table function:

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Tutorials and Materials

2. Create ABAP class and implement logic in class method:

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Tutorials and Materials

Notes:

◈ We are using variable p_ident to select only needed factory calendar, e.i. ‘RU’ in Russia.

◈ We are using column calendar day (scal_tt_date-calendarday), which is number of a day in month, to ‘crop’ work day flag from tfacs-monXX columns.

◈ Base tables are not client dependent that’s why we don’t have mandt column and annotate ABAP CDS view respectively.

3. In result we have for factory calendar ‘RU’ and the beggining of 2018 calendar year:

SAP ABAP CDS, SAP ABAP Learning, SAP ABAP Tutorials and Materials

2 comments:

  1. Thank you for sharing this blog some of them are useful sap abap stands or advanced business application programming Click Here

    ReplyDelete
  2. we provide a best modules in sap and (selenium) softwaare testing with real time scenarios.
    Our consultants are working professionals they will share our experience
    Who can learn in this module?
    Opportunities in this Module?
    Why Prefer Training with US?
    Training by Leading Architects
    Topic based Training
    Long-Term Technical Support
    Placement Assistance
    End to End – Project Support
    SAP HR Training in Chennai
    SAP Success Factors Training in Chennai
    SAP FICO Training in Chennai
    SAP MM Training in Chennai
    Sap Fiori Training in Chennai
    SAP HANA Training in Chennai
    software Testing modules
    Selenium Training in Chennaiss
    for more informations call 8122241286

    ReplyDelete