Quantcast
Channel: SCN: Message List - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 7775

Re: Difference between do_prepare_output and do_init_context methods

$
0
0

Hi Srujana,

 

Do_init_context method:

     This method is called after the context node is created.

     This method is called after wd_create_context which in turn calls connect_nodes on context level. This method is usually used to initialize the context nodes or pre-populate with values.

EX: Consider you have a table view, every time you open this webpage, then you might have to display few values into the table, then you can get value from any ZTABLE and assign to context node for displaying into the view by adding into the context_wrapper.

 

Do_prepare_output:

     This is triggered when each time view is displayed. This method is also called whenever you do some action (press enter, press button) on the view, first do_validate_input is called, then do_finish_input will be called. After this methods is called do_prepare_output is called.

     This method is used for preparing the output for UI Screen. It is possible to change the field properties based on requirement. It has one parameter called IV_FIRST_TIME which has the value 'X' for the first time the view is displayed.

Note: Only for the first time view is displayed the value will be 'X'

      Example: Consider an scenario where you want to display buttons according to the user. Then you can check which user is logged in and accordingly you can adjust the view display.

 

Here is an example for enable/disable button based on authorization.

IF gt_button IS INITIAL.

*   here the name of the button and the event is determine

    ls_button-type     = cl_thtmlb_util=>gc_icon_new.

    ls_button-text     = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BP/CORPORATEACCOUNT' ). "#EC NOTEXT

    ls_button-on_click = 'CREATECORP'.                      "#EC NOTEXT


*   check if button should be enabled according to UIU_COMP authorization values

    IF cl_crm_uiu_bp_authority=>bp_check_authority_create( iv_object_type = if_crm_bupa_uiu_otype~gc_otyp_corp_account ) = abap_true.

      ls_button-enabled  = gc_x.

    ENDIF.


    APPEND ls_button TO gt_button.

    CLEAR ls_button.

endif.


Viewing all articles
Browse latest Browse all 7775

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>