SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

History of Purchase Requisitions Release strategies



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Wed Sep 05, 2007 5:01 pm    Post subject: History of Purchase Requisitions Release strategies Reply with quote

Author: Kaleemullah

Report to Display All change History of Purchase requisitions With their release strategies.
Here is a hand made ready made rewport to display all the release strategies of purchase requisitions along with List of Approvers. This report may be use ful for many with a minimal changes to be made in order to meet their individual requirement.

Code:
TABLES :      cdhdr,
              t001w,
              eban,
              ekko.
*&---------------------------------------------------------------------*
*                         Type Declarations                            *
*&---------------------------------------------------------------------*
TYPE-POOLS : slis.
*
TYPES:  BEGIN OF t_cdhdr,
             objectid   LIKE cdhdr-objectid,
             changenr   LIKE cdhdr-changenr,
             objectclas LIKE cdhdr-objectclas,
             tcode      LIKE cdhdr-tcode,
             udate      LIKE cdhdr-udate,
             username   LIKE cdhdr-username,
             utime      LIKE cdhdr-utime,
             flag       TYPE c,
        END OF t_cdhdr,
*
        BEGIN OF t_eban,
             banfn   LIKE eban-banfn,    "Purchase requisition number
             bnfpo   LIKE eban-bnfpo,    "Item number of purch.req.
             bsart LIKE eban-bsart, "Purch.req document type
             frgkz LIKE eban-frgkz, "Release indicator
             frgzu LIKE eban-frgzu, "Release status
             frgst LIKE eban-frgst, "Release strategy in purc. req.
             ekgrp LIKE eban-ekgrp, "Purchasing group
             ernam   LIKE eban-ekgrp,    "Name of Person Crea'd Object
             afnam LIKE eban-afnam, "Name of requ'er/requester
             txz01 LIKE eban-txz01, "Short text
             matnr LIKE eban-matnr, "Material number
             werks LIKE eban-werks, "Plant
             menge LIKE eban-menge, "Purchase requisition quantity
             meins LIKE eban-meins, "Purch.req unit of measure
             badat LIKE eban-badat, "Requisition (request) date
             frgdt LIKE eban-frgdt, "Purch.req release date
             preis LIKE eban-preis, "Price in purchase requisition
             peinh   LIKE eban-peinh,    "Price Unit
             flief LIKE eban-flief, "Fixed vendor
             ebeln LIKE eban-ebeln, "Purchase order number
             ebelp LIKE eban-ebelp, "Purchase order item number
             frggr LIKE eban-frggr, "Release group
             waers LIKE eban-waers, "Currency Key
        END OF t_eban,
*
        BEGIN OF t_ebkn,
             banfn   LIKE eban-banfn,    "Purchase requisition number
             bnfpo   LIKE eban-bnfpo,    "Item number of purch.req.
             kostl   LIKE ebkn-kostl,    "Cost Center
        END OF t_ebkn,
*
        BEGIN OF t_output,
             werks   LIKE eban-werks,        "Plant               -1
             banfn   LIKE eban-banfn,        "Purchase Requisition-2
             bnfpo   LIKE eban-bnfpo,        "Item Pur.Requisition-3
             bsart   LIKE eban-bsart,        "Document Type       -4
             frggr   LIKE eban-frggr,     "Release Group       -5
             frgzu   LIKE eban-frgzu,     "Release Status      -6
             rcode(24),                      "Release Code        -7
             frgst   LIKE eban-frgst,        "Release Strategy
             frgkz   LIKE eban-frgkz,     "Release Indicator   -8
             ernam   LIKE eban-ernam,        "Person Responsible  -9
             kostl   LIKE ebkn-kostl,        "Cost Center         -10
             matnr   LIKE eban-matnr,        "Material            -11
             txz01   LIKE eban-txz01,        "Short Text          -12
             menge   LIKE eban-menge,        "Quantity Requested  -13
             meins   LIKE eban-meins,        "Unit of Measure     -14
             badat   LIKE eban-badat,        "Req Date            -15
             frgdt   LIKE eban-frgdt,        "Release Date        -16
             preis   LIKE eban-preis,        "Valuation Price     -17
             waers   LIKE eban-waers,        "Currency            -18
             peinh   LIKE eban-peinh,        "Per Unit            -19
             flief   LIKE eban-flief,        "Fixed Vendor        -20
             ebeln   LIKE ekpo-ebeln,        "Purchase Order      -21
             ebelp   LIKE ekpo-ebelp,        "Item PO             -22
             afnam   LIKE eban-afnam,        "Requisitioner       -23
       END OF t_output,
