Skip to Content
0
Oct 19, 2005 at 02:52 PM

Charactersic Combo Proposal Exit returning #

24 Views

I’m attempting to use the combo proposal user exit. [code below].

The object of the exercise is to provide a limited list of COORDER selection proposals [based on various order attributes] for the cost center the user may select. The cost centers are user specific and linked to authorizations. All Possible Characteristic Combinations is selected in the layout.

The eth_chas table is filled with the appropriate values for 0COORDER and 0COSTCENTER from the code. The selections for cost center are forced as you can see from the code, but I can fill those dynamically later once I get the order proposals working. These are valid combinations and data is in the planning cube.

What is returned for Cost Center 53120 is ORDER ‘#’’. It should be 608085, or present the user with the possibility of selecting from multiple valid orders [ there can be more than one valid order, but I’m keeping this prototype simple during development].

What am I missing or doing incorrectly in the function code, or perhaps the issue is in the Planning level selection criteria ?

Thanks

Brent Mawhinney

<u>Planning level Content:</u>

Cost Element 700000 700099

Order

Budget Year ZIFISCYR

Company code XXXX

Controlling area XXXX

Cost Center ZTSTAUTH

Currency CAD

Fiscal year ZFISCYR

Fiscal Year Variant XX

Posting period #

Value type 20

Version ZVERSION

<u>Table eth_chas status before exiting the combo function:</u>

Internal table eth_chas Type HASHED

1 0COMP_CODE 0COORDER 0COSTCENTER 0COSTELMNT 0CO_AREA 0CURRE

1 |000000608085|0000053120 | | |

2 |000000634616|0000053140 | | |

FUNCTION Z_BPS_ORD_PROPOSE_PRIME.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(I_AREA) TYPE  UPC_Y_AREA
*"     VALUE(ITO_CHA) TYPE  UPC_YTO_CHA
*"     VALUE(ITO_CHASEL) TYPE  UPC_YTO_CHASEL
*"  EXPORTING
*"     REFERENCE(ETH_CHAS) TYPE  HASHED TABLE
*"  EXCEPTIONS
*"      FAILED
*"----------------------------------------------------------------------

  FIELD-SYMBOLS: <ls_cha> TYPE upc_ys_cha.

  DATA: ls_charng  TYPE upc_ys_charng,
        ls_chasel  TYPE upc_ys_chasel,
        lto_chasel TYPE upc_yto_chasel.

  DATA: lto_costcenter TYPE upc_yto_chavl,
        lto_order      TYPE upc_yto_chavl.

  FIELD-SYMBOLS: <ls_costcenter>    TYPE upc_ys_chavl,
                 <ls_order>         TYPE upc_ys_chavl.

  DATA: lrs_chas TYPE REF TO data     ,
        i_order type UPC_YTO_CHARSEL  ,
        li_order like i_order with header line,
        t_order type UPC_YTO_CHA      .

  FIELD-SYMBOLS: <ls_chas>  TYPE ANY,
                 <ls_chavl> TYPE ANY.

  CLEAR: eth_chas.

* If we don't have 0COSTCENTER we can not perform any check
* -> error
  READ TABLE ito_cha TRANSPORTING NO FIELDS
                     WITH TABLE KEY chanm = '0COSTCENTER'.
  IF sy-subrc <> 0.
    MESSAGE e006(UPF) RAISING failed.
  ENDIF.

  CREATE DATA lrs_chas LIKE LINE OF eth_chas.

  ASSIGN lrs_chas->* TO <ls_chas>.

FIELD-SYMBOLS: <l_costcenter>,
               <l_order>.

      READ TABLE ito_cha TRANSPORTING NO FIELDS
                         WITH TABLE KEY chanm = '0COORDER'.
      IF sy-subrc = 0.
        ASSIGN COMPONENT '0COORDER'
               OF STRUCTURE <ls_chas>
               TO <l_order>.

        ASSIGN COMPONENT '0COSTCENTER'
               OF STRUCTURE <ls_chas>
               TO <l_costcenter>.

** Pulls back Operating Scheduled orders only from ODS ZBPS_C04
** Into range table i_order
        CALL FUNCTION 'Z_BPS_ORD_CC_OPR_SCHED'
          EXPORTING
            I_AREA            =  I_AREA
            I_VARIABLE        =  'ZTSTAUTH'
            I_CHANM           =  '0COORDER'
            ITO_CHANM         =  t_order
          IMPORTING
            ETO_CHARSEL       =  i_order.
                  .
      ENDIF.


 loop at i_order into li_order.

   case li_order-low.
    when '000000608085'.
     <l_costcenter> = '0000053120'.
    when '000000634616'.
     <l_costcenter> = '0000053140'.
   endcase.
   <l_order> = li_order-low.

  INSERT <ls_chas> INTO TABLE eth_chas.

 endloop.

ENDFUNCTION.