cancel
Showing results for 
Search instead for 
Did you mean: 

BRF custom expression problem at ev_value

Former Member
0 Kudos

Hello Experts,

We are SRM 7.0 and using BRF workflow.

I am working on automation for the approval. Therefore, i have created a cutomized z expression for the same. I am fetching a data from a ztable. Please find the attachment. Table is a small matrix. When SC type is CATALOG and direct maanger is Y then ev_value = 'X' and when SC type is CATALOG  direct manager is N, ev_value = ' '. Query is written accordingly. Right now SC type is CATAGORY and direct manager is N. Therefore, direct manager should not be visible (dorect manager should be skipped). But currently, it is visible. I am using customized FM of /SAPSRM/WF_BRF_0EXP000. Constant is Y.

I have also pasted the code below.

   data : it_item type standard TABLE OF ZSC_APPROVAL_LVL,
         wa_item type ZSC_APPROVAL_LVL.

  ev_type          = /sapsrm/if_wf_rule_c=>type_bool.

  ev_length        = 1.
  CLEAR ev_currency.
  ev_output_length = 1.
  ev_decimals      = 0.
  ev_value         = /sapsrm/if_wf_rule_c=>brf_result_bool_noprocessing. " no processing
  ev_data_missing  = /sapsrm/if_wf_rule_c=>brf_data_missing.

  ev_value = abap_false.

  select * from ZSC_APPROVAL_LVL into TABLE it_item
    where ZSC_TYPE = 'CATALOG'. "and ZDIRECT_MGR = 'Y'.

    loop at it_item INTO wa_item.
    if wa_item-ZDIRECT_MGR = 'Y'.
      ev_value = abap_true.
      elseif wa_item-ZDIRECT_MGR = 'N'.
        ev_value = abap_false.

   ENDIF.
   ENDLOOP.

  lo_wf_brf_msg = lo_context_provider->get_wf_brf_msg( ).

  CALL METHOD /sapsrm/cl_wf_rule_context=>create_call_sequence
    EXPORTING
      it_expressions = it_expressions
    IMPORTING
      et_expressions = lt_expressions
      et_wf_brf_call = lt_wf_brf_call.

   FIELD-SYMBOLS <fs_exp> TYPE sbrf260a.

  LOOP AT lt_wf_brf_call INTO ls_wf_brf_call.
    lv_class_name = ls_wf_brf_call-class_name.
    lv_method_name = ls_wf_brf_call-method_name.
    lv_property_name = ls_wf_brf_call-property_name.
    EXIT.
  ENDLOOP.

  IF lv_method_name IS INITIAL.
* Missing Parameter for Method Name. Configure BRF.
    MESSAGE e080(/sapsrm/brf) INTO lv_msg.
    lo_wf_brf_msg->write_brf_msg( ).
    ev_data_missing = /sapsrm/if_wf_rule_c=>brf_data_missing.
    EXIT.
  ENDIF.

  IF    lv_class_name IS INITIAL.
* Missing Parameter for Class Name. Configure BRF.
    MESSAGE e081(/sapsrm/brf) INTO lv_msg.
    lo_wf_brf_msg->write_brf_msg( ).
    ev_data_missing = /sapsrm/if_wf_rule_c=>brf_data_missing.
    EXIT.
  ENDIF.

*  ev_value = c_value.

  CALL METHOD /sapsrm/cl_wf_rule_context=>call_rfw
    EXPORTING
      iv_document_guid       = lv_document_guid
      iv_document_type       = lv_document_type
      iv_class_name          = lv_class_name
      iv_method_name         = lv_method_name
      iv_property_name       = lv_property_name
      it_expressions         = lt_expressions
      io_wf_context_provider = lo_context_provider
    IMPORTING
      ev_value               = ev_value
      ev_type                = ev_type
      ev_length              = ev_length
      ev_currency            = ev_currency
      ev_output_length       = ev_output_length
      ev_decimals            = ev_decimals
      ev_data_missing        = ev_data_missing.

In debugging I can see ev_value = ' '. But at the end it becomes 'X' hence ev_value becomes true even if it is supposed to be false. I want to know whether i am missing any step or I should change my approach.Please share your experience.

Thank you,

Accepted Solutions (1)

Accepted Solutions (1)

robin_janke
Contributor
0 Kudos

Hi,

I guess you have to remove everything after your ENDLOOP so you only have the following left:

data : it_item type standard TABLE OF ZSC_APPROVAL_LVL,

         wa_item type ZSC_APPROVAL_LVL.

  ev_type          = /sapsrm/if_wf_rule_c=>type_bool.

  ev_length        = 1.
  CLEAR ev_currency.
  ev_output_length = 1.
  ev_decimals      = 0.
  ev_value         = /sapsrm/if_wf_rule_c=>brf_result_bool_noprocessing. " no processing
  ev_data_missing  = /sapsrm/if_wf_rule_c=>brf_data_missing.

  ev_value = abap_false.

  select * from ZSC_APPROVAL_LVL into TABLE it_item
    where ZSC_TYPE = 'CATALOG'. "and ZDIRECT_MGR = 'Y'.

    loop at it_item INTO wa_item.
    if wa_item-ZDIRECT_MGR = 'Y'.
      ev_value = abap_true.
      elseif wa_item-ZDIRECT_MGR = 'N'.
        ev_value = abap_false.

   ENDIF.
   ENDLOOP.

Just before the ENDLOOP insert the line "CLEAR ev_data_missing." as well.

The rest of the standard code is needed for another way of retrieving the data using the standard FM you copied.

Regards,

Robin

Former Member
0 Kudos

Hello Robin,

That was great. It worked. Clear ev_data_missing was the root cause.

Earlier I had tried by commenting rest of the standard code but that didn't work but after inserting clear ev_data_missing and commenting standard code it worked. Thank you again. Will you please let me know what exaclty ev_data_missing does ? I was able to extract some part of the code. I know ev_value is result type. Ev_length is length. But i am not able to crack this FM group completely. If you could let me know about ev_data_missing or where I can find the documentation about this then it would be a great help. I am new to workflow and BRF.

Thank you.

Answers (0)