cancel
Showing results for 
Search instead for 
Did you mean: 

Change Data in BPS Layout: Exit Function

Former Member
0 Kudos

Hello everyone,

We are using BW-BPS and we need to make a sort of a certain characteristic in a Planning Folder. In the specific Planning Folder it was defined an exit function and it was assigned a function module.

We implement the following code:

*************************************************

FUNCTION Z_ORDENAR_CLASSIFICACAO_PLANO.

*"----


""Interface local:

*" IMPORTING

*" REFERENCE(I_AREA) TYPE UPC_Y_AREA

*" REFERENCE(I_PLEVEL) TYPE UPC_Y_PLEVEL

*" REFERENCE(I_METHOD) TYPE UPC_Y_METHOD

*" REFERENCE(I_PARAM) TYPE UPC_Y_PARAM

*" REFERENCE(I_PACKAGE) TYPE UPC_Y_PACKAGE

*" REFERENCE(IT_EXITP) TYPE UPF_YT_EXITP

*" REFERENCE(ITO_CHASEL) TYPE UPC_YTO_CHASEL

*" REFERENCE(ITO_CHA) TYPE UPC_YTO_CHA

*" REFERENCE(ITO_KYF) TYPE UPC_YTO_KYF

*" EXPORTING

*" REFERENCE(ET_MESG) TYPE UPC_YT_MESG

*" CHANGING

*" REFERENCE(XTH_DATA) TYPE HASHED TABLE

*"----


DATA:

lr_area TYPE REF TO cl_sem_planarea_attributes,

wa_hash_table type ref to data,

l_sortfield type STRING,

lr_t_data TYPE REF TO data.

FIELD-SYMBOLS:

<lt_data> TYPE STANDARD TABLE,

<ht_head> TYPE ANY TABLE,

<xth_data> TYPE HASHED TABLE,

<ls_data> TYPE ANY,

<wa_data> TYPE ANY,

<fundo> TYPE ANY,

<eco> TYPE ANY.

CALL METHOD cl_sem_planarea_attributes=>get_instance

EXPORTING

i_area = i_area

RECEIVING

er_instance = lr_area.

CREATE DATA wa_hash_table LIKE LINE OF xth_data.

ASSIGN wa_hash_table->* TO <ht_head>.

<ht_head> = xth_data.

LOOP AT <ht_head> ASSIGNING <ls_data>.

  • This is the characteristic that we pretend to sort

l_sortfield = 'S_CHAS-0CMMT_ITEM'.

SORT <ht_head>

BY (l_sortfield) DESCENDING.

ENDLOOP.

<xth_data> = <ht_head>.

UNASSIGN: <ls_data>, <ht_head>.

ENDFUNCTION.

*************************************************

When execute this function, we get a DUMP (ASSIGN_TYPE_CONFLICT). Does anybody have any suggestion how to change a hash table or somehow make a sort in this hash table?

Thanks in advance.

Ilda

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

After some changes in the code, it seems that xth_data table is assuming the “new content”. In debugging, we could see that the assignment was made and xth_data records are now in a different order. But when executing the BPS Layout assigned to this planning function, all the lines (records) still in the same place. The Layout doesn’t change.

This is the code:

FUNCTION Z_ORDENAR_CLASSIFICACAO_PLANO.

*"----


""Interface local:

*" IMPORTING

*" REFERENCE(I_AREA) TYPE UPC_Y_AREA

*" REFERENCE(I_PLEVEL) TYPE UPC_Y_PLEVEL

*" REFERENCE(I_METHOD) TYPE UPC_Y_METHOD

*" REFERENCE(I_PARAM) TYPE UPC_Y_PARAM

*" REFERENCE(I_PACKAGE) TYPE UPC_Y_PACKAGE

*" REFERENCE(IT_EXITP) TYPE UPF_YT_EXITP

*" REFERENCE(ITO_CHASEL) TYPE UPC_YTO_CHASEL

*" REFERENCE(ITO_CHA) TYPE UPC_YTO_CHA

*" REFERENCE(ITO_KYF) TYPE UPC_YTO_KYF

