cancel
Showing results for 
Search instead for 
Did you mean: 

How to create our own BOL entity

Former Member
0 Kudos

Hi guys,

I have a individual table, and I want to show the data of it on the view of ICWebClient application by the tableview.

Now what I need is a context node to work as a model. (I was told not to create our own data model class inherited CL_BSP_MODEL2) But the cookbook only show us one way:create attributes, create set types and assign the attributes to the newly create set types, and define new object and assign the set types to the newly defined object. But I don't think this way is suitable for my problem.

Is there anybody know how to create our own BOL entity so that we could use it to store the data of individual table as context node.

Thanks very much.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Guys,

Hope this will help you.

1) Create your new context node using super class as CL_BSP_WD_CONTEXT_NODE_TV.

As a standard you have to implement the method GET_TABLE_LINE_SAMPLE method aparat from this

2) overrid the following methods in your z class .

GET_T_TABLE- to get the data from your z table

SET_T_TABLE- to set the data in the z table

GET_M_T_TABLE - metadat for z table

<b>sample coding for the

method GET_T_TABLE</b> .

data: lt_table type table of ztest_ic.

FIELD-SYMBOLS:

<lv_value> TYPE ANY.

DATA:

ls_attribute TYPE ztest_ic,

lr_dref TYPE REF TO data.

----


  • Get data and convert to external format

----


*DATA LT_TABLE TYPE TABLE OF ZTEST_IC.

If TESTtable is initial.

SELECT * FROM ZTEST_IC INTO TABLE TESTTABLE.

endif.

<b>//here how do you want to fill the data ...</b>APPEND LINES OF TESTTABLE TO lT_TABLE.

read table lt_table into ls_attribute index index.

ASSIGN COMPONENT component OF STRUCTURE ls_attribute TO

<lv_value>.

IF sy-subrc = 0.

GET REFERENCE OF <lv_value> INTO lr_dref.

value = if_bsp_model_util~convert_to_string(

data_ref = lr_dref

attribute_path = attribute_path ).

ENDIF. "// if sy-subrc = 0

endmethod.

-


********************************************************************************************

***************************************************************************************

<b>sample coding for the

method GET_M_T_TABLE .</b>

DATA: attr TYPE ztest_ic.

DATA: dref TYPE REF TO data.

DATA: l_dfies_wa TYPE dfies,

l_dfies_tab TYPE TABLE OF dfies,

l_metadata_if TYPE REF TO if_bsp_metadata,

l_comp_metas TYPE tbspobjrefs,

l_comp_meta TYPE LINE OF tbspobjrefs,

l_rtti TYPE REF TO cl_abap_structdescr,

l_dref TYPE REF TO data.

FIELD-SYMBOLS: <l_dfies_wa> TYPE dfies.

***

GET REFERENCE OF attr INTO dref.

l_rtti ?= cl_abap_typedescr=>describe_by_data_ref(

dref ).

l_dfies_tab = l_rtti->get_ddic_field_list( ).

IF component IS INITIAL.

LOOP AT l_dfies_tab ASSIGNING <l_dfies_wa>.

CREATE OBJECT l_metadata_if TYPE cl_bsp_metadata_simple

EXPORTING info = <l_dfies_wa>.

l_comp_meta-name = <l_dfies_wa>-fieldname.

l_comp_meta-object = l_metadata_if.

APPEND l_comp_meta TO l_comp_metas.

ENDLOOP.

CREATE OBJECT l_metadata_if TYPE cl_bsp_metadata_struct

EXPORTING info = l_dfies_wa

component_metadata = l_comp_metas.

ELSE. "//component IS INITIAL

READ TABLE l_dfies_tab WITH KEY fieldname = component

ASSIGNING <l_dfies_wa>.

IF sy-subrc = 0.

CREATE OBJECT l_metadata_if TYPE cl_bsp_metadata_simple

EXPORTING info = <l_dfies_wa>.

ENDIF."// sy-subrc = 0

ENDIF."//component IS INITIAL

metadata ?= l_metadata_if.

endmethod.

***************************************************

<b>write the same type code for set method</b>

Regards,

Swapna

Former Member
0 Kudos

Hi,

I am facing the same problem..

anybody there who can help!..

thanks,

sudeep v d.

Former Member
0 Kudos

please...it is urgent

Former Member
0 Kudos

Same question.

It would appreciated if anyone can give some hints!

Thanks

Former Member
0 Kudos

Hey guys please... ...

any information related is welcome

Former Member
0 Kudos

Is there anybody have such experience, please do us a favour