cancel
Showing results for 
Search instead for 
Did you mean: 

Maintain a variable in web application with user restrictions

Former Member
0 Kudos

Hello,

My users are planning more than 200 cost centers. Our process is to generate a version by copying actual and plan data for these 200 cost centers (maintained with authorization).

Some users would like to restrict cost centers when they generate a new version :

- CC A, B, C and Z for version 1

- CC B,Z for version 2

...

instead of these 200 CC (gain in performance and data volume).

They really want to generate some cost centers they'd choose in the web interface.

I tried to do this with a variable maintained in the web with several cost center values but i didn't succeed in.

So, is there a way to include several values in one variable and modify it or make it empty ?

Thanks for your help

Accepted Solutions (0)

Answers (2)

Answers (2)

gerd_schoeffl
Advisor
Advisor
0 Kudos

Hello,

The concept of a BPS variable is that in the BPS0 an administrator can maintain a set of values and the end- user can select one value or one interval from these values if necessary. If the variable is "user input allowed" then the user can maintain and choose an additional single value. Unfortunately using the standard web functions a user cannot enter a number of values for a variable.

A work around could look like this: create a variable type exit that returns a list of variable values. In order to fill this list create an own entry screen (using a BSP application) to fill the ABAP table that the exit returns. Make sure that the variable is not set to "user input required".

Best regards,

Gerd Schoeffl,

SAPNetWeaver RIG BI

Former Member
0 Kudos

Hello,

Thanks for your reply.

In order to avoid this development, here what I tried :

I have a cost center variable let's say ZCC (user value type with restriction by user unticked an input allowed from user ticked).

In the web interface, I included this variable twice in a container :

- first component with an input formating

- second component with a dropdown formatting

So, when I put a new value in the first one and enter, it's included in the second one (eg : ZCC is empty at the beginning, I type CC001, CC002 and cc003 and the second component is filled with these 3 values.)

It could fit the user needs but unfortunately, I can't clear the variable at the begginning of the process (or when i want to change the selection).

Is there a way to clear a user value variable in Web ?

Thanks again for your help.

gerd_schoeffl
Advisor
Advisor
0 Kudos

Hello,

That is actually a good idea... You can clear variables in the web only with a planning function type exit. in the planning function use the following coding:

FUNCTION z_bps_reset_var.

*"----


""Local interface:

*" IMPORTING

*" VALUE(I_AREA) TYPE UPC_Y_AREA

*" VALUE(I_PLEVEL) TYPE UPC_Y_PLEVEL

*" VALUE(I_METHOD) TYPE UPC_Y_METHOD

*" VALUE(I_PARAM) TYPE UPC_Y_PARAM

*" VALUE(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

*"----


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

  • BPS Planning Function:

  • This function is used to remove restrictions set for variables.

  • The names of the variables are given in the parameter group.

*

  • Main Function: Z_BPS_RESET_VAR

  • Init Function: -

*

  • Parameters:

  • VAR1 UPC_Y_VARIABLE

  • VAR2 UPC_Y_VARIABLE

  • ... more parameters can be added

*

  • Fields to be changed:

  • All

*

  • Field list:

  • None

*

  • Note: For performance reasons, this function should be run for a

  • planning package that does not contain any data.

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

DATA:

ls_mesg TYPE upc_ys_mesg,

ls_exitp TYPE upf_ys_exitp,

l_variable TYPE upc_y_variable,

lr_variable TYPE REF TO cl_sem_variable.

  • Process all parameters

LOOP AT it_exitp INTO ls_exitp.

l_variable = ls_exitp-chavl.

  • Get variable instance

CALL METHOD cl_sem_variable=>get_instance

EXPORTING

i_area = i_area

i_variable = l_variable

RECEIVING

rr_variable = lr_variable

EXCEPTIONS

not_existing = 1

OTHERS = 2.

IF sy-subrc <> 0.

MOVE-CORRESPONDING syst TO ls_mesg.

