Professional Documents
Culture Documents
This
document has step by step information with
screen shots on how to create BOPF
application.
Save Transaction.
Exercise 1 Create Invoice
Create report ZCI_11_CREATE_INVOICE (transaction se38). It shall create new invoices with ID 123.
Finally, save the transaction and Execute the Report.
REPORT ZCI_11_CREATE_INVOICE.
).
REPORT ZCI_11_RETRIEVE_ITEMS.
1. Add an action on the root node to your business object that sets an Invoice Paid
status. You can name your action INVOICE_PAID.
2. Provide Class Interface name as ZCL_CI_11_A_INVOICE_PAID.
IO_READ->RETRIEVE(
exporting
IV_NODE = ZIF_CI_11_CUSTOMER_INVOICE_C=>SC_NODE-
ROOT " Node Name
IT_KEY = it_key " Key Table
importing
ET_DATA = lt_root " Data Return Structure
).
1. Expand ITEM node and create Determination Specify the Class Name as
ZCL_CI_11_D_ITEM_CALC_AMOUNT.
2. Implement the Method /BOBF/IF_FRW_DETERMINATION~EXECUTE of the class using forward
Navigation and write the Below Code.
data : lt_item type ZCI_11_T_ITEM,
LR_ITEM TYPE REF TO ZCI_11_S_ITEM.
IO_READ->RETRIEVE(
exporting
IV_NODE = zif_ci_11_customer_invoice_c=>SC_NODE-
ITEM " Node Name
IT_KEY = it_key " Key Table
importing
ET_DATA = lt_item " Data Return Structure
).
ENDLOOP.
ENDIF.
ENDLOOP.
8. Test Action validation. Goto test UI and Execute action INVOICE Issued.
.
9. Implement the Method /BOBF/IF_FRW_VALIDATION~EXECUTE using forward navigation and
write the below code.
10.
data : lt_root TYPE zci_11_t_item,
ls_key TYPE /bobf/s_frw_key,
lo_messsage TYPE REF TO ZCM_CI_11_MESSAGE,
ls_location TYPE /bobf/s_frw_location.
ENDIF.
ENDLOOP.
11. Goto Test UI and create and save data for ITEM
Creation of Alternative Keys.
1. Create Alternative Key under ROOT node.
2. Goto EXTRAS->Propose Repository Names.
1. Create Programe ZCI_11_CONVERT_INVOICE_ID copy the below code and Execute the
Report.
REPORT ZCI_11_CONVERT_INVOICE_ID.
REPORT ZCI_11_UPDATE_ALL_INVOICES.
Switch to change mode, double-click on ROOT beneath Node Elements -> ROOT -> Node Categories, and
choose the tab Attribute Properties. Mark the Read-Only flags of the status fields.
Go to Test UI The status fields are can no longer be edited on the user interface.
Dynamic Properties
Ensure that, if an invoice has been issued, the invoice ID is always switched to read-only to avoid any
changes being made to the ID later.
To do this, create a property determination that checks the status (ISSUANCE_STATUS). Specify class
name as ZCL_CI_11_D_ROOT_PROPERTIES.
Implement the Method /BOBF/IF_FRW_DETERMINATION~EXECUTE write the below code.
2. Create a new interface ZIF_CI_11_CONSTANTS_C where you define the two constant
values GC_NORMAL_ITEM = space and GC_SERVICE_ITEM = S for the new field
ITEM_CATEGORY.
If an ID or number of a document is created using a number range and if gaps are not allowed within
the numbers (e.g. for legal purposes), the number should be used only if the transaction is successfully
saved.
Maintain Interval.
3. Create a determination for ROOT named FILL_TMP_GAPLESS_ID specify class name as
ZCL_CI_11_D_ROOT_FILL_TMP_ID.
Save and regenerate the constant interface.
Goto Generate Class ZCL_CI_11_D_ROOT_FILL_TMP_ID and add two static attributes to your classes
GV_TMP_GAPLESS_ID (type INT2, initial value = 1) and GT_ADJUSTED_NUMBER (type
/BOBF/T_FRW_ADJUSTED_NUMBERS).
4. Implement the Method /BOBF/IF_FRW_DETERMINATION~EXECUTE
data : lt_root type zci_11_t_root,
lr_root TYPE REF TO zci_11_s_root,
lv_tmp_gapless_id(2) TYPE c,
ls_adjusted_number TYPE /bobf/s_frw_adjusted_numbers.
_
Create Determination FILL_FINAL_GAPLESS_ID specify the class name as
ZCI_CL_11_D_ROOT_FILL_GAPL_ID.
Save the BO and regenerate the constants interface.
5. Generate the class ZCL_CI_11_D_ROOT_FILL_GAPL_ID and Implement the method
/BOBF/IF_FRW_DETERMINATION~EXECUTE
field-
symbols : <ls_adjusted_number> type /bobf/s_frw_adjusted_numbers.
clear :eo_message, et_failed_key.
sort zcl_ci_11_d_root_fill_tmp_id=>gt_adjusted_number by old_attribute_va
lue.
** Retrieve root node data for given keys
io_read->retrieve(
exporting
iv_node = is_ctx-node_key " Node Name
it_key = it_key " Key Table
importing
et_data = lt_root " Node Category Assignment
).
sort lt_root by gapless_id.
lv_tmp_gapless_id_string = lr_root->gapless_id.
read table zcl_ci_11_d_root_fill_tmp_id=>gt_adjusted_number assigning <
ls_adjusted_number>
with key old_attribute_value = lv_tmp_gapless_id_string binary search .
assert sy-subrc is initial.
" do the node by the input and the buffered key coincide?
" if not , programming error
lv_node_id = <ls_adjusted_number>-node_id.
assert lv_node_id eq lr_root->key.
endloop.
6. goto Test UI and create a entry.