Documente Academic
Documente Profesional
Documente Cultură
htm
IT_MARA1 = MARA
AMBIL IN DARI IT_MARA
SFLIGHT
FLDATE
PRICE
CARRID
CONNID
https://mylearning.accenture.com/
https://blogs.sap.com/2013/02/13/alv-column-editable-colour/
https://archive.sap.com/discussions/thread/736234
https://wiki.scn.sap.com/wiki/display/ABAP/ALV+TUTOTIAL+FOR+BEGINERS+WITH+EXAMPLES
https://savemedia.com
CL_SALV
smartforms
YNR_OT_DOCC
TABLE
YNR_OT_HEADD
CLASS
Y_CL_OVERTIME_WORKFLOWW
ENDCLASS.
METHOD CONSTRUCTOR.
ENDMETHOD.
METHOD GETMODEL.
MODEL = MODEL.
ENDMETHOD.
METHOD GETDISC.
DATA: HASILDISC TYPE N.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA(NEWMOBILE) = NEW ANDROID( MODEL = 'AAASDS'
OS = 'ANDROID KITKAT'
PRICE = 1200000 ).
NEWMOBILE->GETDISC( DISC = 12
PRICE = 121212 ).
ENDCLASS.
METHOD CONSTRUCTOR.
SUPER->CONSTRUCTOR( ).
PINBB = PINBB.
ENDMETHOD.
ENDCLASS.
*==============================
*&---------------------------------------------------------------------*
*& Report ZPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZPSM_000.
END OF ADDRESS.
IF TEMPERATURE = 'C'.
DO 10 TIMES.
TMP = TMP - 1.
ENDDO.
ENDIF.
*WRITE TMP.
ENDFORM.
ENDCLASS.
METHOD CONSTRUCTOR.
ENDMETHOD.
METHOD GETMODEL.
MODEL = MODEL.
ENDMETHOD.
METHOD GETDISC.
ENDMETHOD.
ENDCLASS.
*WRITE:/ 'HASIL :', HASILDISC.
START-OF-SELECTION.
DATA(NEWMOBILE) = NEW ANDROID( MODEL = 'AAASDS'
OS = 'ANDROID KITKAT'
PRICE = 1200000 ).
WRITE:/ NEWMOBILE->GETDISC( DISC = 12
PRICE = 121212 ).
*====================
*not working yet
TRY.
NEWMOBILE->GETDISC( DISC = 12
PRICE = 121212 ).
CATCH CX_ROOT INTO OREF.
ASX = OREF->GET_TEXT( ).
WRITE:/ ASX.
ENDTRY.
DAY 3
===========================================
DATA: I_SFLIGHT TYPE TABLE OF SFLIGHT.
********************************************
*&---------------------------------------------------------------------*
*& Report ZPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZPSM_000.
TYPE-POOLS: SLIS.
DATA : BEGIN OF I_OUTTAB OCCURS 0. INCLUDE STRUCTURE SFLIGHT.
START-OF-SELECTION.
IF SY-SUBRC <> 0.
MESSAGE I000(0K) WITH SY-SUBRC.
ENDIF.
LOOP AT I_OUTTAB WHERE W_CHK = 'X'.
WRITE:/ I_OUTTAB-CARRID, I_OUTTAB-PRICE.
ENDLOOP.
****************************************************
* Populate stat and icon columns of internal table i_tab with specific
* columns and symbols based on some logic for quantity and value fields.
PERFORM SUB_MODIFY_RECORDS.
* struct_layout-hotspot_fieldname = 'X'.
AT LINE-SELECTION.
PERFORM SUB_HOTSPOT.
*&---------------------------------------------------------------------*
*& Form SUB_VARIANT_INIT
*&---------------------------------------------------------------------*
* Display default variant
*----------------------------------------------------------------------*
FORM SUB_VARIANT_INIT.
I_VARIANT1-REPORT = SY-REPID.
* Search default variant for the report
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = 'A'
CHANGING
CS_VARIANT = I_VARIANT1
EXCEPTIONS
NOT_FOUND = 2.
*kALAU DEFAULT VARIANT KETEMU, GUNAKAN SBG DEFAULT
*ELSE, GUNAKAN VARIANT LAYOUT1
IF SY-SUBRC = 0.
P_VAR = I_VARIANT-VARIANT.
ELSE.
P_VAR = 'LAYOUT1'.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------------------
*
*& Form SUB_CHECK_PVAR
*&---------------------------------------------------------------------------------
*
* Once the user has entered variant, check about its existence
*&---------------------------------------------------------------------------------
*
FORM SUB_CHECK_PVAR.
*kALAU AMA VARIABLE GA BLANK, CHECK EXISTENCE
IF NOT P_VAR IS INITIAL.
CLEAR I_VARIANT.
I_VARIANT-REPORT = SY-REPID.
I_VARIANT-VARIANT = P_VAR.
*&---------------------------------------------------------------------*
*& Form SUB_PREPARE_FIELDCATALOG
*&---------------------------------------------------------------------*
* Prepare field catalog for the main report. State the name of
* the field , name of internal table , various formatting options etc
*----------------------------------------------------------------------*
FORM SUB_PREPARE_FIELDCATALOG.
* First field to appear in ALV list
X_FIELDCAT-COL_POS = 1.
* Name of the internal table field
X_FIELDCAT-FIELDNAME = 'SYM'.
* Name of the internal table
X_FIELDCAT-TABNAME = 'I_TAB'.
* Heading for the field
X_FIELDCAT-SELTEXT_M = 'Stat'.
* The field is going to contain a symbol
x_fieldcat-symbol = 'X'.
* Append the specifications to the internal table for field catalog.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
* Second field to appear in ALV list
X_FIELDCAT-COL_POS = 2.
* Name of the field in the internal table
X_FIELDCAT-FIELDNAME = 'MATNR'.
* Name of the internal table
X_FIELDCAT-TABNAME = 'I_TAB'.
* Heading for the column
X_FIELDCAT-SELTEXT_M = 'MatItem'.
* It is going to be the key field.The color for this field is going to
* be different
X_fieldcat-key = 'X'.
X_fieldcat-key_sel = 'X'.
* Single click on the field will trigger double click event.Also, a hand
* will appear when the cursor navigates to the field
X_fieldcat-hotspot = 'X'.
* The column and those left to it will not scroll
X_fieldcat-fix_column = 'X'.
* F1 help will come as it is referenced to DDIC table
x_fieldcat-ref_tabname = 'MSEG'.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 3.
X_FIELDCAT-FIELDNAME = 'MAKTG'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = 'Description'.
* X_FIELDCAT-OUTPUTLEN = 50.
x_fieldcat-hotspot = space.
* The field is centre(C for centre, R and L for left and
* right) justified
x_fieldcat-just = 'C'.
x_fieldcat-key = 'X'.
x_fieldcat-fix_column = 'X'.
* X_fieldcat-no_out = 'X'.
X_fieldcat-fix_column = 'X'.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 4.
X_FIELDCAT-FIELDNAME = 'CHARG'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = 'Batch'.
* X_FIELDCAT-OUTPUTLEN = 10.
x_fieldcat-hotspot = space.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 5.
X_FIELDCAT-FIELDNAME = 'EBELN'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = 'Purchase Order'.
* X_FIELDCAT-OUTPUTLEN = 14.
* The field will be colored differently(Cxyz)
x_fieldcat-emphasize = 'C511'.
* Initially the field will be hidden
x_fieldcat-no_out = 'X'.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 6.
X_FIELDCAT-FIELDNAME = 'MBLNR'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = 'Document no'.
* X_FIELDCAT-OUTPUTLEN = 14.
x_fieldcat-emphasize = 'C711'.
x_fieldcat-no_out = 'X'.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 7.
X_FIELDCAT-FIELDNAME = 'WERKS'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = 'Plant'.
* X_FIELDCAT-OUTPUTLEN = 5.
x_fieldcat-emphasize = 'C310'.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 8.
X_FIELDCAT-FIELDNAME = 'LGORT'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = 'St.Loc'.
* X_FIELDCAT-OUTPUTLEN = 7.
* X_fieldcat-no_out = 'X'.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 9.
X_FIELDCAT-FIELDNAME = 'MENGE'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = 'Quantity'.
X_FIELDCAT-OUTPUTLEN = 12.
* Summation is allowed for this field
x_fieldcat-do_sum = 'X'.
X_FIELDCAT-ref_tabname = 'MSEG'.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 10.
X_FIELDCAT-FIELDNAME = 'ICN'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = ''.
X_FIELDCAT-OUTPUTLEN = 2.
x_fieldcat-icon = 'X'.
* X_fieldcat-no_out = 'X'.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 11.
X_FIELDCAT-FIELDNAME = 'MEINS'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = 'Unit'.
X_FIELDCAT-OUTPUTLEN = 5.
x_fieldcat-qfieldname = 'MEINS'.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 12.
X_FIELDCAT-FIELDNAME = 'DMBTR'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = 'Local curr'.
X_FIELDCAT-OUTPUTLEN = 12.
x_fieldcat-INTTYPE = 'P'.
x_fieldcat-just = 'R'.
x_fieldcat-do_sum = 'X'.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
X_FIELDCAT-COL_POS = 13.
X_FIELDCAT-FIELDNAME = 'EXCPT'.
X_FIELDCAT-TABNAME = 'I_TAB'.
X_FIELDCAT-SELTEXT_M = ''.
X_FIELDCAT-OUTPUTLEN = 3.
append X_fieldcat TO I_FIELDCAT.
clear x_fieldcat.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form SUB_SELECT_RECORD
*&---------------------------------------------------------------------*
* Fetches records from database into table i_tab to be passed as export
* parameter t_outtab in function module : REUSE_ALV_GRID_DISPLAY
*----------------------------------------------------------------------*
form SUB_SELECT_RECORD.
SELECT mblnr A~matnr A~maktg charg
werks lgort menge meins dmbtr ebeln
FROM makt as a join mseg as b
on ( a~matnr = b~matnr )
INTO TABLE I_TAB
where b~bwart = '101' .
endform.
*&---------------------------------------------------------------------*
*& Form SUB_MODIFY_RECORDS
*&---------------------------------------------------------------------*
* Populate stat and icon columns of internal table i_tab with specific
* columns and symbols based on some logic for quantity and value fields.
*----------------------------------------------------------------------*
form SUB_MODIFY_RECORDS.
loop at i_tab.
if i_tab-dmbtr gt 10000.
* Field icn of internal table is going to contain icon . For this column
*icon_allowed is set in the field catalog table. For various icons,see
* type pool <ICON>
i_tab-icn = ''.
modify i_tab transporting icn.
endif.
if i_tab-menge gt 50.
* Field icn of internal table is going to contain symbol . For this
* column symbol_allowed is set in the field catalog table. For various
* icons,see type pool <SYMBOL>
i_tab-sym = 'N'.
modify i_tab transporting sym.
endif.
IF I_TAB-WERKS NE 'SDC1'.
* This field will contain lights , traffic signals : red.yellow,green
* That this field will be used as a light will be specified in the
* column of structure STRUCT_LAYOUT.
I_TAB-EXCPT = '1'.
MODIFY I_TAB TRANSPORTING EXCPT.
endif.
endloop.
endform. " SUB_MODIFY_RECORDS
*&---------------------------------------------------------------------*
*& Form SUB_DETERMINE_ALV_LAYOUT *
*&---------------------------------------------------------------------*
*& Defines the overall structure of the report layout *
*----------------------------------------------------------------------*
form SUB_DETERMINE_ALV_LAYOUT.
* Field EXCPT will show the light signal
STRUCT_LAYOUT-LIGHTS_FIELDNAME = 'EXCPT'.
* Field BOS of the internal table will act as pushbutton and will appear
* at the left of the grid display. User will press that to select a
* record
struct_layout-box_fieldname = 'BOX'.
STRUCT_layout-totals_text = 'Totqty '.
STRUCT_LAYOUT-ZEBRA = 'X'.
struct_layout-confirmation_prompt = 'X'.
struct_layout-detail_titlebar = 'Details of Storing'.
struct_layout-no_sumchoice = 'X'.
struct_layout-totals_only = 'X'.
endform.
*&---------------------------------------------------------------------*
*& Form SUB_DETERMINE_SORT_SEQUENCE
*&---------------------------------------------------------------------*
* Defines the sort sequence of the report
*----------------------------------------------------------------------*
form SUB_DETERMINE_SORT_SEQUENCE.
X_sort-spos = 1. " Sort order
X_sort-fieldname = 'MATNR'.
X_sort-tabname = 'I_TAB'.
X_sort-up = 'X'.
X_sort-subtot = 'X'. " Sub total allowed
append X_sort TO IT_SORT.
clear X_sort.
endform.
*&---------------------------------------------------------------------*
*& Form SUB_SHOW_ALV_LIST
*&---------------------------------------------------------------------*
* Shows ALV list in grid form
*----------------------------------------------------------------------*
form SUB_SHOW_ALV_LIST.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID "* Name of the program
I_GRID_TITLE = 'Details of Storing'
"* title
I_callback_pf_status_set = 'PF_STATUS_SET' "* calls
subroutine : PF_STATUS_SET
i_callback_user_command = 'USER_COMMAND' "* Calls subroutine
: user_command
IS_LAYOUT = STRUCT_LAYOUT "*
Overall structure of the report
IT_FIELDCAT = I_FIELDCAT
"* Passes the field catg internal table
IT_SORT = IT_SORT
"* Passes the sort sequence internal table
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT = i_variant1
* fetches different events into internal table i_events
it_events = i_events[]
TABLES
* Passes data table for ALV display
T_OUTTAB = I_TAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " SUB_SHOW_ALV_LIST
*&---------------------------------------------------------------------*
*& Form set_status
*&---------------------------------------------------------------------*
* Form used to set the Custom pf-status of the List Display
*----------------------------------------------------------------------*
* rt_extab :
*----------------------------------------------------------------------*
FORM pf_status_set USING i_rt_extab TYPE slis_t_extab.
data : x_extab type slis_extab.
x_extab-fcode = '&LFO'.
append x_extab to i_rt_extab.
* Pf-status STANDARD of program SAPLSALV is copied to ZSTANDARD of the
* current program and the pushbutton for Information (okcode=&LFO) is
* excluded
SET PF-STATUS 'ZSTANDARD' excluding i_rt_extab .
ENDFORM.
*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
* Form used to handle USER_COMMAND events
*----------------------------------------------------------------------*
* rf_ucomm: Function Code
* rs : Internal Table containing the selection information.
*----------------------------------------------------------------------*
FORM user_command USING rf_ucomm LIKE sy-ucomm
rs TYPE slis_selfield.
data : v_mblnr like mseg-mblnr.
case rf_ucomm.
* A custom pushbutton for record deletion is set in the GUI status. When a record
is selected , the field BOC for that *record becomes 'X'.
* The records are traced and deleted and the fields are refreshed( rs of type
slis_selfield is refreshed)
when '&DEL'. "Print button clicked.
delete i_tab where box = 'X'.
rs-refresh = 'X'.
* When the user selects a row and presses the Select pushbutton ( user defined )
from the application toolbar, the details * of the document will be shown in
another ALV list
when '&SEL'.
PERFORM SUB_SELECT_DOCUMENT.
* set parameter id 'MBN' field i_tab-mblnr.
* call transaction 'MB03'.
* Ok code for double click is &IC1 for ALV report
when '&IC1'.
perform sub_hotspot.
endcase.
ENDFORM.
form SUB_HOTSPOT.
message i398(00) with 'Hello'.
endform. " SUB_HOTSPOT
*&---------------------------------------------------------------------*
*& Form SUB_VARIANT_F4
*&---------------------------------------------------------------------*
* Display a list of various variants of the report when the user presses F4 key in
the variant field
*------------------------------------------------------------------------*
form SUB_VARIANT_F4.
i_variant-report = sy-repid.
* Utilising the name of the report , this function module will search for a list of
variants and will fetch the selected one * into the parameter field for variants
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = I_VARIANT
I_SAVE = 'A'
I_DISPLAY_VIA_GRID = 'X'
IMPORTING
ES_VARIANT = I_VARIANT1
EXCEPTIONS
NOT_FOUND = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC = 0.
P_VAR = I_VARIANT1-VARIANT.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form SUB_SELECT_DOCUMENT
*&---------------------------------------------------------------------*
form SUB_SELECT_DOCUMENT.
data : v_lines type i .
read table i_tab with key box = 'X'.
Select * from mseg INTO TABLE I_DOC WHERE MBLNR = I_TAB-MBLNR.
IF SY-SUBRC EQ 0 .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'I_DOC'
I_STRUCTURE_NAME = 'MSEG'
CHANGING
CT_FIELDCAT = I_FIELDCAT1
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
clear struct_layout1.
STRUCT_layout1-colwidth_optimize = 'X'.
refresh it_sort.
clear it_sort.
*&---------------------------------------------------------------------*
*& Form SUB_COMMENT_BUILD
*&---------------------------------------------------------------------*
form SUB_COMMENT_BUILD using I_top_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
***Header
CLEAR ls_line.
ls_line-typ = 'H'.
* LS_LINE-KEY: not used for this type
ls_line-info = 'Heading list'.
APPEND ls_line TO I_top_of_page.
***Selection
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Key 1'.
ls_line-info = 'Material '.
APPEND ls_line TO i_top_of_page.
ls_line-key = 'Key 2'.
ls_line-info = 'Document no'.
APPEND ls_line TO I_top_of_page.
***Action
CLEAR ls_line.
endform.
*&---------------------------------------------------------------------*
*& Form SUB_EVENTTAB_BUILD
*&---------------------------------------------------------------------*
* Defines the event table
*&---------------------------------------------------------------------*
FORM sub_eventtab_build USING l_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
* Get the different events of the ALV
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = l_events.
* Search the top of page events
READ TABLE l_events WITH KEY name = slis_ev_top_of_page INTO ls_event.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO l_events.
ENDIF.
endform.
*&---------------------------------------------------------------------*
* FORM TOP_OF_PAGE *
*&---------------------------------------------------------------------*
* When TOP-OF-PAGE will be fired , this event will be called and it
* will use the contents of i_list_top_of_page for output in the header
*&---------------------------------------------------------------------*
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = i_list_top_of_page.
ENDFORM.
*******************************************************
*&---------------------------------------------------------------------*
*& Report ZPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZPSM_000.
DATA:
GT_DATA TYPE TABLE OF SFLIGHT,
G_GRID TYPE REF TO CL_GUI_ALV_GRID.
CONSTANTS:
C_MAX_ROWS TYPE I VALUE 100.
FORM READ_DATA.
SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_DATA
FROM SFLIGHT
UP TO C_MAX_ROWS ROWS.
ENDFORM.
FORM DISPLAY_GRID.
CREATE OBJECT G_GRID
EXPORTING
I_PARENT = CL_GUI_CONTAINER=>DEFAULT_SCREEN.
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
CHANGING
IT_OUTTAB = GT_DATA
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV4.
ENDIF.
ENDFORM.
******************************************
*&---------------------------------------------------------------------*
*& Report ZPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZPSM_000.
DATA:
GT_DATA TYPE TABLE OF SFLIGHT
,G_GRID TYPE REF TO CL_GUI_ALV_GRID
.
PARAMETERS:
MROWS TYPE I
,LDT TYPE SY-DATUM
,HDT TYPE SY-DATUM DEFAULT SY-DATUM.
TABLES: sflight.
END OF ty_outtab.
FROM sflight
INTO TABLE gt_outtab
WHERE fldate IN s_fldate
.
cl_salv_table=>factory(
EXPORTING
list_display = 'X'
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = gt_outtab ).
gr_table->set_screen_popup(
start_column = 1
end_column = 100
start_line = 1
end_line = 20 ).
lr_selections = gr_table->get_selections( ).
lr_selections->set_selection_mode(
if_salv_c_selection_mode=>row_column ).
gr_table->display( ).
**********************************************************************
REPORT YYPSM_000.
START-OF-SELECTION.
***********************************************************************
REPORT YYPSM_000.
START-OF-SELECTION.
RESULT = 3 - P_NUM * Q_NUM.
WRITE:/ 'HASIL = ', RESULT.
***********************************************************************
REPORT YYPSM_000.
START-OF-SELECTION.
CONCATENATE sy-datum sy-uzeit INTO v_timestamp_string.
v_timestamp = v_timestamp_string.
**********************************************************************
REPORT YYPSM_000.
DATA: VOWELS_COUNT TYPE I
,VOWELS_TOT TYPE I
,VUSER TYPE SY-UNAME
,IVUSER TYPE I
.
START-OF-SELECTION.
IVUSER = STRLEN( SY-UNAME ).
TRANSLATE VUSER TO UPPER CASE.
WRITE IVUSER.
**********************************************************************
REPORT YYPSM_000.
DATA: number type i value 1.
START-OF-SELECTION.
while number <= 100.
if number mod 8 = 0.
write :/ 'The number ', number, 'is a multiple of 8'.
NEW-LINE.
endif.
endwhile.
**********************************************************************
DATA : A TYPE I
,B TYPE I
,RESULT TYPE I
.
IF A = B.
RESULT = A ** 2.
WRITE RESULT.
ELSE.
IF A > B.
RESULT = A / B.
WRITE RESULT.
ELSE .
RESULT = B / A.
WRITE RESULT.
ENDIF.
ENDIF.
endform.
*********************************************************************
ENDIF.
ELSE.
MESSAGE E398(00) WITH 'HAI'.
ENDIF.
**************************************************************
*&---------------------------------------------------------------------*
*& Report YYPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YYPSM_000.
APPEND wa TO itab.
ENDFORM.
*******************************************************************
*&-------------------------------------------------------------------
*& Report YPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YPSM_000.
********************************************************************
*&-------------------------------------------------------------------
*& Report YPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YPSM_000.
PARAMETERS: p_text TYPE string OBLIGATORY.
data: p_len TYPE i.
AT SELECTION-SCREEN ON p_text.
START-OF-SELECTION.
p_len = strlen( p_text ).
DO p_len TIMES.
WRITE: 'Line [', sy-index , ']: ', p_text(sy-index).NEW-LINE.
ENDDO.
********************************************************************
SELECT-OPTIONS SNUM FOR VNUM NO-EXTENSION
********************************************************************
PARAMETERS: p_list AS CHECKBOX
,p_econo LIKE P_LIst AS CHECKBOX
.
********************************************************************
PARAMETER p_list TYPE scarr-carrid AS LISTBOX VISIBLE LENGTH 20
********************************************************************
PARAMETERs p_first RADIOBUTTON GROUP grp1 USER-COMMAND action.
PARAMETERs p_busin RADIOBUTTON GROUP grp1.
PARAMETERs p_econo LIKE p_first RADIOBUTTON GROUP grp1.
PARAMETERs p_input TYPE string.
AT SELECTION-SCREEN.
IF sy-ucomm = 'ACTION'.
CLEAR p_input.
ENDIF.
******************************************************************
118 0f 143
*****************************************************************
*&-------------------------------------------------------------------
*& Report YPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YPSM_000.
AT SELECTION-SCREEN.
Asyucomm = SY-UCOMM.
AT SELECTION-SCREEN OUTPUT.
IF Asyucomm = 'ACTION'.
CASE 'X'.
WHEN P_FIRST.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_INPUT' OR SCREEN-NAME = 'P_INPUT2'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN P_BUSIN.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_INPUT'.
SCREEN-REQUIRED = 1.
MODIFY SCREEN.
ENDIF.
IF SCREEN-NAME = 'P_INPUT2'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN P_ECONO.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_INPUT' OR SCREEN-NAME = 'P_INPUT2'.
SCREEN-INPUT = 0.
SCREEN-INVISIBLE = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDIF.
**********************************************************
*&-------------------------------------------------------------------
*& Report YPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YPSM_000.
REPORT YPSM_000.
PARAMETERS p1 TYPE I .
SELECTION-SCREEN ULINE.
PARAMETERS P2(20) TYPE C.
SELECTION-SCREEN SKIP 1.
PARAMETERS P3 TYPE D.
**********************************************************
*&-------------------------------------------------------------------
*& Report YPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YPSM_000.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_luck FOR v_luck,
s_bad FOR v_bad_luck NO INTERVALS,
s_favo FOR v_favourite NO-EXTENSION.
INITIALIZATION.
VPERS = 'ASDF'.
**********************************************************
*&-------------------------------------------------------------------
*& Report YPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YPSM_000.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_luck FOR v_luck,
s_bad FOR v_bad_luck NO INTERVALS,
s_favo FOR v_favourite NO-EXTENSION.
INITIALIZATION.
VPERS = 'ASDF'.
S_LUCK-HIGH = SY-DATUM.
APPEND S_LUCK.
**********************************************************
*&-------------------------------------------------------------------
*& Report YPSM_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YPSM_000.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_luck FOR v_luck,
s_bad FOR v_bad_luck NO-EXTENSION,
s_favo FOR v_favourite NO-EXTENSION.
INITIALIZATION.
VPERS = 'ASDF'.
S_LUCK-HIGH = SY-DATUM.
S_BAD = SY-UZEIT.
APPEND S_LUCK.
**********************************************************
*&---------------------------------------------------------------------*
*& Report YYPSM1_000
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YYPSM1_000.
TABLES: sflight.
END OF ty_outtab.
*----------------------------------------------------------------------*
* SELECTION-SCREEN *
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK gen WITH FRAME.
SELECT-OPTIONS:s_fldate FOR sflight-fldate.
SELECTION-SCREEN END OF BLOCK gen.
*----------------------------------------------------------------------*
* START-OF-SELECTION *
*----------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM select_data.
INITIALIZATION.
s_fldate-high = sy-datum.
APPEND s_fldate.
*----------------------------------------------------------------------*
* END-OF-SELECTION *
*----------------------------------------------------------------------*
END-OF-SELECTION.
PERFORM display_fullscreen.
*&---------------------------------------------------------------------*
*& Form select_data
*----------------------------------------------------------------------*
FORM select_data .
SELECT connid
fldate
sum( price ) as price
FROM sflight
INTO TABLE gt_outtab
WHERE fldate IN s_fldate
group by connid fldate
ORDER BY fldate
.
cl_salv_table=>factory(
EXPORTING
list_display = 'X'
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = itab ).
gr_table->set_screen_popup(
start_column = 1
end_column = 100
start_line = 1
end_line = 20 ).
lr_selections = gr_table->get_selections( ).
lr_selections->set_selection_mode(
if_salv_c_selection_mode=>row_column ).
gr_table->display( ).
**********************************************************