cancel
Showing results for 
Search instead for 
Did you mean: 

Purchase Requisition: simultaneous item and header release strategy

wolfgangwiesmay
Explorer
0 Kudos

Hi guys,

I found multiple archived threads asking for an answer to achieve simultaneous releases on item and header level for a single purchase requisition type.

I found the solution to e.g. differentiate between purchasing organizations - so organization 0001 can work with PR-type NB with item level releases and organization 0002 works with header level releases.

Answer in the comments.

Best regards,

Wolfgang

Accepted Solutions (1)

Accepted Solutions (1)

wolfgangwiesmay
Explorer
0 Kudos

You need to enhance method PROCESS_RULES of local class LCL_RULE_INTERPRETER in include LMEREQF11. Basically you need to set, before the method runs, the following parameters:

FIELD-SYMBOLS: <lv_t161_gsfrg>   TYPE gsfrg,
               <lv_header_gsfrg> TYPE gsfrg.

ASSIGN ('im_context->t161-gsfrg') TO <lv_t161_gsfrg>.
IF sy-subrc EQ 0.
  <lv_t161_gsfrg> = 'X'.
ENDIF.

ASSIGN ('im_context->req_header->my_state->header-gsfrg') TO <lv_header_gsfrg>.
IF sy-subrc EQ 0.
  <lv_header_gsfrg> = 'X'.
ENDIF.

Careful - a header release is only shown in ME51N/ME52N after check/save-routine. You also need to add some way to determine if the above logic should run or not - you can retrieve item level data like this:

  FIELD-SYMBOLS: <lt_oitems>       TYPE ANY TABLE,
                 <lo_item>         TYPE any,
                 <ls_item>         TYPE mereq_item.

  "get ekorg/werks from first item
  ASSIGN ('im_context->req_header->my_state->items') TO <lt_oitems>.
  IF sy-subrc EQ 0.
    LOOP AT <lt_oitems> ASSIGNING <lo_item>.
      ASSIGN ('<lo_item>->my_state->item') TO <ls_item>.
    ENDLOOP.
  ENDIF.

Hope I could help someone!

Answers (0)