Skip to Content

Passing data of internal table to a form/subroutine

I have used the IF/ElSE statement to get data in an Internal Table say ITAB1 on base of some parameters. If ITAB1 IS NOT INITIAL it will PERFORM FORM_FILL.

FORM_FILL takes the ITAB1 data and filters it on certain parameters, and READ TABLE is done to get data from other tables. I want to know the method of passing the ITAB1 data to the FORM_FILL subroutine.

How can I do this?

Moderator Message - Basic ABAP syntax question. Thread locked.

Message was edited by: Suhas Saha

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Dec 14, 2012 at 08:00 AM

    Hi,

    Suppose the structure name is ty_itab, internal table name is t_itab1. Table Type is tty_itab1.

    TYPES: tty_itab1 TYPE STANDARD TABLE of ty_itab.

    PERFORM FORM_FILL CHANGING t_itab1.

    FORM FORM_FILL CHANGING t_itab1 type tty_itab1.

    *-- Business Logic

    ENDFORM.

    Regards,

    Debopriya Ghosh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 14, 2012 at 07:22 AM

    Hi,

    You can write like this..

    Declare itab1 globally. and write like below.

    PERFORM FORM_FILL using itab1.

    Regards

    Ram

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi,

      If your using FM declare lit(internal table ) in top include,,,,

      for local internal table use TABLES to pass internal table.

      perform update_table tables lit .

      form update_table tables lit  structure ztt.

      ztt should be type of lit.  if standerd structure not there you have to create zstructure.

      regards.

      Lingaraj.

  • Dec 14, 2012 at 07:51 AM

    If you want to use local variables, it is better to use USING/CHANGING instead of TABLES. TABLES is an old way of passing internal tables.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 14, 2012 at 08:08 AM

    Hi Das,

    Check the below code.

    Perfrom TEST_FORM TABLES ITAB

                                     USING WA.

    In the Form----EndForm the code will be like this.

    FORM TEST_FORM TABLES P_ITAB

                                   USING P_WA.

    -----------------Your Code-------------------

    ENDFORM.

    Remember the only Rule is whenever you are using TABLES Parameter in the PERFORMs it should be the First One later you can add USING , CHANGING etc.. Hope this helps.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Das,

      Check the below code and try it will work. Hope this helps

      PERFORM FILL_FINAL TABLES IT_VBAK USING WA_VBAK. 


      FORM FILL_FINAL TABLES IT_VBAK

                                     USING P_WA_VBAK Like WA_VBAK.

      *********** code***************

      * Here you use the P_WA_VBAK as WA_VBAK.

      ENDFORM.

  • avatar image
    Former Member
    Dec 14, 2012 at 08:43 AM

    Hello Soumen,

       Do you want to just pass internal table to refer in routine or you want to make changes. If it global declaration that you can use it directly without passing it in form routine. If still you need to access thru routine then check below logic

    PERFORM FORM_FILL TABLES t_itab1.

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

    FORM FORM_FILL TABLES t_itab1.

    *.............

    Logic

    ............

    ENDFORM.

    regards,

    Deepti

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 14, 2012 at 09:26 AM

    Options for you:-

    FORM subroutine CHANGING pi_table LIKE i_table

    FORM subroutine TABLES pi_table TYPE STANDARD TABLE

    FORM subroutine TABLES pi_table STRUCTURE dictionary_structure

    FORM subroutine CHANGING pi_table TYPE table_type



    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 14, 2012 at 09:33 AM

    Hi Souman

    If your table data needs to be modified or changed and gets returned from the subroutine then you can use:

    Perform Form_fill changing itab1.

    Form Form_fill changing ITAb1 type <type of itab1>.

    ....

    .....

    ENDFORM.

    or if you simply wants to pass the data from data from table :

    use value instead of changing.

    regards

    vaibhav

    Add comment
    10|10000 characters needed characters exceeded