Using Progress indicator UI Element at Table Control (Web Dynpro for ABAP)


We will have to write the code to fetch the data from database in this action method. For this, double click the action that you created.  

Inside this method write, the below code.

    Node_Date_Node                      type ref to If_Wd_Context_Node,
    Elem_Date_Node                      type ref to If_Wd_Context_Element,
    Stru_Date_Node                      type If_View1=>Element_Date_Node ,
    Item_DATE                           like Stru_Date_Node-DATE.
* navigate from <CONTEXT> to <DATE_NODE> via lead selection
  Node_Date_Node = wd_Context->get_Child_Node( Name = `DATE_NODE` ).
* get element via lead selection
  Elem_Date_Node = Node_Date_Node->get_Element(  ).
* get single attribute
      Name =  `DATE`
      Value = Item_Date ).
    Node_Mat_Node                       type ref to If_Wd_Context_Node,
    Elem_Mat_Node                       type ref to If_Wd_Context_Element,
    Stru_Mat_Node                       type If_View1=>Element_Mat_Node ,
    Item_MATERIAL                       like Stru_Mat_Node-MATERIAL.
* navigate from <CONTEXT> to <MAT_NODE> via lead selection
  Node_Mat_Node = wd_Context->get_Child_Node( Name = `MAT_NODE` ).
* get element via lead selection
  Elem_Mat_Node = Node_Mat_Node->get_Element(  ).
* get single attribute
      Name =  `MATERIAL`
      Value = Item_Material ).
  types : BEGIN OF ty_data,
          kunnr type kunnr,
          matnr TYPE matnr,
          arktx TYPE arktx,
          zmeng type dzmeng,
          meins TYPE meins,
          progress TYPE numc3,
          END OF ty_data.
  types : BEGIN OF order_data,
          vbeln type vbeln,
          posnr type posnr,
          matnr TYPE matnr,
          arktx TYPE arktx,
          kunnr type kunnr,
          zmeng type dzmeng,
          meins TYPE meins,
          progress TYPE numc3,
          END OF order_data.
  data : fs_dd type ty_data,
         it_dd type TABLE OF ty_data.
*      fs_data TYPE ty_data,
*      it_data TYPE TABLE OF ty_data,
        fs_order TYPE order_data,
        it_order_data TYPE TABLE OF order_data.
  refresh it_order_data.
  select vbeln
    from wb2_v_vbak_vbap2
    into table it_order_data
    where erdat eq item_date
     and matnr_i eq item_material.
    Node_Order_Data                     type ref to If_Wd_Context_Node,
    Elem_Order_Data                     type ref to If_Wd_Context_Element,
    Stru_Order_Data                     type If_View1=>Element_Order_Data .
  types : BEGIN OF ty_temp_order,
          kunnr type kunnr,
          zmeng type dzmeng,
          end of ty_temp_order.
        lw_total type dzmeng,
        lw_aveprogress type dzmeng,
        lw_qty type dzmeng,
        lw_order_data type ty_temp_order,
        it_temp_order_data type table OF ty_temp_order.
  sort it_order_data by kunnr.
  loop at it_order_data into fs_order.
    move fs_order-zmeng to lw_order_data-zmeng.
    move fs_order-kunnr to lw_order_data-kunnr.
    collect lw_order_data into it_temp_order_data.
    clear lw_order_data.
  sort  it_order_data by kunnr.
  delete ADJACENT DUPLICATES FROM it_order_data COMPARING kunnr.
  loop at it_ordeR_data into fs_order.
    read TABLE it_temp_order_data into lw_order_data with key kunnr = fs_order-kunnr.
    if sy-subrc = 0.
      fs_order-zmeng = lw_order_data-zmeng.
      MODIFY it_order_data from fs_order.
  LOOP AT it_order_data into fs_order.
    lw_total = fs_order-zmeng + lw_total.
  loop at it_order_data into fs_order.
    lw_aveprogress = ( fs_order-zmeng * 100 ) / lw_total.
    fs_order-progress = lw_aveprogress.
    Modify it_order_data from fs_order.
  loop AT it_order_data into fs_order.
    move : fs_order-kunnr to fs_dd-kunnr,
           fs_order-matnr to fs_dd-matnr,
           fs_order-arktx to fs_dd-arktx,
           fs_order-meins to fs_dd-meins,
           fs_order-zmeng to fs_dd-zmeng,
           fs_order-progress to fs_dd-progress.
    append fs_dd to it_dd.
* navigate from <CONTEXT> to <ORDER_DATA> via lead selection
  Node_Order_Data = wd_Context->get_Child_Node( Name = `ORDER_DATA` ).
  Node_Order_Data->bind_table( it_dd ).

6)       Go to layout. Create a table for output. The output table contains the following data.

Sold to number, material number, material description, target quantity, unit and progress indicator.

Right click the ROOTUIELEMENTCONTAINER and select table from it.

Layout will look like:

Click here to continue...


Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image