Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

Dynamic Node in Web Dynpro ALV

$
0
0

Dynamic Node in Web Dynpro ALV

 

  Dynamic programming is very helpful to provide solution for some critical business requirement in SAP GUI and this legacy is carried forward to the
dynpro era also. Here I worked on a requirement on which output table columns are not fixed. Based on material number in output all other data has been

changed based on classification maintained for that material in material master, so we cannot fix field catalog for this requirement or in web dynpro we
cannot create fixed node and attribute to map the ALV d
ata in interface controller.

 

So to achieve this following steps need to be taken care :

 

 

Step 1 :

Create an internal table which having information of field name and field type(data element) for that material, like :

 

DN1.png

 

here in this type :

 

FNAME - Hold the name of the field

FTYPE - Hold Data type for the field

 

Now based on dynamic condition fill this internal table.

 

Step 2 :

 

Create Dynamic Structure and Dynamic Table based on fields fill in above steps:

 

Here I have created a method which is having field information in table "gt_field_list".This method having 2 exporting parameter which give
reference of dynamically created data type reference of s
tructure and internal table, later you can assign these variable into field symbols for
further processing.

 

 

E_STRUCTURE -Will return reference for structure.

E_TABLE           - Will Return standard internal table reference with line type as e_structure.

 

DN2.png

 

 

Step 3

 

After getting reference of structure and table call above method in get data method and do following coding. After the below coding <f_line1> and <f_tab>
field symbols are ready to use to fill internal final data.

 

DN3.JPG

Step 4

 

Create Dynamic node in Web Dynpro Application:

 

Following code will create a node named "DYNAMIC_NODE" in root node of view.

 

Here node attributes will be added from dynamic structure "gs_structdescr"  and this structure is of same type describe in step 2   "e_structure".

 

 

DN5.png

  

Step 5 :

 

After creating dynamic node now its turn to get reference of newly created node and bind data for this node to the internal table which we filled in step 3.

 

DN1.png

 

 

Step 6:

 

After binding the table now its turn to instantiate ALV component which can be done by following steps:

DN1.png

Step 7: Executeapplication for dynamic node.

 

Thanks and Regards,

Gagan Choudha


Viewing all articles
Browse latest Browse all 943

Trending Articles



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