cancel
Showing results for 
Search instead for 
Did you mean: 

Data fetch for range of value inside an assistance class

former_member187692
Participant
0 Kudos
154

I want to create an assistance class where I can fetch data for the range of values selected ( basically when I select a range of sales order ).

I was only only successfully in creating parameters, passing single values.

Regards,

Krishna.

Accepted Solutions (1)

Accepted Solutions (1)

former_member222068
Active Participant
0 Kudos

Hi Krishna,

Logic to fetch the data of range ( implement in the method  )

   data : lv_matnr TYPE string VALUE 'MATNR',
            lr_matnr TYPE REF TO data.

FIELD-SYMBOLS : <lr_matnr> TYPE ANY TABLE.

************ Method to call range of data ************************


CALL METHOD wd_this->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD
  EXPORTING
    I_ID               = lv_matnr
  RECEIVING
    RT_RANGE_TABLE     = lr_matnr.

ASSIGN lr_matnr->* to <lr_matnr>.

*************** call the method of the assistance class

wd_assist->GET_DATA( EXPORTING IR_MATNR = <lr_matnr> ).

****************** parameters of the method in the assistance class ********************

Hope this helps you

Thanks & Regards,

Sankar Gelivi

former_member187692
Participant
0 Kudos

what do you mention in the "where condition in ur select query"..... (since the parameter is of table, then    what'll ur 'matnr' be equal to  ___ .).

Mine is like this

Eg:

select

         KUNNR

         VBELN

         LAND1

         NAME1

         ERDAT

         ERNAM

         VKORG

         POSNR

     FROM <table>
     INTO TABLE <itab>
     WHERE KUNNR = <IM_KUNNR> .   


ramakrishnappa
Active Contributor
0 Kudos

Hi Krishna,


data lr_range_table type ref to data.

"get range table

  • m_select_options->get_range_table_of_sel_field(

               exporting

                    i_id = 'KUNNR'

               importing

                    rt_range_table = lr_KUNNR_DATA ).

  field-symbols: <im_kunnr> type any.

               assign lr_kunnr_data->* to <im_kunnr>.

select

         KUNNR

         VBELN

         LAND1

         NAME1

         ERDAT

         ERNAM

         VKORG

         POSNR

FROM <table>
     INTO TABLE <itab>
     WHERE KUNNR  in <IM_KUNNR>


Here: <im_kunnr> is a range table, hence we have use "in" operator


Hope this helps you.


Regards,

Rama

former_member187692
Participant
0 Kudos

Thanks Rama.

Thanks Sankar.

Also got some info from this site below. I will post it, it may be useful.

http://wiki.scn.sap.com/wiki/display/WDABAP/Assistance+class+functionality+in+WDA

Answers (2)

Answers (2)

ramakrishnappa
Active Contributor
0 Kudos

Hi Krishna,

You can achieve your requirement as below


Adding select options into view:

  • Create a range table lr_range_table as below

   data lr_range_table type ref to data.

lr_range_table = m_sel_options->CREATE_RANGE_TABLE( I_TYPENAME = 'VBELN' ).

m_sel_options->add_selection_field(

     exporting

          i_id = 'VBELN'

          it_result = lr_range_table ).

Plese refer the below link to know, how to add a selection field and get the values of selection field into a range table.

WDA Select Options in detail 

Now, question is how to pass the data to assistance class method and fetch data accordingly

  • Get the value of select options into range table by using method m_select_options->get_range_table_of_sel_field(

               exporting

                    i_id = 'VBELN'

               importing

                    rt_range_table = lr_vbeln_data ).

              

                    field-symbols: <fs_vbeln> type any.

               assign lr_vbeln_data->* to <fs_vbeln>.

  • Create a method GET_DATA with parameters so_vbeln of TYPE TABLE selopt ( importing parameter ) and a return parameter rt_result of type your ZST_RESULT

          call method as below

                    wd_assist->GET_DATA(

                         exporting

                              so_vbeln = <fs_vbeln>

                         importing

                              rt_result = lt_result ).

Hope this helps you.

Regards,

Rama

Kiran_Valluru
Active Contributor
0 Kudos

Hi,

Create a range table type and pass values to that.

Regards,

Kiran