Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to get a field by validating other field in a table in webdynpro

Hi,

My requirement is to feed a ztable through a webdynpro component

with the below code am able to get 1st record only

i dont know how to loop in this scenario

am new to webdynpro

help meee

method ONACTIONONSAVE .

   DATA LO_ND_ND_FORM TYPE REF TO IF_WD_CONTEXT_NODE.

   DATA LO_EL_ND_FORM TYPE REF TO IF_WD_CONTEXT_ELEMENT.

   DATA LS_ND_FORM TYPE WD_THIS->ELEMENT_ND_FORM.

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

   LO_ND_ND_FORM = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_ND_FORM ).

* get element via lead selection

   LO_EL_ND_FORM = LO_ND_ND_FORM->GET_ELEMENT( ).

* get all declared attributes

   LO_EL_ND_FORM->GET_STATIC_ATTRIBUTES(

     IMPORTING

       STATIC_ATTRIBUTES = LS_ND_FORM ).

   INSERT ZSILO_CREATE from LS_ND_FORM.

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

   DATA LO_ND_ND_TABLE TYPE REF TO IF_WD_CONTEXT_NODE.

   DATA LT_ND_TABLE TYPE WD_THIS->ELEMENTS_ND_TABLE.

   DATA Ls_ND_TABLE TYPE WD_THIS->ELEMENTs_ND_TABLE.

   data wa TYPE  ZSILO_CREAT.

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

   LO_ND_ND_TABLE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_ND_TABLE ).

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

*DATA LO_ND_ND_TABLE TYPE REF TO IF_WD_CONTEXT_NODE.

*    DATA LT_ND_TABLE TYPE WD_THIS->ELEMENTS_ND_TABLE.

*    DATA LS_ND_TABLE TYPE WD_THIS->ELEMENT_ND_TABLE.

     DATA LO_EL_ND_TABLE TYPE REF TO IF_WD_CONTEXT_ELEMENT.

     DATA LV_werks TYPE WD_THIS->ELEMENT_ND_TABLE-werks.

     DATA LV_DIP_HI TYPE WD_THIS->ELEMENT_ND_TABLE-DIP_HI.

     DATA LV_VOL_DIP TYPE WD_THIS->ELEMENT_ND_TABLE-VOL_DIP.

     DATA LV_PRESSURE TYPE WD_THIS->ELEMENT_ND_TABLE-PRESSURE.

     DATA LV_PRESSURE_VOL TYPE WD_THIS->ELEMENT_ND_TABLE-PRESSURE_VOL.

     DATA D_VOL TYPE ZSILO_CREAT-VOL_DIP.

     DATA P_VOL TYPE ZSILO_CREAT-PRESSURE_VOL.

     LO_ND_ND_TABLE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_ND_TABLE ).

     LO_EL_ND_TABLE = LO_ND_ND_TABLE->GET_ELEMENT( ).

*   get single attribute

     LO_EL_ND_TABLE->GET_ATTRIBUTE(

       EXPORTING

         NAME `DIP_HI`

       IMPORTING

         VALUE = LV_DIP_HI ).

     LO_EL_ND_TABLE->GET_ATTRIBUTE(

       EXPORTING

         NAME `PRESSURE`

       IMPORTING

         VALUE = LV_PRESSURE ).

   

*    if lt_nd_table is not INITIAL.

     if lv_dip_hi is not INITIAL.

       CALL FUNCTION 'ZSILO_FM2'

         EXPORTING

           IM_DIP_HI        = lv_dip_hi

        IMPORTING

          EX_VOL_DIP       = d_vol

        EXCEPTIONS

          EXP1             = 1

*         OTHERS           = 2

                 .

lv_vol_dip = D_VOL.

        LO_EL_ND_TABLE->SET_ATTRIBUTE(

          NAME `VOL_DIP`

          VALUE = LV_VOL_DIP ).

        ENDIF.

     IF LV_PRESSURE is not INITIAL.

       CALL FUNCTION 'ZSILO_FM1'

     EXPORTING

       IM_PRESSURE           = lv_PRESSURE

    IMPORTING

      EX_PRESSURE_VOL       = p_vol

    EXCEPTIONS

      EXP1                  = 1

             .

    LV_PRESSURE_VOL = P_VOL.

        LO_EL_ND_TABLE->SET_ATTRIBUTE(

          NAME `PRESSURE_VOL`

          VALUE = LV_PRESSURE_VOL ).

       endif.

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

   LO_ND_ND_TABLE->GET_STATIC_ATTRIBUTES_TABLE( IMPORTING TABLE = LT_ND_TABLE ).

   LOOP at LT_ND_TABLE into wa.

*    if wa-dip_hi is not INITIAL.

     if wa-WERKS is not INITIAL.

       insert ZSILO_CREAT from  wa.

     else.

       CLEAR wa.

     ENDIF.

ENDLOOP.

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

endmethod.

Former Member
Not what you were looking for? View more on this topic or Ask a question