cancel
Showing results for 
Search instead for 
Did you mean: 

CRM WEB UI: Getting the current value of a certain field

Former Member
0 Kudos

Hello,

im rather new to the CRM_UI and i would really appreciate some help.

Situation:

In CRM_UI, on the PARTNER web mask i have a certain field that is NOT "connected" to any of the fields in standard CRM tables (i.e. CRMD_PARTNER). I want to save the value of this field into my own non-standard table.

For now i have this this:

In transaction BSP_WD_CMPWB i load the component BTPARTNER. I select a View called BTPARTNER/PartnerEF. Under Context i have 2 Context Nodes:

- ZBP ... in the Attributes there are listed variables that are not "directly connected" to any of the CRM tables

- BTPARTNER (Base Entity BTPartner) ... in the Attributes there are listed variables that are "directly connected" to CRMD_PARTNER

In ZBP node i defined a new field Z_TAX_VALUE. When i load the web mask, the method GET_Z_TAX_VALUE is ran, in which i read the value from my non-standard table and put it into the Z_TAX_VALUE. When i change the value on web mask and press back, the GET_Z_TAX_VALUE method is again run and i can save the changed value of Z_TAX_VALUE into my non-standard table. To read the current value of Z_TAX_VALUE i use this code in GET_Z_TAX_VALUE:


dref                 = current->get_property( 'Z_TAX_VALUE' ).

l_current_value = if_bsp_model_util~convert_to_string( data_ref         = dref

                                                                               attribute_path = attribute_path ).


Problem:

When i change the value of Z_TAX_VALUE, i have to press ENTER to save the value into Z_TAX_VALUE. Otherwise when reading the current value, old value is getting returned into l_current_value.

Example:

- Current value of a field in my non-standard table is 100

- I load the PARTNER web mask and Z_TAX_VALUE shows 100

- I change the value to 200. If i press ENTER and go back, the field in my non-standard table is getting updated to 200. If i dont press ENTER and go back, the field is not updated to the new value

What should i do ? How can i overcome this mandatory ENTER ? Should i do this completely differently ?

Thank you

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Zoran,

You can read the values from the from the DB in method DO_PREPARE_OUTPUT and set the value of field Z_TAX_VALUE and for inserting and updating Z_TAX_VALUE into the DB table you can use the method DO_FINISH_INPUT.

Pradeep

Former Member
0 Kudos

Hi Pradeep,

thanks for the answer.

Main question for my current solution (non-automatic/manual reading and updating fields in my custom Z table through WEB UI):

How do i read the current value in the Z_TAX_VALUE field, which i updated without pressing the ENTER ?

Im using this to read the current value:

dref                 = current->get_property( 'Z_TAX_VALUE' ).

l_current_value = if_bsp_model_util~convert_to_string( data_ref         = dref

                                                                               attribute_path = attribute_path ).

But without pressing ENTER this code returns the old value.

Former Member
0 Kudos

Hi Zoran,

you can go to get_P of the attribute and create an on click event and do the save to DB code in on click event you have raised there.

But, a better approach will be getting the data from the database on on_new_focus method of node and saving it back to database on any of the save event.

Former Member
0 Kudos

Hi Pratyush,

thanks for the reply. But will the above written code read the updated value (without pressing ENTER) of the field ?

Former Member
0 Kudos

Anyone ?

Help much appreciated.

former_member182421
Active Contributor
0 Kudos

Hi Zoran,

What's the logic behind this field which is not connected to the crm tables? I mean, for example,did you want to add extra fields at partner level?  It's a Z table which doesn't have any connection, in this case what's the primary key of the Z table? Did you considere enhance the BP entity with the extra filed via AET?

Cheers!

Luis

Former Member
0 Kudos

Hi Luis, thanks for the reply!

Like i mentioned i'm rather new to the CRM UI. The reason for adding a non-standard table field is that i reached the maximum number of additional Z fields in CRMD_PARTNER table. So i had to define a new non-standard table and a new field Z_TAX_VALUE on the mask is getting filled with the value from new table in the GET_Z_TAX_VALUE method.

Primary key of the new table is comprised of a few GUIDs (CRMD_ORDERADM_H, CRMD_PARTNER ...).

Im guessing im doing this the hard way. There is probably a much more elegant solution to directly connect my new table and the mask, the same way CRMD_PARTNER is connected. Could you perhaps provide step by step instructions ?

former_member182421
Active Contributor
0 Kudos

I think you can overcome  the limit of non standard fields on a standard table is create a AET table extension, instead of creating field in the corresponding table, the system links the object to the new table, maybe this way suits you.

http://scn.sap.com/community/crm/webclient-ui-framework/blog/2012/11/24/the-new-aet-table-extension-...

Another option is create a custom bol/genil object for you Z table which is linked ot the BTpartner, this is a clearer solution but will involve some extra development and the integration on th BT model goes to your side, and belive me, is quite troublesome.

Former Member
0 Kudos

Thanks for the link. Im having trouble finding the ADD TABLE.

My steps:

- I go to the web mask where i want additional fields

- I click on "Show Configurable Areas" and select the desired area. A pop-up window opens

- in the upper part of a pop-up window i click on "Display Enhancements" which open a new pop-up window. There are 3 available buttons: "New" & "Add Reusable Field" & "Edit List"

- When i press "New" a new pop-up window opens where i enter the name of my package and  select "Part of a BO" = PARTNER

- When i press OK i get an error "Field enhancement for place INCL_EEW_PARTNER_CRM is not possible due to database limit"

former_member182421
Active Contributor
0 Kudos

hmmmmmmmmmmm looks like you can't do a table extension on the PARTNER.

What's the functional requeriment behind Z_TAX_VALUE?

Former Member
0 Kudos

Z_TAX_VALUE is showing the value from my Z table (value gets filled in some function module). Additionally the Z_TAX_VALUE is an input field and  manual changes to the field have to be saved into my Z table (table field is updated).

former_member182421
Active Contributor
0 Kudos

You didn't answer exactly what I ask but that's ok

Z_TAX_VALUE is a value attribute of the Context node PARTNER or did you enhanced the PARTNER BOL structure?

How Z_TAX_VALUE is readed from the DB and how do you plan update it?

Former Member
0 Kudos

Hi Luis,

i managed to solve the problem :

I added a new value node (Component --> Views --> Context Nodes --> Create) with the desired attribute (Z_TAX_VALUE). Then in the GET and SET methods of the attribute i added the code for reading and updating the table.

With this the main problem was solved:

When updating the value of a Z_TAX_VALUE field the ENTER button is not mandatory anymore.

Thanks for your help.

Regards, Zoran

former_member182421
Active Contributor
0 Kudos

I'm glad I helped somehow , be carefull about how you will persist the info of the value node into the DB, for example:

- If the user press cancel, popup is showed by stadnard, data has changed do you want to save? yes/no.

- If you want only save the info together with the Business Transaction.

Cheers!

Luis