Problem in ALV display using OOPs
Hi,
I have a dynamic selection screen where i am submitting one report to the other using SUBMIT statement.
After entering values in the selection screen, the output should be displayed using ALV.so i created a screen in the 2nd report i.e ZARR_MASSUPDATEFORNOTES and wrote the code in the PBO module of the screen.But while executing the output is not getting displayed.
My code is as below.
INSERT REPORT 'ZARR_MASSUPDATEFORNOTES' FROM t_comm.
SUBMIT ZARR_MASSUPDATEFORNOTES VIA SELECTION-SCREEN .
Thanks in advance......
Thanks,
Kiran.
Hi,
Try creting two different 'Z' programs without creating a different screen.
populate your internal table with data.
Do this.
Export the internal table using memory id.
Import the memory id in the 2nd report and pass the required value to the selection screen of the 2nd report and execute.
Regards,
Amit
Similar Messages
-
End of page in ALV display using OOPS
Hi all,
How can i display end of page or footer in ALV display using OOPS concept.
Thanks,
vinitHi ,
Try using this code.
First add a handler method in your handler class definition as:
e.g. METHOD handle__end_of_page
FOR EVENT print_end_of_page OF cl_gui_alv_grid .
Then implement the method in the implementation part of your local class.
e.g. METHOD handle_print_end_of_page .
WRITE:/ 'Flights Made on ', sy-datum .
ENDMETHOD .
And register this method as the handler.
SET HANDLER gr_event_handler->handle_print_end_of_page FOR gr_alvgrid .
Hope this helps.
Regards,
Janaki. -
Toolbar in alv display using oops alv
i have written code for displaying toolbar in alv display using oops, but it is not displaying please find the below code and let me know reason.
*& Report ZTRANSFER_ORDER2 *
REPORT ZTRANSFER_ORDER2 .
*& Report ZTRANSFER_ORDER *
TABLES:sflight.
TYPE-POOLS : icon.
* G L O B A L I N T E R N A L T A B L E S
CLASS lcl_event_receiver DEFINITION DEFERRED.
types : begin of ty_mara,
matnr type matnr,
mtart type mtart,
mbrsh type mbrsh,
matkl type matkl,
bismt type bismt,
meins type meins,
end of ty_mara.
DATA: t_mara type STANDARD TABLE OF ty_mara.
* G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
g_wa_mara type ty_mara.
DATA : t_fcat type LVC_T_FCAT.
DATA : l_VAR TYPE disvariant.
DATA : gs_layout type lvc_s_layo.
* Declare reference variables to the ALV grid and the container
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container.
data : it_toolbar TYPE stb_button,
event_receiver TYPE REF TO lcl_event_receiver.
* S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
CALL SCREEN 100 .
*CLASS lcl_event_receiver DEFINITION.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
*handling toolbar for interactive
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
*handling menu button
handle_menu_button
FOR EVENT menu_button OF cl_gui_alv_grid
IMPORTING e_object e_ucomm,
*On click of the menu button
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
handle toolbar
CLEAR it_toolbar.
MOVE 'DETAIL' TO it_toolbar-function.
MOVE icon_detail TO it_toolbar-icon.
MOVE 2 TO it_toolbar-butn_type.
APPEND it_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
METHOD handle_menu_button.
handle own menubuttons
IF e_ucomm = 'DETAIL'.
CALL METHOD e_object->add_function
EXPORTING
fcode = 'DISPLAY'
text = 'DISPLAY'.
ENDIF.
ENDMETHOD. "handle_menu_button
METHOD handle_user_command.
*On click
CASE e_ucomm.
WHEN 'DISPLAY'.
MESSAGE 'Menu Clicked' TYPE 'I'.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
sET PF-STATUS 'STATUS'.
Create objects
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
PERFORM load_data_into_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form load_data_into_grid
FORM load_data_into_grid.
Read data from table SFLIGHT
SELECT matnr mtart mbrsh matkl bismt meins
FROM mara
INTO corresponding fields of TABLE t_mara.
PERFORM fld_cate changing T_fcat.
l_var-report = sy-repid.
gs_layout-grid_title = 'Analysis Report'.
gs_layout-NO_TOOLBAR = 'X'.
gs_layout-BOX_FNAME = 'Selection'.
Load data into the grid and display them
caLL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'S_MVKE'
i_save = 'A'
is_variant = l_var
is_layout = gs_layout
CHANGING
it_outtab = t_mara[]
it_fieldcatalog = t_fcat.
endform.
*& Module pai INPUT
text
MODULE pai INPUT.
data: l_valid type c.
clear ok_code.
break-point.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
call method go_grid->check_changed_data
importing
e_valid = l_valid.
loop at t_mara into g_wa_mara.
endloop.
ENDCASE.
ENDMODULE. " pai INPUT
*& Form fld_cate
text
<--P_T_FCAT text
FORM fld_cate CHANGING P_T_FCAT TYPE lvc_t_fcat.
DATA : s_fcat type LVC_S_FCAT .
REFRESH: t_fcat.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX1'.
s_fcat-coltext = 'Box1'.
s_fcat-seltext = 'Box1'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 1.
s_fcat-col_pos = 1.
s_fcat-fieldname = 'MATNR'.
s_fcat-ref_field = 'MATNR'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material'.
s_fcat-seltext = 'Material'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 2.
s_fcat-col_pos = 2.
s_fcat-fieldname = 'MTART'.
s_fcat-ref_field = 'MTART'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material type'.
s_fcat-seltext = 'Material type'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX2'.
s_fcat-coltext = 'Box2'.
s_fcat-seltext = 'Box2'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 3.
s_fcat-col_pos = 3.
s_fcat-fieldname = 'MBRSH'.
s_fcat-ref_field = 'MBRSH'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Industry Sector'.
s_fcat-seltext = 'Industry Sector'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 4.
s_fcat-col_pos = 4.
s_fcat-fieldname = 'MATKL'.
s_fcat-ref_field = 'MATKL'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material Group'.
s_fcat-seltext = 'Material Group'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 5.
s_fcat-col_pos = 5.
s_fcat-fieldname = 'BISMT'.
s_fcat-ref_field = 'BISMT'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Old material number'.
s_fcat-seltext = 'Old material number'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 6.
s_fcat-col_pos = 6.
s_fcat-fieldname = 'MEINS'.
s_fcat-ref_field = 'MEINS'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Base Unit of Measure'.
s_fcat-seltext = 'Base Unit of Measure'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX3'.
s_fcat-coltext = 'Box3'.
s_fcat-seltext = 'Box3'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
ENDFORM. " fld_cate .MOVE 2 TO it_toolbar-butn_type.
Try changing the 2 (menu) to 0 (button) and see if that helps
also you need to set the event handler after you create your alv object
set handler handle_toolbar for [whatever object is called].
Edited by: Kev Mycock on Jul 24, 2008 7:59 AM -
Display error message in ALV grid using OOPS
Hi,
I have a requirement to display report in ALV. I have created ALV grid using OOPS with three editable cells and 1 button on toolbar. When user enter values in Ediatble cell and click on the Toolbar button, sales order item should be assigned to contract.
When the user select the row and click on toolbar button, a salesorder item should be assigned to contract and i am using BAPI and fine with BAPI. All the error message should be displayed in a popup and the corresponding failed row should change its color .
Once the user identified the failed row, he can edit the value in the ediatble cells and should reprocess in the same screen ( without going back to selection screen).
To display POP Up, I am using FM BAL_LOG_CREATE, BAL_LOG_MSG_ADD, BAL_DSP_PROFILE_NO_TREE_GET, BAL_CNTL_CREATE.
by using above 4 FM , i can display POP UP. but i cannot change the color of the failed row.
Once I identified the failed row and reprocess from the same screen , I am successful in processing the failed row, but my error log still has the reprocessed row as failed row because, error log is not refreshing.
Please suggest me how to clear error log which was created by using the above FM's and change the color of the failed row .
Thanks in AdvanceHi
Please suggest me how to clear error log which was created by using the above FM's....
U can use BAL_LOG_REFRESH
....and change the color of the failed row
You need to insert a new field for Colour Attributes in your output table and input its name in the layout structure:
IS_LAYOUT-INFO_FNAME = <field name for colour>
The field has to be a CHAR 3 and its value can be -
> Cxy
C is a constant
x is the colour number (from 1 to 9)
y is intensified (0 = off, 1 = on)
After changing the value of output table you need to run the method REFRESH_TABLE_DISPLAY for refreshing the output
Max -
Disbable button on alv report using oops
Hi all,
I have a button to toll bar of alv grid using oops
based on that when the user clicks on that some action is performed and list is displayed again
now when the list is diaplyed i need the button that i added to be disabled so that the user cannot click it agin
i have everything i don't know how to disable the button.
USING THIS STATMENT move 'X' to ls_toolbar-disabled WE CAN DISABLE BUT I DON'T WHERE TO PASS IT..
LOCAL CLASSES: Definition
*===============================================================
class lcl_event_receiver: local class to
define and handle own functions.
Definition:
~~~~~~~~~~~
class lcl_event_receiver definition.
public section.
methods:
handle_toolbar
for event toolbar of cl_gui_alv_grid
importing e_object e_interactive,
handle_user_command
for event user_command of cl_gui_alv_grid
importing e_ucomm.
private section.
endclass.
lcl_event_receiver (Definition)
*===============================================================
LOCAL CLASSES: Implementation
*===============================================================
class lcl_event_receiver (Implementation)
class lcl_event_receiver implementation.
method handle_toolbar.
append a separator to normal toolbar
clear ls_toolbar.
move 3 to ls_toolbar-butn_type.
append ls_toolbar to e_object->mt_toolbar.
append an icon to show booking table
clear ls_toolbar.
move 'ADD' to ls_toolbar-function.
move icon_employee to ls_toolbar-icon.
move 'Show Bookings'(111) to ls_toolbar-quickinfo.
move 'Add Material'(112) to ls_toolbar-text.
move '' to ls_toolbar-disabled.
append ls_toolbar to e_object->mt_toolbar.
endmethod.
method handle_user_command.
case e_ucomm.
when 'ADD'.
call method g_grid->get_selected_rows
importing et_index_rows = lt_rows.
call method cl_gui_cfw=>flush.
if sy-subrc ne 0.
add your handling, for example
call function 'POPUP_TO_INFORM'
exporting
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
else.
*tHIS IS THE PART IAM HAVING PROBLEM WITH
*class lcl_event_receiver implementation.
method handle_toolbar.
*clear : ls_toolbar.
loop at e_object->mt_toolbar into ls_toolbar WHERE FUNCTION = 'ADD'.
DELETE e_object->mt_toolbar FROM ls_toolbar.
move ' ' to ls_toolbar-disabled.
append ls_toolbar to e_object->mt_toolbar.
endloop.
*ENDMETHOD.
*ENDCLASS.
***tHIS IS THE PART
call method g_grid->refresh_table_display.
endif.
endcase.
endmethod.
Thanks in advanceHi
hI ALL,
MY QUESTION IS WHEN method handle_toolbaR WOULD BE TRIGERRED
first time i have the button enabled and when i press the button its get disabled.This is what i need
But iam trying to understand how this is working
Let me know whether iam right or not
when this piece of code would be triggered
method handle_toolbar.
clear ls_toolbar.
move 3 to ls_toolbar-butn_type.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 'ADD' to ls_toolbar-function.
move icon_employee to ls_toolbar-icon.
move 'Show Bookings'(111) to ls_toolbar-quickinfo.
move 'Add Material'(112) to ls_toolbar-text.
move ' ' to ls_toolbar-disabled.
append ls_toolbar to e_object->mt_toolbar.
IF FLAG = 'X'.
LOOP AT e_object->mt_toolbar INTO ls_toolbar.
if ls_toolbar-function = 'ADD'.
ls_toolbar-disabled = 'X'.
MODIFY e_object->mt_toolbar FROM ls_toolbar.
endif.
ENDLOOP.
ENDIF.
1 ) would this be triggered
when i call this call method g_grid->refresh_table_display.
2)or
call method g_grid->set_toolbar_interactive
This is my piece of code
class lcl_event_receiver definition.
public section.
methods:
handle_toolbar
for event toolbar of cl_gui_alv_grid
importing e_object e_interactive,
handle_user_command
for event user_command of cl_gui_alv_grid
importing e_ucomm.
private section.
endclass.
class lcl_event_receiver implementation.
method handle_toolbar.
clear ls_toolbar.
move 3 to ls_toolbar-butn_type.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 'ADD' to ls_toolbar-function.
move icon_employee to ls_toolbar-icon.
move 'Show Bookings'(111) to ls_toolbar-quickinfo.
move 'Add Material'(112) to ls_toolbar-text.
move ' ' to ls_toolbar-disabled.
append ls_toolbar to e_object->mt_toolbar.
IF FLAG = 'X'.
LOOP AT e_object->mt_toolbar INTO ls_toolbar.
if ls_toolbar-function = 'ADD'.
ls_toolbar-disabled = 'X'.
MODIFY e_object->mt_toolbar FROM ls_toolbar.
endif.
ENDLOOP.
ENDIF.
endmethod.
method handle_user_command.
case e_ucomm.
when 'ADD'.
call method g_grid->get_selected_rows
importing et_index_rows = lt_rows.
call method cl_gui_cfw=>flush.
if sy-subrc ne 0.
else.
perform test.
call method g_grid->refresh_table_display.
endif.
endcase.
endmethod. "handle_user_command
odule status_0100 output.
SET PF-STATUS 'STATUS'.
set pf-status 'MAIN100'.
set titlebar 'HEADER_CHECK'.
if g_custom_container is initial.
create object g_custom_container
exporting container_name = g_container.
create object g_grid
exporting i_parent = g_custom_container.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'ZTEST'
changing
ct_fieldcat = fieldcat
exceptions
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.
g_layout-sel_mode = 'A'. " TO GET SELECTION BOX
call method g_grid->set_table_for_first_display
exporting
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
is_layout = g_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
it_toolbar_excluding = pt_exclude
IT_HYPERLINK =
IT_ALV_GRAPHICS =
changing
it_outtab = i_zTEST
it_fieldcatalog = fieldcat
IT_SORT =
IT_FILTER =
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
create object event_receiver.
set handler event_receiver->handle_user_command for g_grid.
set handler event_receiver->handle_toolbar for g_grid.
call method g_grid->set_toolbar_interactive.
endif. "IF grid1 IS INITIAL
call method cl_gui_control=>set_focus exporting control = g_grid.
endmodule. " STATUS_0100 OUTPUT
Thanks
Suchitra -
Alv output using oops for numc field
Hi,
iam displaying alv output using oops.
one of output field data type numc and length 4.
in field catalog i set lzero = 'X'.
now data is coming with leading zero. if data contains 0000 i want blank value in report output.
i tried with no_zero = 'X' blank values are display but leading zero are not display for other values.
how can i change the code.
Regards,
Suresh.You will have to use data type char in your case.
regards,
Advait -
ALV report using OOPS concept.
Hi,
Please help me in writing ALV report using OOPS concept as i have never used this concept before.Please post a clear picture for this.
Thanks in advance.Hi
Refer this code:
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
Thanks
Vasudha -
Attaining Hot spot in ALV Tree Using OOPS concept
Hi All,
In our requirement we are displaying the data in ALV Tree Using OOPS.
We need to achieve hot spot on one of the header field.
I am using Class 'CL_GUI_ALV_TREE'
Ex:
CreditAccnt/ Company codes DSO DDSO
26 15 15
8000 5 5
8545 10 10
In the above example for every credit accnt in header we r displaying the values ( DSO ,DDSO) for all company codes.
Now we require hot spot on Credit Accnt 26. Such that when user clicks on the credit accnt it should navigate to another transaction.
NOTE: we havent build any field catalogue for field CreditAccnt/ Company codes .Hi,
You can refer to the tutorial -
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
Or try using the code below-
CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
Hot Spot Click
handle_hotspot
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id
e_column_id
es_row_no,
ENDCLASS.
Implementation
*& Method handle_hotspot
This method is called when the user clicks on a hotspot to drill down.
The following types are exported from the ALV
LVC_S_ROW
LVC_S_COL
LVC_S_ROID
METHOD handle_hotspot.
The hotspot processing coded in the form below.
PERFORM f9802_handle_hotspot USING e_row_id
e_column_id
es_row_no.
ENDMETHOD.
*& Form f9802_handle_hotspot
This form is called when the user clicks on a hotspot on the ALV grid
The parameters are of type
-->P_E_ROW text
-->P_E_COL text
-->P_E_ROID text
FORM f9802_handle_hotspot USING p_row
p_col
p_roid.
DATA: lw_output LIKE LINE OF i_output.
READ TABLE i_output INDEX p_row INTO lw_output.
SET PARAMETER ID 'MAT' FIELD lw_output-matnr.
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
ENDFORM. " f9802_handle_hotspot
FORM f9300_modify_field_cat TABLES p_fieldcat STRUCTURE lvc_s_fcat.
Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.
LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.
CASE <lfs_fieldcat>-fieldname.
WHEN 'MATNR'.
<lfs_fieldcat>-hotspot = c_x.
<lfs_fieldcat>-key = c_x.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
ENDFORM.
In PBO,
module STATUS_9001 output.
Set handlers for events
SET HANDLER o_eventreceiver->handle_hotspot FOR o_Alvgrid.
ENDMODULE.
Hope this helps -
Sub total in ALV GRID using oops concept
Hi,
If Plant (VBAP-WERKS) is not the same for all items on a Sales Order (VBAK-VBELN is the same for al items) then create a separate line on the report for each different plant specified in the line items. Copy all fields from the original order line except for plant and Net Value. Net Value should be the total of item Net Values for all items with the same plant in the order.
Example:
Data:
Order---- Item- Plant- Net Value---
123---- 010- 3467- 100.00---
123---- 020- 7865- 50.00---
123---- 030- 3467- 80.50---
Report:
Order- Plant- Net Value---
123- 3467- 180.50---
123- 7865- 50.00----
I need to dispaly the Report format in ALV Grid using oops concept...
no need of calling any function modules.
Regards,
NithyaHi
Here is example code
This is the method to be called:
get_subtotals
Use
Returns the current subtotals of the ALV Grid Control. Having created totals for at least one column, users can calculate at most nine subtotals. The list is sorted by the values of one or several columns (called the subtotals column). If a value is changed in the subtotals column, the subtotal is displayed (this is also referred to as control level change).
Integration
Before you access the subtotals value, you use the method get_sort_criteria to get the sort table . One row of this table describes properties of a column in the output table.
If the field SUBTOT is set for a column in this table, the column is a subtotals column.
The field SPOS then indicates at which level (see below) the subtotal has been calculated.
The field FIELDNAME contains the name of the subtotals column in the output table.
Based on this information, you specifically access the values of the tables passed (using reference variables COLLECT01 to COLLECT09).
Features
CALL METHOD <ref. var. to CL_GUI_ALV_GRID>->get_subtotals
IMPORTING
EP_COLLECT00 = <reference variable of type REF TO DATA>
EP_COLLECT01 = <reference variable of type REF TO DATA>
EP_COLLECT02 = <reference variable of type REF TO DATA>
EP_COLLECT03 = <reference variable of type REF TO DATA>
EP_COLLECT04 = <reference variable of type REF TO DATA>
EP_COLLECT05 = <reference variable of type REF TO DATA>
EP_COLLECT06 = <reference variable of type REF TO DATA>
EP_COLLECT07 = <reference variable of type REF TO DATA>
EP_COLLECT08 = <reference variable of type REF TO DATA>
EP_COLLECT09 = <reference variable of type REF TO DATA>
ET_GROUPLEVELS = <ínternal table of type LVC_T_GRPL>.
In order to access the values of EP_COLLECT00 to EP_COLLECT09, you use ASSIGN to dereference the relevant reference variable in a field symbol of your output table type (see below).
Parameters
Meaning
EP_COLLECT00
Points to the totals line. Since there is only one totals line which, in addition, has a unique totalling area, no further information is available for this table in table ET_GROUPLEVELS.
get_subtotals
EP_COLLECT01 to EP_COLLECT09
Point to the subtotals line. For each subtotals level, there is one reference variable. Each of these variables points to an internal table that has the type of the output table. EP_COLLECT01 points to the subtotal at the hightest level, while EP_COLLECT02 points to the subtotal at the second highest level, and so on. The levels are derived from the sort priority (field SPOS in the sort table ). The column by which the data was sorted first, is the highest subtotals level.
ET_GROUPLEVELS
Manages all indexes for the individual control levels. The fields of the table have the following meaning:
INDEX_FROM, INDEX_TO: Rows of the output table for which the subtotal was created
LEVEL: Subtotals level (see above)
COUNTER: Number of rows for which the subtotal was created
COMPRESS: For this subtotals line, the user has hidden the associated rows.
COLLECT: Indicates the subtotals table (01-09) in which the values are stored
For an overview, see Methods of Class CL_GUI_ALV_GRID
Activities -
Freeze toolbar while scrolling down in ALV grid using OOPS
Hi,
My program is showing few products in ALV grid using OOPS. But If I scroll down to select a product, then I cant see the toolbar on which I have to press a button using selected product. Is there any way to freeze toolbar while scrolling down also.
As of now I have to scroll up after selecting product and then press the button on toolbar.
Regards,
Seema
Edited by: Seema Naharia on Feb 23, 2012 9:17 AMHi ,
You may have to set handler for the toolbars. Check class cl_gui_alv_grid for the events toolbar.
Or just for a try, since your problem is only when scrolling,you can use set_visible_row_count to -1 , so that data will appear in same view without the need to scroll.
Regards,
Ramya -
hi friendz,
can any one of u give an example, how to build alv report using oops abap ?
thanks in advance.
points for sure
regards,
VijayaHi Vijaya,
I hope the following code upto your requirement.
*& Report ZMAT_ALV_GRID *
REPORT ZCL_CLASS1.
TYPES: BEGIN OF T_MARA,
MATNR TYPE MARA-MATNR,
MAKTX TYPE MAKT-MAKTX,
WERKS TYPE MARD-WERKS,
LGORT TYPE MARD-LGORT,
LABST TYPE MARD-LABST,
END OF T_MARA.
*DATA: IT_MARA TYPE STANDARD TABLE OF T_MARA.
DATA: IT_MARA TYPE T_MARA OCCURS 0.
DATA: O_CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: X_FLDCAT TYPE LVC_S_FCAT.
DATA: IT_FLDCAT TYPE LVC_T_FCAT.
DATA: I_LAYOUT TYPE LVC_S_LAYO.
DATA: X_SORT TYPE LVC_S_SORT.
DATA: I_SORT TYPE LVC_T_SORT.
TABLES: MARA.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
PARAMETERS: P_CHK AS CHECKBOX.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM GENERATE_FLDCAT.
PERFORM GENERATE_LAYOUT.
PERFORM DO_SORT.
SET SCREEN 100.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'xxx'.
PERFORM BUILD_ALV.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_ALV
text
FORM BUILD_ALV .
CREATE OBJECT O_CONT
EXPORTING
CONTAINER_NAME = 'MAT_CONTAINER'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6.
CREATE OBJECT O_GRID
EXPORTING
I_PARENT = O_CONT
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5.
CALL METHOD O_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = ' '
IS_LAYOUT = I_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_MARA
IT_FIELDCATALOG = IT_FLDCAT[]
IT_SORT = I_SORT
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4.
ENDFORM. " BUILD_ALV
*& Form GET_DATA
text
FORM GET_DATA .
SELECT A~MATNR
B~MAKTX
C~WERKS
C~LGORT
C~LABST
INTO TABLE IT_MARA
FROM MARA AS A
INNER JOIN MAKT AS B
ON BMATNR = AMATNR
INNER JOIN MARD AS C
ON CMATNR = AMATNR
WHERE A~MATNR IN S_MATNR
AND B~SPRAS = SY-LANGU.
ENDFORM. " GET_DATA
*& Form GENERATE_FLDCAT
text
FORM GENERATE_FLDCAT .
*CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
I_STRUCTURE_NAME = 'ZSMARA'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME = ' '
CHANGING
CT_FIELDCAT = IT_FLDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
X_FLDCAT-COL_POS = 1.
X_FLDCAT-FIELDNAME = 'MATNR'.
X_FLDCAT-OUTPUTLEN = '18'.
X_FLDCAT-REPTEXT = 'Material No'.
APPEND X_FLDCAT TO IT_FLDCAT.
X_FLDCAT-COL_POS = 2.
X_FLDCAT-FIELDNAME = 'MAKTX'.
X_FLDCAT-OUTPUTLEN = '48'.
X_FLDCAT-REPTEXT = 'Material Desc'.
X_FLDCAT-TOOLTIP = 'Material Desc'.
APPEND X_FLDCAT TO IT_FLDCAT.
X_FLDCAT-COL_POS = 3.
X_FLDCAT-FIELDNAME = 'WERKS'.
X_FLDCAT-OUTPUTLEN = '5'.
X_FLDCAT-REPTEXT = 'Plant'.
X_FLDCAT-TOOLTIP = 'Plant'.
APPEND X_FLDCAT TO IT_FLDCAT.
X_FLDCAT-COL_POS = 4.
X_FLDCAT-FIELDNAME = 'LGORT'.
X_FLDCAT-OUTPUTLEN = '5'.
X_FLDCAT-REPTEXT = 'S.Loc'.
X_FLDCAT-TOOLTIP = 'S.Loc'.
APPEND X_FLDCAT TO IT_FLDCAT.
X_FLDCAT-COL_POS = 5.
X_FLDCAT-FIELDNAME = 'LABST'.
X_FLDCAT-OUTPUTLEN = '20'.
X_FLDCAT-REPTEXT = 'Quantity'.
X_FLDCAT-TOOLTIP = 'Quantity'.
X_FLDCAT-DO_SUM = 'X'.
APPEND X_FLDCAT TO IT_FLDCAT.
ENDFORM. " GENERATE_FLDCAT
*& Form GENERATE_LAYOUT
text
FORM GENERATE_LAYOUT .
I_LAYOUT-ZEBRA = 'X'.
I_LAYOUT-FRONTEND = 'X'.
I_LAYOUT-GRID_TITLE = 'ALV GRID USING OOPS'.
I_LAYOUT-NUMC_TOTAL = 'X'.
ENDFORM. " GENERATE_LAYOUT
*& Form DO_SORT
text
FORM DO_SORT .
X_SORT-FIELDNAME = 'MATNR'.
X_SORT-UP = 'X'.
X_SORT-SUBTOT = 'X'.
IF P_CHK = 'X'.
X_SORT-EXPA = SPACE.
ELSE.
X_SORT-EXPA = 'X'.
ENDIF.
APPEND X_SORT TO I_SORT.
ENDFORM. " DO_SORT
inorder to execute this code perfectly, do the following things.
1. Create a Graphical Screen 100.
2. Place a Custom Control on that screen and give name as MAT_CONTAINER.
3. activate the screen.
and execute the program.
if this suits requirement award points.
satish -
ALV display using dynamic field catalog and dynamic internal table
hi ,
please guide me for ALV display using dynamic field catalog and dynamic internal table.
Thank you.Hi Rahul,
maybe thread dynamic program for alv is helpful for you. More information about the [SAP List Viewer (ALV)|http://help.sap.com/saphelp_nw70/helpdata/EN/5e/88d440e14f8431e10000000a1550b0/frameset.htm]. Also have a look into the example programs SALV_DEMO_TABLE*.
Regards Rudi -
DIfference between Reusable FM for ALV display and ALV display using class
Hi,
Is there any difference between alv display using Resuable FM and ALV display using classes except the later one uses OO concept.??
One mere thing i want to clarify is that is there any difference exist between REUSE_ALV_GRID_DISPLAY and REUSE_ALV_LIST_DISPLAY? If so, then let me know.
It could be easier to understand me if yuo give scenario where these FM comes into picture
Regards,
ParagHi,
(1) REUSE_ALV_LIST_DISPLAY
Display an ALV list as per parameters defined in the function call
(2) REUSE_ALV_GRID_DISPLAY
Display an ALV grid as per parameters defined in the function call
(3) REUSE_ALV_COMMENTARY_WRITE
List header information is output according to its type. The output information is put in an internal table. Output attributes are assigned to each line via the TYP field.This module outputs formatted simple header information at TOP-OF-PAGE.
(4) REUSE_ALV_HIERSEQ_LIST_DISPLAY
This module outputs two internal tables as a formated hierarchical-sequential list.
(5) REUSE_ALV_VARIANT_F4
Display variant selection dialog box.
(6) REUSE_ALV_VARIANT_EXISTENCE
Checks whether a display variant exists.
Other Useful Link :
Customize ALV grid layout at run time
Download ALV grid Control Tutorial
Understand ALV report ( Just Copy and paste )
Dynamic selection on ALV at run time
Dynamic selection on ALV at run time
Regards
Kiran -
Problem in displaying data using ALV interactive using OOPS
Hi friends,
I have created one interactive report using oops..
on my selection screen i have a select-option TABNAME for DD02L table with no intervals option.
ie : i enter table names in that field..
for example i enter VBAP
MARA,
MARC. etc
when i execute i get a basic list which gives some details about the tables.
now on my basic list when i double click on any row then ie : say if i click on 2nd row , in the back ground based on the index on which i have click iam reading that particular row from the table and from that using the table name iam displaying the all the fields of the table in the ist secondary list....
Till now its working fine but once when i go back to the back to the basic list and when i click another row... here even if click another row its displaying the same fields of the table which was ist click.
ie : say ist time i have clicked mara then later vbap.....But its displaying me the mara details instead it should display vbap details...
I have used refresh_table_display method also.... But its not working fine...
How can i correct it...
Regards,
Kumar.Hello Kumar
I can only guess that you call the second screen (perhaps '0200') within the event handler method for event DOUBLE_CLICK. This is not really a good idea. Instead use a simple trick to overcome this refreshing problem:
METHOD handle_double_click.
" Save the row perhaps in a static attribute of your event handler method, e.g.
. lcl_eventhandler=>ms_row = e_row. " ms_row defined as static attribute of event handler class
" Trigger PAI with a defined ok-code:
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
ok_code = 'DETAIL_LIST'.
ENDMETHOD.
This method call triggers PAI of your screen which otherwise does not occur after an event has been raised.
MODULE user_command_0100 PAI.
CASE gd_okcode.
WHEN 'DETAIL_LIST'.
perform DISPLAY_DETAIL_LIST. " and call screen '0200'
WHEN OTHERS.
ENDCASE.
ENDMODULE.
The next time you make a double click a new row/index is filled into the static attribute. By triggering PAI (followed by PBO) you ensure a flushing (= refreshing) before the secondary list is displayed.
Regards
Uwe -
Traffic Signals in ALV Without using oops only for normal Grid Display.
Hi Experts ,
I need to add traffic signals into my normal ALV Grid program without using oops concepts.
Please any one send me full code or provide me one program code without using oops concept for normal ALV Grid .
I searched in many forums but i found most of the programs wriiten using oops concept with ALV's but here my requirement without using oops concept and only normal reuse_alv_grid_display.
Thanks in Advance.
Venky.You can check the below sample code.Traffic light is implemented in it.
REPORT ztest NO STANDARD PAGE HEADING
LINE-SIZE 255 MESSAGE-ID zlqm.
TYPE-POOLS : slis,icon.
TABLES :qals,qave.
INCLUDE : zlqmr002_top, "Global Data Declaration
zlqmr002_selection_screen, "Selection Screen Inputs
zlqmr002_subroutine. "Subroutines
INITIALIZATION
INITIALIZATION.
PERFORM variant_init.
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
Check for Variant existance
PERFORM pai_of_selection_screen.
*Validation for Material
AT SELECTION-SCREEN ON s_matnr.
IF NOT s_matnr IS INITIAL.
SELECT SINGLE matnr
INTO g_matnr
FROM mara
WHERE matnr IN s_matnr.
IF sy-subrc <> 0.
SET CURSOR FIELD 'S_MATNR'.
MESSAGE e000 WITH text-003.
ENDIF.
ENDIF.
*Validation for Plant
AT SELECTION-SCREEN ON s_werk.
IF NOT s_werk IS INITIAL.
SELECT SINGLE werks
INTO g_werk
FROM t001w
WHERE werks IN s_werk.
IF sy-subrc <> 0.
SET CURSOR FIELD 'S_WERK'.
MESSAGE e000 WITH text-004.
ENDIF.
ENDIF.
*Validation for Inspection Type
AT SELECTION-SCREEN ON s_art.
IF NOT s_art IS INITIAL.
SELECT SINGLE art
INTO g_art
FROM tq30
WHERE art IN s_art.
IF sy-subrc <> 0.
SET CURSOR FIELD 'S_ART'.
MESSAGE e000 WITH text-005.
ENDIF.
ENDIF.
*Validation for Code group
AT SELECTION-SCREEN ON s_vcdgrp.
IF NOT s_vcdgrp IS INITIAL.
SELECT SINGLE codegruppe
INTO g_vcdgrp
FROM qpgr
WHERE codegruppe IN s_vcdgrp.
IF sy-subrc <> 0.
SET CURSOR FIELD 'S_VCDGRP'.
MESSAGE e000 WITH text-006.
ENDIF.
ENDIF.
*Validation for Code
AT SELECTION-SCREEN ON s_vcode.
IF NOT s_vcode IS INITIAL.
SELECT SINGLE code
INTO g_vcode
FROM qpcd
WHERE code IN s_vcode.
IF sy-subrc <> 0.
SET CURSOR FIELD 'S_VCODE'.
MESSAGE e000 WITH text-007.
ENDIF.
ENDIF.
Process on value request
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM f4_for_variant.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vcdgrp-low.
PERFORM get_codegroup.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vcdgrp-high.
PERFORM get_codegroup.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vcode-low.
PERFORM get_code.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vcode-high.
PERFORM get_code.
START-OF-SELECTION.
START-OF-SELECTION.
**Selecting data form Database tables
PERFORM select_data TABLES i_out i_out1.
END-OF-SELECTION
END-OF-SELECTION.
**Generate ALV
PERFORM generate_alv.
DATA TYPES
TYPES : BEGIN OF t_qals,
matnr TYPE qals-matnr, "Material
werk TYPE qals-werk, "Plant
mengeneinh TYPE qals-mengeneinh, "UOM
lmenge01 TYPE qals-lmenge01, "Unrestricted qty
lmenge02 TYPE qals-lmenge02, "Scrap qty
lmenge03 TYPE qals-lmenge03, "Sample qty
lmenge04 TYPE qals-lmenge04, "Blocked qty
lmenge05 TYPE qals-lmenge05, "Retain qty
lmenge06 TYPE qals-lmenge06, "Othermat qty
lmenge07 TYPE qals-lmenge07, "RTV qty
lmenge08 TYPE qals-lmenge08, "Exp.scrap qty
prueflos TYPE qals-prueflos, "Inspection lot
art TYPE qals-art, "Inspection type
charg TYPE qals-charg, "Batch
vcode TYPE qave-vcode, "Usage decision
vdatum TYPE qave-vdatum, "Date
qmnum TYPE qmel-qmnum, "Notification
END OF t_qals.
TYPES : BEGIN OF t_out,
icon TYPE icon-id, "Status
matnr TYPE qals-matnr, "Material
werk TYPE qals-werk, "Plant
mengeneinh TYPE qals-mengeneinh, "UOM
vcode TYPE qave-vcode, "Usage decision
mncod(30) TYPE c, "Disposition
lmenge01 TYPE qals-lmenge01, "Unrestricted qty
lmenge02 TYPE qals-lmenge02, "Scrap qty
lmenge03 TYPE qals-lmenge03, "Sample qty
lmenge04 TYPE qals-lmenge04, "Blocked qty
lmenge05 TYPE qals-lmenge05, "Retain qty
lmenge06 TYPE qals-lmenge06, "Othermat qty
lmenge07 TYPE qals-lmenge07, "RTV qty
lmenge08 TYPE qals-lmenge08, "Exp.scrap qty
prueflos TYPE qals-prueflos, "Inspection lot
art TYPE qals-art, "Inspection type
qmnum TYPE qmel-qmnum, "Notification
vdatum TYPE qave-vdatum, "Date
charg TYPE qals-charg, "Batch
END OF t_out.
TYPES : BEGIN OF t_qmsm,
qmnum TYPE qmsm-qmnum,
manum TYPE qmsm-manum,
mncod TYPE qmsm-mncod,
END OF t_qmsm.
TYPES: BEGIN OF t_disp,
qmnum TYPE qmsm-qmnum,
mncod(30) TYPE c,
END OF t_disp.
TYPES: BEGIN OF t_codegrp,
katalogart TYPE qpgt-katalogart,
codegruppe TYPE qpgt-codegruppe,
kurztext TYPE qpgt-kurztext,
END OF t_codegrp.
TYPES: BEGIN OF t_code,
katalogart TYPE qpct-katalogart,
codegruppe TYPE qpct-codegruppe,
code TYPE qpct-code,
version TYPE qpct-version,
kurztext TYPE qpct-kurztext,
END OF t_code.
INTERNAL TABLES
DATA: i_qals TYPE TABLE OF t_qals,
wa_qals LIKE LINE OF i_qals,
i_qmsm TYPE TABLE OF t_qmsm,
wa_qmsm TYPE t_qmsm,
i_disp TYPE TABLE OF t_disp,
wa_disp LIKE LINE OF i_disp,
i_out TYPE TABLE OF t_out,
wa_out TYPE t_out,
i_out1 TYPE TABLE OF t_out,
wa_out1 TYPE t_out,
i_codegrp TYPE TABLE OF t_codegrp,
i_code TYPE TABLE OF t_code,
i_qmsm_tmp TYPE TABLE OF t_qmsm.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_layout TYPE slis_layout_alv,
g_repid TYPE sy-repid,
wa_fieldcat TYPE slis_fieldcat_alv.
Global Variables
DATA : g_matnr TYPE matnr,
g_werk TYPE werks,
g_art TYPE qpart,
g_vcdgrp TYPE qvgruppe,
g_vcode TYPE qvcode,
g_red TYPE c,
g_yellow TYPE c,
g_table(6) TYPE c,
g_save(1) TYPE c,
g_exit(1) TYPE c,
g_report TYPE sy-repid,
g_var TYPE disvariant,
g_variant TYPE disvariant.
Constants
CONSTANTS: c_green TYPE icon-id VALUE '@08@',
c_yellow TYPE icon-id VALUE '@09@',
c_red TYPE icon-id VALUE '@0A@'.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR qals-matnr, "Material Number
s_werk FOR qals-werk, "Plant
s_art FOR qals-art, "Inspection Type
s_vcdgrp FOR qave-vcodegrp, "Usage Decision Code Group
s_vcode FOR qave-vcode, "Usage Decision Code
s_vdatum FOR qave-vdatum. "Usage Decision Code Date
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_all RADIOBUTTON GROUP g1 DEFAULT 'X',
p_excp RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-009.
"Variant Selection
PARAMETERS: p_vari TYPE disvariant-variant.
SELECTION-SCREEN END OF BLOCK b3.
*& Form select_data
Select Inspection Details
FORM select_data TABLES p_out STRUCTURE wa_out
p_out1 STRUCTURE wa_out.
DATA:l_mncod(30) TYPE c.
REFRESH : i_qals,i_qmsm,i_qmsm_tmp,i_disp,p_out.
SELECT qalsmatnr qalswerk qals~mengeneinh
qalslmenge01 qalslmenge02 qals~lmenge03
qalslmenge04 qalslmenge05 qals~lmenge06
qalslmenge07 qalslmenge08 qals~prueflos
qalsart qalscharg qave~vcode
qavevdatum qmelqmnum
INTO CORRESPONDING FIELDS OF TABLE i_qals
FROM qals
INNER JOIN qave
ON qalsprueflos = qaveprueflos
INNER JOIN qmel
ON qalsprueflos = qmelprueflos
WHERE qals~matnr IN s_matnr
AND qals~werk IN s_werk
AND qals~art IN s_art
AND qals~stat34 EQ 'X'
AND qave~vcodegrp IN s_vcdgrp
AND qave~vcode IN s_vcode
AND qave~vdatum IN s_vdatum.
IF sy-subrc NE 0.
MESSAGE i000 WITH text-008.
ENDIF.
IF NOT i_qals IS INITIAL.
SELECT qmnum manum mncod INTO TABLE i_qmsm
FROM qmsm
FOR ALL ENTRIES IN i_qals
WHERE qmnum EQ i_qals-qmnum
AND mngrp LIKE 'Q_D%'
AND kzloesch NE 'X'.
ENDIF.
***Concatenation of Disposition Codes
IF NOT i_qmsm IS INITIAL.
i_qmsm_tmp = i_qmsm.
SORT i_qmsm_tmp BY qmnum mncod.
DELETE ADJACENT DUPLICATES FROM i_qmsm_tmp COMPARING qmnum mncod+0(2).
CLEAR wa_qmsm.
LOOP AT i_qmsm_tmp INTO wa_qmsm.
MOVE wa_qmsm-qmnum TO wa_disp-qmnum.
CONCATENATE l_mncod wa_qmsm-mncod+0(2) INTO l_mncod SEPARATED BY space.
AT END OF qmnum.
SHIFT l_mncod LEFT DELETING LEADING space.
MOVE l_mncod TO wa_disp-mncod.
APPEND wa_disp TO i_disp.
CLEAR:wa_disp,l_mncod.
ENDAT.
ENDLOOP.
ENDIF.
***Transfer of data to the output table
LOOP AT i_qals INTO wa_qals.
MOVE-CORRESPONDING wa_qals TO wa_out.
CLEAR wa_disp.
READ TABLE i_disp INTO wa_disp
WITH KEY qmnum = wa_qals-qmnum.
IF sy-subrc EQ 0.
MOVE wa_disp-mncod TO wa_out-mncod.
ENDIF.
PERFORM check_quantity USING wa_qals.
CLEAR wa_qmsm.
LOOP AT i_qmsm INTO wa_qmsm
WHERE qmnum EQ wa_qals-qmnum.
PERFORM check_group USING wa_qals
wa_qmsm.
CLEAR wa_qmsm.
ENDLOOP.
IF g_red NE 'X'.
CLEAR wa_qmsm.
LOOP AT i_qmsm INTO wa_qmsm WHERE qmnum = wa_qals-qmnum
AND mncod0(2) NE wa_qals-vcode0(2).
g_yellow = 'X'.
ENDLOOP.
ENDIF.
IF g_yellow EQ 'X'.
MOVE c_yellow TO wa_out-icon.
ELSEIF g_red EQ 'X'.
MOVE c_red TO wa_out-icon.
ELSE.
MOVE c_green TO wa_out-icon.
ENDIF.
APPEND wa_out TO p_out.
CLEAR:wa_qals,wa_out,g_red,g_yellow.
ENDLOOP.
***IF only exceptions are need to be displayed
IF p_excp EQ 'X'.
CLEAR wa_out.
LOOP AT p_out INTO wa_out WHERE icon EQ c_red.
APPEND wa_out TO p_out1.
ENDLOOP.
ENDIF.
ENDFORM. " select_data
*& Form populate_fieldcat
Populate the Fieldcat Table
FORM populate_fieldcat USING p_table TYPE c.
**status
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'ICON'.
wa_fieldcat-seltext_l = text-010.
wa_fieldcat-outputlen = 15.
wa_fieldcat-icon = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
**Material
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_l = text-011.
wa_fieldcat-outputlen = 15.
APPEND wa_fieldcat TO i_fieldcat.
**Plant
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'WERK'.
wa_fieldcat-seltext_l = text-012.
wa_fieldcat-outputlen = 7.
APPEND wa_fieldcat TO i_fieldcat.
**Usage Decision
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'VCODE'.
wa_fieldcat-seltext_l = text-013.
wa_fieldcat-outputlen = 15.
APPEND wa_fieldcat TO i_fieldcat.
**Dispositions
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'MNCOD'.
wa_fieldcat-seltext_l = text-014.
wa_fieldcat-outputlen = 18.
APPEND wa_fieldcat TO i_fieldcat.
**UOM
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'MENGENEINH'.
wa_fieldcat-seltext_l = text-015.
wa_fieldcat-outputlen = 18.
APPEND wa_fieldcat TO i_fieldcat.
**Unrestricted Quantity
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'LMENGE01'.
wa_fieldcat-seltext_l = text-016.
wa_fieldcat-qfieldname = 'MENGENEINH'.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Scrap Quantity
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'LMENGE02'.
wa_fieldcat-seltext_l = text-017.
wa_fieldcat-qfieldname = 'MENGENEINH'.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Sample Quantity
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'LMENGE03'.
wa_fieldcat-seltext_l = text-018.
wa_fieldcat-qfieldname = 'MENGENEINH'.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Blocked Quantity
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'LMENGE04'.
wa_fieldcat-seltext_l = text-019.
wa_fieldcat-qfieldname = 'MENGENEINH'.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Retain Quantity
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'LMENGE05'.
wa_fieldcat-seltext_l = text-020.
wa_fieldcat-qfieldname = 'MENGENEINH'.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Other Mat Quantity
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'LMENGE06'.
wa_fieldcat-seltext_l = text-021.
wa_fieldcat-qfieldname = 'MENGENEINH'.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**RTV Quantity
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'LMENGE07'.
wa_fieldcat-seltext_l = text-022.
wa_fieldcat-qfieldname = 'MENGENEINH'.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Exp. Scrap Quantity
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'LMENGE08'.
wa_fieldcat-seltext_l = text-023.
wa_fieldcat-qfieldname = 'MENGENEINH'.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Inspection Lot
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'PRUEFLOS'.
wa_fieldcat-seltext_l = text-024.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Inspection Type
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'ART'.
wa_fieldcat-seltext_l = text-025.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Notification
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'QMNUM'.
wa_fieldcat-seltext_l = text-026.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Date
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'VDATUM'.
wa_fieldcat-seltext_l = text-027.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
**Batch
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'CHARG'.
wa_fieldcat-seltext_l = text-028.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " populate_fieldcat
*& Form check_quantity
To Check the Quantity
FORM check_quantity USING p_qals TYPE t_qals.
IF wa_qals-lmenge01 GT 0.
LOOP AT i_disp TRANSPORTING NO FIELDS
WHERE qmnum EQ wa_qals-qmnum
AND ( mncod CP 'UI'
OR mncod CP 'SR'
OR mncod CP 'ND' ).
ENDLOOP.
IF sy-subrc NE 0.
g_red = 'X'.
ENDIF.
ENDIF.
IF wa_qals-lmenge02 GT 0 AND g_red NE 'X'.
LOOP AT i_disp TRANSPORTING NO FIELDS
WHERE qmnum EQ wa_qals-qmnum
AND ( mncod CP 'SC'
OR mncod CP 'SR' ).
ENDLOOP.
IF sy-subrc NE 0.
g_red = 'X'.
ENDIF.
ENDIF.
IF wa_qals-lmenge04 GT 0 AND g_red NE 'X'.
LOOP AT i_disp TRANSPORTING NO FIELDS
WHERE qmnum EQ wa_qals-qmnum
AND ( mncod CP 'RW'
OR mncod CP 'RD' ).
ENDLOOP.
IF sy-subrc NE 0.
g_red = 'X'.
ENDIF.
ENDIF.
IF wa_qals-lmenge05 GT 0 AND g_red NE 'X'.
LOOP AT i_disp TRANSPORTING NO FIELDS
WHERE qmnum EQ wa_qals-qmnum
AND mncod CP 'R1'.
ENDLOOP.
IF sy-subrc NE 0.
g_red = 'X'.
ENDIF.
ENDIF.
IF wa_qals-lmenge06 GT 0 AND g_red NE 'X'.
LOOP AT i_disp TRANSPORTING NO FIELDS
WHERE qmnum EQ wa_qals-qmnum
AND mncod CP 'RD'.
ENDLOOP.
IF sy-subrc NE 0.
g_red = 'X'.
ENDIF.
ENDIF.
IF wa_qals-lmenge07 GT 0 AND g_red NE 'X'.
LOOP AT i_disp TRANSPORTING NO FIELDS
WHERE qmnum EQ wa_qals-qmnum
AND mncod CP 'RV'.
ENDLOOP.
IF sy-subrc NE 0.
g_red = 'X'.
ENDIF.
ENDIF.
IF wa_qals-lmenge08 GT 0 AND g_red NE 'X'.
LOOP AT i_disp TRANSPORTING NO FIELDS
WHERE qmnum EQ wa_qals-qmnum
AND ( mncod CP 'SC'
OR mncod CP 'SE' ).
ENDLOOP.
IF sy-subrc NE 0.
g_red = 'X'.
ENDIF.
ENDIF.
ENDFORM. " check_quantity
*& Form check_group
To check the Disposition Code
FORM check_group USING p_qals TYPE t_qals
p_qmsm TYPE t_qmsm.
IF p_qmsm-mncod+0(2) EQ 'UI' AND
NOT p_qals-lmenge01 GT 0.
g_red = 'X'.
EXIT.
ENDIF.
IF p_qmsm-mncod+0(2) EQ 'RW' AND
NOT p_qals-lmenge04 GT 0.
g_red = 'X'.
EXIT.
ENDIF.
IF p_qmsm-mncod+0(2) EQ 'SC' AND
NOT p_qals-lmenge02 GT 0 AND
NOT p_qals-lmenge08 GT 0.
g_red = 'X'.
EXIT.
ENDIF.
IF p_qmsm-mncod+0(2) EQ 'SE' AND
NOT p_qals-lmenge08 GT 0.
g_red = 'X'.
EXIT.
ENDIF.
IF p_qmsm-mncod+0(2) EQ 'RV' AND
NOT p_qals-lmenge07 GT 0.
g_red = 'X'.
EXIT.
ENDIF.
IF p_qmsm-mncod+0(2) EQ 'SR' AND
NOT p_qals-lmenge01 GT 0 AND
NOT p_qals-lmenge02 GT 0.
g_red = 'X'.
EXIT.
ENDIF.
IF p_qmsm-mncod+0(2) EQ 'ND' AND
NOT p_qals-lmenge01 GT 0.
g_red = 'X'.
EXIT.
ENDIF.
IF p_qmsm-mncod+0(2) EQ 'R1' AND
NOT p_qals-lmenge05 GT 0.
g_red = 'X'.
EXIT.
ENDIF.
IF p_qmsm-mncod+0(2) EQ 'RD' AND
NOT p_qals-lmenge04 GT 0 AND
NOT p_qals-lmenge06 GT 0.
g_red = 'X'.
EXIT.
ENDIF.
ENDFORM. " check_group
*& Form call_alv
Call ALV Grid Display
FORM call_alv TABLES p_out STRUCTURE wa_out.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
is_layout = i_layout
it_fieldcat = i_fieldcat[]
TABLES
t_outtab = p_out
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. " call_alv
*& Form generate_alv
Build ALV
FORM generate_alv .
IF NOT i_out IS INITIAL OR
NOT i_out1 IS INITIAL.
g_repid = sy-repid.
IF p_excp EQ 'X'.
MOVE 'I_OUT1' TO g_table.
ELSEIF p_all EQ 'X'.
MOVE 'I_OUT' TO g_table.
ENDIF.
PERFORM populate_fieldcat USING g_table.
i_layout-zebra = 'X'.
i_layout-colwidth_optimize = 'X'.
IF p_excp = 'X'.
PERFORM call_alv TABLES i_out1.
ELSEIF p_all = 'X'.
PERFORM call_alv TABLES i_out.
ENDIF.
ENDIF.
ENDFORM. " generate_alv
*& Form PF_STATUS_SET
Setting PF Status
FORM pf_status_set USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STATUS1' .
ENDFORM. "PF_STATUS_SET
*& Form USER_COMMAND
User Command Processing
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN 'UDG'.
IF p_all EQ 'X'.
CLEAR wa_out.
READ TABLE i_out INTO wa_out INDEX rs_selfield-tabindex.
SET PARAMETER ID 'QLS' FIELD wa_out-prueflos.
ELSEIF p_excp EQ 'X'.
CLEAR wa_out1.
READ TABLE i_out1 INTO wa_out1 INDEX rs_selfield-tabindex.
SET PARAMETER ID 'QLS' FIELD wa_out1-prueflos.
ENDIF.
CALL TRANSACTION 'QA13' AND SKIP FIRST SCREEN.
WHEN 'QNF'.
IF p_all EQ 'X'.
CLEAR wa_out.
READ TABLE i_out INTO wa_out INDEX rs_selfield-tabindex.
SET PARAMETER ID 'IQM' FIELD wa_out-qmnum.
ELSEIF p_excp EQ 'X'.
CLEAR wa_out1.
READ TABLE i_out1 INTO wa_out1 INDEX rs_selfield-tabindex.
SET PARAMETER ID 'IQM' FIELD wa_out1-qmnum.
ENDIF.
CALL TRANSACTION 'QM03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form variant_init
Initialize variant
FORM variant_init .
Set Options: save variants userspecific or general
g_save = 'A'.
g_report = sy-repid.
g_var-report = g_report.
Get default variant
g_variant = g_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = g_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = g_variant-variant.
ENDIF.
ENDFORM. " variant_init
*& Form f4_for_variant
F4 help for variant
FORM f4_for_variant .
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_var
i_save = g_save
IMPORTING
e_exit = g_exit
es_variant = g_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF g_exit = space.
p_vari = g_variant-variant.
ENDIF.
ENDIF.
ENDFORM. " f4_for_variant
*& Form pai_of_selection_screen
Check existence of Variant
FORM pai_of_selection_screen .
IF NOT p_vari IS INITIAL.
MOVE g_var TO g_variant.
MOVE p_vari TO g_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = g_save
CHANGING
cs_variant = g_variant.
g_var = g_variant.
ELSE.
PERFORM variant_init.
ENDIF.
ENDFORM. " pai_of_selection_screen
*& Form get_codegroup
Get F4 help for Code Group
FORM get_codegroup .
DATA: i_return TYPE TABLE OF ddshretval.
SELECT katalogart codegruppe kurztext FROM qpgt
INTO TABLE i_codegrp
WHERE katalogart EQ '3'
AND sprache EQ sy-langu.
IF sy-subrc EQ 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'CODEGRUPPE'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_VCDGRP'
value_org = 'S'
TABLES
value_tab = i_codegrp[]
return_tab = i_return[]
EXCEPTIONS
parameter_error = 1
no_values_found = 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.
ENDIF.
ENDFORM. " get_codegroup
*& Form get_code
Get F4 help for Code
FORM get_code .
DATA: l_field TYPE rsscr-name VALUE 'S_VCDGRP',
l_field_kind TYPE rsscr-kind VALUE 'S',
li_par_values TYPE TABLE OF rsparams,
la_par_values TYPE rsparams,
r_cdgrp TYPE RANGE OF qpct-codegruppe,
la_cdgrp LIKE LINE OF r_cdgrp.
**Get the values entered in the selection screen
PERFORM f4_get_related_values IN PROGRAM rsdbspf4
TABLES li_par_values
USING l_field l_field_kind.
IF NOT li_par_values IS INITIAL.
CLEAR:la_cdgrp,la_par_values.
LOOP AT li_par_values INTO la_par_values.
MOVE-CORRESPONDING la_par_values TO la_cdgrp.
IF la_cdgrp-option IS INITIAL.
MOVE 'EQ' TO la_cdgrp-option.
ENDIF.
APPEND la_cdgrp TO r_cdgrp.
CLEAR la_cdgrp.
ENDLOOP.
ENDIF.
SELECT katalogart codegruppe
code version
kurztext FROM qpct
INTO TABLE i_code
WHERE katalogart EQ '3'
AND codegruppe IN r_cdgrp
AND sprache EQ sy-langu.
IF sy-subrc EQ 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'CODE'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_VCODE'
value_org = 'S'
TABLES
value_tab = i_code[]
return_tab =
EXCEPTIONS
parameter_error = 1
no_values_found = 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.
ENDIF.
ENDFORM. " get_code
Maybe you are looking for
-
How do I find the devices registered on my icloud account
I have made a number of upgades to my PCs and use a different logon for Icloud as I was an ME client. I cannot access icloud on my laptop using my ME logine. It does work for my apple account. How do I deactivate old devices? They are no longer in us
-
Migration / time machine backup not seen- help!
I have been using time machine for years and have never had to use it until now- and it does not work. White screen of Death indicated a dead HD. New HD installed on my computer today, I reboot....after the start up video I ask to transfer everything
-
Launchpad arrangement is saved in PRAM?
I swapped my HDD from a mid-2011 MBP to a mid-2012 today. I wasn't surprised to find I needed to change some trackpad settings to my liking because I knew those are saved in the PRAM. To my dismay, though, I found that my Launchpad arrangement is in
-
Importing iPhoto Events as individual Projects
Hi, I am attempting to import my iPhoto library into Aperture 3 a single event at a time, since I am unable to import my entire library without Aperture crashing. However, when I import the events, they come across as folders instead of Projects so t
-
Quick Profile Name system not working as expected
When I open the EMET and I change the value of "Quick Profile Name" from Recommended Security settings to maximum security settings and then restart the application it always changes to "Custom Security Settings" and it also changes the Data Executio