cancel
Showing results for 
Search instead for 
Did you mean: 

In MDG-F how extend decision table columns with BAdi in USMD_SSW_RULE_CONTEXT_PREPARE

Former Member
0 Kudos

I have coded the changes to BADI as suggested by SAP how_to documentation..
I need some information, however.

The example data points to the MM data model and I am
wondering how to make sure I point to the FI data model, which is 0G instead of
MM and that the structure I used to return the account type and account data
was the correct one.

Is this something you can point me in the right direction
on?  

I created enhancement implementation
ZMDG_BS_FI_BRF_CONTEXT_ACC of enhancement spot
USMD_SSW_SERVICE_PROCESSOR.  All of the new code is in the class
ZMDG_BS_FI_BRF_CONTEXT_ACC.

     

As the structure for holding the change request data for FI I used:

DATA: ls_account     TYPE /MDG/_SF_0G_PP_ACCOUNT.

Read_request method reads material data model

method READ_CREQUEST.

 
DATA: lr_model    TYPE REF TO if_usmd_model_ext.

 
DATA: lt_sel      TYPE usmd_ts_sel.

 
DATA: ls_sel      TYPE usmd_s_sel.

 
DATA: lt_crequest TYPE usmd_ts_crequest.

 
CONSTANTS: lc_incl  TYPE ddsign   VALUE 'I'.

 
CONSTANTS: lc_equal TYPE ddoption VALUE 'EQ'.



 
CLEAR: es_crequest.
* Get read-only access to USMD model data

 
CALL METHOD cl_usmd_model_ext=>get_instance

   
EXPORTING

      i_usmd_model
= if_mdg_bs_mat_gen_c=>gc_model_mm

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Have you tried to pass '0G' to the method cl_usmd_model_ext=>get_instance?

Somthing like:

CALL METHOD cl_usmd_model_ext=>get_instance
   
EXPORTING
      i_usmd_model
= '0G'

...

Former Member
0 Kudos

Using the reference to '0G' definitely got access to the FI data model.

I defined the following to get the FI data.

The code finds the id for the element (lv_brf_expr_id )

but the CREATE_DATA method does not find data. 

DATA: ls_account     TYPE /MDG/_SF_0G_PP_ACCOUNT.

CALL METHOD read_crequest
    EXPORTING
      iv_cr_number = iv_cr_number
    IMPORTING
      es_crequest  = lv_crequest.



* fill out the return table

  get_element_id(
    EXPORTING
      iv_cr_type = lv_crequest-usmd_creq_type
      iv_name    = 'ACCOUNT_GROUP'
    IMPORTING
      ev_brf_expr_id = lv_brf_expr_id ).
  ls_context-id = lv_brf_expr_id.

  CREATE DATA ls_context-value TYPE USMDZ1_KTOKS.
  ASSIGN  ls_context-value->* TO <value>.



*  <value> = ls_material-labor.
   <value> = ls_account-accgrpacc.



  APPEND ls_context TO et_rule_context_value.

Former Member
0 Kudos

The following code retrieves the guid for the field but does not retrieve the data.  Any ideas as to why?  e.g.  lv_brf_expr_id is filled on import, but ls_account-accgrpacc returns empty table.

get_element_id(

    EXPORTING

      iv_cr_type = lv_crequest-usmd_creq_type

      iv_name    = 'ACCOUNT_GROUP'

    IMPORTING

      ev_brf_expr_id = lv_brf_expr_id ).

  ls_context-id = lv_brf_expr_id.

  CREATE DATA ls_context-value TYPE USMDZ1_KTOKS.

  ASSIGN  ls_context-value->* TO <value>.

*  <value> = ls_material-labor.

   <value> = ls_account-accgrpacc.

Former Member
0 Kudos

This method only returns the ID (GUID) of the element as the name suggests. I don't recall the name of the method that returns the data but you should be able to find it in the class. It could be something like READ_DATA or GET_DATA.

Answers (2)

Answers (2)

Former Member
0 Kudos

Following used instead.  

CALL METHOD lr_model->read_entity_data_all
 
EXPORTING

    i_fieldname     
= ld_field

    if_active       
= abap_false

    i_crequest      
=

iv_cr_number

former_member206605
Active Contributor
0 Kudos

Hello Bob

Why you are using BADI for account type and account? Any specific reason? Based on that I can try to help.

Kiran

Former Member
0 Kudos

My understanding is that we need to map the data model data to the BRF+ tables.