Ads

How to Display Data into Table in Webdynpro

How to Display Data into the Table in Webdynpro

Here , we can display the data into table for the given input field that is according to user input ,the table will be filled with data.For this action ,we have to create one context node with input_node and table_node with their corresponding attributes .In the view layout ,create input field ,button with onactiongo event method and table elements .
Now let us see the coding part for the above scenario.

INPUT_NODE is declared as an internal variable for the context node of the user input TABLE_NODE is declared as an internal variable for the context node of the result table
CAR is declared as an internal variable of the user input FLIGHTS is declared as an internal table for the result representation Table.

Attribute of the context node INPUT_NODE is read and passed to an internal variable of the method ONACTIONGO.
 An internal table is filled according to the value of the internal variable.
The context node is filled with the content of the internal table.

*Data Declaration
 
 
method ONACTIONGO.
 
data:
INPUT_NODE type ref to IF_WD_CONTEXT_NODE,
      TABLE_NODE type ref to IF_WD_CONTEXT_NODE,
     
CAR        type        STRING,
      FLIGHTS    type standard table of SPFLI.

*Importing the User Input
INPUT_NODE = WD_CONTEXT->GET_CHILD_NODE( 'INPUT_NODE' ).
  INPUT_NODE->GET_ATTRIBUTE( exporting Name = 'IN1'
                             importing Value = CAR ).
   *Filling the Result Table
FLIGHTS = CL_WD_FLIGHT_MODEL=>GET_FLIGHTS_BY_CARRID( CAR ).
   
*Passing the Result Table
TABLE_NODE = WD_CONTEXT->GET_CHILD_NODE( 'TABLE_NODE' ).
TABLE_NODE->BIND_ELEMENTS( FLIGHTS ).
 
endmethod. 




Comments

Popular posts from this blog

BADI Interview Questions in SAP ABAP

Sample SAP ABAP Programming Examples for Practice

Module Pool Programming Interview Questions and Answers in SAP ABAP

Step by Step tutorial on BDC Session Method Program in SAP ABAP

SAP ABAP Interview Questions and Answers for 10 Years Experienced