cancel
Showing results for 
Search instead for 
Did you mean: 

Sample code of func module to intialize the (custom) planning function

Former Member
0 Kudos

Hi,

Can some body send me this sample code for the initialization function module to intialize the planning function for referential data access. I have a situation or scenario where ITO_CHASEL contains multiple selection conditions for some characteristics in the planning package. And would like to know how to code to add the keys of objects in ETO_CHAS. Thanks in advance for your help.

Any queries, please revert...

Thanks,

Ram

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Maybe could you use a field symbol that would point on a field containing the right value?

That field can be build by concatening

<b>'/1sem/_yto_chas_' sy-mandt 'area'</b>

into it.

Ask one of your Abaper to help you.

regards

Laurent

Former Member
0 Kudos

Instead of hard coding the planning area

characteristics structure, use the following code sample:

data: lr_plarat TYPE REF TO cl_sem_planarea_attributes,

lr_data TYPE REF TO data,

field-symbols: <ls_chas> TYPE any,

<ls_data> type any.

lr_plarat = cl_sem_planarea_attributes=>get_instance(i_area ).

CREATE DATA lr_data like line of (lr_plarat->typename_th_data).

ASSIGN lr_data->* TO <ls_data>.

assign component 'S_CHAS' of structure <ls_data>

to <ls_chas>.

***

Now use <ls_chas> in place of ls_chas in the rest of your code.

Regards - Ravi

former_member93896
Active Contributor
0 Kudos

Hello Ram,

here's some sample coding. Nothing useful but you see the logic of filling ETO_CHAS.

  • replace 999 with client, area with name of area

DATA: lto_chas TYPE /1sem/_yto_chas_999area,

ls_chas TYPE /1sem/_ys_chas_999area,

ls_chasel TYPE upc_ys_chasel,

ls_charng TYPE upc_ys_charng.

FIELD-SYMBOLS: <f> TYPE ANY.

CLEAR ls_chas.

LOOP AT ito_chasel INTO ls_chasel.

READ TABLE ls_chasel-t_charng INTO ls_charng INDEX 1.

IF sy-subrc = 0.

ASSIGN COMPONENT ls_chasel-chanm OF STRUCTURE ls_chas TO <f>.

IF sy-subrc = 0.

<f> = ls_charng-low.

ENDIF.

ENDIF.

ENDLOOP.

COLLECT ls_chas INTO lto_chas.

eto_chas = lto_chas.

Regards,

Marc

SAP NetWeaver RIG

Former Member
0 Kudos

HI Mark,

Thanks for your reply. I had done this before. But my problem is I have multiple selection conditions for a charateristic in ITO_CHASEL and one of them being a range. I can loop at ls_chasel-t_charng to get to these values. But How do I insert the records into ETO_CHAS for the ranges. Please explain...

Appreciate your help.

Thanks & Regards,

Ram.

former_member93896
Active Contributor
0 Kudos

Ram,

it is a nested internal table. First build the ranges in ls_charng, then insert ls_charng into ls_chasel-t_charng, and finally insert ls_chasel into lto_chas (and do eto_chas = lto_chas at the end).

Regards,

Marc

SAP NetWeaver RIG

PS: If you can't figure it out, get some help from an experienced programmer or check in the ABAP forum.

Former Member
0 Kudos

Hi Marc,

I have a routine and is ok. But How I can transport the function on the production system thus the client change ?

the definition of ls_data_sl type 1sem_ys_data_300zpbudsl.

is not ok for my production system that should be ls_data_sl type 1sem_ys_data_400zpbudsl.

How can I do to solve this problem ?

Thanks in advance.

Mario