APPEND ls_mesg TO et_mesg.

EXIT.

ENDIF.

  • Remove restrictions

CALL METHOD lr_variable->set_user_restriction

EXPORTING

i_user = sy-uname

i_delete = 'X'

EXCEPTIONS

failed = 1

OTHERS = 2.

IF sy-subrc <> 0.

MOVE-CORRESPONDING syst TO ls_mesg.

APPEND ls_mesg TO et_mesg.

EXIT.

ENDIF.

  • Success!

CLEAR ls_mesg.

ls_mesg-msgid = 'UPF'.

ls_mesg-msgty = 'I'.

ls_mesg-msgno = '001'.

ls_mesg-msgv1 = 'Variable has been reset to all values:'.

ls_mesg-msgv2 = l_variable.

APPEND ls_mesg TO et_mesg.

ENDLOOP.

ENDFUNCTION.

Best regards,

Gerd

Former Member
0 Kudos

Gerd,

We have already tried this Function module but it didn't work. My technical teammate made a change with CALL METHOD lr_variable->set_user_restriction and replace it with CALL METHOD lr_variable->set_user_value and it worked but in the web, the variable is empty only if we leave the interface and go back again (the refresh doesn't work : pb in buffer ???).

I will send you the code as soon as I can get it.

Thanks anyway.

gerd_schoeffl
Advisor
Advisor
0 Kudos

Hi Boujema,

I think the coding works as it is but the web interface is not refreshed. When the web interface builds up a BPS page with a variable selector it calls the variable only once to fill the drop down box. If the variable is a variable of type exist and the underlying values are changed during a session (as it is done here) the web interface does not refresh the values in the drop down box. I think this is the problem in your case. There is a work around and it is described in OSS note 720265.

Best regards,

Gerd

Former Member
0 Kudos

Thanks Gerd,

i will try asap and let you know tomorow if it's work.

Best regards

Former Member
0 Kudos

Hello,

We tested the workaround and it doesn't work.

About the code you provided, here the info coming from my Abap teammate :

We want to remove restrictions set for variables. We use two methods : the first one to get variable instance and the second one to remove the restrictions.

We have noticed an unormal functionality of the following second method :

method SET_USER_RESTRICTION.

  • method sets values for one user

check m_type = upcfw_cs_var_type-char.

  • we check if its possible

call method is_user_input_allowed

exporting i_restrict = 'X'

exceptions not_allowed = 1.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4

raising failed.

endif.

if i_delete is initial.

<…>

endif.

  • insert to the buffer

delete mto_sel_act where user = i_user.

insert lines of lto_usel into table mto_sel_act.

  • update table of users, who have set their values

delete mto_user_act where uname = i_user.

data ls_uname type upc_ys_uname.

ls_uname-uname = i_user.

insert ls_uname into table mto_user_act.

endmethod.

If we check with a break-point this method, we remarks that our data are not present in mto_sel_act but only in mto_sel.

The treatment delete so no rows and we have replaced the following method 'CALL METHOD lr_variable->set_user_restriction' in our function module z_bps_reset_var with the following coding :

  • The work table w_charsel is empty when we call the following method

  • Remove restrictions

CALL METHOD lr_variable->set_user_value "restriction

EXPORTING

i_user = sy-uname

ito_charsel = w_charsel

EXCEPTIONS

failed = 1

OTHERS = 2.

Moreover, we noticed that The method read_db is called via the two methods: The following methods are called the following lines :

call method read_db_char_sel.

call method read_db_char_sel( i_active = 'X' ).

If we analyze this , we see that the i_active flag determine which table should be filled (mto_sel or mto_sel_act).

It seems that the two preceding sentence should be inversed for our case. How can we modify the value of this field i_active.

At last, the workaround in note 755459 doesn't work for us (we have BW BPS 3.5 st 10).

Regards

Former Member
0 Kudos

I forgot to precise that I work on a BPS appli.