cancel
Showing results for 
Search instead for 
Did you mean: 

WebServices and Dynamic Layout

Former Member
0 Kudos

dear,

I have some questions:

1- Could I call Web Services Using ABAP WebDynpro.?(any Reference).

2- How i can connect to external DB Using ABAP WebDynpro?

3- Can I do a dynamic View Layout in WDA?

br,

Ali

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ali ,

3- Can I do a dynamic View Layout in WDA?

When we donot know the UI elements our view would contain , we can make use of dynamic programming .

create context nodes dynamically:

for binding our dynamically generated UI elements , we need to create the dynamic nodes.

We first get the node info wd_context->get_node_info( ).Then using the method new node has to add_new_child_node( ) , a new node has to be defined.

creating context attributes dynamically:

The context attributes can be added to the dynamically generated dynamic node , using the emethod add attribute ( ) .

creating UI elements dynamically:

We have different classes for this , like cl_wd_uielement_container for container ;

cl_wd_dropdown_by_idx for drop down by index .

Now I move ahead to to create a Dynamic Drop Down By Index , to make the things more clearer .I would proceed like this :

Using the method add_new_child_node , I would be creating a node and using the add_attribute method, the corresponding attributes of the node .I would take the reference of the view IF_WD_VIEW in my attribute mr_view.

TC_SYSTEM is the transparent container I have added in the layout of my view in which I want to add my dunamic UI elements

regards,

amit

Answers (4)

Answers (4)

Former Member
0 Kudos

hi,

Refer this on consuming webservies thru webdynpro ABAP :

/people/thomas.jung/blog/2007/12/17/consuming-services-with-abap

Please search on SDN regarding this . It has been discussed many times :

For :Creating a Web Service and Consuming a web service

Refer this :

I hope it would help.

Former Member
0 Kudos

hi Ali ,

1- Could I call Web Services Using ABAP WebDynpro.?(any Reference).

u can call web services in WD ABAP as well .

refer Thoma's reply in the thread :

In Web Dynpro ABAP there is nothing special about calling a web service. Unlike WD Java, there are not dedicated model object types in WD ABAP. WD ABAP simply has the ability to interact with other ABAP development object types. You can call function modules, ABAP classes, even modules in old dynpro apps.

So calling the webservice from ABAP therefore is just the process of generating the ABAP Proxy Class. This is the same process regardless of if you want to use this proxy class from WDA or any other type of ABAP development object. You can then call the proxy class from WDA just like any other type of ABAP class. There is a service wizard option in later support package levels that includes an option for ABAP Proxy classes - although it doesn't generate the proxy class it just generates the code and context for the call to an already existing proxy class. The service wizards in WD ABAP are not required however. They are just shortcut code generators and often can't even generate a complete context for a complex web service proxy - so expect to do some manual adjustment after running the wizard.

also check out the links :

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/244e7923-0a01-0010-5887-fe0b0c6d...

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/30f1b585-0a01-0010-3d96-ad0...

I hope u shud b clear wid ur query

regards,

amit

Former Member
0 Kudos

I would try to explain things by creating the dropdown using the class cl_wd_dropdown_by_idx and add it to my transparent container .



lr_node_info = wd_context->get_node_info( ).

CALL METHOD lr_node_info->add_new_child_node
EXPORTING
name = lv_node (name of the node)
RECEIVING
child_node_info = lr_node_info.

* Get instance of new node

DATA: dyn_node TYPE REF TO if_wd_context_node.

dyn_node = wd_context->get_child_node( name = lv_node ).

*** Prepare properties of attribute & add to context node CHILD
lr_attribute_info-name = 'SYS_ID'.
lr_attribute_info-type_name = 'STRING'.
lr_attribute_info-value_help_mode = '0'.

lr_node_info->add_attribute (
EXPORTING attribute_info = lr_attribute_info ).

lr_element = dyn_node->create_element( ).


* Dynamic drop down by index
DATA: lo_container TYPE REF TO cl_wd_uielement_container,
lo_dropdown TYPE REF TO cl_wd_dropdown_by_idx .
lo_container ?= wd_this->mr_view->get_element( 'TC_SYSTEM' ).


CONCATENATE lv_node '.SYS_ID' INTO LV_SAP.
lo_dropdown = cl_wd_dropdown_by_idx=>new_dropdown_by_idx(
bind_texts = LV_SAP
id = dd_indx_id view = wd_this->mr_view ).

cl_wd_matrix_head_data=>new_matrix_head_data( element = lo_dropdown ).

lo_container->add_child( lo_dropdown ). 

here mr_view is the view reference . this is declared as under the Attribute tab and is of type IF_WD_VIEW.

Basically, we should use the dynamic manipulation of the layout only if it not know defined which all UI elements would appear in the layout.

Refer Thomas jungu2019s reply in the thread :

Have a look at the documentation for the WDDOMODIFYVIEW section of the phase model:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/d2/8acd409cc4dd50e10000000a1550b0/frameset.htm

There is also the class CL_WD_DYNAMIC_TOOL:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/67/6935425394033be10000000a1550b0/frameset.htm

Also have a look at the example application DEMODYNAMIC.

I've got an eLearning on the topic here as well:

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/201ddd3b-b4ce-2b10-8883-880ae814...

for dynamic node creation , pls refer :

https://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/201ddd3b-b4ce-2b10-8883-880ae8147f89&overri...

also refer to http://wiki.sdn.sap.com/wiki/x/9gQ5C , tht might help u

Former Member
0 Kudos

FYI

The external DB is nonSAP DB.

Former Member
0 Kudos

1- Could I call Web Services Using ABAP WebDynpro.?(any Reference).

Yes. If you are calling a webservice on R3 enviroment, you could use the Service Call Wizard. Its like calling a FM but WS works too.

2- How i can connect to external DB Using ABAP WebDynpro?

I think this relates to Basis. I'm not sure how. Do let me know if you get the answer.

3- Can I do a dynamic View Layout in WDA?

You can do Dynamic UI on view. Thus you dont need to have multiple Views You could regenarate the UI's on the same screen.

Do let me know if you have more question.

Thank you.

-V-