Monday, 8 December 2025

SAP ABAP Web Dynpro

 1. Application Creation

Go to SE80, choose Web Dynpro Components/Interfaces and write name of Web Dynpro Components:







Type: Web Dynpro Components

Update Layout, Views > Main















ROOTUIELEMENTCONTAINER > layout choose matrixLayout
















ROOTUIELEMENTCONTAINER Right Click Insert Element












Create Text








Input Text Description:








Create Input Field:








Click Label SALES_LBL, fill labelFor to connect lable with input field

Create Button













Choose Layout Data "MatrixHeadData" to put button in a new line & Input Text Submit

Create Createtion Date, Time, Name & Document Category wit the same step:
















Clik COMPONENTCONTROLLER
Create Node Base on Structure:









Create Node One by One in component controller:










Input Node Name














Create Attribut



















Open tab Contex move SALES form Context COMPONENTCONTROLLER to Context Main








Binding, Back to the views > main, click SALES_IN in tab Layout
Binding value, CONTEXT>SALES>VBELN








Binding text, CONTEXT>SALES>ERDAT







Create Action Method:












Double click Method ONACTIONDISPLAY:

Click Web Dynpro Code Wizard



Read > Context > Sales-VBELN for read value of sales order number

Generated code


Assistance Class
Input assistance class and double click for create class 


Add Method Get Data


Double click for create method:

Query Get data inside assistance class

Set value for ERDAT, ERZET, ERNAM and VBTYP






All Code in Event Handler ONACTIONDISPLAY :
METHOD onactiondisplay .
  DATA lo_nd_sales TYPE REF TO if_wd_context_node.

  DATA lo_el_sales TYPE REF TO if_wd_context_element.
  DATA ls_sales TYPE wd_this->Element_sales.
  DATA ld_vbeln TYPE wd_this->Element_sales-vbeln.

*   navigate from <CONTEXT> to <SALES> via lead selection
  lo_nd_sales = wd_context->get_child_node( name = wd_this->wdctx_sales ).
*   get element via lead selection
  lo_el_sales = lo_nd_sales->get_element( ).

*   get single attribute
  lo_el_sales->get_attribute(
    EXPORTING
      name =  `VBELN`
    IMPORTING
      value = ld_vbeln ).

  CALL METHOD wd_assist->get_data
    EXPORTING
      p_vbeln = ld_vbeln
    IMPORTING
      p_erdat = DATA(ld_erdat)
      p_erzet = DATA(ld_erzet)
      p_ernam = DATA(ld_ernam)
      p_vbtyp = DATA(ld_vbtyp).

*     set single attribute
  lo_el_sales->set_attribute(
    name =  `ERDAT`
    value = ld_erdat ).

* set single attribute
  lo_el_sales->set_attribute(
    name =  `ERZET`
    value = ld_erzet ).

* set single attribute
  lo_el_sales->set_attribute(
    name =  `ERNAM`
    value = ld_ernam ).

* set single attribute
  lo_el_sales->set_attribute(
    name =  `VBTYP`
    value = ld_vbtyp ).

ENDMETHOD.












No comments:

Post a Comment