Thursday, 23 June 2011

enhancement for gov contract rating

************************************************************************
* SGL Group - The Carbon Company                                       *
*----------------------------------------------------------------------*
* Type:         Badi     :ME_PROCESS_REQ_CUST                          *
*               Method   :FIELDSELECTION_ITEM_REFKEYS                  *                           *
* Application:  MM                                                     *
* Date:         2011-06-23                                             *
* Last Update:  N/A                                                    *
*----------------------------------------------------------------------*
* Author:       POSNIAN                                                *
* Requester:    Ronald Ward                                            *
* Ticket No:    9999019030                                             *
*----------------------------------------------------------------------*
* Description:  Method to display the Government Priority Rating text  *
*               for the plants GAR1 and ARK2.                          *
*----------------------------------------------------------------------*
* Change Log                                                           *
*                                                                      *
* YYYY-MM-DD  Ini  Description / Reason of Change (incl. ticket no.)   *
* ---------- ----- --------------------------------------------------- *
* 2011-06-23  POSNIAN Initial Development-Transport Request# S1DK988941*
*                                                                      *
************************************************************************
METHOD if_ex_me_process_req_cust~fieldselection_item_refkeys.

* Data declaration
  DATA: l_item_list     TYPE mmpur_requisition_items,
        l_item          TYPE mmpur_requisition_item,
        l_item_akt      TYPE mereq_item,
        l_item_ref      TYPE REF TO if_purchase_requisition_item,
        ld_attr         TYPE string,
        lo_obj          TYPE REF TO object,  " root object
        it_ebkn         TYPE TABLE OF ebkn,
        wa_ebkn         TYPE ebkn,
        it_prps         TYPE TABLE OF prps,
        wa_prps         TYPE prps,
        wa_eban         TYPE eban,
        obj12           TYPE REF TO object,
        textname        TYPE string,
        tline           TYPE TABLE OF tline,
        et_textlines    TYPE mmpur_t_textlines,
        wa_textlines    TYPE mmpur_textlines,
        ev_bool         TYPE c,
        is_texttypes    TYPE mmpur_texttypes.
* Field symbols delcaration
  FIELD-SYMBOLS:
    <lo_lcl>            TYPE ANY,
    <ls_item>           TYPE mereq_item,
    <ls_itemx>          TYPE mereq_itemx.

  l_item_ref ?= im_item.   " TYPE REF TO if_purchase_requisition_item

  obj12 = im_item.

* Assing the field sysmbol to data
  ld_attr = 'MY_PERSISTENT_EBAN'.
  ASSIGN obj12->(ld_attr) TO <lo_lcl> .

* Move the data from field symbol to workarea
  MOVE <lo_lcl> TO wa_eban.

* Feching data from ebkn table
  SELECT SINGLE * FROM ebkn INTO wa_ebkn WHERE banfn = wa_eban-banfn.

* Feching data from prps table
  SELECT SINGLE * FROM prps INTO wa_prps WHERE  pspnr = wa_ebkn-ps_psp_pnr.

* Concatenate the purchase requisation number and item number
  CONCATENATE wa_eban-banfn wa_eban-bnfpo INTO textname.

* assign the text ids
  is_texttypes-tdobject = 'EBAN'.
  is_texttypes-tdid = 'B99'.
  is_texttypes-tdtext =  textname.
  is_texttypes-textflag = 'X'.

* Appling the condition
  IF ( ( ( wa_eban-werks EQ 'GAR1' ) OR ( wa_eban-werks EQ 'ARK2' ) )
    AND ( wa_eban-knttp EQ 'Q' ) AND ( wa_prps-slwid EQ 'Z000001' ) ).

* Concatenate the Gov contract and priority rating
    CONCATENATE wa_prps-usr01 wa_prps-usr03 INTO wa_textlines-tdline SEPARATED BY '*'.

* Assign the text ids
    wa_textlines-tdobject = 'EBAN'.
    wa_textlines-tdid     = 'B99'.
    wa_textlines-tdformat = '*'.
    wa_textlines-tdline   = wa_textlines-tdline.

* Append the data workarea to internal table
    APPEND wa_textlines TO et_textlines.

* Set the Government Priority Rating text by using set_text
    CALL METHOD l_item_ref->if_longtexts_mm~set_text(
      EXPORTING
      im_tdid      = 'B99'
      im_textlines = et_textlines
       ) .
* Get the Government Priority Rating  text by using get_text
  ELSE.
    CALL METHOD l_item_ref->if_longtexts_mm~get_text(
    EXPORTING
    im_tdid      = 'B99'
    im_texttype = is_texttypes
    IMPORTING
    ex_textlines = et_textlines ).

* Refresh Government Priority Rating the text
    REFRESH et_textlines.

* Set the Government Priority Rating text by using set_text
    CALL METHOD l_item_ref->if_longtexts_mm~set_text(
    EXPORTING
    im_tdid      = 'B99'
    im_textlines = et_textlines
     ) .
  ENDIF.

ENDMETHOD.

No comments:

Post a Comment