cancel
Showing results for 
Search instead for 
Did you mean: 

Assistance class in Web dynpro ABAP

raj2
Explorer
0 Kudos

step 1: Create WEB DYNPRO component. Example: Zwd_assist_class_test.

             -save.

            -Active.  

step 2: Assistance class on component(Zwd_assist_class_test)  screenwriter assist class name Example:Asistance_class.

step3: Select the Assistance class name click on pop up new window .

step4:Assistance class window methods  give method name

step5: Select parameters of the methods  giving importing exporting table ,objects.

step6:Select Attributes button given the attribute name Example:ET_MAR.

For example methods READ_ONLY.

coding for method: select * from <db_table> into table <ET_tab> where matnr between im_matnr1 and im_matnr2.

I want using MARA,VBAK,VBAP tables data display in single table,creating two search fields .these are VBELN, MATNR

how to write READ_ONLY method ?

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Rajasekhar,


how to write READ_ONLY method ?

What do you mean by READ_ONLY method? I wonder if there is concept "READ ONLY METHOD".

          Hope your requirement is to create a method in assistance class to read data from database tables based on input fields.

Proceed as below to achieve your requirement

  • Create a node ND_INPUT with two attributes VBELN & MATNR
  • Create the ui elements for these two input fields and also create a button SEARCH
  • Create a structure ZST_RESULT with all the required fields and create a context node ND_RESULT by using structure
  • Also, create table type ZTT_RESULT by using structure ZST_RESULT
  • Create a method GET_DATA in assistance class with importing parameters IV_VBELN & IV_MATNR and return parameter RT_RESULT of type ZTT_RESULT
  • Inside method you can write the logic to inner join the related tables and put the result into RT_RESULT internal table
  • Now, call the method GET_DATA inside the event handler of button SEARCH

Hope this helps you.

Regards,

Rama

raj2
Explorer
0 Kudos

Assistance class methods:

methods: Read_data       level: Instance     visible : public.

Importing parameters:

matnr: im_matnr1 ,im_matnr2. MARA table.

vbeln: im_vbeln1 , im_vbeln2     VBAK table.

Exporting Parameters:

lt_mara  type mara.

lt_vbak type vbak

lt_vbap type vbap.

method read_data( ).

*** MARA TABLE***

select * from mara into table et_mara    where matnr between im_matnr1 and im_matnr2.

***VBAP TABLE***

select * from vbap into table et_vbap  for all entries in et_mara

               where matnr = et_mara-matnr and

                         vbeln between im_vbeln1 and im_vbeln2.

***VBAK TABLE***

select * from vbak into table et_vbak for all entries in et_vbap

               where vbeln = et_vbap-vbeln

    end method. 

Former Member
0 Kudos

Hi,

Now you have data in 3 exporting Itabs ( et_mara  ,et_vbap,et_vbak). Now take another itab with required fields(i,e which you want to show as table ) ,populate that itab based on 3 itabs and bind that final itab so that you can able to display required results.

Thanks

KH

ramakrishnappa
Active Contributor
0 Kudos

Hi Rajasekhar,

The exporting parameters which you have declared can take only one record as its declared as work area. Instead you need to identify the table type and use like

for MARA... MARA_TT

for VBAK... VBAK_T

for VBAP... VBAP_T

but, for your requirement, you need not required to pass mara, vbak, vbap table data, instead you need to put into final internal table ET_result.

I suggest you to create a table type ZTT_RESULT in SE11 which contains all your fields in the output.

Now, inside READ_DATA( ) method you can do as below ( just an example)


loop at lt_mara into ls_mara.

     move-corresponding ls_mara to ls_result.

     loop at lt_vbap into ls_vbap where matnr = ls_mara-vbeln.   

           move-corresponding ls_vbap to ls_result.

         

          read table lt_vbak into ls_vbak with key vbeln = ls_vbap-vbeln.

    

          if sy-subrc is initial.

                    move-corresponding ls_vbak to ls_result.

          endif.

         

     endloop.

append ls_result to ET_RESULT.

endloop.

Hope this helps you.

Regards,

Rama

Answers (2)

Answers (2)

raj2
Explorer
0 Kudos

Thank you

Former Member
0 Kudos

Hi,

Pls close the thread if your question is addressed.

Thanks

KH

raj2
Explorer
0 Kudos

how it is?

Former Member
0 Kudos

Hi,

Refer below link

How to close a discussion and why

Former Member
0 Kudos

Hi,

If i'm not wrong,you want to fetch data from MARA,VBAK,VBAP into single table?..If so, Create an itab will all the required fields from three tables and also create 3 temp itabs.

1) Fetch data from Table-1 based on your requirement/selection criteria into itab1.

2) Fetch data from Table-2 based on entires of itab1 into itab2.

3) Fetch data from Table-3 based on entires of itab2 into itab3.

Now you have data in Itab1,Itab2,Itab3. Use these three itab's and populate the data into final Itab(which you want to use to finally).

Thanks

KH