Relevance of assistant class.

when we can directly make use of class and create its object and make use of its methods in our component without declaring assistant class.  what is the relevance of assistance class?

Hi,
You can access assistance class objects using wd_assist  attribute.  No need of separate instance like normal class.
The assistance class is automatically instantiated when a component is called. The instance is available to each controller of the component through the attribute WD_ASSIST.
Assistance class is use to manage of dynamic texts. Texts that are combined at runtime only and/or contain variables can be stored in the text pool of the assistance class as text symbols.
Regards
Srinivas

Similar Messages

  • To call standard tcode in webdynpro( thru webgui) : Assistance class

    Hi Gurus,
    I have an alv display in which the vbeln entries have link to action control.
    i.e when i click vbeln( sales order no), it should open a new window through its/webgui.
    1.I am getting following error when i activate , get_execute_location is private/protected.
    2. How do i go about the following code:
    wd_comp_controller->execute_get_location(
    IMPORTING
    e_host = lv_host
    e_out_protocol = lv_out_protocol
    e_port = lv_port ).
    Within my method of my assistance class I call an interface in class cl_http_server to procure my host,
    protocol and port number.
    CALL METHOD cl_http_server=>if_http_server~get_location
    IMPORTING
    host = e_host
    port = e_port
    out_protocol = e_out_protocol.
    Can some one explain in detail.
    Best Regards,
    Navin Fernandes.

    Hi Navin,
    To display a standard tcode in your webdynpro application using  ITS  you can use the following code
    DATA: url TYPE string,
            host type string,
            port type string.
    *Call below method to get host and port
      cl_http_server=>if_http_server~get_location(
         IMPORTING host = host
                port = port ).
    *create URL
      CONCATENATE 'http'
      '://' host ':' port
      '/sap/bc/gui/sap/its/webgui/?sap-client=&~transaction=' 'SE11'
       INTO url.
    *get the window manager as we are opening t code in external window.
      DATA lo_window_manager TYPE REF TO if_wd_window_manager.
      DATA lo_api_component TYPE REF TO if_wd_component.
      DATA lo_window TYPE REF TO if_wd_window.
      lo_api_component = wd_comp_controller->wd_get_api( ).
      lo_window_manager = lo_api_component->get_window_manager( ).
    *  call the url which we created above
      lo_window_manager->create_external_window(
      exporting
      url = url
      receiving
      window = lo_window ).
      lo_window->open( ).
    Hope this helps!
    Best Regards,
    Radhika Vadher.

  • Assistance class in Web dynpro ABAP

    step 1: Create WEB DYNPRO component. Example: Zwd_assist_class_test.
                 -save.
                -Active.  
    step 2: Assistance class on component(Zwd_assist_class_test)  screenwriter assist class name Example:Asistance_class.
    step3: Select the Assistance class name click on pop up new window .
    step4:Assistance class window methods  give method name
    step5: Select parameters of the methods  giving importing exporting table ,objects.
    step6:Select Attributes button given the attribute name Example:ET_MAR.
    For example methods READ_ONLY.
    coding for method: select * from <db_table> into table <ET_tab> where matnr between im_matnr1 and im_matnr2.
    I want using MARA,VBAK,VBAP tables data display in single table,creating two search fields .these are VBELN, MATNR
    how to write READ_ONLY method ?

    Hi Rajasekhar,
    The exporting parameters which you have declared can take only one record as its declared as work area. Instead you need to identify the table type and use like
    for MARA... MARA_TT
    for VBAK... VBAK_T
    for VBAP... VBAP_T
    but, for your requirement, you need not required to pass mara, vbak, vbap table data, instead you need to put into final internal table ET_result.
    I suggest you to create a table type ZTT_RESULT in SE11 which contains all your fields in the output.
    Now, inside READ_DATA( ) method you can do as below ( just an example)
    loop at lt_mara into ls_mara.
         move-corresponding ls_mara to ls_result.
         loop at lt_vbap into ls_vbap where matnr = ls_mara-vbeln.   
               move-corresponding ls_vbap to ls_result.
              read table lt_vbak into ls_vbak with key vbeln = ls_vbap-vbeln.
              if sy-subrc is initial.
                        move-corresponding ls_vbak to ls_result.
              endif.
         endloop.
    append ls_result to ET_RESULT.
    endloop.
    Hope this helps you.
    Regards,
    Rama

  • Assistance class not instantiated in the component controller of an ABAP WD

    I have a very weird problem when trying to launch an ABAP webdynpro I get a short dump, looking into it the assitance class does not get instantiated properly so it falls over.  It used to work, but I don't think I have substantially changed anything with the assitance class just on the layout, although something must have changed.
    In the constructor of the component controller it trys to cast (I think that is the correct term)  the assistance class from the compoent controller as below, Me->f_Alter_Ego->assistance_class is initial so that fails, it then tries to create the assistance class and falls over on create object Me->f_Assist.
      try.
        Me->f_Assist ?= Me->f_Alter_Ego->assistance_class.
      catch cx_sy_move_cast_error.    "#EC NO_HANDLER
      endtry.
      if not Me->f_Assist is bound.
        create object Me->f_Assist.
      endif.
    Extract from the short dump below.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "/1BCWDY/4LYS0NWZ8L8ENKKA93YQ==CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
        The following syntax error occurred in program
         "ZCL_WD_USER_MAINT=============CP " in include
         "ZCL_WD_USER_MAINT=============CM004 " in
        line 7:
        "You can only use "class=>method" with static methods."
    Other ABAP web dynpros in our system are fine.
    I have tried the obvious stuff like removing the assitance class from the WD component and putting it back in again.
    There is obviously somehting I am missing can anyone point me in the right direction or has experienced this before?
    Thanks,
    Tim

    Thanks Thomas,
    I could not see the wood for the trees on that one, I had syntax checked the assitance class ZCL_WD_USER_MAINT, however, that error would have been raised at runtime.
    Anyway all sorted now.
    Cheers,
    Tim

  • Data fetch for range of value inside an assistance class

    I want to create an assistance class where I can fetch data for the range of values selected ( basically when I select a range of sales order ).
    I was only only successfully in creating parameters, passing single values.
    Regards,
    Krishna.

    Hi Krishna,
    Logic to fetch the data of range ( implement in the method  )
       data : lv_matnr TYPE string VALUE 'MATNR',
                lr_matnr TYPE REF TO data.
    FIELD-SYMBOLS : <lr_matnr> TYPE ANY TABLE.
    ************ Method to call range of data ************************
    CALL METHOD wd_this->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD
      EXPORTING
        I_ID               = lv_matnr
      RECEIVING
        RT_RANGE_TABLE     = lr_matnr.
    ASSIGN lr_matnr->* to <lr_matnr>.
    *************** call the method of the assistance class
    wd_assist->GET_DATA( EXPORTING IR_MATNR = <lr_matnr> ).
    ****************** parameters of the method in the assistance class ********************
    Hope this helps you
    Thanks & Regards,
    Sankar Gelivi

  • Custom controller v Assistance Class

    Hi
    I have always used the assistance class to place all business logic.  I understand that this replaces the custom controller that is generally used for theis purpose in WDJ. Therefore, is the custom controller used much in WDA or is it largely redundant?
    Cheers
    Ian

    >
    Abhimanyu Lagishetti wrote:
    > Hi Ian,
    >
    >  It is not largely redundant as such, i can see two main reasons
    >
    >  1.  Configuration Controller, entire FPM is based on this. you can control the configuration of the WDA using custom controller
    >
    >  2. Business Logic, which belong to only current WDA can be put in Custom Controller so that it is more readable, where as in Assistance class we can use it in other applications when working in a team
    >
    > in both the cases you are following MVC
    >
    > Abhi
    1.  You are correct that configuration controllers are a useful feature of custom controllers; however FPM is not really based on this.  Custom Controllers/Configuration Controllers in your components are not a requirement of FPM.  In FPM your component implements a special Web Dynpro Component Interface.  The configuration of the FPM is done using component configuration of a standard SAP component.  Once again you can use Configuration Controllers in your FPM components like you would in any other component; but it is in no way a requirement to do so in order to use FPM.
    2.  Technically it is possible to place business logic in the custom controller, but my personal suggestion would be to not do so.  The context and context bindings carry a performance penalty and should only be used data that is needed by the layouts.  You end up creating custom controllers with logic that is locked into the component and only uses the attributes/methods.  What you end up with is a less useful class.  That is why I feel that using a normal ABAP class (possibly an Assistance Class) is the perfered way to go.
    I would add a third use: the service call wizards.  If you are going to use the wizards to generate calls to RFCs or other classes, it is often advisable to place this generated code into a custom controller (one of the wizard options). This is particularly useful if you are going to have more than one wizard call generated.  I guess you could make a case that this is the "business logic" that was being refered to in Item 2 above.  However I want would make the distinction that this is only the call to the business logic.

  • Relavance of assistant class in Webdynpro ABAP.

    When we can create a object for a class in the attributes tab of the component controller and acess the methods of the class directly, why do we need a assistant class.??
    Moderator message : Search for available information, post the question in Web Dynpro forum, thread locked
    Edited by: Vinod Kumar on Dec 22, 2011 3:09 PM

    Hai,
           In webdynpro ABAP,we use to write all the coding part within the component itself but there is a provision with which we can write the necessary business logic outside the component that is in a class and we can use that class as the assistance class in the current component. It is same as model class.

  • Select options range table to be passed to Assistance class

    Hi Guru's,
    I have an assistance class where I have to write all my select queries. I have a selection screen with multiple Select options (as input fields). Now I want to pass the select options range table to assistance class.
    Please let me know if you have any sample code for this which may also include building range tables for select options.
    Thanks,
    Pradeep

    Hi Pardeep,
    U can use following code: for field ERDAT
    data: rt_ERDAT      type ref to data,
            R_ERDAT       TYPE RANGE OF VIQMEL-ERDAT,
            R_ERDAT_line  LIKE LINE OF R_ERDAT,
    field-symbols: <fs_ERDAT> type table.
    Retrieve the data from the select option
      rt_ERDAT = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'ERDAT' ).
    Assign it to a field symbol
      assign rt_ERDAT->* to <fs_ERDAT>.
    copy field symbols to local variable
      R_ERDAT = <fs_ERDAT>.
    CALL METHOD WD_ASSIST->"METHOD_NAME"
          R_ERDAT        = R_ERDAT
    where in class method:
    R_ERDAT     Importing     Type     ZU5QNM_ERDAT_T
    ZU5QNM_ERDAT_T : is a table type of ZU5QNM_ERDAT_R
    and ZU5QNM_ERDAT_R has following structure :
    SIGN     ACE_SIGN     CHAR     1     0     Debit/Credit Sign (+/-)
    OPTION     ACE_OPTION     CHAR     2     0     Option for Ranges Tables
    LOW     ERDAT     DATS     8     0     Date on Which Record Was Created
    HIGH     ERDAT     DATS     8     0     Date on Which Record Was Created
    I hope this wiol solve ur problem.
    Regards,
    Vishal.

  • Abap error when using Web Dynpro assistance class

    Hello All,
    I created Web Dynpro component with assistance class.
    On the component controller I can see the attribute "WD_ASSIST".
    I also can use Goto  -> text symbols and create net text key.
    But when I tried to read the text:
    wd_assist->get_text( '001' ).
    There is abap error:
    Method get_text is unknown protected or private.
    I can see the method get_text inside my assistance class like this:
    IF_WD_COMPONENT_ASSISTANCE~GET_TEXT visibility - public.
    I think I missed something while creating the assistance class?
    Thanks in advanced for the help.
    Nir

    Your method call should be:
    wd_assist->IF_WD_COMPONENT_ASSISTANCE~get_text( '001' ).
    You have to supply the interface name or go into the class definition and create a public alias for that method.

  • Raising Exceptions and Assistance classes

    Hi everyone. I know that the WDA framwork will not let me declare a raising clause in the method signature. However, during checks in the component i usually declare some code like this which is not pretty:
    The methods below were declared in the view controller.
    *---this method is called from DOBEFOREACTION method
    METHOD validate_view_fields .
      DATA: l_returncode TYPE sysubrc.
      CALL METHOD validate_required_fields(
        IMPORTING
          e_returncode = l_returncode ).
      IF l_returncode <> 0.
        e_returncode = l_returncode.
      ENDIF.
    -more code down here-
    ENDMETHOD.
    I would like the framework to call a method and if something goes wrong I do not want to proceed further down the code or navigate. If I could declare exceptions I could handle this pretty easily.
    If assistance classes or model classes are the answer then would I be able to read the context from those classes? I've also read that passing references of the web dynpro controllers to the assistance class could produce some problems.
    What's the best way to check the view fields and to prevent going further with the subsequent code if an exception condition is found?
    Thanks! Generous points will be awarded!

    Hi Alexander,
    The best way to check the input fields and prevent the framework from calling further methods is this:
    Check the values in WDDOBEFOREACTION. In this method you can check the name of the action, if it is an action of the same view. Maybe you want to skip testing, if the user pressed the CANCEL button or something similar.
    Report the message as an error message attached to an attribute. Then the next methods (e.g. event handler) will not be called, and therefore no navigation will take place.
    If this does not work as described here, you should check your basis support package. It should be SP11 or higher.
    Ciao, Regina

  • Assistance Class is instantiated two times

    Hi at all,
    i´ve git a problem with using the assistance class. I declared the usage of an assistance class in my compoonent. But however, the framework is instantiating it two times. I don´t call the Create Object Method - nowhere. Can anybody help?
    Kind regards
    Armin Dizdarevic

    Hi, i have done the following and it is not coming 2 times in the constructor of Assistance class.
    Components Comp-1 ,Comp-2 are created with respective assistance classes.
    assit_1 and assist_2 and both classes have the  constructor.
    Each component has a view and window init.
    Comp-1->view_1- has a button 'Popup'.
    on action popup
    data lo_cmp_usage type ref to if_wd_component_usage.
    lo_cmp_usage =   wd_this->wd_cpuse_usage_popup( ).
    if lo_cmp_usage->has_active_component( ) is initial.
      lo_cmp_usage->create_component( ).
    endif.
    data lo_window_manager type ref to if_wd_window_manager.
    data lo_api_component  type ref to if_wd_component.
    data lo_window         type ref to if_wd_window.
    lo_api_component  = wd_comp_controller->wd_get_api( ).
    lo_window_manager = lo_api_component->get_window_manager( ).
    lo_window         = lo_window_manager->create_window_for_cmp_usage(
                       interface_view_name    = 'W_MAIN'
                       component_usage_name   = 'USAGE_POPUP'
    *                  title                  =
    *                  close_in_any_case      = abap_true
                       message_display_mode   = if_wd_window=>co_msg_display_mode_selected
    lo_window->open( ).
    when i run this code, the assist classes are called only once and not twice as you posted.
    Please explain me where are you differing in the above process.

  • Wat is  Assistance class in WD for Abap

    hi,
    Can any one gives perfect picture about  Asisstance class in Webdynpro abap.
    Thanks in advance.
    Best Regards,
    Kranthi.

    Assistance Class in WD is used for storing common reusable logic apart from component controller.
    It can also be used to store Text Symbols for displaying messages or lables for the WD application.
    Per WD session there will be one instance of assistance class ( if mentioned ) will be automatically instantiated and you can access it by wd_assist.
    It can also be used to store a reusable set of constants, public attributes, types etc.
    Assistance class has some standard methods like get_text to fetch text from text symbols.
    To craete an assistance class you have to create a normal class and then mention CL_WD_COMPONENT_ASSISTANCE as superclass. Then you can metion you class name in WD Component Header Details.
    To have a look of assistance class you can look at CL_WD_COMPONENT_ASSISTANCE class then navigate to all its Subclasses ( Assistance Class ). The methods will give you an idea of the usage.
    Hope this helps
    Regards
    manas Dua

  • Error in Assistance class.

    Hi experts,
    I am getting an error in assistance class, below is the error :
    " Web Dynpro Comp. / Intf. ZWD_TEST,Web Dynpro View V_TEST
    Attribute WD_ASSIST
    The type "ZASSIST_DISP" is unknown, but there is a type with the
    similar name "IG_ZWD_TEST" . . . . .  "
    where :
    ZASSIST_DISP is the assistance class,
    ZWD_TEST is the component,
    V_TEST is the view.
    But when i activate it anyway , it works fine.
    Help me in this error.
    Thanks
    Aisurya

    Hi,
    I believe this is due to you using an interface as an assistance class. This will normally generate the error "the type ZIF_CLASSNAME is unknown, but there is a type with the similar name IG_ZIF_CLASSNAME..."
    Make sure your assistance class is a proper class, and not an interface, and your problem should be solved.
    Regards,
    Trond

  • How to use assistance class in WD4A?

    Hi SDN,
    Can you please tell me How to use assistance class in WD4A?
    Regards,
    Rahul

    Create a class that inherits the class cl_wd_component_assistance. By default, it will have the method if_wd_component_assistance~get_text, which is used to retrieve text elements defined in the class. You can also add any other methods to it, like accessing your data etc.
    In your wd4a component, in the main component overview screen, there will be a tetxfield for assistance class. define your class name there. You do not have to instantiate it separately. You can access the class methods using the object wd_assist, which will be created globally in your component.
    Regards
    Nithya

  • Assistance Class

    Hi Experts,
    I know assistance class is being useful for passing the value throughout the components. I have two WDP components which is CompA and CompB. In CompA I have to key in a value in which it need to be used in the following components. When it goes to CompB, the value will be used to populate a table which is from database. So far I have created the assistance class with belows method:
    method GET_USER_PROFILE.
    SELECT * FROM PA0002
    INTO CORRESPONDING FIELDS OF TABLE LT_USER
    WHERE PERNR = USRID AND endda > sy-datum AND begda < sy-datum.
    endmethod.
    USRID is the Importing parameter while LT_USER is the exporting parameter which is a table.
    This method works well in CompA which is the table is created successfully. But the table is actually to be used in CompB. So how am I going to do that? Besides, I'm so confuse of using assistance class in WDP. It would be great if someone can clarify the usage of that. Thanks.
    Regards,
    YC
    Edited by: ycwong on Mar 12, 2011 11:23 AM

    Hi Bhaskaran,
    i used same assistance class for two components, however i have two different instances of assistant classes in two components and not able to share data, however as you said when i pass assistance class instance wd_assist to create component , i am able to share data
    comp A with assistance class AS
    comp B with assistance class AS
    assitance class with attribute "myattr"
    in component controller method wddoinit of comp A i have statement
    wd_assist->myattr = 'Comp A'.
    in the view controller method wddoinit of comp B i created component usage of A ( i have declared component usage of A in B )
    and then
    lv_string = wd_assist->myattr.
    lv_string is empty after this statement..
    what i felt is wd_assit is not singleton class because if it is then it should have only one instance is't it??? and i should be able to share data.
    however when i create component usage by passing wd_assist to create_component method it is working.. i am not sure of this behaviour of assistance class.
    correct me if i am wrong...

Maybe you are looking for

  • How can i create a table which name is dynamic and not static?

    i have a question to ask. normaly if i want to create a table, i must provid a name for the table. for example, create table tt (id number(5)). But now in my application, I need to control the table name with params through function, how can i do? th

  • I can't delete the files in my spam folder

    Spam email is existing in the spam folder. I can usually delete them. I click the box next to the spam items ad hit delete. Nothing happens. Is there a setting that has been changed?

  • Error message when trying to use app store

    I can't access the apple store, it comes up with an error as well as some other apps. But my wifi is working fine and I am able to use safari

  • IPhone not being recognised

    hi purchased iphone and for the first few days it was working brilliantly and managed to sync through iTunes. however it is now not being recognised by itunes and won't charge it also won't allow me to put into restore mode using the home button and

  • Manual white balance

    How do I manually white balance my three Sony HDR-HC1 hidef (consumer) video cameras in a dark theater? I produce DVDs of ballets for a local ballet company and I have trouble with color disparities between different camera angles when I am editing t