Skip to Content
avatar image
Former Member

how to move internal table from one method to anothe in BADI

hi experts,

how can i move a internal data containg information from one method called lilne_modify ino anothe rmaethod called post_document, or is there a way to declare the internal table globally ..??

plz reply soon...

thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 28, 2010 at 06:54 AM

    Hey as far as my knowledge goes , system creates different local copies for every method implementation. So you will not be able to share that internal table data.

    What you can do is , create your own Z Transparent table , populate that internal table data into that transparent table in first method and fetch in other method.

    Hope this is helpful.

    Regards,

    Uma

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi uma,

      i have created a transparent table as suggested above. am facing a problem .

      only line item 10 is getting inserted into the table and for line item 20 and 30 etc sy-subrc is 4.

      any idea why is this happening..??

      thanks in advance..

  • avatar image
    Former Member
    Jun 28, 2010 at 07:07 AM

    Hi,

    It is very simple to handle such situatuion. You can use export/import statements, Export/Import (ABAP Memory) internally acts as an interface to transfer the information.

    But make sure that you will run the method that populates the Internal table.

    For Eg: Method A contains the logic to populate the Internal table and Method B uses the internal table.

    Write an Export statement exporting internal table using Memory-ID, and declare the same Internal table in Method B and Import the table using the Memory-ID.

    In your standalone program, Call Mehtod A first which populates the internal table. then execute Method B to fulfill your requirement.

    Thanks and Regards,

    Santosh Kumar Mukka.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      you can use Export/Import statements even in OO context preferably by passing with Alias names.

      For Eg:

      Export gt_out from gt_out into memory-id <MEM-ID>

      Import gt_out to gt_out from memory-id <MEM-ID>.

      Try this once.

      Thanks and Regards,

      Santosh Kumar Mukka.

  • Jun 28, 2010 at 09:18 AM

    You can use Field Symbols for the same

    ( ASSIGN ('(PROGRAM)TABLE[]') TO <my_tab> )

    Caution...!

    hope it helps...

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 28, 2010 at 09:41 AM

    Hi Abhilash,

    those 2 methods you are using belong to same BAdI ?

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 28, 2010 at 10:25 AM

    Then you can declare internal table as public attribute in your implementing class.

    Which can be filled in your method1 and the same can be used in the other method.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 28, 2010 at 10:27 AM

    Hi,

    an easy way of doing this is

    1. Create a new function group (e.g. ZDATA_TRANSFER)

    2. Create FM SET_DATA with input parameter IT_TABLE and store the table to global FM memory

    3. Create FM GET_DATA with export parameter ET_TABLE and return the global table.

    So in BAdI 1 you call SET_DATA with the table, in BAdI 2 you call GET_DATA. Works fine (as long as you stay in the same memory session).

    Roy

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 30, 2010 at 04:39 AM

    Hi ,

    Please go for EXPORT to MEMORY ID and IMPORT from MEMEORY ID ,this will surely solve your problem for synatx just press F1 on the above syntax in the ABAP editor.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi,

      export and import i am able to move only one line item tht is it acts as a structure. in OO internal table cant be moved . i got the same error when i used this command.

      Regards,