Skip to Content
0

Purchase Requisition: simultaneous item and header release strategy

Aug 23, 2017 at 07:04 AM

47

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Wolfgang Wiesmayr Aug 23, 2017 at 07:09 AM
0

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!

Share
10 |10000 characters needed characters left characters exceeded