09-08-2008 8:43 AM
hi all,
i am working with lists,
i hav basic list and detail list, in basic list i have 4 fields and in basic list i hav 3 fields so how can i display th e detail list pls help me out when i display it displays the basic list so how can i display the detail list pls help me out and this is my code.
hi all,
i am working with lists,
i hav basic list and detail list, in basic list i have 4 fields and in basic list i hav 3 fields so how can i display th e detail list pls help me out when i display it displays the basic list so how can i display the detail list pls help me out and this is my code.
tables: spfli,sflight.
types: BEGIN OF stab,
carrid like spfli-carrid,
connid like spfli-connid,
airpfrom like spfli-airpfrom,
airpto like spfli-airpto,
deptime like spfli-deptime,
end of stab.
data: i_spfli type STANDARD TABLE OF stab.
data: wa_spfli like line of i_spfli.
types: begin of s_flight,
fldate like sflight-fldate,
seatsmax like sflight-seatsmax,
seatsocc like sflight-seatsocc,
end of s_flight.
data: i_sflight type STANDARD TABLE OF s_flight.
data: wa_sflight like line of i_sflight.
endselect.
endif.
START-OF-SELECTION.
select carrid
connid
airpfrom
airpto
deptime
from spfli into CORRESPONDING FIELDS OF TABLE i_spfli.
endselect.
loop at i_spfli into wa_spfli.
write: /
wa_spfli-carrid,
wa_spfli-connid,
wa_spfli-airpfrom,
wa_spfli-airpto,
wa_spfli-deptime.
endloop.
HIDE: wa_spfli-carrid,
wa_spfli-connid.
at LINE-SELECTION.
*
if sy-lsind = 1.
write: text-001,
wa_spfli-carrid,
wa_spfli-connid.
select fldate seatsmax seatsocc from sflight
into CORRESPONDING FIELDS OF TABLE i_sflight
where carrid = wa_spfli-carrid and
connid = wa_spfli-connid.
WRITE: / wa_sflight-fldate,
wa_sflight-seatsmax,
wa_sflight-seatsocc.
endif.
09-08-2008 8:51 AM
Use Hide statement in LOOP and ENDLOOP
loop at i_spfli into wa_spfli.
write: /
wa_spfli-carrid,
wa_spfli-connid,
wa_spfli-airpfrom,
wa_spfli-airpto,
wa_spfli-deptime.
HIDE: wa_spfli-carrid,
wa_spfli-connid.
endloop.
09-08-2008 9:02 AM
Modify these also, No LOOP and ENDLOOP for Secondary list, for i_sflight table
LOOP AT i_spfli INTO wa_spfli.
WRITE: /
wa_spfli-carrid,
wa_spfli-connid,
wa_spfli-airpfrom,
wa_spfli-airpto,
wa_spfli-deptime.
HIDE: wa_spfli-carrid, wa_spfli-connid.
ENDLOOP.
BREAK-POINT.
AT LINE-SELECTION.
IF sy-lsind = 1.
WRITE: text-001,
wa_spfli-carrid,
wa_spfli-connid.
SELECT fldate seatsmax seatsocc FROM sflight
INTO CORRESPONDING FIELDS OF TABLE i_sflight
WHERE carrid = wa_spfli-carrid AND
connid = wa_spfli-connid.
LOOP AT i_sflight INTO wa_sflight.
WRITE: / wa_sflight-fldate,
wa_sflight-seatsmax,
wa_sflight-seatsocc.
ENDLOOP.
09-08-2008 9:26 AM
Hi Kata ,
Try this Code :
*" Table declarations...................................................
TABLES :
spfli, " Flight Schedule
sflight. " Flight
*" Data declarations...................................................
*"--------------------------------------------------------------------*
* Work variables *
*"--------------------------------------------------------------------*
DATA :
w_checkbox TYPE c, " Check Box
w_checkbox1 TYPE c, " Check Box
w_lineno LIKE sy-lilli, " Current Line No
w_lines TYPE i. " No. Of Records in Int.Table
*"--------------------------------------------------------------------*
* Internal table to hold Flight Schedule data *
*"--------------------------------------------------------------------*
DATA :
t_spfli LIKE
STANDARD TABLE
OF spfli.
*"--------------------------------------------------------------------*
* Internal table to hold Flight data *
*"--------------------------------------------------------------------*
DATA :
t_sflight LIKE
STANDARD TABLE
OF sflight.
*"--------------------------------------------------------------------*
* Internal table to hold Function Codes *
*"--------------------------------------------------------------------*
DATA :
t_fcode TYPE TABLE OF sy-ucomm.
*"--------------------------------------------------------------------*
* Structure to hold Function Codes *
*"--------------------------------------------------------------------*
DATA :
fs_fcode LIKE LINE OF t_fcode.
*"--------------------------------------------------------------------*
* TOP-OF-PAGE EVENT *
*"--------------------------------------------------------------------*
TOP-OF-PAGE.
PERFORM top_of_page.
*"--------------------------------------------------------------------*
* TOP-OF-PAGE DURING LINE-SELECTION EVENT *
*"--------------------------------------------------------------------*
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM topofpage_during_linesel.
*"--------------------------------------------------------------------*
* START-OF-SELECTION EVENT *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM fetch_spfli_data.
SET PF-STATUS 'YMENU1'.
DESCRIBE TABLE t_spfli LINES w_lines.
fs_fcode = 'EXIT'.
APPEND fs_fcode TO t_fcode.
fs_fcode = 'SELECT'.
APPEND fs_fcode TO t_fcode.
fs_fcode = 'DESELECT'.
APPEND fs_fcode TO t_fcode.
fs_fcode = 'RETRIEVE'.
APPEND fs_fcode TO t_fcode.
*"--------------------------------------------------------------------*
* AT USER-COMMAND EVENT *
*"--------------------------------------------------------------------*
AT USER-COMMAND.
PERFORM user_command.
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* This Subroutine Performs the Event Top-Of-Page
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM top_of_page .
WRITE :/50 'Flight Schedule Information'(008).
ULINE.
FORMAT COLOR 1.
WRITE :/10 'Carrier ID'(001),
25 'Connection ID'(002) ,
43 'Airport From'(003),
59 'Airport To'(004),
74 'Departure Time'(007),
93 'Arrival Time'(011),
106 space.
ENDFORM. " FORM TOP_OF_PAGE
*&---------------------------------------------------------------------*
*& Form TOPOFPAGE_DURING_LINESEL *
*&---------------------------------------------------------------------*
* This Subroutine Performs the Event Top-Of-Page During Line-Selection *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM topofpage_during_linesel .
IF sy-lsind = 1.
WRITE :/50 'Flight Information'(009).
ULINE.
FORMAT COLOR 1.
WRITE :/10 'Flight Date'(005),
25 'Seats Maximum'(012),
43 'Seats Occupied'(013),
60 space.
ENDIF. " IF SY-LSIND = 1.
ENDFORM. " FORM TOPOFPAGE_DURING_LINESEL
*&---------------------------------------------------------------------*
*& Form fetch_spfli_data *
*&---------------------------------------------------------------------*
* This Subroutine Fetches Data from the Database Table Spfli *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM fetch_spfli_data .
SELECT carrid " Carrier ID
connid " Connection ID
airpfrom " Airport From
airpto " Airport To
deptime " Departure Time
arrtime " Arrival Time
FROM spfli
INTO CORRESPONDING FIELDS OF
TABLE t_spfli.
IF sy-subrc EQ 0.
PERFORM display_spfli_data.
ENDIF. " IF SY-SUBRC EQ 0
ENDFORM. " FORM FETCH_SPFLI_DATA
*&---------------------------------------------------------------------*
*& Form display_spfli_data *
*&---------------------------------------------------------------------*
* This Subroutine Displays Data from the Database Table Spfli *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM display_spfli_data .
SORT t_spfli BY carrid ASCENDING.
LOOP AT t_spfli INTO spfli.
FORMAT COLOR 2.
WRITE :/2 w_checkbox AS CHECKBOX,
spfli-carrid UNDER text-001,
spfli-connid UNDER text-002,
spfli-airpfrom UNDER text-003,
spfli-airpto UNDER text-004,
spfli-deptime UNDER text-007,
spfli-arrtime UNDER text-011.
HIDE : spfli-carrid,
spfli-connid.
ENDLOOP. " LOOP AT T_SPFLI...
ENDFORM. " FORM DISPLAY_SPFLI_DATA
*&---------------------------------------------------------------------*
*& Form USER_COMMAND *
*&---------------------------------------------------------------------*
* This Subroutine performs operations according to the User Command *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM user_command .
CASE sy-ucomm.
WHEN 'SELECT'.
w_checkbox1 = 'X'.
DO w_lines TIMES.
w_lineno = sy-index + 3.
READ LINE w_lineno FIELD VALUE w_checkbox.
IF w_checkbox = '*'.
CONTINUE.
ELSE.
MODIFY LINE w_lineno FIELD VALUE w_checkbox FROM w_checkbox1.
ENDIF. " IF W_CHECKBOX = '*'
ENDDO. " DO W_LINES TIMES.
WHEN 'DESELECT'.
w_checkbox1 = ' '.
DO w_lines TIMES.
w_lineno = sy-index + 3.
READ LINE w_lineno.
IF w_checkbox = '*'.
CONTINUE.
ELSE.
MODIFY LINE w_lineno FIELD VALUE w_checkbox FROM w_checkbox1.
ENDIF. " IF W_CHECKBOX = '*'
ENDDO. " DO W_LINES TIMES.
WHEN 'RETRIEVE'.
w_checkbox = ' '.
DO w_lines TIMES.
w_lineno = sy-index + 3.
READ LINE w_lineno FIELD VALUE w_checkbox INTO w_checkbox.
IF w_checkbox = 'X'.
PERFORM fetch_sflight_data.
PERFORM display_sflight_data.
ENDIF. " IF W_CHECKBOX = 'X'
ENDDO. " DO W_LINES TIMES.
ENDCASE. " CASE SY-UCOMM
ENDFORM. " FORM USER_COMMAND
*&---------------------------------------------------------------------*
*& Form FETCH_SFLIGHT_DATA *
*&---------------------------------------------------------------------*
* This Subroutine Fetches Data from the Database table Sflight *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM fetch_sflight_data .
SELECT carrid " Carrier ID
connid " Connection ID
fldate " Flight Date
seatsmax " Seats Maximum
seatsocc " Seats Occupied
FROM sflight
INTO CORRESPONDING FIELDS OF
TABLE t_sflight
WHERE carrid EQ spfli-carrid
AND connid EQ spfli-connid.
w_checkbox = '*'.
MODIFY LINE w_lineno
FIELD VALUE w_checkbox
FIELD FORMAT w_checkbox INPUT OFF.
ENDFORM. " FORM FETCH_SFLIGHT_DATA
*&---------------------------------------------------------------------*
*& Form display_sflight_data
*&---------------------------------------------------------------------*
* This Subroutine Displays Data from the Database table Sflight *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM display_sflight_data .
SET PF-STATUS space EXCLUDING t_fcode.
LOOP AT t_sflight INTO sflight.
FORMAT COLOR 3 INTENSIFIED OFF.
WRITE 😕 sflight-fldate UNDER text-005,
sflight-seatsmax UNDER text-012,
sflight-seatsocc UNDER text-013,
60 space.
ENDLOOP. " LOOP AT T_SFLIGHT...
ENDFORM. " FORM DISPLAY_SFLIGHT_DATA
This program is used to display Details from Tables SPFLI and SFLIGHT on Basic & Detail List.
Regards,
Swapna.