*
       BEGIN OF t_tcdrp,
           object LIKE tcdrp-object,
       END OF t_tcdrp,
*
       BEGIN OF t_t16fs,
           frggr LIKE t16fs-frggr,
           frgsx LIKE t16fs-frgsx,
           frgc1 LIKE t16fs-frgc1,
           frgc2 LIKE t16fs-frgc2,
           frgc3 LIKE t16fs-frgc3,
           frgc4 LIKE t16fs-frgc4,
           frgc5 LIKE t16fs-frgc5,
           frgc6 LIKE t16fs-frgc6,
           frgc7 LIKE t16fs-frgc7,
           frgc8 LIKE t16fs-frgc8,
       END OF t_t16fs,
*
       BEGIN OF t_cdpos,
            objectid   LIKE cdpos-objectid,
            changenr   LIKE cdpos-changenr,
            objectclas LIKE cdpos-objectclas,
            tabkey     LIKE cdpos-tabkey,
            fname      LIKE cdpos-fname,
            value_new  LIKE cdpos-value_new,
            value_old  LIKE cdpos-value_old,
       END OF t_cdpos,
*
       BEGIN OF t_cdpos1,
            objectid   LIKE eban-banfn,
            changenr   LIKE cdpos-changenr,
            objectclas LIKE cdpos-objectclas,
            value_new  LIKE cdpos-value_new,
       END OF t_cdpos1.
*
*&---------------------------------------------------------------------*
*                         Table Declarations                           *
*&---------------------------------------------------------------------*
DATA  : i_eban   TYPE STANDARD TABLE OF t_eban,
        i_ebkn   TYPE STANDARD TABLE OF t_ebkn,
        i_output TYPE STANDARD TABLE OF t_output,
        i_tcdrp  TYPE STANDARD TABLE OF t_tcdrp,
        i_cdhdr  TYPE STANDARD TABLE OF t_cdhdr,
        i_t16fs  TYPE STANDARD TABLE OF t_t16fs,
        i_cdpos  TYPE STANDARD TABLE OF t_cdpos,
        i_cdpos1 TYPE STANDARD TABLE OF t_cdpos1,
        i_cdpos3 TYPE STANDARD TABLE OF t_cdpos.
*
DATA  : t_fcat TYPE slis_t_fieldcat_alv.
*
*&---------------------------------------------------------------------*
*                         Work Area Declarations                       *
*&---------------------------------------------------------------------*
DATA  : wa_eban    LIKE LINE OF i_eban,
        wa_ebkn    LIKE LINE OF i_ebkn,
        wa_output  LIKE LINE OF i_output,
        wa_tcdrp   LIKE LINE OF i_tcdrp,
        wa_t16fs   LIKE LINE OF i_t16fs,
        wa_cdpos   LIKE LINE OF i_cdpos,
        wa_cdpos3  LIKE LINE OF i_cdpos.
*
DATA  : wa_fcat TYPE slis_fieldcat_alv.
*
*&---------------------------------------------------------------------*
*                         Constants Declarations                       *
*&---------------------------------------------------------------------*
CONSTANTS: c_me       LIKE tcdrp-devclass VALUE 'ME',
           c_inc(1)   TYPE c VALUE 'I',
           c_eq(2)    TYPE c VALUE 'EQ',
           c_frgzu(5) TYPE c VALUE 'FRGZU',
           c_frgkz(5) TYPE c VALUE 'FRGKZ',
           c_eban(4)  TYPE c VALUE 'EBAN',
           c_update   TYPE c VALUE 'U'.
*
*&---------------------------------------------------------------------*
*                         Input parameters                             *
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-033.
SELECT-OPTIONS :
           s_bukrs  FOR ekko-bukrs       OBLIGATORY,
           s_ekorg  FOR eban-ekorg       OBLIGATORY,
           s_ekgrp  FOR eban-ekgrp,
           s_bsart  FOR eban-bsart,
           s_value  FOR cdhdr-objectid,
           s_frggr  FOR ekko-frggr,
           s_user   FOR cdhdr-username,
           s_date   FOR cdhdr-udate,
           s_tcode  FOR cdhdr-tcode      OBLIGATORY,
           s_werks  FOR t001w-werks      OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
