Skip to Content

creation of superclass for reusability, how to define DDIC types in methods?

Hi everyone,

For our inbound interfaces, I'm planning on creating a superclass for each BAPI we'll be using. Within it, I'll have a method for each table/structure that the BAPI can accept.

For example, we are using 'BAPI_ACC_DOCUMENT_POST'. I have created a superclass with the following mapping methods:

  • HEADER_MAPPING
  • ACCT_GL_MAPPING
  • VENDOR_MAPPING
  • CURRENCY_MAPPING
  • TAX_MAPPING
  • EXTENSION_MAPPING

To make the superclass reusable, I plan on passing in data using TYPE REF TO DATA in the constructor method. However, in my mapping methods, how can cast that into something useful (at the superclass level)?

Or, do I just have to wait until I inherit it out to a subclass, then declare a specific DDIC to cast into?

Hope that makes sense.

Robert.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 18, 2016 at 01:50 PM

    Sounds like you want something like the Strategy Pattern.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 17, 2016 at 08:06 PM

    It's called overengineering. I can't imagine that you gain some time with publishing an API of an API.

    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.