report ZERN_TAW12_WRITE.
* KULANILACAK TABLOLAR
TABLES : sbook ,
sflight ,
scarr .
* 1. EKRANDA YAZILACAK DEGERLER
DATA : BEGIN OF ktab OCCURS 0 ,
a(1) , " Checkbox
carrname LIKE scarr-carrname ,
carrid LIKE scarr-carrid ,
connid LIKE spfli-connid ,
cityfrom LIKE spfli-cityfrom ,
cityto LIKE spfli-cityto ,
END OF ktab.
* 2. EKRANDA YAZILACAK DEGERLER
DATA : BEGIN OF stab OCCURS 0 ,
b(1) , " Checkbox
carrid LIKE spfli-carrid ,
connid LIKE spfli-connid ,
fldate LIKE sflight-fldate ,
seatsmax LIKE sflight-seatsmax ,
seatsocc LIKE sflight-seatsocc ,
END OF stab.
* SPFLI TABLOSUNDAN VERILER ITAB ICERISENE ATILIR
DATA itab LIKE spfli OCCURS 0 WITH HEADER LINE .
DATA rtab LIKE sbook .
SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE text-456.
SELECTION-SCREEN BEGIN OF BLOCK bl1 .
PARAMETERS par1 LIKE sbook-customid.
PARAMETERS par2 LIKE sbook-bookid.
SELECTION-SCREEN END OF BLOCK bl1.
SELECTION-SCREEN END OF SCREEN 123.
AT USER-COMMAND.
IF sy-ucomm EQ 'ARNT'.
PERFORM at_user_command.
PERFORM write_screen.
ELSEIF sy-ucomm EQ 'RZRT'.
PERFORM call_screen.
ENDIF.
* EKRANDAN GIRILECEK OLAN CARRID DEÐERI
PARAMETERS : p_carrid LIKE spfli-carrid.
* START-OF-SELECTION.
START-OF-SELECTION.
* DATABASE TABLOLARINDAN DATA ALIMI
PERFORM get_data.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
FORM get_data.
*BREAK TRAINING .
SELECT * FROM spfli INTO TABLE itab WHERE carrid EQ p_carrid.
LOOP AT itab.
SELECT SINGLE * FROM scarr WHERE carrid EQ itab-carrid.
MOVE : scarr-carrname TO ktab-carrname ,
itab-carrid TO ktab-carrid ,
itab-connid TO ktab-connid ,
itab-cityfrom TO ktab-cityfrom ,
itab-cityto TO ktab-cityto .
APPEND ktab.
ENDLOOP.
SET PF-STATUS 'DE'.
LOOP AT ktab.
WRITE : / ktab-a AS CHECKBOX ,
ktab-carrname ,
ktab-connid ,
ktab-cityfrom ,
ktab-cityto .
HIDE : ktab-a ,
ktab-carrname ,
ktab-connid.
ENDLOOP.
ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Form at_user_command
*&---------------------------------------------------------------------*
FORM at_user_command.
DO .
READ LINE sy-index FIELD VALUE ktab-a .
* SAYFA BITENE KADAR OKU
*------------------------
IF sy-subrc NE 0.
EXIT.
ENDIF.
*------------------------
IF ktab-a EQ 'X'.
LOOP AT ktab WHERE carrname EQ ktab-carrname AND
connid EQ ktab-connid .
MOVE 'X' TO ktab-a .
MODIFY ktab INDEX sy-tabix.
ENDLOOP.
ENDIF.
ENDDO.
ENDFORM. " at_user_command
*&---------------------------------------------------------------------*
*& Form write_screen
*&---------------------------------------------------------------------*
FORM write_screen.
CLEAR ktab.
CLEAR stab.
REFRESH stab.
LOOP AT ktab WHERE a EQ 'X'.
SELECT * FROM sflight APPENDING CORRESPONDING FIELDS OF TABLE stab
WHERE carrid EQ ktab-carrid AND
connid EQ ktab-connid .
ENDLOOP.
SET PF-STATUS 'DE'.
LOOP AT stab.
WRITE : / stab-b AS CHECKBOX ,
stab-carrid ,
stab-connid ,
stab-fldate ,
stab-seatsmax,
stab-seatsocc.
HIDE : stab-b ,
stab-carrid ,
stab-connid ,
stab-fldate .
ENDLOOP.
LOOP AT ktab.
CLEAR ktab-a.
* MOVE ' ' TO ktab-a .
MODIFY ktab INDEX sy-tabix.
ENDLOOP.
ENDFORM. " write_screen
*&---------------------------------------------------------------------*
*& Form call_screen
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM call_screen.
PERFORM set_rez.
CALL SELECTION-SCREEN 123.
PERFORM set_data.
ENDFORM. " call_screen
*&---------------------------------------------------------------------*
*& Form set_rez
*&---------------------------------------------------------------------*
FORM set_rez.
DO .
READ LINE sy-index FIELD VALUE stab-b .
* SAYFA BITENE KADAR OKU
*------------------------
IF sy-subrc NE 0.
EXIT.
ENDIF.
*------------------------
IF stab-b EQ 'X'.
LOOP AT stab WHERE carrid EQ stab-carrid AND
connid EQ stab-connid AND
fldate EQ stab-fldate .
MOVE 'X' TO stab-b .
MODIFY stab INDEX sy-tabix.
ENDLOOP.
ENDIF.
ENDDO.
ENDFORM. " set_rez
*&---------------------------------------------------------------------*
*& Form set_Data
*&---------------------------------------------------------------------*
FORM set_data.
LOOP AT stab WHERE b EQ 'X'.
MOVE : stab-carrid TO rtab-carrid ,
stab-connid TO rtab-connid ,
stab-fldate TO rtab-fldate ,
par1 TO rtab-customid ,
par2 TO rtab-bookid .
* DATABASE TABLOSU OLAN SBOOK VERI EKLENMESI
INSERT INTO sbook VALUES rtab.
ENDLOOP.
LOOP AT stab.
CLEAR stab-b.
* MOVE ' ' TO ktab-a .
MODIFY stab INDEX sy-tabix.
ENDLOOP.
ENDFORM. " set_Data
Hiç yorum yok:
Yorum Gönder