*
SELECT-OPTIONS :
           s_object FOR cdhdr-objectclas NO-DISPLAY.
*&---------------------------------------------------------------------*
*                   INITIALIZATION
*&---------------------------------------------------------------------*
INITIALIZATION.
*
  PERFORM get_object_class.
*
*&---------------------------------------------------------------------*
*                   AT SELECTION-SCREEN
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN.
* Validate Input At Selection Screen
* PERFORM screen_validation.
*&---------------------------------------------------------------------*
*                   START-OF-SELECTION.
*&---------------------------------------------------------------------*
START-OF-SELECTION.
* Get all Transactions from CDHDR
  PERFORM get_cdhdr.
* Get Purchase Requisition Data
  PERFORM doc_details.
* Get Release codes
  PERFORM get_relcode.
*&---------------------------------------------------------------------*
*                   END-OF-SELECTION.
*&---------------------------------------------------------------------*
END-OF-SELECTION.
  IF i_eban IS INITIAL.
    MESSAGE s000(zm) WITH 'No Records Found for the Selection'(001).
  ELSE.
* Prepare O/P Table
    PERFORM fill_output.
* Submit to ALV O/P
    PERFORM alv_output.
  ENDIF.
*&---------------------------------------------------------------------*
*&                    Form  get_object_class
*&---------------------------------------------------------------------*
*                 Get Object Class for Purchase Req.
*----------------------------------------------------------------------*
FORM get_object_class.
*
  SELECT object
    INTO TABLE i_tcdrp
    FROM tcdrp
    WHERE devclass = c_me.
*
  LOOP AT i_tcdrp INTO wa_tcdrp.
    s_object-sign   = c_inc.
    s_object-option = c_eq.
    s_object-low    = wa_tcdrp-object.
    APPEND s_object.
  ENDLOOP.
*
ENDFORM.                    " get_object_class
*&---------------------------------------------------------------------*
*&                        Form  get_cdhdr
*&---------------------------------------------------------------------*
*                       Get Document Details
*----------------------------------------------------------------------*
FORM get_cdhdr.
*
  SELECT objectid
         changenr
         objectclas
         tcode
         udate
         username
         utime
                    INTO TABLE i_cdhdr
                    FROM cdhdr
                    WHERE objectclas IN s_object
                    AND   objectid   IN s_value
                    AND   tcode      IN s_tcode
                    AND   udate      IN s_date
                    AND   username   IN s_user
                    AND   change_ind =  'U'.
  IF sy-subrc = 0.
    SORT i_cdhdr BY objectclas objectid.
*
    SELECT objectid
           changenr
           objectclas
           tabkey
           fname
           value_new
           value_old
                      INTO TABLE i_cdpos  FROM cdpos
                      FOR ALL ENTRIES  IN i_cdhdr
                      WHERE objectclas EQ i_cdhdr-objectclas
                      AND   objectid   EQ i_cdhdr-objectid
                      AND   changenr   EQ i_cdhdr-changenr
                      AND   tabname    EQ c_eban
                      AND   fname      EQ c_frgzu
                      AND   chngind    EQ c_update.
*
    SELECT objectid
           changenr
           objectclas
           tabkey
           fname
           value_new
           value_old
                      INTO TABLE i_cdpos3 FROM cdpos
                      FOR ALL ENTRIES  IN i_cdhdr
                      WHERE objectclas EQ i_cdhdr-objectclas
                      AND   objectid   EQ i_cdhdr-objectid
                      AND   changenr   EQ i_cdhdr-changenr
                      AND   tabname    EQ c_eban
                      AND   fname      EQ c_frgkz
                      AND   chngind    EQ c_update.
*
    IF sy-subrc = 0.
      i_cdpos1[] = i_cdpos[].
      SORT i_cdpos1 BY objectid.
      DELETE ADJACENT DUPLICATES FROM i_cdpos1[] COMPARING objectid.
    ENDIF.
  ENDIF.
*
ENDFORM.                    " get_cdhdr
*&---------------------------------------------------------------------*
*&                    Form  doc_details
*&---------------------------------------------------------------------*
*                   Get Document Details
*----------------------------------------------------------------------*
FORM doc_details.
*
  IF NOT i_cdpos1[] IS INITIAL.
    SORT i_cdpos1 BY objectid.
