cancel
Showing results for 
Search instead for 
Did you mean: 

How to call Class inside Transformation

Vincent801
Explorer
0 Kudos

Dear Experts,

I am trying to call my class in one of my BW transformations.

To make it simple, I just created a Class (SYSTEM_DATE_CLASS) which will give the output as System date.

In my BW transformation, I just created a new Info-object "CUR_DATE" in my ADSO. While loading the date to ADSO, I need to write a field routine by calling the system date Class and populate the date for the field CUR_DATE in the ADSO. I dont know, how to call class inside transformation with variable. I am getting error in Class implementation in Outtab.

Invalid character string "(" in "ZDELETE=>AMDP_SYSTEM_DATE(". Only transparent database tables, views, or database procedures can be specified after USING.

 

CLASS SYSTEM_DATE_CLASS DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .
  PUBLIC SECTION.
*AMDP Class 
  INTERFACES if_amdp_marker_hdb.
*declare Class method amdp_system_date
  class-methods amdp_system_date
  exporting
  value(i_sydate) type D.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS SYSTEM_DATE_CLASS IMPLEMENTATION.
METHOD amdp_system_date by database procedure
                   for hdb
                   language sqlscript
                   options read-only.

i_sydate = session_context( 'SAP_SYSTEM_DATE' );
ENDMETHOD.
ENDCLASS.

 

BW transformation Code :

 

class ZCLKMCRK3HNI3A57NCPAQHC_M definition
  public
  create public .

public section.
 interfaces IF_AMDP_MARKER_HDB .
   types:

methods S0001_G01_R18
    importing
      value(i_req_dtp_name) type STRING
      value(i_req_logsys) type STRING
      value(i_req_src_name) type STRING
      value(i_req_src_type) type STRING
      value(i_req_tgt_name) type STRING
      value(i_req_tgt_type) type STRING
      value(i_req_requid) type STRING
      value(i_sydate) type D
      value(inTab) type TN_T_IN_S0001_G01_R18
    exporting
      value(outTab) type TN_T_OUT_S0001_G01_R18 .
protected section.
private section.

ENDCLASS.

CLASS ZCLKMCRK3HNI3A57NCPAQHC_M IMPLEMENTATION.
METHOD S0001_G01_R18 BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY USING zdelete=>amdp_system_date( i_sydate ).

outtab = select ( CALL "ZDELETE=>AMDP_SYSTEM_DATE( I_SYDATE )" ) AS "CUR_DATE",
                 "RECORD",
                 "SQL__PROCEDURE__SOURCE__RECORD"
                 from :INTAB;

errortab = SELECT NULL AS "ERROR_TEXT",
                  NULL AS "SQL__PROCEDURE__SOURCE__RECORD"
                  FROM "DUMMY";

ENDMETHOD.
ENDCLASS.

 

Accepted Solutions (0)

Answers (1)

Answers (1)

roland_szajko
Product and Topic Expert
Product and Topic Expert
0 Kudos

I think you just need the method in the definition and not the whole parametrized call:

 

...USING ZDELETE=>AMDP_SYSTEM_DATE