cancel
Showing results for 
Search instead for 
Did you mean: 

How to write code in webdynpro ?

Former Member
0 Kudos

Hi sap guys...

I am new to sap ..

Can any body help me...How to write code in wendynpro for any application...

i know this..

1) some code will automatically write using code wizard.. Then whats about others?

**********************************************************************************************************************************************************************************

2) What is the meaning of this ?

DATA:   node_node_cust TYPE REF TO if_wd_context_node,

             node_node_custtab TYPE REF TO if_wd_context_node,

             elem_node_cust TYPE REF TO if_wd_context_element,

             stru_node_cust TYPE if_componentcontroller=>element_node_cust,

             ls_where(72) TYPE c,

             lt_where LIKE TABLE OF ls_where,

             lt_cust TYPE TABLE OF zcust.

Pls help me....

<-- Moderator Note: Please do some research before posting basic questions. SCN is here to help, not to teach. Thread locked. -->

Message was edited by: Neil Gardiner

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Lokesh,

When you use code wizard automatically it will generate code for the READ / SET Node values or Attribute values.

Context : is to store application data/runtime data in the form of NODES and Attributes.

Based on cardinality a node can store 1 instance ( 1:1 or 0:1 )

N instances ( 0:N or 1: N)

to read values from node or to set values to node, we have to get NODE instance.

From that we have to get ELEMENT Instance.

From the element instance we can get single attribute/ set of attributes( Structure) using methods

like get_attribute / get_static_attributes.

similary for setting values to node we use SET_ATTRIBUTE / SET_ STATIC_ATTRIBUTES.

So WE will create nodes in CONTEXT. Here CONTEXT is the root node with cardinality 1:1.

Below are Declarations for NODE, ELEMENT,VARIABLES,Int Table.

DATA lo_nd_input TYPE REF TO if_wd_context_node.

    DATA lo_el_input TYPE REF TO if_wd_context_element.

    DATA ls_input TYPE wd_this->Element_input.

    DATA lv_matnr TYPE wd_this->Element_input-matnr.

*   navigate from <CONTEXT> to <INPUT> via lead selection

    lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_input ).

*   get element via lead selection

    lo_el_input = lo_nd_input->get_element( ).

*   get single attribute

    lo_el_input->get_attribute(

      EXPORTING

        name =  `MATNR`

Regards,

Paul.

Former Member
0 Kudos

Hi Lokesh,

We can write code any where as we wish.

But we need to Implement as per MVC - Model View Control flow only for better programming .

OOPS: We required to use global class with methods and attributes etc stuff..

Suppose if you developed a global class in SE24 you can use the same in webdynpro.

Next, Writing code with Wizard is simple but need to understand what it is generated.

Using Wizard you can write set/read/append code.

I think you are required to more concentrate on Object Oriented approach.

Regards,

SAI

hemanth_kumar21
Contributor
0 Kudos

Hi K LOKESH,

Generally we will write code in Methods. Below is the link for more information about methods.

http://wiki.scn.sap.com/wiki/display/WDABAP/Hooks+Methods+in+Webdynpro+for+ABAP