*" EXPORTING

*" REFERENCE(ET_MESG) TYPE UPC_YT_MESG

*" CHANGING

*" REFERENCE(XTH_DATA) TYPE HASHED TABLE

*"----


DATA:

lr_area TYPE REF TO cl_sem_planarea_attributes,

l_sortfield type STRING,

data_ref TYPE REF TO data,

lr_t_data TYPE REF TO data.

FIELD-SYMBOLS:

<lt_data> TYPE ANY TABLE,

<ls_data> TYPE ANY,

<ls_data_copy> TYPE ANY.

CALL METHOD cl_sem_planarea_attributes=>get_instance

EXPORTING

i_area = i_area

RECEIVING

er_instance = lr_area.

CREATE DATA lr_t_data TYPE (lr_area->typename_t_data).

ASSIGN lr_t_data->* TO <lt_data>.

<lt_data> = xth_data.

CLEAR xth_data.

l_sortfield = 'S_CHAS-0CMMT_ITEM'.

SORT <lt_data> BY (l_sortfield) DESCENDING.

MOVE <lt_data> TO xth_data.

ENDFUNCTION.

Does anybody understand this behavior, why the changes in the user-exit are not assumed in the BPS Layout?

Thanks,

Ilda

Former Member
0 Kudos

> Does anybody understand this behavior, why the

> changes in the user-exit are not assumed in the BPS

> Layout?

May be you have to run API_SEMBPS_GETDATA FM in the end of your function?

Former Member
0 Kudos

I Jacob,

Thanks for your input.

I tried the code you suggest and when executing the Planning Function, it seems that the assignment isn’t made. The order of 0CMMT_ITEM characteristic didn’t change in the Layout.

I can understand where in the code sample that you suggest, I assign <lt_data> table to hash table xth_data. I need to make this assignment, in order to sort all xth_data records in a temporary table lt_data, and then associate this “new content” again to xth_data.

Thanks in advance,

Ilda

Former Member
0 Kudos

Hi,

Before you add the 'new content' again to xth_data, clear the xth_data.

This should solve your issue.

HTH,

regards,

Nataraj.

former_member192142
Contributor
0 Kudos

Hi,

Try the code below (I haven't validated it):

*************************************************

FUNCTION Z_ORDENAR_CLASSIFICACAO_PLANO.

*"----


""Interface local:

*" IMPORTING

*" REFERENCE(I_AREA) TYPE UPC_Y_AREA

*" REFERENCE(I_PLEVEL) TYPE UPC_Y_PLEVEL

*" REFERENCE(I_METHOD) TYPE UPC_Y_METHOD

*" REFERENCE(I_PARAM) TYPE UPC_Y_PARAM

*" REFERENCE(I_PACKAGE) TYPE UPC_Y_PACKAGE

*" REFERENCE(IT_EXITP) TYPE UPF_YT_EXITP

*" REFERENCE(ITO_CHASEL) TYPE UPC_YTO_CHASEL

*" REFERENCE(ITO_CHA) TYPE UPC_YTO_CHA

*" REFERENCE(ITO_KYF) TYPE UPC_YTO_KYF

*" EXPORTING

*" REFERENCE(ET_MESG) TYPE UPC_YT_MESG

*" CHANGING

*" REFERENCE(XTH_DATA) TYPE HASHED TABLE

*"----


DATA:

lr_area TYPE REF TO cl_sem_planarea_attributes,

l_sortfield type STRING,

lr_t_data TYPE REF TO data.

FIELD-SYMBOLS:

<lt_data> TYPE STANDARD TABLE.

CALL METHOD cl_sem_planarea_attributes=>get_instance

EXPORTING

i_area = i_area

RECEIVING

er_instance = lr_area.

CREATE DATA lr_t_data TYPE (lr_area->typename_t_data).

ASSIGN lr_t_data->* TO <lt_data>.

l_sortfield = 'S_CHAS-0CMMT_ITEM'.

SORT <lt_data> BY (l_sortfield) DESCENDING.

<xth_data> = <lt_data>.

ENDFUNCTION.

*************************************************

Regards,

-Jacob