Code: Alles auswählen.
WHEN 'CHANGE'.
IF flag = ' '.
flag = 'X'.
ELSEIF flag = 'X'.
flag = ' '.
ENDIF.
Code: Alles auswählen.
WHEN 'INSERT'.
APPEND G_TABLE_UMSATZ_WA TO G_TABLE_UMSATZ_ITAB.
Code: Alles auswählen.
WHEN 'DELETE'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TEXTLINE1 = 'Selected rows will be deleted!'
TEXTLINE2 = 'Are you sure?'
TITEL = 'Delete rows'
IMPORTING
answer = confirmation.
IF CONFIRMATION = 'G'.
* delete ZGUI_UMSATZ FROM TABLE G_TABLE_UMSATZ_ITAB.
delete TABLE G_TABLE_UMSATZ_ITAB FROM G_TABLE_UMSATZ_WA.
ENDIF.
Mondhund76 hat geschrieben:Ich schäme mich auch ganz arg, dass ich das nicht hinbekomme, aber mein FRUST ist größer.
Code: Alles auswählen.
LOOP AT SCREEN.
IF screen-group1 = 'MOD'.
IF flag = ' '.
screen-input = '0'.
ELSEIF flag = 'X'.
screen-input = '1'.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Code: Alles auswählen.
WHEN 'CHANGE'.
IF flag = ' '.
flag = 'X'.
ELSEIF flag = 'X'.
flag = ' '.
ENDIF.
Code: Alles auswählen.
IF G_TABLE_UMSATZ_COPIED IS INITIAL.
*&SPWIZARD: COPY DDIC-TABLE 'ZGUI_UMSATZ'
*&SPWIZARD: INTO INTERNAL TABLE 'g_TABLE_UMSATZ_itab'
SELECT * FROM ZGUI_UMSATZ
INTO CORRESPONDING FIELDS
OF TABLE G_TABLE_UMSATZ_ITAB.
G_TABLE_UMSATZ_COPIED = 'X'.
REFRESH CONTROL 'TABLE_UMSATZ' FROM SCREEN '0001'.
ENDIF.
DESCRIBE TABLE G_TABLE_UMSATZ_ITAB.
Code: Alles auswählen.
TABLES: ZGUI_UMSATZ.
*&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'TABLE_UMSATZ'
TYPES: BEGIN OF T_TABLE_UMSATZ,
JAHR LIKE ZGUI_UMSATZ-JAHR,
MONAT LIKE ZGUI_UMSATZ-MONAT,
UMSATZ2011 LIKE ZGUI_UMSATZ-UMSATZ2011,
UMSATZ2012 LIKE ZGUI_UMSATZ-UMSATZ2012,
END OF T_TABLE_UMSATZ.
*&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'TABLE_UMSATZ'
DATA:
* G_TABLE_UMSATZ_ITAB TYPE T_TABLE_UMSATZ OCCURS 0,
* G_TABLE_UMSATZ_WA TYPE T_TABLE_UMSATZ. "work area
G_TABLE_UMSATZ_ITAB type table of T_TABLE_UMSATZ,
G_TABLE_UMSATZ_WA LIKE LINE OF G_TABLE_UMSATZ_ITAB. "work area
DATA: G_TABLE_UMSATZ_COPIED. "copy flag
Code: Alles auswählen.
DESCRIBE TABLE G_TABLE_UMSATZ_ITAB LINES G_TABLE_UMSATZ_WA.
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report Z_GUI_SCENARIO_POPUP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_GUI_SCENARIO_POPUP.
INCLUDE Z_INCLUDE_PARAMETER.
INCLUDE Z_INCLUDE_SCREEN.
*&SPWIZARD: OUTPUT MODULE FOR TC 'TABLE_UMSATZ'. DO NOT CHANGE THIS LINE
*&SPWIZARD: COPY DDIC-TABLE TO ITAB
MODULE TABLE_UMSATZ_INIT OUTPUT.
INCLUDE Z_INCLUDE_SET_GUIS.
INCLUDE Z_INCLUDE_SCREEN_MODUS.
IF G_TABLE_UMSATZ_COPIED IS INITIAL.
*&SPWIZARD: COPY DDIC-TABLE 'ZGUI_UMSATZ'
*&SPWIZARD: INTO INTERNAL TABLE 'g_TABLE_UMSATZ_itab'
SELECT * FROM ZGUI_UMSATZ
INTO CORRESPONDING FIELDS
OF TABLE G_TABLE_UMSATZ_ITAB.
G_TABLE_UMSATZ_COPIED = 'X'.
REFRESH CONTROL 'TABLE_UMSATZ' FROM SCREEN '0001'.
ENDIF.
DESCRIBE TABLE G_TABLE_UMSATZ_ITAB.
ENDMODULE.
*&SPWIZARD: OUTPUT MODULE FOR TC 'TABLE_UMSATZ'. DO NOT CHANGE THIS LINE
*&SPWIZARD: MOVE ITAB TO DYNPRO
MODULE TABLE_UMSATZ_MOVE OUTPUT.
MOVE-CORRESPONDING G_TABLE_UMSATZ_WA TO ZGUI_UMSATZ.
ENDMODULE.
*&SPWIZARD: INPUT MODULE FOR TC 'TABLE_UMSATZ'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MODIFY TABLE
MODULE TABLE_UMSATZ_MODIFY INPUT.
MOVE-CORRESPONDING ZGUI_UMSATZ TO G_TABLE_UMSATZ_WA.
MODIFY G_TABLE_UMSATZ_ITAB
FROM G_TABLE_UMSATZ_WA
INDEX TABLE_UMSATZ-CURRENT_LINE.
ENDMODULE.
INCLUDE Z_INCLUDE_PARAMETERS.
*&---------------------------------------------------------------------*
*& Module PAI_EVENTS INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE PAI_EVENTS INPUT.
CASE g_ok_code.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
* CALL FUNCTION 'COPO_POPUP_TO_GOON'
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TEXTLINE1 = 'Any modifications will be lost!'
TEXTLINE2 = 'Are you sure?'
TITEL = 'Exit The Program'
IMPORTING
answer = confirmation.
if confirmation = 'G'.
LEAVE PROGRAM.
ENDIF.
WHEN 'RETURN'.
LEAVE PROGRAM.
WHEN 'SAVE'.
PERFORM modify_changes.
WHEN 'DELETE'.
CALL FUNCTION 'COPO_POPUP_TO_GOON'
EXPORTING
TEXTLINE1 = 'Selected rows will be deleted!'
TEXTLINE2 = 'Are you sure?'
TITEL = 'Delete rows'
IMPORTING
answer = confirmation.
IF CONFIRMATION = 'G'.
* delete ZGUI_UMSATZ FROM TABLE G_TABLE_UMSATZ_ITAB.
delete TABLE G_TABLE_UMSATZ_ITAB FROM G_TABLE_UMSATZ_WA.
ENDIF.
WHEN 'CHANGE'.
IF flag = ' '.
flag = 'X'.
ELSEIF flag = 'X'.
flag = ' '.
ENDIF.
WHEN 'INSERT'.
* CLEAR g_ok_code.
* CLEAR G_TABLE_UMSATZ_WA.
APPEND G_TABLE_UMSATZ_WA TO G_TABLE_UMSATZ_ITAB.
ENDCASE.
CLEAR g_ok_code.
ENDMODULE. " PAI_EVENTS INPUT
*&---------------------------------------------------------------------*
*& Form MODIFY_CHANGES
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM MODIFY_CHANGES .
modify ZGUI_UMSATZ from table G_TABLE_UMSATZ_ITAB.
commit work.
ENDFORM. " MODIFY_CHANGES
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Include Z_INCLUDE_PARAMETER
*&---------------------------------------------------------------------*
***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'TABLE_UMSATZ'
*&SPWIZARD: DEFINITION OF DDIC-TABLE
TABLES: ZGUI_UMSATZ.
*&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'TABLE_UMSATZ'
TYPES: BEGIN OF T_TABLE_UMSATZ,
JAHR LIKE ZGUI_UMSATZ-JAHR,
MONAT LIKE ZGUI_UMSATZ-MONAT,
UMSATZ2011 LIKE ZGUI_UMSATZ-UMSATZ2011,
UMSATZ2012 LIKE ZGUI_UMSATZ-UMSATZ2012,
END OF T_TABLE_UMSATZ.
*&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'TABLE_UMSATZ'
DATA:
* G_TABLE_UMSATZ_ITAB TYPE T_TABLE_UMSATZ OCCURS 0,
* G_TABLE_UMSATZ_WA TYPE T_TABLE_UMSATZ. "work area
G_TABLE_UMSATZ_ITAB type table of T_TABLE_UMSATZ,
G_TABLE_UMSATZ_WA LIKE LINE OF G_TABLE_UMSATZ_ITAB. "work area
DATA: G_TABLE_UMSATZ_COPIED. "copy flag
DATA: CONFIRMATION.
*&SPWIZARD: DECLARATION OF TABLECONTROL 'TABLE_UMSATZ' ITSELF
CONTROLS: TABLE_UMSATZ TYPE TABLEVIEW USING SCREEN 0001.
DATA: G_OK_CODE LIKE sy-ucomm.
DATA flag(1) TYPE c.
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Include Z_INCLUDE_SCREEN
*&---------------------------------------------------------------------*
START-OF-SELECTION.
CALL SCREEN 0001.
Code: Alles auswählen.
LOOP AT SCREEN.
IF screen-group1 = 'MOD'.
IF flag = ' '.
screen-input = '0'.
ELSEIF flag = 'X'.
screen-input = '1'.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Code: Alles auswählen.
SET PF-STATUS 'GUI_STATUS'.
SET TITLEBAR 'MAIN_TITLE'.
Code: Alles auswählen.
PROCESS BEFORE OUTPUT.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TABLE_UMSATZ'
MODULE TABLE_UMSATZ_INIT.
*&SPWIZARD: MODULE TABLE_UMSATZ_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TABLE_UMSATZ_CHANGE_COL_ATTR.
LOOP AT G_TABLE_UMSATZ_ITAB
INTO G_TABLE_UMSATZ_WA
WITH CONTROL TABLE_UMSATZ
CURSOR TABLE_UMSATZ-CURRENT_LINE.
*&SPWIZARD: MODULE TABLE_UMSATZ_CHANGE_FIELD_ATTR
MODULE TABLE_UMSATZ_MOVE.
ENDLOOP.
* MODULE STATUS_0001.
*
PROCESS AFTER INPUT.
MODULE PAI_EVENTS.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TABLE_UMSATZ'
LOOP AT G_TABLE_UMSATZ_ITAB.
CHAIN.
FIELD ZGUI_UMSATZ-JAHR.
FIELD ZGUI_UMSATZ-MONAT.
FIELD ZGUI_UMSATZ-UMSATZ2011.
FIELD ZGUI_UMSATZ-UMSATZ2012.
MODULE TABLE_UMSATZ_MODIFY ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
*&SPWIZARD: MODULE TABLE_UMSATZ_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TABLE_UMSATZ_CHANGE_COL_ATTR.
* MODULE USER_COMMAND_0001.
Code: Alles auswählen.
DESCRIBE TABLE G_TABLE_UMSATZ_ITAB LINES TABLE_UMSATZ-LINES.
Code: Alles auswählen.
delete G_TABLE_UMSATZ_ITAB.
Code: Alles auswählen.
delete G_TABLE_UMSATZ_ITAB where MARK eq 'X'.
Code: Alles auswählen.
ld_index = sy-stepl + (CONTROL-TOP_LINE - 1).
Code: Alles auswählen.
get cursor LINE sy-stepl.
ld_index = sy-stepl + (CONTROL-TOP_LINE - 1).
Code: Alles auswählen.
delete TABLE G_TABLE_UMSATZ_ITAB FROM G_TABLE_UMSATZ_WA.
delete ZGUI_UMSATZ FROM G_TABLE_UMSATZ_WA.
Code: Alles auswählen.
DELETE G_TABLE_UMSATZ_ITAB WHERE MARK EQ 'X'
Code: Alles auswählen.
DELETE G_TABLE_UMSATZ_ITAB WHERE FLAG EQ 'X'
Code: Alles auswählen.
FIELD-SYMBOLS: <L_LINE_UMSATZ_WA> LIKE LINE OF G_TABLE_UMSATZ_ITAB.
LOOP AT G_TABLE_UMSATZ_ITAB ASSIGNING <L_LINE_UMSATZ_WA> WHERE FLAG EQ 'X'.
DELETE ZGUI_UMSATZ FROM <L_LINE_UMSATZ_WA>.
DELETE G_TABLE_UMSATZ_ITAB.
ENDLOOP.