.
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 .
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.