*
    SELECT   banfn    "Purchase requisition number
             bnfpo    "Item number of purchase requisition
             bsart    "Purchase requisition document type
             frgkz    "Release indicator
             frgzu    "Release status
             frgst    "Release strategy in the purc. requisition
             ekgrp    "Purchasing group
             ernam    "Name of Person who Created the Object
             afnam    "Name of requisitioner/requester
             txz01    "Short text
             matnr    "Material number
             werks    "Plant
             menge    "Purchase requisition quantity
             meins    "Purchase requisition unit of measure
             badat    "Requisition (request) date
             frgdt    "Purchase requisition release date
             preis    "Price in purchase requisition
             peinh    "Price Unit
             flief    "Fixed vendor
             ebeln    "Purchase order number
             ebelp    "Purchase order item number
             frggr  "Release group
             waers    "Currency Key
                       INTO TABLE i_eban FROM eban
                       FOR ALL ENTRIES IN i_cdpos1
                       WHERE banfn EQ i_cdpos1-objectid
                       AND   bsart IN s_bsart
                       AND   ekgrp IN s_ekgrp
                       AND   ekorg IN s_ekorg
                       AND   frggr IN s_frggr
                       AND   werks IN s_werks.
*
    REFRESH i_cdpos1.
*
    IF sy-subrc = 0.
      SORT i_eban BY banfn bnfpo.
      SELECT   banfn    "Purchase requisition number
               bnfpo    "Item number of purchase requisition
               kostl    "Cost Center
                         INTO TABLE i_ebkn FROM ebkn
                         FOR ALL ENTRIES IN i_eban
                         WHERE banfn EQ i_eban-banfn
                         AND   bnfpo EQ i_eban-bnfpo.
      IF sy-subrc = 0.
        SORT i_ebkn BY banfn bnfpo.
      ENDIF.
    ENDIF.
*
  ENDIF.
*
ENDFORM.                    " doc_details
*&---------------------------------------------------------------------*
*&                  Form  fill_output
*&---------------------------------------------------------------------*
*               Prepare Final O/P Table
*----------------------------------------------------------------------*
FORM fill_output.
*
  DATA : v_count        TYPE i,
         v_chng_flg     TYPE c.
*
  v_count = 0.
*
  SORT i_cdpos  BY tabkey changenr.
  SORT i_cdpos3 BY objectid changenr objectclas tabkey fname.
*
  LOOP AT i_cdpos INTO wa_cdpos.
*
    ON CHANGE OF wa_cdpos-tabkey.
      v_chng_flg = 'X'.
      CLEAR : v_count.
    ENDON.
*
    v_count = v_count + 1.
*
    READ TABLE i_eban INTO wa_eban WITH KEY banfn = wa_cdpos-objectid
                                           bnfpo = wa_cdpos-tabkey+13(5)
                                           BINARY SEARCH.
    IF sy-subrc = 0.
*
      READ TABLE i_ebkn INTO wa_ebkn WITH KEY banfn = wa_eban-banfn
                                              bnfpo = wa_eban-bnfpo
                                              BINARY SEARCH.
      IF sy-subrc = 0.
        wa_output-kostl = wa_ebkn-kostl.
      ENDIF.
* Get all release codes for the current Rel. Strategy
      READ TABLE i_t16fs INTO wa_t16fs WITH KEY frggr = wa_eban-frggr
                                                frgsx = wa_eban-frgst
                                                BINARY SEARCH.
      IF sy-subrc = 0.
* Prepare Release Code
        PERFORM relcode USING v_count.
      ENDIF.
* Read Release Indicator
      PERFORM read_indicator.
      IF sy-subrc = 0.
        IF v_chng_flg = 'X'.
          wa_output-frgkz = wa_cdpos3-value_old.
        ELSE.
          wa_output-frgkz = wa_cdpos3-value_new.
        ENDIF.
      ENDIF.
