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

Total value in CO area currency determination



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



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sun Jan 27, 2008 1:50 pm    Post subject: Total value in CO area currency determination Reply with quote

Code:
FUNCTION z_co_kennzahl.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(LCKOKRS) LIKE COEP-KOKRS DEFAULT 'PAWI'
*" VALUE(LNGJAHR) LIKE COSR-GJAHR
*" VALUE(LNPERIO_VON) LIKE COEP-PERIO DEFAULT 1
*" VALUE(LNPERIO_BIS) LIKE COEP-PERIO DEFAULT 12
*" VALUE(LCKSTGRU) LIKE BAPICO_GROUP-GROUPNAME OPTIONAL
*" VALUE(LCKST) LIKE BAPI0012_GEN-COSTCENTER OPTIONAL
*" VALUE(LCSTAGR) LIKE COSR-STAGR
*" VALUE(LLSINGLE_KST) LIKE BAPI0012_GEN-MASTER_DATA_INACTIVE
*" DEFAULT 'X'
*" VALUE(LLDETAIL) LIKE BAPI0012_GEN-MASTER_DATA_INACTIVE OPTIONAL
*" VALUE(LNWRTTP) LIKE COSR-WRTTP DEFAULT 1
*" EXPORTING
*" VALUE(LNWERT) LIKE COEP-WKGBTR
*" TABLES
*" DETAILWERTE STRUCTURE COSR OPTIONAL
*"----------------------------------------------------------------------

* Exporttabelle leeren
  REFRESH: detailwerte .
  CLEAR: lnwert .

  DATA: llcheckperm(1) TYPE c .

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

*Interne Tabelle fьr Kostenstellenselektion
  DATA: BEGIN OF itab_kst OCCURS 30 .
          INCLUDE STRUCTURE bapi1112_values .
  DATA: END OF itab_kst .

*Interne Tabelle mit Knotenpunkten
  DATA: BEGIN OF itab_hie OCCURS 30 .
          INCLUDE STRUCTURE bapiset_hier .
  DATA: END OF itab_hie .

*Interne Tabelle fьr Aufbau der Objektnummer
  DATA: BEGIN OF itab_kstsel OCCURS 30 ,
  sign(1) TYPE c ,
  option(2) TYPE c ,
  low LIKE coep-objnr ,
  high LIKE coep-objnr .
  DATA: END OF itab_kstsel .


  IF llsingle_kst = ' ' .
* Ermitteln der Kostenstellen zur KST-Gruppe
    REFRESH itab_kst .
    CALL FUNCTION 'BAPI_COSTCENTERGROUP_GETDETAIL'
         EXPORTING
              controllingarea = lckokrs
              groupname       = lckstgru
         TABLES
              hierarchynodes  = itab_hie
              hierarchyvalues = itab_kst.


* Fьllen der Selektionstabelle fьr KST
    REFRESH itab_kstsel .
    LOOP AT itab_kst .
      MOVE: 'I' TO itab_kstsel-sign ,
      'BT' TO itab_kstsel-option .
      CONCATENATE 'KS' lckokrs itab_kst-valfrom INTO itab_kstsel-low .
      CONCATENATE 'KS' lckokrs itab_kst-valto INTO itab_kstsel-high .
      APPEND itab_kstsel .
    ENDLOOP .
  ELSE .
    REFRESH itab_kstsel .
    MOVE: 'I' TO itab_kstsel-sign ,
    'EQ' TO itab_kstsel-option .
    CONCATENATE 'KS' lckokrs lckst INTO itab_kstsel-low .
    CONCATENATE 'KS' lckokrs lckst INTO itab_kstsel-high .
    APPEND itab_kstsel .
  ENDIF .


* Abfrage der Kennzahlen
  SELECT * FROM cosr
  WHERE objnr IN itab_kstsel
  AND gjahr = lngjahr
  AND wrttp = lnwrttp
  AND stagr = lcstagr .


* Ermitteln der Summen
    IF 1 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme001 .
    ENDIF .

    IF 2 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme002 .
    ENDIF .

    IF 3 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme003 .
    ENDIF .

    IF 4 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme004 .
    ENDIF .

    IF 5 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme005 .
    ENDIF .

    IF 6 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme006 .
    ENDIF .

    IF 7 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme007 .
    ENDIF .

    IF 8 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme008 .
    ENDIF .

    IF 9 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme009 .
    ENDIF .

    IF 10 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme010.
    ENDIF .

    IF 11 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme011 .
    ENDIF .

    IF 12 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme012 .
    ENDIF .

    IF 13 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme013 .
    ENDIF .

    IF 14 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme014 .
    ENDIF .

    IF 15 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme015 .
    ENDIF .

    IF 16 BETWEEN lnperio_von AND lnperio_bis .
      lnwert = lnwert + cosr-sme016 .
    ENDIF.

    IF lldetail = 'X' .
      MOVE-CORRESPONDING cosr TO detailwerte .
      APPEND detailwerte .
    ENDIF .

  ENDSELECT .
ENDFUNCTION.
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 -> CO 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.