Various options are available for the product configurator to make it easier to implement customer-specific adjustments. For example:
Window prd_links2.psr
e.g. for further use of data from this detail area after the configuration. Reading out the data is only possible at runtime of the configurator. Therefore, the windowevent "post_result" is available.
This is, of course, only possible if the detail area is processed during the configuration. Therefore, a Beas script for the configurator window is necessary (file prd_links2.src") and a customer specific table is created in the database for storing these data.
Example for a customer specific table:
Table:
BEAS_CUSTOMER_PC_RESULT
Columns:
VARIANTE int
LINE int
PARAMETER varchar(50)
DESCRIPTION varchar(200)
PRICE numeric(19,6)
CURRENCY varchar(10)
//***************************************************
//* Example for fetching "result/price" data
//* from detail area line by line into database
//*
//* (c) Beas GmbH
//***************************************************
windowevent post_result
destroy=dtw
declare=dtw=ue_datastorevalues
dtw=addfield=line=i=10
dtw=addfield=paramater=c=50
dtw=addfield=content=c=200
dtw=addfield=price=n=20
dtw=addfield=currency=c=10
dtw=createbyfield
// Read all line of detail area
for=loop=1=<dw_2.rowcount>
dtw=insertrow
dtw.line.value=<loop>
dtw.paramater.value=<dw_2.item.parameter:[loop].value>
dtw.content.value=<dw_2.item.inhalt:[loop].value>
setvar=v_price=<dw_2.item.preis:[loop].value,#0.00>
dtw.price.value=<v_price,#0.00>
dtw.currency.value=<dw_2.item.currency:[loop].value>
next
end event
windowevent postsave
// Called after configuration was stored in database.
// you must have have a corresponding result table in database
// (e.g. BEAS_CUSTOMER_PC_RESULT).
// Read all lines of datastore and transfer to table
// delete already existing data for actual variant number
sql=delete from "BEAS_CUSTOMER_PC_RESULT" where "VARIANTE" = <str_parm.c_parm1,num(0)>
// write all lines from datastore into database
for=loop=1=<dtw.rowcount>
dtw.setrow=<loop>
sql=insert into "BEAS_CUSTOMER_PC_RESULT"("VARIANTE","LINE","PARAMETER","DESCRIPTION","PRICE","CURRENCY") &
values(<str_parm.c_parm1,num(0)>,<loop,num(0)>,<dtw.paramater.value,dbstring>,<dtw.content.value>, &
<dtw.price.value,num(6)>,<dtw.currency.value,dbstring>
next
// destroy datastore with
destroy=dtw
end event
|
|
Window prd_links2.psr
Check entries:
If you want to check the entries after storing a configuration (only if all parameter values are stored in the database), this is only possible via a customer-specific script programming. This check is usually done when the Configuration is finished.
//***************************************************
//* Short Example for checking parameter entries
//* after storing into database for defined variant
//*
//* (c) Boyum IT Solutions GmbH
//***************************************************
windowevent open
global function test_parameter
// test whether parameter 'form' was inserted
select Coalesce("INHALT",'') &
from "BEAS_CAFT_VARIANTE" &
where "VARIANTE" = <str_parm.c_parm1,num(0)> &
and "Parameter" = 'FORM'
if <wert1> = then
message=Value for Parameter 'Form' was not inserted.
return failure
end if
// re-set flag (all checks ok)
setglobal=v_ok_button=0
end global
end event
windowevent click button_ok
// Button OK/Update pressed
if <global.v_ok_button> n= 1 then
// configuration stored,
// Call function for testing parameter
test_parameter()
end if
if <return> n= -1 then
return failure
end if
end event
windowevent postsave
// set flag to identify, if configuration was stored
setglobal=v_ok_button=1
end event
windowevent click button_close
// Button 'Cancel' was pressed
// re-set flag
setglobal=v_ok_button=0
end event
windowevent click button_varianteladen
// Button 'load variant' was pressed
// re-set flag
setglobal=v_ok_button=0
end event
windowevent click button_variantekopieren
// Button 'Copy variant' was pressed
// re-set flag
setglobal=v_ok_button=0
end event
|
|
(Only one group is open at a time)
Window prd_links2.psr
By default, the selected and current group is opened, and all other groups remain closed. This is just for clarity when using multiple groups that have many input or selection possibilities.
If you wish to keep all groups open constantly in the navigation area, this can be adjusted by setting a system variable directly in the database. Then, with every change in the details area on the right side, all variables must be re-determined in the groups on the left. This may lead to performance problems in case of complex configurations.
Open the Debug window, switch to Script tab, enter and execute the following script:
> all groups are open: setsetup=pconfig_block_close=N
> only the current group is open (default): setsetup=pconfig_block_close=Y
|
Table: BEAS_SYS_SETUP
Variable: pconfig_block_close
Content: N - all groups open
Y - only current group is open (default)
If this variable was not yet set or changed, the entry is missing. It needs then to be entered initially.
insert into "BEAS_SYS_SETUP"("BENUTZER","VARIABLE_ID","INHALT") values('','pconfig_block_close','N')
If the variable is already in use, you only need to change it:
update "BEAS_SYS_SETUP" set "INHALT" = 'Y' where "VARIABLE_ID" = 'pconfig_block_close'
|
|
Window prd_links2.psr
For changes in the details area (right side of the configurator window) the tabulator can be used to jump to the next field. The cursor is placed at the beginning of the field. In an already filled box, the cursor is positioned before the entry.
If you do not need this functionality, it can be changed via BeasScript to "Auto-Select". Then, if the cursor jumps to the next input field, and if there is already a text, it will be selected/marked.
For this purpose, a script file "prd_links2.src" is required for the product configurator window.
windowevent postopen
if <dw_2.dataobject> = program\prd_rechts.psr then
dw_2.modify=inhalt.edit.autoselect=yes
end if
end event
|
|
Before saving a new configuration, based on a parameter string (a string that consists of all the parameters and set-objects and of their assigned content) the program checks whether this configuration already exists. If yes, the existing configuration is loaded. Otherwise, the configuration is created and saved under a new variant number.
As an additional option, you can also incorporate the short name into the check. Thus, it would be possible to store two configurations with equal but different short names (with different version numbers). For this purpose, an entry must be made in the Beas system table.
Open the Debug window, switch to Script tab, enter and execute the following script:
> normal function (Standard): setsetup=pconfig_check_desc=N
> Check for existing configurations via parameter string and short description: setsetup=pconfig_check_desc=Y
|
Should values from the current line or also from the "header" of the Sales Order or Quotation of the SAP form needed for the Beas configurator, this can be done with a simple scripting.
For this, the configurator window requires a stored Beas script in the file "prd_links2.src".
Example:
windowevent preopen
if <parent:sys_formtypeex> n= 139 or <parent:sys_formtypeex> n= 149 then
// only if Sales Order or Quotation
// get Cardcode from SAP form
setvar=e_cardcode=<parent:item 4>
// get Product-ID
setvar=e_product=<parent:item 38=col=U_produkt>
end if
end event
With this definition, the variables [e_cardcode] and [e_product] are known after calling the product configurator and can be used in the coding.
|
Window prd_links2.psr
It is not reasonable to fill the field "Description" with very long information if the configuration is complex (object type "Definitions", tab "Brief Description" and "Description"). The field "Brief Description" is, as the field says, a short name for the currently configured item (max. 255 characters).
|
With a database query you get all result information of the respective configuration/variant:
select bop."PARAMETER"+'' as parameter, bop."BEZEICHNUNG"+'' as description_coding,
bcv."BEZEICHNUNG"+'' as description, substring(bcv."INHALT",1,1024)+'' as "content"
from "BEAS_OITM_PRODUKTKONFIGURATOR" bop,"BEAS_CAFT_VARIANTE" bcv
where substring(bop."PARAMETER",1,50) = bcv."PARAMETER"
and bop."ItemCode" = 'SE0001'
and bop."TYP" = 0
and bcv."VARIANTE" = 43
|
First, it should be clarified when the data for the respective configuration is needed at all:
- after leaving the product configurator
// *****************************************************************
// customer specific development
//
// Example: get data of a configurated item after closing
//
// (c) Boyum IT Solutions GmbH
// *****************************************************************
windowevent close
destroy=dtw
declare=dtw=ue_datastorevalues
dtw=select bop."Parameter"||'' as "Parameter", &
bop."BEZEICHNUNG"||'' as Description_coding, &
bcv."BEZEICHNUNG"||'' as "Description", &
substring(bcv."INHALT",1,1024)||'' as "Content" &
from "BEAS_OITM_PRODUKTKONFIGURATOR" bop,"BEAS_CAFT_VARIANTE" bcv &
where substring(bop."Parameter",1,50) = bcv."Parameter" &
and bop."ItemCode" = <str_parm.s_parm1,dbstring> &
and bop."TYP" = 0 &
and bcv."VARIANTE" = <str_parm.c_parm1,num(0)>
// put now your coding to process the data appropriately (with example)
for loop=1 to <dtw.rowcount>
setvar=v_param=<dtw.parameter.value>
setvar=v_desc_code=<dtw.description_coding.value>
setvar=v_desc=<dtw.description.value>
setvar=v_content=<dtw.content.value>
// your coding
next
// clear datastore
destroy=dtw
return success
end event
|
- For a report that is called up from a quotation line or a sales order, for example
(This could be done in a similar way as for leaving the product configurator).
Help URL: https://help.beascloud.com/beas202402/index.html?customer_specific_adjustments.htm
|