*
      wa_output-werks = wa_eban-werks.
      wa_output-banfn = wa_eban-banfn.
      wa_output-bnfpo = wa_eban-bnfpo.
      wa_output-bsart = wa_eban-bsart.
      wa_output-frggr = wa_eban-frggr.
      wa_output-frgst = wa_eban-frgst.
      wa_output-ernam = wa_eban-ernam.
      wa_output-matnr = wa_eban-matnr.
      wa_output-txz01 = wa_eban-txz01.
      wa_output-menge = wa_eban-menge.
      wa_output-meins = wa_eban-meins.
      wa_output-badat = wa_eban-badat.
      wa_output-frgdt = wa_eban-frgdt.
      wa_output-preis = wa_eban-preis.
      wa_output-waers = wa_eban-waers.
      wa_output-peinh = wa_eban-peinh.
      wa_output-flief = wa_eban-flief.
      wa_output-ebeln = wa_eban-ebeln.
      wa_output-ebelp = wa_eban-ebelp.
      wa_output-afnam = wa_eban-afnam.
      wa_output-frgzu = wa_cdpos-value_new.
*
      APPEND  wa_output TO i_output.
*
      CLEAR:  wa_output,
              wa_eban,
              wa_ebkn,
              wa_t16fs,
              wa_cdpos3,
              v_chng_flg.
    ENDIF.
*
  ENDLOOP.
*
ENDFORM.                    " fill_output
*&---------------------------------------------------------------------*
*&                        Form  alv_output
*&---------------------------------------------------------------------*
*                         ALV O/P Display
*----------------------------------------------------------------------*
FORM alv_output.
*
  PERFORM fill_field_catalog.
*
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_grid_title                      =  text-034
     it_fieldcat                       =  t_fcat
    TABLES
      t_outtab                          = i_output
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.*
ENDFORM.                    " alv_output
*&---------------------------------------------------------------------*
*&      Form  fill_field_catalog
*&---------------------------------------------------------------------*
*       Build Field Catalog
*----------------------------------------------------------------------*
FORM fill_field_catalog.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'WERKS' .
  wa_fcat-ref_tabname = 'T024' .
  wa_fcat-outputlen   =  5 . "colume width
  wa_fcat-seltext_m   = 'Plant'(010).
  wa_fcat-col_pos     =  1.
  wa_fcat-key         =  'X'.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'BANFN' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  15. "colume width
  wa_fcat-seltext_m   = 'Purch. Req.'(011).
  wa_fcat-col_pos     =  2.
  wa_fcat-key         =  'X'.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'BNFPO' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  5. "colume width
  wa_fcat-seltext_m   = 'Item'(012).
  wa_fcat-col_pos     =  3.
  wa_fcat-key         =  'X'.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'BSART' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  4. "colume width
  wa_fcat-seltext_m   = 'Document Type'(013).
  wa_fcat-col_pos     =  4.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'FRGGR' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  4. "colume width
  wa_fcat-seltext_m   = 'Grp.'(014).
  wa_fcat-col_pos     =  5.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'FRGZU' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  8. "colume width
  wa_fcat-seltext_m   = 'Rel Stat'(015).
  wa_fcat-col_pos     =  6.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'RCODE' .
  wa_fcat-outputlen   =  24. "colume width
  wa_fcat-seltext_m   = 'Rel. Code'(016).
  wa_fcat-col_pos     =  7.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'FRGKZ' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  4. "colume width
  wa_fcat-seltext_m   = 'Rel'(017).
  wa_fcat-col_pos     =  8.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'ERNAM' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  14. "colume width
  wa_fcat-seltext_m   = 'Person Resp.'(018).
  wa_fcat-col_pos     =  9.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'KOSTL' .
  wa_fcat-ref_tabname = 'EBKN' .
  wa_fcat-outputlen   =  10. "colume width
  wa_fcat-seltext_m   = 'Cost Center'(019).
  wa_fcat-col_pos     =  10.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'MATNR' .
  wa_fcat-ref_tabname = 'eban' .
  wa_fcat-outputlen   =  18. "colume width
  wa_fcat-seltext_m   = 'Material'(020).
  wa_fcat-col_pos     =  11.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'TXZ01' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  25. "colume width
  wa_fcat-seltext_m   = 'Short Text'(021).
  wa_fcat-col_pos     =  12.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'MENGE' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  13. "colume width
  wa_fcat-seltext_m   = 'Qty. Requested'(022).
  wa_fcat-col_pos     =  13.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'MEINS' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  3. "colume width
  wa_fcat-seltext_m   = 'Un.'(023).
  wa_fcat-col_pos     =  14.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'BADAT' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  5 . "colume width
  wa_fcat-seltext_m   = 'Req. Date'(024).
  wa_fcat-col_pos     =  15.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'FRGDT' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  5 . "colume width
  wa_fcat-seltext_m   = 'Rel. Date'(025).
  wa_fcat-col_pos     =  16.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'PREIS' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  11. "colume width
  wa_fcat-seltext_m   = 'Valn. Price'(026).
  wa_fcat-col_pos     =  17.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'WAERS' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  5 . "colume width
  wa_fcat-seltext_m   = 'Curr'(027).
  wa_fcat-col_pos     =  18.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'PEINH' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  5 . "colume width
  wa_fcat-seltext_m   = 'Per'(028).
  wa_fcat-col_pos     =  19.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'FLIEF' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  10. "colume width
  wa_fcat-seltext_m   = 'Fixed Vendor'(029).
  wa_fcat-col_pos     =  20.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'EBELN' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  10. "colume width
  wa_fcat-seltext_m   = 'Purchase Order'(030).
  wa_fcat-col_pos     =  21.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'EBELP' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  5. "colume width
  wa_fcat-seltext_m   = 'Item'(031).
  wa_fcat-col_pos     =  22.
  APPEND wa_fcat TO t_fcat.
