Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
AndrewBarnard
Contributor
2,247

Purpose


The purpose of this little series of blog posts is to provide an orientation to working with equipment addresses in customer developed programs. In prior blog posts, we looked at how addresses are managed. Now in this blog post, we look at how to create an address suitable for a piece of equipment.

This is the fifth blog post in the series, which has the following structure.

  1. Equipment Address Management - introduction

  2. Equipment Address Management - a closer look

  3. Equipment Address Management - reading and searching for addresses

  4. Equipment Address Management - creating Equipment with an address

  5. Equipment Address Management - creating an address for equipment


Similar to the prior blog posts, we will continue with a generous sprinkling of code snippets.

What are we seeking to achieve?


In blog post 4, we went through the details of creating the equipment and assigning the address. We
didn't however spend any time looking at how to create the address. In this blog post, we will look more closely at the steps to create an address for the equipment; particularly how to use the functions below.
 CALL FUNCTION 'ADDR_INSERT'
CALL FUNCTION 'ADDR_NUMBER_GET'
CALL FUNCTION 'ADDR_MEMORY_SAVE'

Function ADDR_INSERT


The purpose of ADDR_INSERT is to insert an address without dialog. If successful, the address is created, but not persistently saved. The interface of the function has three obligatory parameters:

  1. ADDRESS_DATA

  2. ADDRESS_GROUP

  3. ADDRESS_HANDLE


We will look at each in turn.

ADDRESS_DATA


This structured parameter contains the address details, such as city, suburb etc.

ADDRESS_GROUP


This structured parameter defines the address group to which the address belongs. Every address is assigned to at least one address group. The address group is defined by the application that uses the address. In the case of equipment, the expected address group is PM01, representing addresses of maintenance objects. As an aside, for customer developed applications, a customer can define their own address group.

ADDRESS_HANDLE


This structured parameters defines a temporary handle by which the address can be referenced.
The exchange of the temporary handle for an address number occurs when ADDR_NUMBER_GET is called. See blow.

Function ADDR_NUMBER_GET


The purpose of ADDR_NUMBER_GET is to exchange the temporary handle with an address number. The interface of the function has two obligatory importing parameters:

  1. ADDRESS_HANDLE

  2. ADDRESS_REFERENCE


and returns an address number. Let's look at the importing parameters.

ADDRESS_HANDLE


The temporary handle we supplied when the address was inserted - a means to reference our temporary address.

ADDRESS_REFERENCE


A reference used to identify who uses the address and who owns (has responsibility) for changing or deleting the address.

The address reference contains structured content, which point back to the application object using the address. It contains the application TABLE, the name of the key FIELD in the table, a KEY, an address group and an indicator of ownership.

Here is what I use for the ADDRESS_REFERENCE and HANDLE for a piece of equipment.
   "a simple structured type for the appl_key in the address reference
ADREF_KEY-MANDT = SY-MANDT.
ADREF_KEY-EQUNR = equipment number in internal format

" the address reference for ADDR_NUMBER_GET
ADREF-APPL_TABLE = 'EQUI'.
ADREF-APPL_FIELD = 'EQUNR'.
ADREF-APPL_KEY = ADREF_KEY.
ADREF-ADDR_GROUP = 'PM01'.
ADREF-OWNER = abap_true.

" temporary handle - just use the address reference
HANDLE = ADREF.

And that's is about all there is to it.

Summary


Phew! Again lots of little snippets of code - and not much story, but I hope nevertheless that for someone it will be exactly what they are looking for.

Of course, this little series has not been comprehensive. If you are working with addresses, the documentation of the function group SZA0 is very helpful.

And that basically wraps it up. If you have come on the complete journey or only for parts of it, I thank you for reading.
Labels in this area