Skip to Content
author's profile photo Former Member
Former Member

Exporting Tables from BSP to Class Methods

Afternoon Everybody,

in true SAP OSS Message style I post this question on it's own thread to enable maximum value from the reward points.


I have a BSP, in an event in my BSP I call a method in my class.

I have mastered Exporting parameters to the methods from the BSP and Importing parameters back to the BSP from the methods, but now, I need so Export a table to the method and I don't know how to.

Also, in combination with this, when I create the method I am able to setup the importing parameters, but how can create/define the importing table ?

If this is not clear I will add more info.

Thanks for your help,


Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2005 at 01:59 PM

    Hi Tomas,

    first of all you have to create an Tabletyp

    with help of the Transaction SE11. Use here the datatype-field and key in a name for your Tabletype and press create.Than choose tabletype. Now key in a short description and under linetype enter the name of the structure for your table.

    (If you dont have a structure in the DDIC you can create it the same way you create the tabletype)

    After that is finished you can create a new parameter for your method with refereing to your new created Tabletype.

    Thats should be all

    1.) Se11 ->field datatype ->enter name of your tabletype

    2.) press create -> choose tabletype

    3.) short description and name of the structure

    4.) save

    5.) create parameter for your method with "type my_new_table_type


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 24, 2005 at 02:07 PM

    Tables are no problem. I assume you mean ABAP Internal Tables. They pass in and out of method calls just like any other variable.

    I generally create a table type in the data dictionary and use that as the type for my importing or exporting parameter.

    Let's do a little exercise. Go to SE80. Hit the other Object button. Choose the dictionary tab. Then choose the Data Type Radio Button. In the input field next to the radio button type string_table. Now hit the display button.

    What you should see is a very simple SAP Delivered Table type. This is just the definition for an internal table made up of lines of strings. You could have a more complex table type where you use a structure definition as the line type. But lets start with this simple table type first.

    Now the easiest way to show you this is to point you to a weblog that I wrote the other day. Ignore what the weblog is actually about. Just focus on a few of the class methods that I showed in this weblog. These methods have importing and exporting parameters that are internal tables (specifically this string_table and one that I created).


    At the beginning of each method I cut and past in the definition of the importing and exporting parameters. However if a screen shot would help, I can add it to the weblog for you.

    It sounds like you are really getting into this ABAP OO stuff. Let me know if this helps or not.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 24, 2005 at 02:22 PM

    Hi Tomas,

    at this point I can only advise to read a good book about this topic. Playing around with databases can be dangerous. It's not really difficult to create the database table, but you have different choices that have an influence on the size of the table and it's behaviour (and of course on the performance). You should know for example what a key column is. Stuff like this can increase (or decrease) the performance in factors of 10. You also have to define a structure and a table type (and you should know why you have to do this).



    Oh, the answer tokk to long. Sorry.

    Message was edited by: Rainer Liebisch

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Tomas,

      my last reply wasn't intended to discourage you. I have misunderstood your question and wanted to say that things like creating a db table are complex topics which can't be covered in detail in a thread (well, not really).

      It's a good idea to write a blog with tips for newbies in ABAP OO. Your experiences are not restricted to BSP.



  • Posted on Feb 25, 2005 at 07:09 AM


    The key to problem is always to learn a few "nice" things defined in the system. So let me see. The first problem you have is that methods are declared of the form:

    method <parm> <direction> TYPE [REF TO] <t>
    parm = the name of the paramter
    t = type of parm

    However, in this type it is not possible to write that you want "type of table". You can only use predefined types (either internal or indictionary).

    Having said this, most people with extensive ABAP experience before the OO-wave, tend to use character types all the time. However, we nearly always use only type string. And exactly for this type there is a type string_table.

    So the code would be:

      method lines changing type string_table
      DATA: t TYPE string_table.
      APPEND 'Hello' TO t.
      APPEND 'World' TO t.
      class=>method( CHANGING lines = t ).
    <u>Method Implementation:</u>
      DATA: line LIKE LINE OF lines.
      LOOP AT lines INTO line.
        MODIFY lines FROM line. " write back
    <u>Better Method Implementation (works directly on row):</u>
      FIELD-SYMBOLS: <line> LIKE LINE OF lines.
      LOOP AT lines ASSIGNING <line>.

    These two types <b>string</b> and <b>string_table</b> goes a long way. The other two types that I often use are <b>ihttpvnp</b> and <b>Tihttpvnp</b> (table): they are good for name/value pairs of strings.

    Now is the time that you should invest 30 minutes reading each time that you run into a problem. You have the framework, just check up on one aspect each time. (I usually use online help, for example to understand MODIFY for writing this text.)

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.