cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Syntax for User Exits

charles_soper
Participant
0 Kudos

Hi,

A programmer student of mine needs to know what syntax to use in planning function user exits when using planning area structures instead of assigns?

Thanks

Tim

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You may use the following structure that gets created when you create a planning area:

/1SEM/_YS_DATA_<CCC><PlanArea>

where

<CCC> is your 3 char client id

<PlanArea> is your plannig area

Note that if you develop exit functions based on this structure, you must use the same client id in all your systems (Dev/QA/Prd etc.).

Regards - Ravi

charles_soper
Participant
0 Kudos

Hi Ravi,

That's good advice. Do you happen to have any comments on differences in syntax for a programmer who has been using 'assigns' and now needs to use the structures?

Former Member
0 Kudos

Since you are hard-coding the client id in ytour ABAP, you may have portablity issue. Other than that, I am not aware of any issue. This method may even be more efficient as you do not have to use any "assigns" for xth_data.

Regards - Ravi

gerd_schoeffl
Advisor
Advisor
0 Kudos

Hi Charles,

There is one additional reason why using the assigns might be better - it is independent of the planning area. You can use the same exit in different planning areas.

Imagine you want to use the same exit function in a single area as well as a multi area that contains this (single) planning area. If you use the assign technology you will have no problems, when using fixed structures you will experience problems in one of the areas.

Best regards,

Gerd

SAP NetWeaver RIG BI EMEA

Former Member
0 Kudos

Hi,

Frankly speaking I am against the idea of harcoding in any way. Here's an option

*general data decleration
DATA: my_structure TYPE REF TO data,
      my_table TYPE REF TO data.

*field symbols for getting the reference
FIELD-SYMBOLS: <fsl_structure> TYPE ANY,
               <fsl_table>     TYPE ANY.

*class definitaion for planning area attributes
DATA: g_area TYPE REF TO cl_sem_planarea_attributes.

*get the instance of planning area class for the 
*required area
CALL METHOD cl_sem_planarea_attributes=>get_instance
  EXPORTING
    i_area      = 'Planning Area'
  RECEIVING
    er_instance = g_area
  EXCEPTIONS
    failed      = 1
    OTHERS      = 2.

IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

*the TYPENAME_TH_DATA is an attribute of the class 
*filled in with the structure name (type name) used for 
*data transfer by the area

*create a structure
CREATE DATA my_structure TYPE LINE OF 
    (g_area->typename_th_data).
ASSIGN my_structure->* TO <fsl_structure>.

*create a table. 
CREATE DATA my_table TYPE TABLE OF 
       (g_area->typename_th_data).
ASSIGN my_table->* TO <fsl_table>.

With the above code we have generated a dynamic table and structure which can be used for data manipulation.

thanks

Note: - Assigning points is the way of saying thank you.