*----------------------------------------------------------------------*
* Definition der ITEM-Tabelle (Zeilen der Grafik)
*----------------------------------------------------------------------*
DATA: BEGIN OF ITEM OCCURS 1.
INCLUDE STRUCTURE GGAIT.
DATA: NEWNUM LIKE SY-TABIX, "// for moving ITEMS
MODIF(1), "// `X` (change), 'D' (delete)
END OF ITEM.
*----------------------------------------------------------------------*
* Definition der ELEM-Tabelle (Objekte in der Grafik)
*----------------------------------------------------------------------*
DATA: BEGIN OF ELEM OCCURS 1.
INCLUDE STRUCTURE GGAEL.
DATA: TBEG TYPE T, "// not send
MODIF(1), "// 'X' = modif, 'D' = deleted
END OF ELEM.
DATA: BEGIN OF LGEL OCCURS 1.
INCLUDE STRUCTURE GGAEL.
DATA: END OF LGEL.
DATA: BEGIN OF DFEL OCCURS 1.
INCLUDE STRUCTURE GGAEL.
DATA: END OF DFEL.
*----------------------------------------------------------------------*
* Definition der MIST-Tabelle (Objekte in der Grafik)
*----------------------------------------------------------------------*
DATA: BEGIN OF MIST OCCURS 1.
INCLUDE STRUCTURE GGAMI.
DATA: TBEG TYPE T, "// not send
MODIF(1), "// 'X' = modif, 'D' = deleted
END OF MIST.
DATA: BEGIN OF LGMS OCCURS 1.
INCLUDE STRUCTURE GGAMI.
DATA: END OF LGMS.
DATA: BEGIN OF DFMS OCCURS 1.
INCLUDE STRUCTURE GGAMI.
DATA: END OF DFMS.
*----------------------------------------------------------------------*
* Definition der Rueckmeldetabelle (MUSS IMMER GENAUSO SEIN!!)
*----------------------------------------------------------------------*
DATA: BEGIN OF BACK OCCURS 1.
INCLUDE STRUCTURE GGABA.
DATA: END OF BACK.
*----------------------------------------------------------------------*
* Weitere Deklarationen
*----------------------------------------------------------------------*
DATA: DATE_NULL TYPE D VALUE '18991230'. "// GL 30.8.1993
DATA: GANTT_STAT, DAYS(3).
DATA: TABIX LIKE SY-TABIX,
TAB_INDEX LIKE SY-TABIX.
DATA: T TYPE T,
D TYPE D.
DATA C(10).
DATA: M_TYP(1), G_TYP(1), CUA_ID(10). "// Dialog-Rueckmeldung
DATA ITEMNO TYPE P.
*------------------------------*
* Meldung von Grafik auswerten *
*------------------------------*
IF M_TYP = 'D'. EXIT. ENDIF. "// Grafik geschlossen
CASE G_TYP.
WHEN 'C'. "// Pickup, ignore
WHEN 'U'. "// Timer, ignore
WHEN 'S'. "// Save, exit Dialogloop
EXIT.
WHEN '0'. "// CUA-Actionbar
"// CUA_ID contains ACT_ID
"// will not happen
WHEN '1'. "// CUA-Helprequest
"// not yet
"// will not happen
WHEN '2'. "// CUA-Helpline
"// CUA_ID contains ACTSTRING
"// will not happen
ENDCASE.
ENDDO. "// DialogLoop
* Close will do nothing, if already closed 6.6.92
CALL FUNCTION 'GRAPH_DIALOG'
EXPORTING
CLOSE = 'X'.
* Um mehrfaches Sichern verarbeiten zu koennen, werden die
* Elemente, Meilensteine und Items nicht wirklich in der
* Ausgangstabelle geloescht, sondern nur als geloescht
* gekennzeichnet (ELEM-MODIF = 'D')
* Vor dem naechsten Nachladen der Grafik muessen diese
* Elemente aber wirklich aus den entsprechenden
* Tabellen geloescht werden, damit wieder ein eindeutiger
* Bezug zwischen den internen Nummern der Objekte im
* Grafikprogramm und der entsprechenden Tabellenzeile
* hergestellt werden kann. (PERFORM PACK)
* Merge BACK to Original Data
* Mark changes
LOOP AT BACK.
IF BACK-OBJ = 'E'. "// ELEMENTS
CASE BACK-ACT.
WHEN 'M'. "// Move
TABIX = BACK-ELM.
READ TABLE ELEM INDEX TABIX.
ELEM-MODIF = 'X'.
ELEM-TBEG = BACK-BEG - ( ( BACK-DAT - DATE_NULL ) * 86400 ).
ELEM-BEG = BACK-BEG.
ELEM-TXT = BACK-TXT.
ELEM-DUR = BACK-DUR.
ELEM-ITEMNO = BACK-ITM.
MODIFY ELEM INDEX TABIX.
DELETE BACK.
WHEN 'A'. "// Edit (Length etc)
TABIX = BACK-ELM.
READ TABLE ELEM INDEX TABIX.
ELEM-MODIF = 'X'.
ELEM-TBEG = BACK-BEG - ( ( BACK-DAT - DATE_NULL ) * 86400 ).
ELEM-BEG = BACK-BEG.
ELEM-TXT = BACK-TXT.
ELEM-DUR = BACK-DUR.
ELEM-ITEMNO = BACK-ITM.
MODIFY ELEM INDEX TABIX.
DELETE BACK.
WHEN 'I'. "// Insert New
ELEM-MODIF = 'X'.
ELEM-TBEG = BACK-BEG - ( ( BACK-DAT - DATE_NULL ) * 86400 ).
ELEM-BEG = BACK-BEG.
ELEM-TXT = BACK-TXT.
ELEM-DUR = BACK-DUR.
ELEM-ITEMNO = BACK-ITM.
APPEND ELEM.
DELETE BACK.
WHEN 'D'. "// Delete Element
TABIX = BACK-ELM.
READ TABLE ELEM INDEX TABIX.
ELEM-MODIF = 'D'.
MODIFY ELEM INDEX TABIX.
DELETE BACK.
ENDCASE.
ENDIF. "// ELEMENTS
IF BACK-OBJ = 'I'. "// ITEMS
CASE BACK-ACT.
WHEN 'A'. "// Abaendern ohne Move -> nur text
TABIX = BACK-ITM.
READ TABLE ITEM INDEX TABIX.
ITEM-MODIF = 'X'.
ITEM-ITEXT = BACK-TXT.
MODIFY ITEM INDEX TABIX.
DELETE BACK.
WHEN 'I'. "// Insert -> neue nummer durch append
ITEM-MODIF = 'N'.
ITEM-ITEXT = BACK-TXT.
APPEND ITEM.
DELETE BACK.
WHEN 'M'. "// Move -> vertauschen der Reihefolge extra
"// ITM : alte nummer, ELM : neue Nummer
TABIX = BACK-ITM.
READ TABLE ITEM INDEX TABIX.
ITEM-NEWNUM = BACK-ELM.
IF BACK-ITM NE BACK-ELM.
IF ITEM-MODIF NE 'N'. "// save 'NEW'-Info
ITEM-MODIF = 'M'. "// Marker fuer Pack
"// nothing to do
ENDIF.
MODIFY ITEM INDEX TABIX.
ELSE.
"// unchanged item
"// inserting Items reports
"// ALL items
"// this is not an error
"// just ignore it
ENDIF.
DELETE BACK.
WHEN 'D'. "// Delete -> ELEM und MIST extra geloescht
TABIX = BACK-ITM.
READ TABLE ITEM INDEX TABIX.
ITEM-MODIF = 'D'.
MODIFY ITEM INDEX TABIX.
DELETE BACK.
ENDCASE.
ENDIF. "// ITEMS
* DELETE BACK. "// global fuer alle Faelle
ENDLOOP.
* Reorg ELEM after ITEM-Move
LOOP AT ELEM.
TABIX = ELEM-ITEMNO.
READ TABLE ITEM INDEX TABIX.
IF ITEM-MODIF = 'M' OR ITEM-MODIF EQ 'N'.
ELEM-ITEMNO = ITEM-NEWNUM.
MODIFY ELEM.
ENDIF.
ENDLOOP.
* Reorg MIST after ITEM-Move
LOOP AT MIST.
TABIX = MIST-ITEMNO.
READ TABLE ITEM INDEX TABIX.
IF ITEM-MODIF = 'M' OR ITEM-MODIF EQ 'N'.
MIST-ITEMNO = ITEM-NEWNUM.
MODIFY MIST.
ENDIF.
ENDLOOP.
LOOP AT ITEM. "// Bewirkt eindeutiges Sort fuer Merge/Reorder
IF ITEM-MODIF = 'M' OR ITEM-MODIF EQ 'N'.
"// hat schon neue Nummer
ELSE.
ITEM-NEWNUM = SY-TABIX. "// aktuelle Nummer
MODIFY ITEM.
ENDIF.
ENDLOOP.
SORT ITEM BY NEWNUM.
* End of Merge
* Changes are marked
PERFORM AUSGABE.
SET PF-STATUS 'GRAF'.
* Clear Markers
* Delete physically
PERFORM PACK.
*---------------------------------------------------------------------*
* FORM AUSGABE *
*---------------------------------------------------------------------*
* text *
*---------------------------------------------------------------------*
* Keine USING-Parameter *
*---------------------------------------------------------------------*
FORM AUSGABE.
DETAIL.
TAB_INDEX = 0.
LOOP AT ITEM.
TAB_INDEX = TAB_INDEX + 1.
CASE ITEM-MODIF.
WHEN SPACE.
WRITE: / ITEM-ITEXT.
WHEN 'X'.
WRITE: / ITEM-ITEXT INPUT ON.
WHEN 'M'.
WRITE: / ITEM-ITEXT, TEXT-SOR INPUT ON.
WHEN 'N'.
WRITE: / ITEM-ITEXT, TEXT-NEW INPUT ON.
WHEN 'D'.
WRITE: TEXT-DEL INPUT ON.
ENDCASE.
LOOP AT ELEM.
* ONLY IF SORTED
* IF ELEM-ITEMNO GT TAB_INDEX.
* EXIT.
* ENDIF.
IF ELEM-ITEMNO EQ TAB_INDEX.
D = ( ( ELEM-BEG - ELEM-TBEG ) / 86400 ) + DATE_NULL.
T = ELEM-DUR.
DAYS = ( ELEM-DUR - T ) / 86400.
CASE ELEM-MODIF.
WHEN 'X'.
WRITE: /2 ELEM-TXT(29) INPUT ON.
MOVE D TO C.
WRITE C USING EDIT MASK '____.__.__' INPUT ON.
MOVE ELEM-TBEG TO C.
WRITE: C USING EDIT MASK '__:__:__' INPUT ON.
IF DAYS = 0.
WRITE: ' 0' INPUT ON, ':' INPUT ON.
ELSE.
WRITE: DAYS INPUT ON, ':' INPUT ON.
ENDIF.
MOVE T TO C.
WRITE: C USING EDIT MASK '__:__:__' INPUT ON.
WHEN 'D'.
WRITE: /2 TEXT-DEL INPUT ON.
WHEN SPACE.
WRITE: /2 ELEM-TXT(29).
MOVE D TO C.
WRITE C USING EDIT MASK '____.__.__'.
MOVE ELEM-TBEG TO C.
WRITE: C USING EDIT MASK '__:__:__'.
IF DAYS = 0.
WRITE: ' 0', ':'.
ELSE.
WRITE: DAYS, ':'.
ENDIF.
MOVE T TO C.
WRITE: C USING EDIT MASK '__:__:__'.
WHEN OTHERS.
ENDCASE.
ENDIF.
ENDLOOP.
LOOP AT MIST.
IF MIST-ITEMNO EQ TAB_INDEX.
D = ( ( MIST-BEG - MIST-TBEG ) / 86400 ) + DATE_NULL.
CASE MIST-MODIF.
WHEN 'X'.
WRITE: /2 MIST-TXT(29) INPUT ON.
MOVE D TO C.
WRITE: C USING EDIT MASK '____.__.__' INPUT ON.
MOVE MIST-TBEG TO C.
WRITE: C USING EDIT MASK '__:__:__' INPUT ON.
WHEN 'D'.
WRITE: / TEXT-DEL INPUT ON.
WHEN SPACE.
WRITE: /2 MIST-TXT(29).
MOVE D TO C.
WRITE: C USING EDIT MASK '____.__.__'.
MOVE MIST-TBEG TO C.
WRITE: C USING EDIT MASK'__:__:__'.
ENDCASE.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
* FORM PACK *
*---------------------------------------------------------------------*
* text *
*---------------------------------------------------------------------*
* Keine USING-Parameter *
*---------------------------------------------------------------------*
FORM PACK.
LOOP AT ELEM.
IF ELEM-MODIF = 'D'.
DELETE ELEM.
ELSE.
ELEM-MODIF = SPACE.
MODIFY ELEM.
ENDIF.
ENDLOOP.
LOOP AT MIST.
IF MIST-MODIF = 'D'.
DELETE MIST.
ELSE.
MIST-MODIF = SPACE.
MODIFY MIST.
ENDIF.
ENDLOOP.
LOOP AT ITEM.
IF ITEM-MODIF = 'D'.
DELETE ITEM. "// zugehoerige Elemente schon weg
ENDIF.
IF ITEM-MODIF = 'M'. "// Reihefolgeverschiebung
"// Alle Elemente anpassen
"// Alle Milestones anpassen
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM TOP_TEXT.
*---------------------------------------------------------------------*
* FORM FILL_ELEM
*---------------------------------------------------------------------*
* text *
*---------------------------------------------------------------------*
* AUFNR *
* TEXT *
* BEGIN *
* ENDE *
*---------------------------------------------------------------------*
FORM FILL_ELEM USING TEXT DBEG TBEG DUR UNIT COL SIZE POS.
ELEM-ITEMNO = ITEMNO.
ELEM-TXT = TEXT.
D = DBEG.
T = TBEG.
ELEM-TBEG = T.
ELEM-BEG = ( D - DATE_NULL ) * 86400 + T.
CASE UNIT.
WHEN 'S'.
ELEM-DUR = DUR.
WHEN 'M'.
ELEM-DUR = DUR * 60.
WHEN 'H'.
ELEM-DUR = DUR * 60 * 60.
WHEN 'D'.
ELEM-DUR = DUR * 60 * 60 * 24.
WHEN 'W'.
ELEM-DUR = DUR * 60 * 60 * 24 * 7.
WHEN 'N'.
ELEM-DUR = DUR * 60 * 60 * 24 * 30.
WHEN 'Q'.
ELEM-DUR = DUR * 60 * 60 * 24 * 90.
WHEN 'Y'.
ELEM-DUR = DUR * 60 * 60 * 24 * 365.
ENDCASE.
ELEM-BAKGR = COL.
* ELEM-PLACE = POS.
ELEM-HEIGH = SIZE.
CASE POS.
WHEN 'U'.
ELEM-PLACE = 'ABOVE'.
WHEN 'C'.
ELEM-PLACE = 'CENTER'.
WHEN 'L'.
ELEM-PLACE = 'BELOW'.
ENDCASE.
APPEND ELEM.
ENDFORM.
*---------------------------------------------------------------------*
* FORM TOP_TEXT *
*---------------------------------------------------------------------*
* text *
*---------------------------------------------------------------------*
* Keine USING-Parameter *
*---------------------------------------------------------------------*
FORM TOP_TEXT.
WRITE: /32 TEXT-HEA.
ULINE.
WRITE: / TEXT-PAG.
WRITE: TEXT-DUR.
ULINE.
ENDFORM.
*Text elements
*----------------------------------------------------------
* SEN Test
* ROM Test
* RAM Test
* PAG Test
* P05 Test
* SOR <resorted>
* TIT Test
* T02 Test
* T01 Test
* SPO Test
* HEA Test
* FSR Test
* DUR Duration
* DEL <deleted>
* DBF Football DFB Cup
* LEG Legend
* P04 Test
* P03 Test
* P02 Test
* P01 Tst
* NEW <new>
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 can 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.