Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

IDOC segment handling with OOP

Former Member
0 Likes
973

Let's say we have the following simplified ORDERS05 IDOC

ORDERS05 Purchasing/Sales

Header

E1EDK01 IDoc: Document header general data

E1EDK14 IDoc: Document Header Organizational Data

Rows ( Items )

E1EDP01 IDoc: Document Item General Data

And would like to create it using certain data.

Would the approach of creating a class per each segment type with methods "Append", "Modify", "Delete" be feasible?

For example, if we want to construct ORDERS05 IDOC, we call:

ycl_e1edk01->append( ls_e1edk01 ).
ycl_e1edk14->append( ls_e1edk14 ).
ycl_e1edp01->append( ls_e1edp01 ).

If we would like to modify the data in E1EDK01 segment, of the IDOC, we would call:

ycl_e1edk01->modify( ls_e1edk01 ).

The reason for it would be to track all the changes to the data

in the ORDERS IDOC in different user-exits by "Where-Used".

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
891

Would the approach of creating a class per each segment type with methods "Append", "Modify", "Delete" be feasible?

Yes

The reason for it would be to track all the changes to the data

in the ORDERS IDOC in different user-exits by "Where-Used".

What do you mean by this?


Would the approach of creating a class per each segment type with methods "Append", "Modify", "Delete" be feasible?

Yes

The reason for it would be to track all the changes to the data

in the ORDERS IDOC in different user-exits by "Where-Used".

What do you mean by this?

4 REPLIES 4
Read only

Former Member
0 Likes
892

Would the approach of creating a class per each segment type with methods "Append", "Modify", "Delete" be feasible?

Yes

The reason for it would be to track all the changes to the data

in the ORDERS IDOC in different user-exits by "Where-Used".

What do you mean by this?

Read only

former_member207438
Participant
0 Likes
891

Are you planning to use "Where-Used" for your IDoc segment classes / methods to track where in the user-exits they are used?

This may work if you are the only ABAP-er in your SAP shop. If you have more than one developer then how do you enforce that your class is being used in the user-exits?

Read only

0 Likes
891

Be sure that, if the solution for this whole thing will be nice and usable, I will surely enforce it

Read only

naimesh_patel
Active Contributor
0 Likes
891

Creating individual classes would not be a good design. You should create a single class with different mehtods to achieve the functionality

Couple of months ago I was also thinking to use OO ABAP for the IDoc Processing (but I am not able to put this design into action).

Design would be:


PROCESS_SEGMENTS  Public 
  Changing IA_EDIDD type EDIDD   (Current work area)
  Changing IT_EDIDD type EDIDD   (Actual Idoc internal table)
  Importing IF_TYPE type CHAR1  (Type of processing A - Append, M - Modify, D - Delete)

Individual private methods for processing individual Segments:

E.g. PROCESS_E1EDK01, PROCESS_E1EDK14 etc.

Call this private methods from the public method PROCESS_SEGMENTS. You can try to do it dyanmically to avoid future changes (following [Open-Closed Principle|/people/naimesh.patel/blog/2009/05/20/object-oriented-design-principles-oodp-open-closed-principleocp]) like this:


  concatenate 'PROCESS_' ia_edidd-segnam into lf_method.
  call method me->(lf_method).

Regards,

Naimesh Patel