Issuw with Fieldcatalog in ALV OOPS
Hi All,
I am displaying output using ALV OOPs. in output table ihave dropdown field called Manual Processing status.
to get dropdown i used below logic.
DATA: lt_dropdown TYPE lvc_t_drop,
ls_dropdown TYPE lvc_s_drop.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'OPEN'(016).
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'CLOSED'(012).
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'CANCELLED'(014).
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'NO ACTION REQUIRED'(015).
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = ' '.
APPEND ls_dropdown TO lt_dropdown.
CALL METHOD grid->set_drop_down_table
EXPORTING
it_drop_down = lt_dropdown.
when i a, displaying the output lenth of this field is '9'(i mentioned while building the fieldcatalog) but in output its size is more. I used the below field catalog for this field.
ls_feildcat-fieldname = pv_field.
ls_feildcat-outputlen = pc_length.
ls_feildcat-coltext = pv_header.
ls_feildcat-just = pc_true.
ls_feildcat-no_out = gc_space.
ls_feildcat-drdn_hndl = '1'.
ls_feildcat-fix_column = 'X'.
when i comment ls_feildcat-drdn_hndl = '1' then its working fine but i am not getting dropdown. ANybody can sugeest me how to approach in this case.
Regards,
Maheedhar
Hi,
Not sure to get your point...could this be in relation with your layout settings (e.g by passing is_layout-cwidth_opt = 'X' to method set_table_for_first_display) ?
Kr,
m.
Similar Messages
-
Event handling in alv oops With buttons
Hi Experts
I have some doubt in ALV OOPS using Events. Could any one please tell me the procedure to how to handle events in oops ( Like interactive reports using events ).
Thank you
Satyendra.Hello Satyendra
The following sample report shows you how to handle the event HOTSPOT_CLICK and BUTTON_CLICK.
DATA: gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid.
DATA: gt_knb1 TYPE STANDARD TABLE OF knb1.
PARAMETERS: p_bukrs TYPE bukrs DEFAULT '2000' OBLIGATORY.
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender, " grid instance that raised the event
handle_button_click FOR EVENT button_click OF cl_gui_alv_grid
IMPORTING
es_col_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_col_id TYPE lvc_s_col.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CASE e_column_id-fieldname.
WHEN 'KUNNR'.
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
WHEN 'ERNAM'.*
SET PARAMETER ID 'USR' FIELD ls_knb1-ernam.
CALL TRANSACTION 'SU01' AND SKIP FIRST SCREEN.
WHEN OTHERS.
ENDCASE.
* Set active cell to field BUKRS otherwise the focus is still on
* field KUNNR which will always raise event HOTSPOT_CLICK
ls_col_id-fieldname = 'BUKRS'.
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
is_row_id = e_row_id
is_column_id = ls_col_id.
ENDMETHOD. "handle_hotspot_click
METHOD handle_button_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
READ TABLE gt_knb1 INTO ls_knb1 INDEX es_row_no-row_id.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
ENDMETHOD. "handle_button_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid1,
lcl_eventhandler=>handle_button_click FOR go_grid1.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = gt_knb1
it_fieldcatalog = gt_fcat
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
FORM build_fieldcatalog_knb1 .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
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.
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = 'KUNNR' OR
fieldname = 'ERNAM' OR
fieldname = 'BUKRS' ).
IF ( ls_fcat-fieldname = 'BUKRS' ).
ls_fcat-style = cl_gui_alv_grid=>mc_style_button. " column appears as button
ELSE.
ls_fcat-hotspot = abap_true.
ENDIF.
MODIFY gt_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
Regards
Uwe -
Alv oops raising error message
Hi,
iam displaying output using alv oops.
one of the char field is editable i want to give only numeric values only.i cannot change datatype to numc for that field.if user enters char value(like abc) and click on any button in alv output i want to raise a error message and i want to stop the user in alv report output.
Regards,
SureshHello Suresh
I assume that the editable field in your ALV list is defined as CHAR type in the underlying table (structure). In order to prevent non-numeric entries I would use the following approach:
Define additional column for your ALV list, e.g.:
TYPES: BEGIN OF ty_s_outtab.
INCLUDE type <name of z-table> AS data.
TYPES: numfield(4) TYPE n. " Assumption: Your editable field is CHAR4, e.g. charfld
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab WITH DEFAULT KEY.
DATA: gt_outtab TYPE ty_t_outtab. " your itab for ALV list
Build fieldcatalog automatically and add additional column for NUMFIELD:
" Call fm LVC_FIELDCATALOG_MERGE with your z-table
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = <name of editable field> ).
" Suppress this field
ls_fcat-tech = 'X'.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
" Modify LS_FCAT to reflect the additional NUMC4 field
ls_fcat-fieldname = 'NUMFIELD'.
ls_fcat-rolltype = ... " change technical details from CHAR4 -> NUMC4
ls_fcat-edit = 'X'. " Now the NUMC4 field is editable
INSERT ls_fcat INTO gt_fcat INDEX syst-tabix.
ENDLOOP.
Initial load of outtab: shuffle values from CHAR4 to NUMC4 field
REFRESH: gt_outtab.
LOOP AT gt_data INTO ls_data.
clear: ls_outtab.
ls_outtab-data = ls_data.
move ls_data-charfld TO ls_outtab-numfield.
APPEND ls_outtab TO gt_outtab.
ENDLOOP.
Regards
Uwe -
Hi
Im using ALV OOPS.o/p I have 10 records with checkbox(at user command I have to select record selected by check box). Now on the menu bar I hav a button for "SELECT ALL". If "selected all" 10 recored will be selected. If I filter upon some criteria no. of records will be 3..Now in GUI if I select SELECT all it will display 3 records r selected, but I have to process further internally ,,,but internally 10 records are selected. So how to write code for that is after filterring 3 records r selected and I "select all"..only 3 records will be selected instead of 10?
Part of my code like this..
SELECT all
CALL METHOD G_GRID->CHECK_CHANGED_DATA
IMPORTING
E_VALID = L_VALID.
IF L_VALID EQ 'X'.
LOOP AT PT_OUTTAB INTO LS_OUTTAB.
DATA LS_CELLTAB TYPE LVC_S_STYL.
LOOP AT PS_OUTTAB-CELLTAB INTO LS_CELLTAB.
IF LS_CELLTAB-FIELDNAME = 'CHECKBOX'.
IF LS_CELLTAB-STYLE EQ CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
P_LOCKED = 'X'.
ELSE.
P_LOCKED = SPACE.
ENDIF.
ENDIF.
ENDLOOP.
IF L_LOCKED IS INITIAL
AND NOT LS_OUTTAB-CHECKBOX EQ '-'.
LS_OUTTAB-CHECKBOX = 'X'.
ENDIF.
MODIFY PT_OUTTAB FROM LS_OUTTAB.
ENDLOOP.
CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY.
ENDIF.Hello Kaushik
Using method go_grid->GET_FILTERED_ENTRIES you get an index list of the filtered entries.
DATA: lt_filtered TYPE lvc_t_fidx,
ld_indx LIKE LINE OF lt_filtered.
CALL METHOD go_grid->GET_FILTERED_ENTRIES
IMPORTING
ET_FILTERED_ENTRIES = lt_filtered.
LOOP AT lt_filtered INTO ld_indx.
READ TABLE gt_outtab INTO ls_outtab INDEX ld_indx.
ENDLOOP.
Regards
Uwe -
To set HOTSPOT for a field in ALV-oops and when clecked should call transac
Hi,
I need to set HOTSPOT for a field in O/P list using ALV-oops and when clecked should take me to Transaction VA01. Please help....
Thanks,
PrabhuHi,
Please go through this code it may help u.
REPORT zcls_alv_oops MESSAGE-ID z1.
TABLES : mara.
Types Declaration..\
TYPES :
BEGIN OF t_mara,
matnr TYPE matnr,
mtart TYPE mtart,
maktx TYPE maktx,
END OF t_mara,
BEGIN OF t_marc,
matnr TYPE matnr,
werks TYPE werks_d,
mtart TYPE mtart,
maktx TYPE maktx,
END OF t_marc.
Internal Tables Declaration..\
DATA :
i_mara TYPE TABLE OF t_mara,
i_marc TYPE TABLE OF t_marc,
i_fcat1 TYPE lvc_t_fcat,
i_fcat2 TYPE lvc_t_fcat.
Constants Declaration..\
CONSTANTS :
c_cont1 TYPE scrfname VALUE 'CONT1',
c_cont2 TYPE scrfname VALUE 'CONT2'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS:
s_matnr FOR mara-matnr NO INTERVALS.
SELECTION-SCREEN SKIP 1.
PARAMETERS :
p_hotspt RADIOBUTTON GROUP r1 DEFAULT 'X',
p_bttn RADIOBUTTON GROUP r1.
SELECTION-SCREEN END OF BLOCK b1.
\* Class forward referncing.
CLASS lcl_rcvr_class DEFINITION DEFERRED.
\* Pointers Declaration..
DATA :
lp_rcvr TYPE REF TO lcl_rcvr_class,
lp_cont1 TYPE REF TO cl_gui_custom_container,
lp_cont2 TYPE REF TO cl_gui_custom_container,
lp_grid1 TYPE REF TO cl_gui_alv_grid,
lp_grid2 TYPE REF TO cl_gui_alv_grid.
\* Local Class Definiton.
CLASS lcl_rcvr_class DEFINITION.
PUBLIC SECTION.
METHODS :
hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no,
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
ENDCLASS.
\* Local Class Implementation.
CLASS lcl_rcvr_class IMPLEMENTATION.
METHOD hotspot_click.
DATA :
wa_mara TYPE t_mara,
wa_marc TYPE t_marc.
DATA :
l_index TYPE sy-tabix.
READ TABLE i_mara INTO wa_mara INDEX e_row_id-index.
IF sy-subrc EQ 0.
REFRESH i_marc.
SELECT matnr
werks
INTO TABLE i_marc
FROM marc
WHERE matnr EQ wa_mara-matnr.
IF sy-subrc EQ 0.
LOOP AT i_marc INTO wa_marc.
l_index = sy-tabix.
wa_marc-mtart = wa_mara-mtart.
wa_marc-maktx = wa_mara-maktx.
MODIFY i_marc FROM wa_marc INDEX l_index
TRANSPORTING mtart maktx.
ENDLOOP.
CALL SCREEN 200.
ELSE.
MESSAGE e121 WITH text-005 wa_mara-matnr.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD handle_double_click.
DATA :
wa_mara TYPE t_mara,
wa_marc TYPE t_marc.
DATA :
l_index TYPE sy-tabix.
READ TABLE i_mara INTO wa_mara INDEX e_row-index.
IF sy-subrc EQ 0.
REFRESH i_marc.
SELECT matnr
werks
INTO TABLE i_marc
FROM marc
WHERE matnr EQ wa_mara-matnr.
IF sy-subrc EQ 0.
LOOP AT i_marc INTO wa_marc.
l_index = sy-tabix.
wa_marc-mtart = wa_mara-mtart.
wa_marc-maktx = wa_mara-maktx.
MODIFY i_marc FROM wa_marc INDEX l_index
TRANSPORTING mtart maktx.
ENDLOOP.
CALL SCREEN 200.
ELSE.
MESSAGE e121 WITH text-005 wa_mara-matnr.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
\* Start of Selection
START-OF-SELECTION.
\* Extract the Material Master data for the Input Material.
SELECT a~matnr
a~mtart
b~maktx
INTO TABLE i_mara
FROM mara AS a
INNER JOIN makt AS b
ON a~matnr EQ b~matnr
WHERE a~matnr IN s_matnr
AND b~spras EQ sy-langu.
END-OF-SELECTION.
IF NOT i_mara\[\] IS INITIAL.
\* Call Screen to display the Material Master data.
CALL SCREEN 100.
ELSE.
MESSAGE s121 WITH text-006.
ENDIF.
\*& Module DISP_GRID OUTPUT
\* text
MODULE disp_grid OUTPUT.
\* Build the Field catelog for Material Master data.
PERFORM build_fcat.
\* Display the Material Master data using ALV.
PERFORM disp_alv.
ENDMODULE. " DISP_GRID OUTPUT
\*& Module USER_COMMAND_0100 INPUT
\* text
MODULE user_command_0100 INPUT.
\*when exit or cancel is clicked program has to come out
CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
\*& Form build_fcat
\* text
\* \--> p1 text
\* <-\- p2 text
FORM build_fcat.
DATA : ws_fcat TYPE lvc_s_fcat.
ws_fcat-fieldname = 'MATNR'.
ws_fcat-scrtext_m = text-001.
ws_fcat-tabname = 'I_MARA'.
IF p_hotspt EQ 'X'.
ws_fcat-hotspot = 'X'.
ENDIF.
APPEND ws_fcat TO i_fcat1.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MTART'.
ws_fcat-scrtext_m = text-002.
ws_fcat-tabname = 'I_MARA'.
APPEND ws_fcat TO i_fcat1.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MAKTX'.
ws_fcat-scrtext_m = text-003.
ws_fcat-tabname = 'I_MARA'.
APPEND ws_fcat TO i_fcat1.
CLEAR ws_fcat.
ENDFORM. " build_fcat
\*& Form disp_alv
\* text
\* \--> p1 text
\* <-\- p2 text
FORM disp_alv.
IF lp_cont1 IS INITIAL.
\* Create the Container Object of Material Master.
CREATE OBJECT lp_cont1
EXPORTING
container_name = c_cont1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6 .
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Create the Object for Grid of Material Master.
CREATE OBJECT lp_grid1
EXPORTING
i_parent = lp_cont1
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Dipslay Material Master data by calling method.
CALL METHOD lp_grid1->set_table_for_first_display
CHANGING
it_outtab = i_mara
it_fieldcatalog = i_fcat1
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Set Handler for the Hot Spot Event.
CREATE OBJECT lp_rcvr.
IF p_hotspt EQ 'X'.
SET HANDLER lp_rcvr->hotspot_click FOR lp_grid1.
ELSE.
SET HANDLER lp_rcvr->handle_double_click FOR lp_grid1.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " disp_alv
\*& Module STATUS_0100 OUTPUT
\* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN_STAT'.
SET TITLEBAR 'T_100'.
ENDMODULE. " STATUS_0100 OUTPUT
\*& Module STATUS_0200 OUTPUT
\* text
MODULE status_0200 OUTPUT.
SET PF-STATUS 'PLANT_STAT'.
SET TITLEBAR 'T_200'.
ENDMODULE. " STATUS_0200 OUTPUT
\*& Module DISP_GRID_plant OUTPUT
\* text
MODULE disp_grid_plant OUTPUT.
\* Build the Field catelog for Material Plant data.
PERFORM build_fcat_plant.
\* Display the Material Master Plant data using ALV.
PERFORM disp_alv_plant.
ENDMODULE. " DISP_GRID_plant OUTPUT
\*& Module USER_COMMAND_0200 INPUT
\* text
MODULE user_command_0200 INPUT.
\*when exit or cancel is clicked program has to come out
CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
\*& Form build_fcat_plant
\* text
\* \--> p1 text
\* <-\- p2 text
FORM build_fcat_plant.
DATA : ws_fcat TYPE lvc_s_fcat.
ws_fcat-fieldname = 'MATNR'.
ws_fcat-scrtext_m = text-001.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ws_fcat-fieldname = 'WERKS'.
ws_fcat-scrtext_m = text-004.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MTART'.
ws_fcat-scrtext_m = text-002.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MAKTX'.
ws_fcat-scrtext_m = text-003.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ENDFORM. " build_fcat_plant
\*& Form disp_alv_plant
\* text
\* \--> p1 text
\* <-\- p2 text
FORM disp_alv_plant.
IF lp_cont2 IS INITIAL.
\* Create the Container Object of Material Plant data.
CREATE OBJECT lp_cont2
EXPORTING
container_name = c_cont2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Create the Object for Grid of Material Plant data.
CREATE OBJECT lp_grid2
EXPORTING
i_parent = lp_cont2
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Dipslay Material Plant data by calling method.
CALL METHOD lp_grid2->set_table_for_first_display
CHANGING
it_outtab = i_marc
it_fieldcatalog = i_fcat2
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ELSE.
\* Call method 'REFRESH_TABLE_DISPLAY' to refresh the grid data.
CALL METHOD lp_grid2->refresh_table_display.
ENDIF.
ENDFORM. " disp_alv_plant -
Problem while placing a button in the Output using ALV OOPs
Hi,
I am using ALV OOPs to display report output.
In the toolbar i have to palce an update button and if i click on that update it should then call the selection screen 500 .
So,please help me to achieve this using ALV OOPs.
THANKS & REGARDS,
Kiranmai.Hi,
you can use set pf-status statement with the OOPs' concept where in you will have to give this in the events table and pass it to the method to display the alv ...
Regards,
Siddarth -
Hi Friends,
I just want to convert a normal alv grid report to ALV OOPS report using classes,methods and objects, can you please help me on it.
*I have sent a sample ALV grid report program.
REPORT YSDB_ALV_ECC NO STANDARD PAGE HEADING LINE-SIZE 260 LINE-COUNT 58.
TABLES:
VBRK,
VBRP.
TYPE-POOLS: SLIS.
TYPES:
BEGIN OF Y_VBRK_STRUCT ,
VBELN TYPE VBRK-VBELN,
FKART TYPE VBRK-FKART,
FKDAT TYPE VBRK-FKDAT,
BUKRS TYPE VBRK-BUKRS,
NETWR TYPE VBRK-NETWR,
END OF Y_VBRK_STRUCT.
TYPES:
BEGIN OF Y_VBRP_STRUCT,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
FKIMG TYPE VBRP-FKIMG,
AUBEL TYPE VBRP-AUBEL,
KOSTL TYPE VBRP-KOSTL,
PS_PSP_PNR TYPE VBRP-PS_PSP_PNR,
ARKTX TYPE VBRP-ARKTX,
END OF Y_VBRP_STRUCT.
TYPES:
BEGIN OF Y_DISPLAY_STRUCT,
VBELN TYPE VBRK-VBELN,
FKART TYPE VBRK-FKART,
FKDAT TYPE VBRK-FKDAT,
BUKRS TYPE VBRK-BUKRS,
NETWR TYPE VBRK-NETWR,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
FKIMG TYPE VBRP-FKIMG,
AUBEL TYPE VBRP-AUBEL,
KOSTL TYPE VBRP-KOSTL,
PS_PSP_PNR TYPE VBRP-PS_PSP_PNR,
ARKTX TYPE VBRP-ARKTX,
END OF Y_DISPLAY_STRUCT .
DATA: W_INDEX LIKE SY-TABIX.
DATA: W_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV.
DATA: T_FIELDCATALOG1 TYPE SLIS_T_FIELDCAT_ALV.
DATA: W_REPID TYPE SY-REPID.
DATA: T_VBRK_ITAB TYPE STANDARD TABLE OF Y_VBRK_STRUCT .
DATA: T_VBRP_ITAB TYPE STANDARD TABLE OF Y_VBRP_STRUCT .
DATA: T_DISPLAY_ITAB TYPE STANDARD TABLE OF Y_DISPLAY_STRUCT.
DATA: E_DISPLAY TYPE Y_DISPLAY_STRUCT.
SELECT-OPTIONS S_VBELN FOR VBRK-VBELN.
SELECT-OPTIONS S_BUKRS FOR VBRK-BUKRS.
SELECT-OPTIONS S_FKDAT FOR VBRK-FKDAT.
START-OF-SELECTION.
PERFORM F_GET_DATA1.
PERFORM F_PROCESS_DATA.
PERFORM F_FIELDCATLOG.
PERFORM F_DISPLAY_DATA.
PERFORM F_CLEAR_FIELDS.
*& Form get_data1
text
FORM F_GET_DATA1 .
SELECT VBELN FKART FKDAT BUKRS NETWR
FROM VBRK
INTO TABLE T_VBRK_ITAB
WHERE BUKRS IN S_BUKRS
AND FKDAT IN S_FKDAT
AND VBELN IN S_VBELN.
IF SY-SUBRC NE 0.
FREE: T_VBRK_ITAB.
ENDIF.
IF NOT T_VBRK_ITAB IS INITIAL.
SELECT VBELN POSNR MATNR FKIMG AUBEL
KOSTL PS_PSP_PNR ARKTX
FROM VBRP
INTO TABLE T_VBRP_ITAB
FOR ALL ENTRIES IN T_VBRK_ITAB
WHERE VBELN EQ T_VBRK_ITAB-VBELN.
IF SY-SUBRC NE 0.
FREE: T_VBRK_ITAB.
ENDIF.
ENDIF.
ENDFORM. " GET_DATA1
text
--> p1 text
<-- p2 text
FORM F_PROCESS_DATA .
SORT T_VBRK_ITAB BY VBELN.
SORT T_VBRP_ITAB BY VBELN.
CLEAR: W_INDEX.
UNASSIGN <FS_STRUCT1>.
UNASSIGN <FS_STRUCT2>.
LOOP AT T_VBRK_ITAB ASSIGNING <FS_STRUCT1>.
READ TABLE T_VBRP_ITAB ASSIGNING <FS_STRUCT2> WITH KEY VBELN = <FS_STRUCT1>-VBELN BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE SY-TABIX TO W_INDEX.
WHILE SY-SUBRC IS INITIAL AND <FS_STRUCT1>-VBELN = <FS_STRUCT2>-VBELN.
*Header Items Moving
MOVE:
<FS_STRUCT1>-FKART TO E_DISPLAY-FKART,
<FS_STRUCT1>-FKDAT TO E_DISPLAY-FKDAT,
<FS_STRUCT1>-BUKRS TO E_DISPLAY-BUKRS,
<FS_STRUCT1>-NETWR TO E_DISPLAY-NETWR.
*Line items Moving
MOVE: <FS_STRUCT2>-VBELN TO E_DISPLAY-VBELN,
<FS_STRUCT2>-POSNR TO E_DISPLAY-POSNR,
<FS_STRUCT2>-MATNR TO E_DISPLAY-MATNR,
<FS_STRUCT2>-FKIMG TO E_DISPLAY-FKIMG,
<FS_STRUCT2>-AUBEL TO E_DISPLAY-AUBEL,
<FS_STRUCT2>-KOSTL TO E_DISPLAY-KOSTL,
<FS_STRUCT2>-PS_PSP_PNR TO E_DISPLAY-PS_PSP_PNR,
<FS_STRUCT2>-ARKTX TO E_DISPLAY-ARKTX.
APPEND E_DISPLAY TO T_DISPLAY_ITAB.
CLEAR E_DISPLAY.
ADD 1 TO W_INDEX.
READ TABLE T_VBRP_ITAB ASSIGNING <FS_STRUCT2> INDEX W_INDEX.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
ENDWHILE.
ENDIF.
ENDLOOP.
ENDFORM. " GET_DATA3
*& Form Fieldcatlog
text
--> p1 text
<-- p2 text
FORM F_FIELDCATLOG .
W_FIELDCATALOG-FIELDNAME = TEXT-001.
W_FIELDCATALOG-SELTEXT_L = TEXT-002.
MOVE : 1 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-003.
W_FIELDCATALOG-SELTEXT_L = TEXT-004.
MOVE : 2 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-005.
W_FIELDCATALOG-SELTEXT_L = TEXT-006.
MOVE : 3 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-007.
W_FIELDCATALOG-SELTEXT_L = TEXT-008.
MOVE : 4 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-009.
W_FIELDCATALOG-SELTEXT_L = TEXT-010.
MOVE : 5 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-011.
W_FIELDCATALOG-SELTEXT_L = TEXT-012.
MOVE : 6 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-013.
W_FIELDCATALOG-SELTEXT_L = TEXT-014.
MOVE : 7 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-015.
W_FIELDCATALOG-SELTEXT_L = TEXT-016.
MOVE : 8 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
W_FIELDCATALOG-FIELDNAME = TEXT-017.
W_FIELDCATALOG-SELTEXT_L = TEXT-018.
MOVE : 9 TO W_FIELDCATALOG-COL_POS,
20 TO W_FIELDCATALOG-OUTPUTLEN.
APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
CLEAR W_FIELDCATALOG.
ENDFORM. " Fieldcatlog
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
FORM F_DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_REPID
I_CALLBACK_TOP_OF_PAGE = 'AAAAAAAAADDAADA' "TEXT-021
I_GRID_TITLE = TEXT-020
IT_FIELDCAT = T_FIELDCATALOG1
TABLES
T_OUTTAB = T_DISPLAY_ITAB.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
CLEAR: W_REPID.
CLEAR: T_FIELDCATALOG1.
ENDFORM. " DISPLAY_DATA
*& Form F_Clear_fields
text
--> p1 text
<-- p2 text
FORM F_CLEAR_FIELDS .
FREE: T_VBRK_ITAB.
FREE: T_VBRP_ITAB.
FREE: T_DISPLAY_ITAB.
CLEAR: W_FIELDCATALOG.
ENDFORM. " F_Clear_fields
Regards
DineshIn ALV oops,
1. You need screen on which you must create a custom container. - screen 100
2. In PBO of 100, create module for displaying ALV
MODULE DISPLAY_ALV OUTPUT
PERFORM CREATE_CONTAINER "IN WHICH YOU USE THE CREATE OBJECT METHOD OF CL_GUI_CUSTOM_CONTAINER
PERFORM CREATE_ALV "IN WHICH YOU USE CREATE_OBJECT METHOD OF CL_GUI_ALV_GRID.
PERFORM PREPARE_FIELDCAT "creating fcat using LVC_S_FCAT structure
PERFORM DISPLAY "here you use the SET_TABLE_FOR_FIRST_DISPLAY method of CL_GUI_ALV_GRID class,
where you provide the internal table name and fieldcat internal table
ENDMODULE -
Double click event in alv oops
Hi,
can any one please help me out... i dont know how to call events in alv oops...so can any one provide me with some help..
My requirment is i have to generate a mail grid containing customer details and if i double click on a customer it should go to the transaction XD03 second screen.....u have to declae an event like this.
class event_receiver definition.
public section.
methods handle_double_click
for event double_click of cl_gui_alv_grid
importing e_row.
endclass.
then u have to implement it in the implementation
class lcl_event_receiver implementation.
method lmt_handle_double_click.
perform double_click using e_row
tbl_final_display.
endmethod.
endclass.
form double_click
using fu_e_row type lvc_s_row
fu_tbl_final_display type typ_tbl_display.
read table fu_tbl_final_display into l_h_tbl_final_display
index fu_e_row-index.
if sy-subrc = 0.
set parameter id cns_aun field l_h_tbl_final_display-vbeln.
call transaction cns_trans and skip first screen.
endif.
endform.
hope it will help u -
Hello Friends need help in ALV oops
Hello,
My requirement is that in my ALV ouptut i will edit one cell when i am editing i.e if its is 200,00 i will change it to 300,00 before changing it should ask me wheather to change it or not i need to dispaly a dialog box with yes or no option if i click yes then it should accept the value 300,00.
I am using ALV OOPS.Hi,
You can achieve this as below,
DATA: w_result TYPE c.
METHOD handle_user_command.
* Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
EXPORTING
defaultoption = 'N'
textline1 = 'Do you want to change the value?'
* TEXTLINE2 = ' '
titel = 'Confirmation for change'
* START_COLUMN = 25
* START_ROW = 6
IMPORTING
answer = w_result.
IF w_result = 'J'. "J is for yes.
"Write your logic for saving the changes
ENDIF.
ENDCASE.
ENDMETHOD. "handle_user_command
Hope thi helps you.
Regards,
Manoj Kumar P -
I am using ALV OOPs. In ALV OOPs Appl tool bar is working by default when we create PF-STATUS. But in case of normal ALVs we need to write code for SY-UCOMM in PAI. why this happens, can anybody give tips.
Regards,
Naseer.Hi Naseer,
In Normal ALV we use Function mnodule and in OOPs we use classes and methods.
In Normal ALV we cannot place grids on screens but in OOALV we can place grids on screens.
we can insert logos in OOPS ALV.
see the code below
for displaying LOGO in ALV GRID CONTROL, we work with
Predefined global class. CL_GUI_ALV_TREE_SIMPLE. FOR
displaying LOGO. AND we use CL_GUI_CUSTOM_CONTAINTER for
identifies the location where we r goinh to display.
DECLARATIONS;
TYPE-POOLS: SDYDO, SLIS.
DATA: L_LOGO TYPE SDYDO_VALUE, FOR DISPLAYING LOGO
L_LIST TYPE SLIS_T_LISTHEADER. FOR LIST HEADING
DATA: LOGO TYPE SCRFNAME VALUE SLOGO,
CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
LOGO1 TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.
CREATE INSTANCE FOR ABOVE DEFINED CLASSES IN PBO EVENT
OF SCREEN FLOW LOGIC.
IF CONTAINER IS INITIAL.
CREATE OBJECT CONTAINER EXPORTING CONTAINER_NAME =
LOGO.
CREATE OBJECT LOGO1 EXPORTING I_PARENT = CONTAINER.
NOW CALL THE METHOD FOR DISPLAYING LOGO IN GRID CONTROL
CALL METHOD LOGO->CREATE_REPORT_HEADER
EXPORTING
I_LIST_COMMENTARY = L_LIST
I_LOGO = HERE PASS WHERE LOGO EXISTING.
THE ABOVE METHOD EXISTING
Please reward points if helpful..
Cheers,
Chaitanya. -
Hi Experts,
Can any one solve my problem.
I have displayed (grid display) using ALV OOPS using method (CL_GUI_ALV_GRID=>SET_TABLE_FOR_FIRST_DISPLAY)
But I want colors should come on the list. Colors should be displayed Cell wise.
Suppose for example in the first row fifth column is RED, Then second row fifth column should be other color.
How to do this.
Can any one solve this problem.
Thanks in advance.
Regards,
Kumarhi,
you can change the properties of the cell ie colors.
Coloring Individual Cells
This is the last point about coloring procedures for the ALV Grid. The procedure is similar to coloring an entire row. However, since an individual cell can be addressed with two parameters we will need something more. What is meant by u201Cmoreu201D is a table type structure to be included into the structure of the list data table. It seems strange, because including it will make our list data structure deep. But anyhow ALV Grid control handles this.
The structure that should be included must be of type u201CLVC_T_SCOLu201D. If you want to color the entire row, this inner table should contain only one row with field u201Cfnameu201D is set to space, some color value at field u201Ccolu201D, u201C0u201D or u201C1u201D at fields u201Cintu201D (intensified) and u201Cinvu201D (inverse).
If you want to color individual cells, then for each cell column, append a line to this inner table which also contains the column name at field u201Cfnameu201D. It is obvious that you can color an entire column by filling this inner table with a row for that column for each row in the list data table. But, it is also obvious that, this will be more time consuming than the method at section C.6.1.
Again key field coloring will override your settings. Thatu2019s why, we have another field in this inner table called u201Cnokeycolu201D. For each field represented in the inner table, set this field to u2018Xu2019 to prevent overriding of key color settings.
DATA BEGIN OF gt_list OCCURS 0
INCLUDE STRUCTURE SFLIGHT .
DATA rowcolor(4) TYPE c .
DATA cellcolors TYPE lvc_t_scol
DATA END OF gt_list .
DATA ls_cellcolor TYPE lvc_s_scol .
READ TABLE gt_list INDEX 5 .
ls_cellcolor-fname = 'SEATSOCC' .
ls_cellcolor-color-col = '7' .
ls_cellcolor-color-int = '1' .
APPEND ls_cellcolor TO gt_list-cellcolors .
MODIFY gt_list INDEX 5 .
regards,
Veeresh -
Hi
Can any one please provide material for ALV OOP concepts.
If you attach any PDF to my mail id, that will be more helpful for me.
This is my mailing id : [email protected]
Points will be awarded.
Regards
Sandeep ReddyAn excellent introduction is the following document:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
You will find plenty of sample reports in the reuse library (transaction SE83) and in the Development Workbench Demos (transaction DWDM).
check out any example program starting with BCALV*
You can refer these documents also.
http://esnips.com/doc/b708766f-a934-42a1-8064-c4de75b48fc4/Sample-Program-of-alv-using-oops.ppt
http://esnips.com/doc/a2e42503-cf0f-4418-94ee-580f5900a81f/alv-with-oop.doc
http://esnips.com/doc/2d953590-e8c5-490c-a607-d1ab7cf517d7/ALV.pdf -
Display Currency symbol with value in ALV Report
Hi Experts,
I need to display currency symbol with value in ALV Report like if currency type is dollar then $200.
Here I am using field catalog type slis_t_fieldcat_alv and suing field merge catalog FM: 'REUSE_ALV_FIELDCATALOG_MERGE'
I tried like this
IF <fs_fieldcat>-fieldname = 'STPRS'.
<fs_fieldcat>-seltext_s = 'Std Cost '.
<fs_fieldcat>-seltext_m = 'Std Cost'.
<fs_fieldcat>-seltext_l = 'Std Cost '
<fs_fieldcat>-tabname = 'MBEW'.
<fs_fieldcat>-ctabname = 'T001'.
<fs_fieldcat>-cfieldname ='WAERS'.
<fs_fieldcat>-datatype = 'CURR'.
ENDIF.
Please any one can suggest the solution for this.
Advance Thanks.
Regards,
Bala AchariHİ,
Check this link.
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=24379571
Take care.
Çağatay -
Prob with Drill down ALV's Layout
Hi Friends,
I have developed a report with class based ALV grid.
First screen 100 - has an ALV for header details.
CALL METHOD G_GRID_100->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_VARIANT = GS_DISVARIANT
IS_LAYOUT = GS_LAYOUT
IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
I_SAVE = 'A'
CHANGING
IT_OUTTAB = GT_DATA
IT_FIELDCATALOG = GT_FIELDCAT100.
on double click of any record in primary ALV, another screen 200 is called with line item details of that header in screen 100.
CALL METHOD G_GRID_200->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_VARIANT = GS_DISVARIANT1
IS_LAYOUT = GS_LAYOUT1
IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = GT_FIELDCAT200
IT_OUTTAB = GT_LINEITEM.
Problem: what ever layout is set in header alv is being copied in lineitem alv.
I want to have independent layouts for primary and secondary ALVs.
How to do that.
Any help on this is highly appreciated.
Regards,
Simhait is working for me. here is one working example. some where you are doing a mistake cross check it once.
REPORT ztest_alv_oo.
DATA: it_carr TYPE TABLE OF scarr,
it_flight TYPE TABLE OF sflight.
DATA: grid1 TYPE REF TO cl_gui_alv_grid,
grid2 TYPE REF TO cl_gui_alv_grid,
con1 TYPE REF TO cl_gui_custom_container,
con2 TYPE REF TO cl_gui_custom_container.
DATA: layout1 TYPE lvc_s_layo,
layout2 TYPE lvc_s_layo.
* CLASS cl_defintion
CLASS cl_one DEFINITION.
PUBLIC SECTION.
METHODS:
double_click FOR EVENT double_click
OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no.
ENDCLASS. "cl_defintion
* CLASS cl_implemenatation
CLASS cl_one IMPLEMENTATION.
METHOD double_click.
DATA: wa_carr TYPE scarr.
READ TABLE it_carr INTO wa_carr INDEX e_row-index.
IF sy-subrc EQ 0.
SELECT * FROM sflight
INTO TABLE it_flight
WHERE carrid EQ wa_carr-carrid.
CALL SCREEN 200.
ENDIF.
ENDMETHOD. "double_click
ENDCLASS. "cl_implemenatation
START-OF-SELECTION.
DATA: obj TYPE REF TO cl_one.
SELECT * FROM scarr
INTO TABLE it_carr.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'CARR'.
IF con1 IS INITIAL.
CREATE OBJECT con1
EXPORTING
container_name = 'CAR'.
CREATE OBJECT grid1
EXPORTING
i_parent = con1.
layout1-grid_title = 'Carrid data'.
layout1-smalltitle = 'X'.
layout1-sel_mode = 'A'.
layout1-cwidth_opt = 'X'.
layout1-zebra = 'X'.
grid1->set_table_for_first_display(
EXPORTING
i_structure_name = 'SCARR'
is_layout = layout1
CHANGING
it_outtab = it_carr
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT obj.
SET HANDLER obj->double_click FOR grid1.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0200 OUTPUT
* text
MODULE status_0200 OUTPUT.
SET PF-STATUS 'FLIGHT'.
IF con2 IS INITIAL.
CREATE OBJECT con2
EXPORTING
container_name = 'FLIGHT'.
CREATE OBJECT grid2
EXPORTING
i_parent = con2.
layout2-grid_title = 'Flights data'.
layout2-smalltitle = 'X'.
layout2-sel_mode = 'A'.
layout2-cwidth_opt = 'X'.
layout2-zebra = 'X'.
grid2->set_table_for_first_display(
EXPORTING
i_structure_name = 'SFLIGHT'
is_layout = layout2
CHANGING
it_outtab = it_flight
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
CALL METHOD grid2->refresh_table_display.
ENDIF.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
* text
MODULE user_command_0200 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
Container names are CAR, FLIGHT(for 100, 200 respectively) -
COPA Report Layout with Object List (ALV)
Hi,
I have question about the COPA report layout with object list (ALV). Everytime I executed the report with ALV format, the amount for quantity column always shows with 3 decimal number, menwhile for amount column always follow by 2 decimal number.
Can anyone help me regarding this matter? I do not know how to turn off the decimal number to be 0 in this type of layout, although in the form itself I already put 0 decimal number.
Thanks.Hi,
Better to raise this issue in CO Forum. You can expect some solution.
regards
Maybe you are looking for
-
Business service or Business system??
Hello All, I do get confused with respect to Business service and Business system?? What differentiates between them and when accordingly are they used?? If I am using a HTTP adapter to connect to a URL address of a 3rd party system, what would
-
Every time I try to install Itunes I get an error message saying it is unable to start services and to verify that I have sufficient privileges. I am the administrator. I have tried everything I can think of. When I click the ingore option it does
-
Passing parameters to table valued functions and using parameters as column name on select
I am creating a function where I want to pass it parameters and then use those parameters in a select statement. When I do that it selects the variable name as a literal not a column. How do I switch that context. Query: ALTER FUNCTION [dbo].[ufn_Ban
-
Hi experts, I am writing a Function module to get data from a table. Import : desc TYPE ZTABLE-DESCRIPTION. Now when desc = te* REPLACE ALL OCCURRENCES OF '*' IN desc WITH '%' . SELECT * FROM ZTABLE INTO CORRESPONDING FIELDS OF TABLE t
-
Basic questions about Notes domino connector
Hi, I have a very basic question about the Lotus Domino connector for OIM. We have a requirement to provision accounts into the domino mail server and while doing that also update some information directly into a separate nsf file. I checked the docu