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

Guidance on Internal Tables in BSP's & ABAP Functions

Morning all,

disclaimer: I searched the forum and the blogs but couldn't see anything on this and I think it is a subject which could help others

I'm back on my proof of concept app and I have a question on the fundamental rules and reasons for when to use WorkAreas, Structures, TableTypes, InternalTables in BSP's.

From my BSP, in the OnInputProcessing Event I am trying to

call an ABAP function to send an email.

I have tested the concept of sending an email with a Report in SE38 and

it works, and now I am trying to put this functionality into my BSP.

The problem is, in the Report in SE38 an Internal Table is created

and used to pass contents to the Function, but in a BSP it seems

we cannot use Internal Tables, what do we do ?

In the report in SE38 I have this line:

reclist like somlreci1 occurs 1 with header line

In the BSP I made an Internal Table in the Parameters area with:

it_reclist TYPE somlreci1

Then in the Event, I have ABAP similar to my report and I try to append data

to the Internal Table and then I try to assign the Internal Table to a table of the

SendEmail function as follows:

it_reclist-receiver = 'user@company.com'. "<-- change address for testing

it_reclist-rec_type = 'U'.

append it_reclist.

  • Send Message

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = docdata

DOCUMENT_TYPE = 'RAW'

PUT_IN_OUTBOX = 'X'

COMMIT_WORK = 'X' "used from rel.6.10

  • IMPORTING

  • SENT_TO_ALL =

  • NEW_OBJECT_ID =

TABLES

  • OBJECT_CONTENT = OBJCONT

receivers = it_reclist

When I check this I get the error message:

"IT_RECLIST" is not an internal table - the "OCCURS n" specification is

missing.

My problem, I have not seen documentation anywhere or a blog giving guidance on

how, when and where to use Internal Tables in BSP's.

Todate when I have come across this problem I have by trial and error gone through trying

creating TableTypes, Structures, WorkAreas and passing the data between them all to finally try to get the data into a Function call.

But I have always just used trial and error without any rules or understanding of when to use what/which and why ?

Can anyone advise, using the above case as an example, how to take some code which has been proven in an Abap Report and migrate that code to a BSP, and how to deal with the Internal Tables and what the rules are for dealing with the Internal Tables and when to use WorkAreas, Structures, TableTypes, InternalTables and why ?

If this question is unclear I will add more to try to make it more clear.

Thanks for your time all,

Milan.

p.s. I didn't finish getting my BSP Extension to work, but I'll move back to that once this proof of concept app is finished.

Message was edited by: Milan Benes

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Dec 03, 2004 at 11:31 AM

    The problem isn't that you can't use internal tables in BSP. I use them all the time. The error is that you can't use Internal tables with header lines. I will talk about that more in just a second.

    SOMLRECI1 is actully just a structure. When you define <i>reclist like somlreci1 occurs 1 with header line</i> in your program in SE38 this creates an internal table because of the occurs addition. However <i>it_reclist TYPE somlreci1</i> in your BSP would only create a variable with the structure of SOMLRECI1 - not an internal table. I assume you are defining this in your page attributes so you can't just specify the <i>occurs</i> clause or the <i>type table of</i>. You can always create a <i>table type</i> in the data dictionary however.

    Now I think the problem you are seeing as inconsistency has to do with the difference between classic ABAP and ABAP Objects. When SAP introduced ABAP Objects they decided to clean up some of the legacy syntax and create stricter rules. However they didn't want to break the millions of line of code that already existed, so they only implemented these stricter checks when OO is being used. Therefore you can declare a table with a header line in a regular ABAP program or Function Module but you can't have one with a header line in OO.

    Because everything in BSP generates ABAP OO classes behind the scenes, you get these same stricter syntax checks. My suggestion is that you have a look in the on-line help at the section on ABAP Objects and always follow the newer syntax rules even when writting classic ABAP programs. Also keep in mind that you can still pass an internal table with a header line to a parameter that doesn't want one a header line table by including [] on the end of the table.

    Parameter1 = itab[].

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2004 at 11:32 AM

    Hello, of course you can use internal tables in BSP I do it all the time 😊

    But as to your problem, have you read these weblogs?

    /people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher

    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface

    /people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Thomas Jung

      Hi Thomas,

      thanks very much for the extra information.

      The amazing thing is, this concept is fundamental to creating BSP's which involve some ABAP style data manipulation.

      In the past I've written a few ABAP reports but never had to understand this simple concept because of being able to create Internal Tables with Header Lines on the fly.

      But with OO and BSP's anyone who wants to manipulate ABAP data and who requires an Internal Table will need to understand clearly this concept otherwise they will be left fishing as I was until now.

      Thanks very much,

      Milan.

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.