关于SAP Fiori Smart Template开发的一些实际例子

关于SAP Fiori Smart Template开发的一些实际例子

关于SAP Fiori Smart Template开发的一些实际例子

关于SAP Fiori Smart Template开发的一些实际例子

关于SAP Fiori Smart Template开发的一些实际例子

专家回复了, 不支持。只有用CDS table function。原因也很简单,要支持所有的DB platform。

关于SAP Fiori Smart Template开发的一些实际例子

CDS 里有CAST的关键字,但是专家confirm了不能走类型这条路,因为无法保证这个类型转换在所有DB platform上都工作。

关于SAP Fiori Smart Template开发的一些实际例子

我2013年12月曾经研究过AMDP,这条路可以走通。只是当时没试过如何在CDS view里consume这个生成的procedure。

我现在正在试。


http://scn.sap.com/community/abap/blog/2013/12/10/an-example-of-amdp-abap-managed-database-procedure-in-740


大方向是这样的哈,CDS可以很容易的调用Table function(跟调用CDSview一样),然后table function具体的实现是通过AMDP实现的。

比如下面这个。

define table function ZI_DSO_TF
  with parameters
      @Environment.systemField: #CLIENT
      p_client                    : abap.clnt,
      p_rblsrollingaveragemonths  : abap.int1,
      p_revnrollingaveragemonths  : abap.int1,
      p_todaydate                 : abap.char( 8 ),
      p_displaycurrency           : abap.char( 5 ),
      p_exchangeratetype          : abap.char( 4 )
returns
{
    Client : abap.clnt;
    CompanyCode  : abap.char( 4 );
    Customer     : abap.char( 10 );
    CalendarYear  : abap.numc( 4 ) ;
    CalendarMonth  :  abap.numc( 2 ); 
    CompanyCodeCurrency   : abap.cuky( 5 );
    FinancialAccountType   :   abap.char( 1 );
    ExchangeRateType     : abap.char( 4 );
    CustomerCountry  : abap.char( 3 );
    CustomerRegion  : abap.char( 3 );
    AccountingClerk  : abap.char( 2 );
    CustomerBasicAuthorizationGrp  : abap.char( 4 );
    DurationUnit   :  abap.unit( 3 );
    ChartofAccounts   : abap.char( 4 );
    ReconciliationAccount   :  abap.char( 10 );
    DisplayCurrency   : abap.cuky( 5 ); 
    DebitAmtInDisplayCrcy         : abap.curr( 23, 2 );
    CalendarYearMonth   : abap.char( 6 );
 
}
implemented by method
  ZCL_MM_DSO_TF=>tf_test2;
 
Implementation of table function:
CLASS ZCL_MM_DSO_TF DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .
 
  PUBLIC SECTION.
    INTERFACES if_amdp_marker_hdb.
 
    CLASS-METHODS tf_test2
        FOR TABLE FUNCTION ZI_DSO_TF.
 
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.
 
 
 
CLASS ZCL_MM_DSO_TF IMPLEMENTATION.
 
  METHOD tf_test2 BY DATABASE FUNCTION
                    FOR HDB LANGUAGE SQLSCRIPT
                    OPTIONS READ-ONLY
                    USING P_DSO12
                    icustomerfis paddressfis ifidebtorfidata ificompanycode
                    .
 
    return
 
    select
     "P_DSO12"."MANDT" AS "CLIENT",
     "P_DSO12"."COMPANYCODE",
     "P_DSO12"."CUSTOMER",
     "P_DSO12"."CALENDARYEAR",
     "P_DSO12"."CALENDARMONTH",
     "P_DSO12"."COMPANYCODECURRENCY",
     "P_DSO12"."FINANCIALACCOUNTTYPE",
     ( :p_exchangeratetype ) AS "EXCHANGERATETYPE",
     "=A1"."COUNTRY" AS "CUSTOMERCOUNTRY",
     "=A1"."REGION" AS "CUSTOMERREGION",
     "=A2"."ACCOUNTINGCLERK" AS "ACCOUNTINGCLERK",
     "=A2"."AUTHORIZATIONGROUP" AS "CUSTOMERBASICAUTHORIZATIONGRP",
     "P_DSO12"."DURATIONUNIT",
     "=A3"."CHARTOFACCOUNTS" AS "CHARTOFACCOUNTS",
     "=A2"."RECONCILIATIONACCOUNT" AS "RECONCILIATIONACCOUNT",
     ( :p_displaycurrency ) AS "DISPLAYCURRENCY",
     convert_currency( "AMOUNT" => "P_DSO12"."DEBITAMOUNTINCOMPANYCODECRCY",
               "SOURCE_UNIT" => "P_DSO12"."COMPANYCODECURRENCY",
               "TARGET_UNIT" => :p_displaycurrency,
               "REFERENCE_DATE" => "P_DSO12"."ROLLINGAVERAGEMONTHENDDATEDATS",
               "CONVERSION_TYPE" => :p_exchangeratetype,
               "CLIENT" => :p_client,
               "ERROR_HANDLING" => N'FAIL_ON_ERROR',
               "SCHEMA" => ::CURRENT_OBJECT_SCHEMA,
               "ACCURACY" => N'highest',
               "LOOKUP" => N'regular',
               "OPTIONS" => N'ALLOW_PRECISION_LOSS',
               "STEPS" => 'convert,shift_back,shift,round' )
              as "DEBITAMTINDISPLAYCRCY",
     "P_DSO12"."CALENDARYEARMONTH" as "CALENDARYEARMONTH"
          FROM
          ( ( (
               "P_DSO12"( :P_RBLSROLLINGAVERAGEMONTHS,
               :p_revnrollingaveragemonths,
               :p_todaydate ) "P_DSO12"
                      LEFT OUTER JOIN "ICUSTOMERFIS" "=A0" ON ( "P_DSO12"."MANDT" = "=A0"."MANDT"
                          AND "=A0"."CUSTOMER" = "P_DSO12"."CUSTOMER" ) )
                  LEFT OUTER many TO one JOIN "PADDRESSFIS" "=A1" ON ( "P_DSO12"."MANDT" = "=A1"."MANDT"
                      AND "=A0"."ADDRESSID" = "=A1"."ADDRESSID" ) )
              LEFT OUTER many TO one JOIN "IFIDEBTORFIDATA" "=A2" ON ( "=A2"."COMPANYCODE" = "P_DSO12"."COMPANYCODE"
                  AND "=A2"."CUSTOMER" = "P_DSO12"."CUSTOMER"
                  AND "P_DSO12"."MANDT" = "=A2"."MANDT" ) )
              LEFT OUTER many TO one JOIN "IFICOMPANYCODE" "=A3" ON ( "P_DSO12"."MANDT" = "=A3"."MANDT"
              AND "=A3"."COMPANYCODE" = "P_DSO12"."COMPANYCODE" )
              WHERE NOT ( "P_DSO12"."CALENDARYEARMONTH" IS NULL )
                          AND NOT ( "P_DSO12"."CALENDARYEARMONTH" IS NULL )
            ;
 
  ENDMETHOD.
 
ENDCLASS.

我自己做了一个,已经跑通了。

关于SAP Fiori Smart Template开发的一些实际例子


上一篇:mysql同步出现错误


下一篇:Grunt 插件开发例子