cancel
Showing results for 
Search instead for 
Did you mean: 

How to fill the bol entities in a Z component?

Former Member
0 Kudos

Hi expert,

I'm creating a new component,and a view(Base entity:Product).

And also I created some attributes for the view.

and in method SEARCH_BQ_INFO_RECORD, I want to initialize the bol entity and fill my selected data to it.

I'm not sure how to coding?

Is there any coding example?

Thank you.

Jerry.

Accepted Solutions (1)

Accepted Solutions (1)

dharmakasi
Active Contributor
0 Kudos

Hi Jerry,

You can code in do_init_context method to fill your selected data to the bol context node.

create object lr_bol_col type cl_Crm_bol_bo_col.

CREATE DATA ls_structure_name

assign your custom data to reference ls_structure_name and then create bol entity like below code, here if you have multiple rows you have to use loop on table and each time you need to create entity and assign it to collection. Once the loop is done you need to assign full collection data to context node.

create object lr_bol_entity exporting ls_structure_name.

then fill the entities into collection lr_bol_col->add( lr_bol_entity).

and then add lr_bol_col to context node collection, this statement would come after loop the loop of data.

me->typed_context->context node name->collection_wrapper->add_collection( lr_bol_col ).

Best Regards,

Dharmakasi.

Former Member
0 Kudos

Hi Dharmakasi,

I make the coding in method do_init_context,

and the data can be filled into the bol entity.

But the system didn't get into the get method in each attribute,and several empty lines will be listed.

Do you know what the prolem is ?

Thank you.

Jerry.

dharmakasi
Active Contributor
0 Kudos

Hi Jerry,

Check whether the entity is bound before assigning to collection. You can do the field level check so that system will assign empty line entity.

If possible share your code here.

Best Regards,

Dharmakasi.

Former Member
0 Kudos

OK,I'll check that.

One more question,

In my view, I created both value attributes and model attributes.

For the model attributes, do you think I have to obtain the value manually,or the system will obtain the value?

Thank you.

Jerry.

dharmakasi
Active Contributor
0 Kudos

Hi Jerry,

BOL attributes will get values if the relation names everything is correct in get and set methods.

Best Regards,

Dharmakasi.

Former Member
0 Kudos

Hi Dharmakasi,

thanks for your great help.

As you can see in my above screen shot, the base entity of my view is "Product" and attribute "STRUCT.Produt_ID" was automatically created as soon as the view was created.

Now,I have a problem, the system do not get into the GET method of attribue "STRUCT.Product_ID",and thus could not get the value for this attribute. But it can get into the other value attributes and get the value for them.

Do you know what the problem is? Is there anything I should do?

Thank you.

Jerry.

dharmakasi
Active Contributor
0 Kudos

Hi Jerry,

Have you changed the attribute name, i did not see the STRUCT.PRODUCT_ID in above screen shot. keep break point in GET_S_STRUCT method in context node class  and see whether the structure is having product id or not. All attributes in context node get method will be triggered from GET_S_STRUCT method.

Check you are using STRUCT.PRODUCT_ID field in web ui configuration.

Best Regards,

Dharmakasi.

Former Member
0 Kudos

Hi Dharmakasi,

yes, I do have "STRUCT.PRODUCT_ID " attribute, just not involved in that screen shot.

And also,it is used in the configuration,not hide.

Please advise.

Thank you.

Jerry

dharmakasi
Active Contributor
0 Kudos

Hi Jerry,

As i said earlier keep break point in get_s_struct method and see whether product id is included in structure.

Regards,

Dharmakasi.

Former Member
0 Kudos

Hi Dharmakasi,

no,the system didn't get attribute "product_id" in method get_s_struct.

That's why the system didn't get into the GET method of this attribute,I think.

But,how can I fix this problem?

Please advise.

Thank you.

Jerry

dharmakasi
Active Contributor
0 Kudos

Hi Jerry,

This issue seems strange thing, i see there is another field with name product id what is that field?

You can check the structure used for context node in GET_TABLE_LINE_SAMPLE in context node class.Here you will be having all the list of attributes used in context node attributes.

You can check whether you will be able to see product id field. I think you have added product id 2 one is value attribute and bol attribute.

Best Regards,

Dharmakasi.

Former Member
0 Kudos

Hi Dharmakasi,

I add only one PRODUCT_ID in my attribute. It was generated when the view was created when base entity PRODUCT was set.

Do you have any other suggestions?

Thanks.

former_member210661
Active Contributor
0 Kudos

Hi Jerry,

i have seen your previous reply's in that you have mentioned product_id get method is not triggering right. now you have added product_id attribute into your context node right check weather getter and setter method of that product_id is triggering or not. then write the fetching logic over there if the values are not populating.

check this link..

Thanks & Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

the attribute "Product_id" was generated when the view was created with base entity "product".

I also didn't set the flag "HIDE" and it is also listed in the displayed fields in the user's personalization.  The wierd thing is ,the system do not get into the GET method of attribute "Product_id" at all.

do you have any suggestions to check?

Thank you.

Jerry

former_member210661
Active Contributor
0 Kudos

Hi Jerry,

This is very strange have you move the field from available to display in the config mode.

if you done this step then the system will definitely get trigger that getter and setter methods of the field.

check the configuration once.

Thanks & Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

Yes, I do move the field to display.

Now,I solved the problem by changing the setting in "Deactivting Hiding of Fields". Disable hiding of fields by design layer checkbox.

It seems that my field "Product_ID" is hide,But I'm sure the "Hide" checkbox is not set.

I still don't understand.

Jerry.

former_member210661
Active Contributor
0 Kudos

Hi Jerry,

I have already given step by step document in my previous reply. if you go through that document you will get your requirement.

any wise now you resolved the issue right.

Thanks & Regards,

Srinivas.

Answers (1)

Answers (1)

former_member210661
Active Contributor
0 Kudos

Hi Jerry Cui,

you can fetch the data in do_init_context method for displaying default values when ever your login into web ui the data will displayed in your table view.

just fallow Dharmakasi approch what he said you can achieve your requirement

see this logic for your reference purpose..

here i have used the standard structure that i have converted into collection assign to the node level..

just go through this link..

SAP CRM WEB UI : 57.VALUE NODE - DISPLAYING CUSTOM TABLE ON WEB UI

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

I filled the data into the bol entity.

But it seems that the system do not get into the GET method in each attribute.

The system listed several empty lines in the view at last.

what's the problem?

Thank you.

Jerry.