Sunteți pe pagina 1din 2

Association

AssociationSet
PrincipleEntity TYPE
PrincipleEntity Set
DependentEntity Type
DependentEntity Set
Referential Constraint
NavigationProperty
______________________________
OPEN DATA PROVIDER EXTENSION CLASS,
REDEFINE ~GET_EXPANDED_ENTITYSET METHOD
_______________________
Implement the below code :
___________________________________
DATA : Begin of T_EXPAND.
INCLUDE TYPE ZCL_ZCODE_EXPAND_PR_01_MPC=>TS_USERHEADER.
DATA : NP_ON_USERID TYPE ZCL_ZCODE_EXPAND_PR_01_MPC=>TT_USERIT
EMS,
end of T_expand.
data lt_expand LIKE TABLE oF T_EXPAND.
e
data ls_expand LIKE T_EXPAND.

"Internal table with above data typ


"workarea with above data type

data : lt_header TYPE TABLE of ZUSERINFO, " internal table for header records
only
ls_header TYPE ZUSERINFO.
" workarea for header record only
data : lt_itemdata TYPE TABLE OF ZUSERDETAILS, " internal table for ITEM recor
ds only
ls_itemdata TYPE ZUSERDETAILs.
" workarea for ITEM RECORD ONLY.
data : ls_item

type ZCL_ZCODE_EXPAND_PR_01_MPC=>TS_USERITEMS.

CONSTANTS : lc_expand_tech_Clause TYPE STRING value 'NP_ON_USERID'.


*Get header data from ZUSERINFO table
Select * from ZUSERINFO into corresponding fields of table lt_header.
*get itemdata from ZUSERDETAILS table
select * from ZUSERDETAILS into corresponding fields of table lt_itemdata.
*write logic ( for each header record , find out its item records )
loop at lt_header into ls_header.
MOVE-CORRESPONDING ls_header to ls_expand.
LOOP at lt_itemdata into ls_itemdata where USERID
MOVE-CORRESPONDING ls_itemdata To ls_item.

= ls_header-USERID.

APPEND ls_item TO ls_expand-NP_ON_USERID.


clear ls_item.
endloop.
APPEND ls_expand to lt_expand.
clear ls_expand.
endloop.
*FILL er_entityset for sending output records to front end apps.
COPY_DATA_TO_REF( exporting is_data = lt_expand
changing cr_data = er_entitySet ).
INSERT lc_expand_tech_Clause into table ET_EXPANDED_TECH_CLAUSES.

S-ar putea să vă placă și