AXT Rapid Applications Currency/Quantity fields
Component | Support Package |
---|---|
SAP_BASIS | SAPKB73105 |
SAP_ABA | SAPKA73105 |
WEBCUIF | SAPK-73105INWEBCUIF |
BBPCRM | SAPKU70204 |
Introduction:
I created 2 custom tables (header/item model) and I wanted to maintain those tables in the Web UI. So I decided to use Rapid Applications in order to generate the Web UI components. For more information about Rapid Applications:
http://help.sap.com/saphelp_crm700_ehp02/helpdata/en/23/fb4e7b70e54ca092fca55f261a74d9/frameset.htm
http://scn.sap.com/docs/DOC-5404
http://scn.sap.com/docs/DOC-5405
The main problem that I had is regarding to the header table, which has the ref field for the currency and the items had the currency amount, this scenario is not supported by rapid applications:
- The reference fields for currency and quantity must be in the same table.
The generation of the Rapid Application will skip those fields and generate the component, I’m saying this because it’s easy to: next-next-next-next and wow! what’s happening?! why the currency amount fields are not in the view!? 😈
Unfortunally for me was too late to re-do the model so I needed to come with a workaround.
Caution!!!
All the steps which I describe will be removed in case that you re-generate the RA via the Rapid Application Development Tool
STEPS:
BOL/GENIL/API
The RA framework generates those structures for each table:
ZTABLENAME_ATTR
ZTABLENAME_DYN_QUER
ZTABLENAME_H_LOG_KEY
ZTABLENAME_H_WORK
For this scenario the important structures are the ones finished with ATTR and WORK, which you need to add the currency amount field (For technicall reasons don’t forget to specify the ref table for amounts/quantity in both structures although this is not relevant for the RA).
Once added the fields the GENIL/BOL layer is almoust done, you also need to modify the API generated to update the DB, for each RA application will generate a function group ZAFUGR* with a function for each table usually ZAFUNC*. This Function modules are generated from the template AXT_TABLE_UPDATE_CT_TMPL, you can check it at SE37.
If you observe the source you will see there’s no need to worry about the insert but the update is generated for each field during the RA generation, so the new one won’t be there, this requires to add it manually. No problem so far, is a Z function module 😈
Web UI
If you let the RA framework propose the component structure you probably will have the following views:
ZCOMPONENT/Embed_TABLENAME_HEADER_SRC_Form
ZCOMPONENT/Embed_TABLENAME_HEADER_SRC_Table
ZCOMPONENT/Embed_TABLENAME_HEADER_SRC_VS
ZCOMPONENT/TABLENAME_HEADER_DETAILS
ZCOMPONENTTABLENAME_HEADER_OVP
ZCOMPONENT/TABLENAME_HEADER_SRC_SRC_QUERY
ZCOMPONENT/TABLENAME_HEADER_SRC_SRC_RESULT
ZCOMPONENT/TABLENAME_HEADER_SRC_SRC_VS
ZCOMPONENT/TABLENAME_ITEMS_DETAILS
ZCOMPONENT/TABLENAME_ITEMS_MAIN
ZCOMPONENT/TABLENAME_ITEMS_OVP
We will enhance the ITEMS_DETAILS and the ITEMS_MAIN views:
View: * ITEMS_DETAILS
We need to add the currency amount atribute as a model attribute in the item context node, the attribute will be avaliable as we already added it at the structure *ATTR in the bol/genil/append step.
The only really important thing left is do de input/output conversion in the SETTER/GETTER method, To acomplish this is quite easy:
For a friendly interface you can also add the currency reference field in the context node as an value attribute.
coding in the getter to retrieve the root attribute (as we did in the GET_COND_PRT method) and disabling permanently the field in the GET_I_REF_CURRENCY method, we need to add the new attribute in the configuration but for me there’s no point on disabling it there.
View: * ITEMS_MAIN
In this case the items are represented as a tableview and this gave me some troubles in the moment to add currency reference as value attribute.
Creating it via right click on the contex node(as we do usually) give some syntax error so instead of that we need ro redefine the INIT mehtod and put the following code
And create the getters/setter method manually in the context class, yes you hear it well, manually, remeber getter/setter methods must be public, otherviwse te atrribute won’t appear in the context node 😉
The steps for coding the getter/setter are the same which wie did in the view *ITEMS_DETAILS
And that’s it, the only need left is add the fields in the configuration.
Conclusions:
Well as you see we did an extra steps in order to avoid having the currency/quantity reference field at item level, another aproach can be having those fields in both header/item and trasspasing the value via the BADI AXT_RT_TABLES_API – ON_CHANGE
The transaction AXTSHOW entering in the table parameter the name of the table used to generate the Rapid application will give you all the detail in a very nice format.
There’s documentation in the BADI definition or in the class CL_AXT_CUSTOMER_TABLES_UTIL
you can also take a look to the following blog:
Hope it helps!
Luis