on 02-18-2014 11:46 AM
Hi,
My scenario is ..
In my compoenent i used lot of serviece calls for rfc's ,
so that for every rfc there was one method was created in component controller (let say for 10 rfc's 10 methods are created with nodes and attributes).
How can i move these methods from component controller to assistance class methods .,.. ?
It was created with node declarations and context , element declarations as
data lo_nd_vbak type ref to if_wd_context_node.
wd_context , wd_this ,wd_comp_controller and so on.
How can i use these syntaxes in assistance class ? ....
when i copy these methods same from component controller to assistance class methods it was giving errors with above declarations .. how can i remove of those .. ?
can u please provide one document or clear explanation please ,,
Hi Naveen,
You can move the service call business logic from component controller to an assistance class by making some adjustments like passing controller references, etc
You can achieve your requirement as below
method call_bapi_1.
data lo_node type ref to if_wd_context_node.
data lo_element type ref to if_wd_context_node.
data lt_items type wd_this->elements_ITEMS.
data ls_items like line of lt_items.
lo_node = wd_context->get_child_node( name = wd_this->wdctx_items ).
call function 'BAPI_1'
exporting
ITEMS = LT_ITEMS
Receiving
return = lt_return.
endmethod.
- Create a method BAPI_1 in assistance class and the parameters CO_CONTEXT, CO_THIS as changing parameters
- Replace wd_context with co_context & wd_this with co_this as required
- We call an assistance method BAPI_1( ) as below
wd_assist->bapi_1(
changing
co_context = wd_context
co_this = wd_this ).
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rama,
Can you please tell me how can i declare go_context and co_this in above class .
i am facing the exact problem here only ..Unable to declare compoenent controller attributes and view attributes in assistance class.
let say one example ..
DATA ls_c_is_address TYPE IF_COMPONENTCONTROLLER=>element_is_address.
..in this here i written same code in assistance class method i am getting error like IF_COMPONENTCONTROLLER is unknown
how can i solve this ....
Hi Naveen,
We cannot access the component attributes like WD_THIS->ELEMENT_is_address. Because, wd_this refers to the IF_COMPONENTCONTROLLER which generates at runtime by WD framework. But we can have reference of wd_context & wd_this in assistance class and with dynamic programming we can get the info from that reference.
Hope you are creating nodes with a static DDIC structure.Hence, the internal tables and internal structures will be created by using the DDIC type.
The method BAPI_1( ) in assistance class should have parameters as below
-------------------------------------
I would like to suggest you that, attach every node with a DDIC type and use that to create tables/structures in method.
"you can get DDIC type from node & create an internal table as below as below
DATA lo_node TYPE REF TO if_wd_context_node.
DATA lo_type TYPE REF TO cl_abap_structdescr.
DATA lv_type TYPE string.
DATA LO_DATA TYPE REF TO DATA.
FIELD-SYMBOLS <FS_DATA> TYPE ANY.
lo_node = co_context->get_child_node( name = 'ADDRESSES'
).
lo_type ?=
lo_node->get_node_info( )->get_static_attributes_type( ).
lv_type = lo_type->get_relative_name( ).
CREATE DATA LO_DATA TYPE TABLE OF (LV_TYPE).
ASSIGN LO_DATA->* TO <FS_DATA>.
lo_node->get_static_attributes_table(
IMPORTING
table = <FS_DATA>
).
************************************
************************************
Option2: you can read data from context nodes in WD component and pass all the data as parameters to an assistance class method which just calls the bapi and update the parameters back
Regards,
Rama
Hi Naveen,
This document will give you how to improve performance of an application.
http://scn.sap.com/docs/DOC-50851
Thanks & Regards,
Sankar Gelivi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
You can move your coding to assistance class method and you can pass parameters to that method by calling through wd_assist in component controller .
if I correctly understand your question...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can use Assistance class Attributes to store the data while calling RFC in Assistance class method and where you are calling this Assistance class method in View/Controller, can set at the Node/attribute. .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.