on 04-15-2014 6:56 AM
Hi all,
I have a requirement to add custom fields in an assignment block. i added it through value nodes and populated values for those fields in do_prepare using BOL set_property nd updated BOL using core_modify().
But the values are not updated in BOL after modify() so that i got dump during sort. So i populated values dynamically in get_XX of the attrib that i added.
Here is the link for the previous process i did.
http://scn.sap.com/thread/3534963
Now the issue is when i set the value dynamically to the web ui i could not sort the custom field in the web ui since BOL doesn't contain the data for custom fields. So again i am supposed to look the way in which i can update BOL with the values instead of doing it dynamically.
Plz help me out on this concern.
Regards,
Karthik
Hi Karthik,
You can set the filter option for your value attributes by using configurator class.
Please do the below steps and share results with us,
First step: You might be using the <chtmlb:configTable> tag in your .htm page right?, there will be a standard class linked with this tag.
Open that class in se24 and create an ehnacment for the method get_column_definitions
Second step: Write a if statement to trigger only for your table view id using the parameter in method
p_tableview_id. Once this is satisfied then you can add below code within the if statement as shown below.
Loop at P_COLUMN_DEFINITIONS into ls_column
WHERE COLUMNNAME = 'DOC_DESC' " you can give your custom attribute column name
OR COLUMNNAME = 'DOC_ID'
ls_column-sort = 'X'.
modify p_column_definitions from ls_column index sy-tabix transporting sort.
endloop.
GT_COLUMN_DEFINITIONS[] = P_COLUMN_DEFINITIONS[].
Option 2:
Instead of creating ehnacement spot in standard method you can do this
"you can copy standard chtmlb tag into custom tag then you can use this in your .htm page. You have to modify the same method in your custom class".
I will suggest first create enhancement spot in standard method " GET_COLUMN_DEFINTION"
and check the results if it works you can implement option 2.
Thanks,
Dharmakasi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
ENHANCEMENT 1 ZCUSTOMSORT. "inactive version
IF p_tableview_id eq ''.
Loop at P_COLUMN_DEFINITIONS into ls_column
WHERE COLUMNNAME = 'Z_DUEDATE'
OR COLUMNNAME = 'Z_EMPLOYEERESPONSIBLE'
OR COLUMNNAME = 'Z_RESPONSIBLEGROUP'.
ls_column-sort = 'X'.
modify p_column_definitions from ls_column index sy-tabix transporting sort.
endloop.
GT_COLUMN_DEFINITIONS[] = P_COLUMN_DEFINITIONS[].
ENDIF.
ENDENHANCEMENT.
is the enhancement code. but i get error ls_column is nt definded. enhancement is present efore data declaration of the method.
ls_column is declared in the standard method method itself down the enhancement.
If i declare again then i get GT_COLUMN_DEFINITIONS[] nt declared.
Thanks,
Karthik
Hi Karthick,
It is supposed to be GT_COLUMN_DESCRIPTION only but no need of assign table to GT_COLUMN_DESCRIPTION this value.
Just add the loop code alone,
Loop at P_COLUMN_DEFINITIONS into ls_column
WHERE COLUMNNAME = 'DOC_DESC' " you can give your custom attribute column name
OR COLUMNNAME = 'DOC_ID'
ls_column-sort = 'X'.
modify p_column_definitions from ls_column index sy-tabix transporting sort.
endloop.
For the table name, keep break point in that method and check the parameter p_tableviewid only.
Regardsm
Dharmakasi.
Hi dharma,
below are the screen shot.
these are the fields in the assign block
one of the 3 custom fields
when ever i sort on trans or trans type or date its getting sorted nd custom fields also populates correspondingly.
when i sort on due date or emp res or res group assign block remains same after refresh.
thanks,
karthik
Hi Karthik ,
You have probably not locked the entity before calling the Set property . Just debug the set_property method a bit and you will see the place where the lock on the entity is checked.
Regards,
Vineet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi vineet,
i used that as well. You can visit this discusiion to get detail about the issue.
if lr_entity_val->is_changeable( ) = abap_true.
lr_entity_val->set_property( iv_attr_name = 'Z_RESPONSIBLEGROUP' iv_value = lv_partner_descr ).
endif.
tiz is hw i coded.
http://scn.sap.com/thread/3534963
Thanks,
Karthik
Hi Karthik ,
Let me summarize the issue here :
> You have some custom Z fields in an assignment block for which you need to show the values in UI
> You should be able to sort the assignment block entries based on these Z fields .
Let us understand what the different approaches /steps you have followed till now mean -
1. Coding the values in the GETTER methods ( GET_Z....) : Any values that you return in this method are only for the UI layer display and are not persisted anywhere in the BOL . That's why these GET methods are called every time the page is reloaded . Since the values are not stored in the BOL layer , when you try to do a sort , the BOL frameowrk will only have blank values for these fields . This approach will not satisfy your requirement 2 .
2. Set the properties of the fields using SET_PROPERTY method -
The Set property method pushes the value to the BOL layer . After setting the properties you should be able to sort the BOL collection based on the Z fields . You need to lock the entity before you can do a Set_property . You can do this in the DO_PREPARE_OUTPUT () ( or even in each of the getter methods ) .
3. Modify () - method is used to push the data from the BOL layer to the API layer ( via GENIL ) . In your case , since the Z fields are only present in the UI layer ( and not in DB ) , you do NOT need to call modify () in the DO_PREPARE_OUTPUT () .
So just call set property and set the values of the z fields . You should be able to sort on the z fields .
Regards,
Vineet
Hi vineet,
I have that at first with out using modify(). I am getting dump even now if i use set_property alone.
As i mention in ma last post attrib_ref is getting initialised. Thats why i have gone for modify(). But even after that there was no +ve result.
As you mentioned in Point 2 i have used lock () nd ischangable to check the lock status nd called set_property. But still no breakthrough.
* if lr_entity_val->lock( iv_reread = abap_true ) = if_genil_Boolean=>true.
* lr_entity_val->set_property( iv_attr_name = 'Z_DUEDATE' iv_value = wl_appointment-date_to ).
* ENDIF.
* I used above way of lock also
CALL METHOD lr_entity_val->switch_to_change_mode( ).
if lr_entity_val->is_changeable( ) = abap_true.
lr_entity_val->set_property( iv_attr_name = 'Z_DUEDATE' iv_value = wl_appointment-date_to ).
ENDIF.
Thanks,
Karthik
Vineet,
attrib_ref is getting initial after i use modify() in do_prepare output.
if i dun use modify() in do_prepare then during sort while debugging attrib_ref is initial. So till my knowledge i feel like modify function is done by framework if we dun use manually.
Here is the check for attrib_ref during sort.
if iv_entity->my_manager_entry is not bound or iv_entity->container_proxy is not bound.
raise exception type cx_bol_exception
exporting
textid = cx_bol_exception=>entity_already_freed.
endif.
*here i get the dump since attribref is initial
Pardon me if ma understanding is wrong.
Regards,
Karthik
Hi Karthik ,
When you call modify () then the data is pused to API layer and the data is re-read . This will wipe out the values of your Z fields as they are not present in the DB/API layer structures .
If the value of the Z attribute is initial at the time of sorting , it can only mean that the data has been refreshed after you filled the values. Check if there is any re-read happening after you set the values . Also add a built_table statement at the end of your do_prepare_output code .
Regards,
Vineet
Vineet,
If i use modify() not oly z feilds are initialised. Total attrib_ref is initialed.
If i use reread manualy() then it fetched data from API nd z fields are initial. If i use reread() attrib ref is nt initial only z fields are blank.
Below are the details fr ur understanding.
is_changable is true(lock)
web ui has the values
dump while sorting
if i use modify() without reread() in do_prepare
Attrib_ref when i use modify()
when i use reread() after modify() exception occurs and flow goes to catch block.
i used typed_context->btdocflow->build_table( ). at the end of do_prepare
Regards,
Karthik
User | Count |
---|---|
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.