PCADE01
– Germany, balancesPCADE02
– Germany, Statistical key figuresPCAFR01
– France, balancesPCAFR02
– France, Statistical figuresPCAUK01
– Great Britain, balances,PCAUK02
– United Kingdom, Statistical figuresDE100
– Master data GermanyFR100
– Master data FranceDO BEGIN
my_customers = SELECT customer_name, location, tx_date
from customers_a
where customer_name = 'ACME'
and location = 'NEW YORK';
SELECT
customer_name, location, tx_date
FROM
earliest_customer_transaction (:my_customers);
END;
CREATE OR REPLACE PROCEDURE do_something( IN inTab TABLE(...),
OUT outTab TABLE(...))
...
DO BEGIN
SELECT
customer_name, location, tx_date
FROM
earliest_customer_transaction (customers_a)
WHERE customer_name = 'ACME'
AND location = 'NEW YORK';
END;
Error: (dberror) [7]: feature not supported: nested call on procedure "MULTI_TAB"."EARLIEST_CUSTOMER_TRANSACTION_PROC" has any table output parameter RESULT
CLASS zcl_tr_demo DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
TYPES: BEGIN OF gty_s_totals,
sysid TYPE c LENGTH 6,
ryear TYPE n LENGTH 4,
rbukrs TYPE c LENGTH 4,
prctr TYPE c LENGTH 10,
balance TYPE p LENGTH 000009 DECIMALS 000002,
currunit TYPE c LENGTH 5,
END OF gty_s_totals.
TYPES gty_t_totals TYPE STANDARD TABLE OF gty_s_totals WITH DEFAULT KEY.
TYPES: BEGIN OF gty_s_stat_kyf,
sysid TYPE c LENGTH 6,
ryear TYPE n LENGTH 4,
rbukrs TYPE c LENGTH 4,
prctr TYPE c LENGTH 10,
balance TYPE p LENGTH 000009 DECIMALS 000002,
currunit TYPE c LENGTH 5,
END OF gty_s_stat_kyf.
TYPES gty_t_stat_kyf TYPE STANDARD TABLE OF gty_s_stat_kyf WITH DEFAULT KEY.
TYPES: BEGIN OF gty_s_pplant,
sysid TYPE c LENGTH 6,
plant TYPE c LENGTH 4,
bukrs TYPE c LENGTH 4,
END OF gty_s_pplant.
TYPES gty_t_pplant TYPE STANDARD TABLE OF gty_s_pplant WITH DEFAULT KEY.
TYPES: BEGIN OF gty_s_in_out_tab,
recordmode TYPE rodmupdmod, " InfoObject: 0RECORDMODE
logsys TYPE rsdlogsys, " InfoObject: 0LOGSYS
sysid TYPE c LENGTH 6,
" ...
fiscper TYPE n LENGTH 7,
fiscvar TYPE c LENGTH 2,
" ...
balance TYPE p LENGTH 000009 DECIMALS 000002,
record TYPE c LENGTH 56,
sql__procedure__source__record TYPE c LENGTH 56,
END OF gty_s_in_out_tab.
TYPES gty_t_in_out_tab TYPE STANDARD TABLE OF gty_s_in_out_tab WITH DEFAULT KEY.
METHODS: do_transformation_pca IMPORTING VALUE(it_intab) TYPE gty_t_in_out_tab
VALUE(it_totals) TYPE gty_t_totals
VALUE(it_stat_kyf) TYPE gty_t_stat_kyf
VALUE(it_pplant) TYPE gty_t_pplant
VALUE(iv_sysid) TYPE char6
EXPORTING VALUE(et_result) TYPE gty_t_in_out_tab.
ENDCLASS.
CLASS /BIC/SKCP38MSW2ZH49HEXE5D_M IMPLEMENTATION.
METHOD GLOBAL_END BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY
using ZCL_TR_DEMO=>DO_TRANSFORMATION_PCA
/BIC/APCADE0022
/BIC/APCADE0012
/BIC/PPLANT .
-- *** Begin of routine - insert your code only below this line ***
-- Note the _M class are not considered for DTP execution.
-- AMDP Breakpoints must be set in the _A class instead.
lt_stat_kyf = select * from "/BIC/APCADE0022";
lt_totals = select * from "/BIC/APCADE0012";
lt_plant = select * from "/BIC/PPLANT";
"ZCL_TR_DEMO=>DO_TRANSFORMATION_PCA"( it_intab => :intab,
it_totals => :lt_totals,
it_stat_kyf => :lt_stat_kyf ,
IT_PPLANT => :lt_plant,
ET_RESULT => OUTTAB );
-- *** End of routine - insert your code only before this line ***
ENDMETHOD.
ENDCLASS.
USING
clause.SELECT *
from the source tables, the type of table parameters can also change later, without the need to adjust the transformation routines.ET_RESULT
with the exact structure of the transformation OUTTAB
routines. This saves some paperwork on the one hand, but it is not very flexible. What happens if the country ADSOs differ marginally? For example, a few additional fields that have nothing to do with the implemented business logic. Or if you want to add a field for all data models. Then this must be done simultaneously for all countries. The above approach is therefore less flexible.INTAB
by means of the INNER JOIN
original. For the join condition, the field RECORD
that has a unique value for each record in the INTAB
. The INNER JOIN
can also filter out records in the procedure.-- *** Begin of routine - insert your code only below this line ***
-- Note the _M class are not considered for DTP execution.
-- AMDP Breakpoints must be set in the _A class instead.
lt_stat_kyf = select * from "/BIC/APCADE0022";
lt_totals = select * from "/BIC/APCADE0012";
lt_plant = select * from "/BIC/PPLANT";
"ZCL_TR_DEMO=>DO_TRANSFORMATION_PCA"( it_intab => :intab,
it_totals => :lt_totals,
it_stat_kyf => :lt_stat_kyf ,
IT_PPLANT => :lt_plant,
ET_RESULT => lt_result );
outtab = select it.RECORDMODE,
it.LOGSYS,
it.RYEAR,
" ...
it.CURTYPE,
res.FISCPER,
res.FISCVAR,
it.CHARTACCTS,
" ...
it.CURRUNIT,
res.BALANCE,
it.RECORD,
it.SQL__PROCEDURE__SOURCE__RECORD
from :intab as it
inner join :lt_result as res
on it.record = res.record ;
-- *** End of routine - insert your code only before this line ***
*"* use this source file for your ABAP unit test classes
CLASS ltcl_ DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO zcl_tr_demo.
METHODS:
setup,
first_test FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_ IMPLEMENTATION.
METHOD first_test.
mo_cut->do_transformation_pca(
EXPORTING
it_intab = VALUE #( ( ... ) )
it_totals = VALUE #( ( ... ) )
it_stat_kyf = VALUE #( ( ... ) )
it_pplant = VALUE #( ( ... ) )
IMPORTING
et_result = DATA(lt_result)
).
cl_abap_unit_assert=>assert_equals( act = lt_result
exp = VALUE zcl_tr_demo=>gty_t_in_out_tab( ( ... ) ) ).
ENDMETHOD.
METHOD setup.
CREATE OBJECT mo_cut.
ENDMETHOD.
ENDCLASS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
9 | |
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 |