*
  CLEAR wa_fcat.
  wa_fcat-fieldname   = 'AFNAM' .
  wa_fcat-ref_tabname = 'EBAN' .
  wa_fcat-outputlen   =  12. "colume width
  wa_fcat-seltext_m   = 'Requisitioner'(032).
  wa_fcat-col_pos     =  23.
  APPEND wa_fcat TO t_fcat.
*
ENDFORM.                    " fill_field_catalog
*&---------------------------------------------------------------------*
*&      Form  get_relcode
*&---------------------------------------------------------------------*
*       Get Release codes for all the documents
*----------------------------------------------------------------------*
FORM get_relcode.
  IF NOT i_eban IS INITIAL.
*
    SELECT  frggr
            frgsx
            frgc1
            frgc2
            frgc3
            frgc4
            frgc5
            frgc6
            frgc7
            frgc8
                  INTO TABLE i_t16fs FROM t16fs
                  FOR ALL ENTRIES IN i_eban
                  WHERE frggr = i_eban-frggr
                  AND   frgsx = i_eban-frgst.
    IF sy-subrc = 0.
      SORT i_t16fs BY frggr frgsx.
    ENDIF.
*
  ENDIF.
ENDFORM.                    " get_relcode
*&---------------------------------------------------------------------*
*&                          Form  relcode
*&---------------------------------------------------------------------*
*                 Concatenate Release Codes USING <FS>
*----------------------------------------------------------------------*
FORM relcode USING p_v_count TYPE i.
*
  DATA : v_ind TYPE sy-index.
*
  FIELD-SYMBOLS <fs> TYPE ANY.
*
  v_ind = 3.
*
  DO p_v_count TIMES.
    ASSIGN COMPONENT v_ind OF
           STRUCTURE wa_t16fs TO <fs>.
    IF sy-subrc = 0.
      CONCATENATE  wa_output-rcode  <fs> INTO wa_output-rcode
                                           SEPARATED BY space.
      v_ind = v_ind + 1.
    ENDIF.
  ENDDO.
*
ENDFORM.                    " relcode
*&---------------------------------------------------------------------*
*&                      Form  read_indicator
*&---------------------------------------------------------------------*
*                  To read the release indicator
*----------------------------------------------------------------------*
FORM read_indicator.
*
  READ TABLE i_cdpos3 INTO wa_cdpos3 WITH KEY
                               objectid     = wa_cdpos-objectid
                               changenr     = wa_cdpos-changenr
                               objectclas   = wa_cdpos-objectclas
                               tabkey       = wa_cdpos-tabkey
                               fname        = c_frgkz.
  IF sy-subrc <> 0.
*
    READ TABLE i_cdpos3 INTO wa_cdpos3 WITH KEY
                                 objectid     = wa_cdpos-objectid
                                 objectclas   = wa_cdpos-objectclas
                                 tabkey       = wa_cdpos-tabkey
                                 fname        = c_frgkz.
  ENDIF.
ENDFORM.                    " read_indicator
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.