Making selected rows to display mode in ALV grid
I Have program with ALV grid display, which has check box as the first field.
The requirement is like.
When i select some rows in the grid display with the check box and click on a button , then the selected
rows shud change to display mode and others rows shud be in edit mode as before.
*& Report ZSRI_CHCKBOX_ITAB_UPDATE
REPORT ZSRI_CHCKBOX_ITAB_UPDATE.
TYPE-POOLS: SLIS.
DATA: BEGIN OF ITAB OCCURS 0,
CHK TYPE C,
VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
MATNR TYPE VBAP-MATNR,
MATWA TYPE VBAP-MATWA,
MATKL TYPE VBAP-MATKL,
END OF ITAB.
DATA: T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT TYPE SLIS_FIELDCAT_ALV,
RT TYPE SLIS_SELFIELD,
W_LAYOUT TYPE SLIS_LAYOUT_ALV .
PARAMETERS: S_VBELN TYPE VBAK-VBELN.
DATA: WA LIKE LINE OF ITAB.
DATA: G_GRID_REFERENCE TYPE REF TO CL_GUI_ALV_GRID.
DATA: BEGIN OF ITAB1 OCCURS 0,
CHK TYPE C,
VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
MATNR TYPE VBAP-MATNR,
MATWA TYPE VBAP-MATWA,
MATKL TYPE VBAP-MATKL,
END OF ITAB1.
DATA: T_FCAT1 TYPE SLIS_T_FIELDCAT_ALV.
DATA: W_FCAT1 TYPE SLIS_FIELDCAT_ALV.
START-OF-SELECTION.
SELECT VBELN POSNR MATNR MATWA MATKL FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE VBELN EQ S_VBELN.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'CHK'.
W_FCAT-TABNAME = 'ITAB'.
W_FCAT-CHECKBOX = 'X'.
W_FCAT-EDIT = 'X'.
W_FCAT-SELTEXT_L = 'CHECK'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-TABNAME = 'ITAB'.
W_FCAT-SELTEXT_L = 'SALES'.
W_FCAT-EDIT = 'X'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'POSNR'.
W_FCAT-TABNAME = 'ITAB'.
W_FCAT-SELTEXT_L = 'ITEM'.
W_FCAT-EDIT = 'X'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'MATNR'.
W_FCAT-TABNAME = 'ITAB'.
W_FCAT-SELTEXT_L = 'MATERIAL'.
W_FCAT-EDIT = 'X'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = 5.
W_FCAT-FIELDNAME = 'MATWA'.
W_FCAT-TABNAME = 'ITAB'.
W_FCAT-SELTEXT_L = 'MATERIAL QTY'.
W_FCAT-OUTPUTLEN = 20.
W_FCAT-EDIT = 'X'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = 6.
W_FCAT-FIELDNAME = 'MATKL'.
W_FCAT-TABNAME = 'ITAB'.
W_FCAT-SELTEXT_L = 'MATERIAL GROUP'.
W_FCAT-OUTPUTLEN = 20.
W_FCAT-EDIT = 'X'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS1'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = W_LAYOUT
IT_FIELDCAT = T_FCAT[]
TABLES
T_OUTTAB = ITAB[].
*& Form STATUS1
FORM STATUS1 USING P_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS1' EXCLUDING P_EXTAB.
ENDFORM. "PF_STATUS_SET
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM
R_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN 'READ'.
R_SELFIELD-REFRESH = 'X'.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = G_GRID_REFERENCE.
CALL METHOD G_GRID_REFERENCE->CHECK_CHANGED_DATA.
LOOP AT ITAB INTO WA WHERE CHK = 'X'.
APPEND WA TO ITAB1.
ENDLOOP.
W_FCAT1-COL_POS = 1.
W_FCAT1-FIELDNAME = 'CHK'.
W_FCAT1-TABNAME = 'ITAB'.
W_FCAT1-CHECKBOX = 'X'.
W_FCAT1-SELTEXT_L = 'CHECK'.
APPEND W_FCAT1 TO T_FCAT1.
CLEAR W_FCAT1.
W_FCAT1-COL_POS = 2.
W_FCAT1-FIELDNAME = 'VBELN'.
W_FCAT1-TABNAME = 'ITAB'.
W_FCAT1-SELTEXT_L = 'SALES'.
APPEND W_FCAT1 TO T_FCAT1.
CLEAR W_FCAT1.
W_FCAT1-COL_POS = 3.
W_FCAT1-FIELDNAME = 'POSNR'.
W_FCAT1-TABNAME = 'ITAB'.
W_FCAT1-SELTEXT_L = 'ITEM'.
APPEND W_FCAT1 TO T_FCAT1.
CLEAR W_FCAT1.
W_FCAT1-COL_POS = 4.
W_FCAT1-FIELDNAME = 'MATNR'.
W_FCAT1-TABNAME = 'ITAB'.
W_FCAT1-SELTEXT_L = 'MATERIAL'.
W_FCAT-OUTPUTLEN = 20.
APPEND W_FCAT1 TO T_FCAT1.
CLEAR W_FCAT1.
W_FCAT1-COL_POS = 5.
W_FCAT1-FIELDNAME = 'MATWA'.
W_FCAT1-TABNAME = 'ITAB'.
W_FCAT1-SELTEXT_L = 'MATERIAL TYPE'.
W_FCAT-OUTPUTLEN = 20.
APPEND W_FCAT1 TO T_FCAT1.
CLEAR W_FCAT1.
W_FCAT1-COL_POS = 6.
W_FCAT1-FIELDNAME = 'MATKL'.
W_FCAT1-TABNAME = 'ITAB'.
W_FCAT1-SELTEXT_L = 'MATERIAL GROUP'.
W_FCAT-OUTPUTLEN = 20.
APPEND W_FCAT1 TO T_FCAT1.
CLEAR W_FCAT1.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = T_FCAT1[]
IS_LAYOUT = W_LAYOUT
TABLES
T_OUTTAB = ITAB[].
CLEAR ITAB1.
CLEAR ITAB1[].
CLEAR T_FCAT1.
CLEAR T_FCAT1[].
ENDCASE.
ENDFORM. "USER_COMMAND
Edited by: dharmaji Srinivasu on Feb 6, 2009 1:22 PM
Hi
Check out the following links:
http://www.sapdev.co.uk/reporting/alv/alvgrid_rowsel.htm " To obtain selected rows
http://www.sapdev.co.uk/reporting/alv/alvgrid_editable.htm "To make cells editable
In the case stmt for particular button you can do:
loop at itab into wa.
if wa-sel EQ 'X'.
Process records that have been selected
endif.
endloop.
Hope this helps
Regards,
Jayanthi.K
Similar Messages
-
Getting present display records or Row Id's information in ALV grid?
Hi,
I am using REUSE_ALV_GRID_DISPLAY for ALV display.
I need to get the row id's when user filter the records with any conditions - or any other ways if he selected particular records - I need to process my logic only for those present displaying records in ALV grid.
So How do I can get preset display records in ALV grid or Present display records row id's ?
Please let me know .
And also I am using
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_repid = i_repid
e_grid = lt_grid
In lt_grid there is a table MT_ROID this table is having selected row id's information but I could not read this table. I think this will work only OO ABAP and also method - get_selected_rows is also not working.
I highly appreciate your answers.
Thanks
KevinHallo,
Any ideas?
Thanks. -
Selecting a row in the output of alv grid
hi,
how do i select a row in the output of alv grid?plz help...
regards,
sheeba.Hi,
Please refer the code below:
*& Report ZDEMO_ALVGRID_SELROW *
*& Example of a simple ALV Grid Report *
*& The basic ALV grid, Enhanced to display capture each row a user has *
*& selected *
REPORT zdemo_alvgrid_selrow .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
SEl, "stores which row user has selected
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-box_fieldname = 'SEL'.
"set field name to store row selection
gd_layout-edit = 'X'. "makes whole ALV table editable
gd_layout-zebra = 'X'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
* IT_EVENTS = GT_XEVENTS
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
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. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into corresponding fields of table it_ekko.
endform. " DATA_RETRIEVAL
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
WHEN '&DATA_SAVE'. "user presses SAVE
loop at it_ekko into wa_ekko.
if wa_ekko-sel EQ 'X'.
* Process records that have been selected
endif.
endloop.
ENDCASE.
ENDFORM.
Thanks,
Sriram Ponna. -
Select-options in display mode
Hi
How to set the SELECT-OPTIONS in display mode by default
regards
Srinivashiii
for every LOW and HIGH value of select option you can use a code like given below..
First initialize your select option with some values then use following code
AT SELECTION-SCREEN OUTPUT .
IF s_docno IS NOT INITIAL .
LOOP AT SCREEN.
IF screen-name CS 's_docno'.
screen-input = 0.
MODIFY SCREEN.
ENDIF. " IF screen-name CS 'p_docno'.
ENDLOOP. " LOOP AT SCREEN.
regards
twinkal -
How to merge rows with similar values in alv grid display in webdynpro
Hi experts,
i want to know about how to merge rows with similar values in alv grid display of webdynpro.grouping rows is possible in table display in webdynpro but i am not able to do row grouping in the alv grid display in webdynpro.
kindly suggest.
thanks ,
Anita.Hi Anita,
did you find a solution for this? I have opened a Thread, if you know the answer maybe you could help me out:
Is there an ALV function similar to the TABLE Row grouping?
Thanx in advanced!!!
Kind Regards,
Gerardo J -
Not able to display logo on alv grid output
hi
can anybody guide me.
i have written code for displaying logo on alv grid report.
i uploaded bmp image using OAER
but even then i am not able to display logo on the report please help me
i am using 4.7 version..
code...
REPORT ZALVLOGO .
type-pools: slis.
data: i_sflight type table of sflight.
*data: begin of i_sflight occurs 10.
*include structure sflight.
*data: end of i_sflight.
data: it_events type slis_t_event,
wa_events type slis_alv_event.
select * from sflight into table i_sflight.
perform form_fill_table.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_TOP_OF_PAGE = 'top-of-page'
I_STRUCTURE_NAME = 'sflight'
TABLES
T_OUTTAB = i_sflight
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.
*& Form top_of_page
text
--> p1 text
<-- p2 text
FORM top-of-page .
data: t_header type slis_t_listheader,
wa_header type slis_listheader.
wa_header-typ = 'h'.
wa_header-info = 'FLIGHT DETAILS'.
APPEND wa_header to t_header.
CLEAR WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = t_header
I_LOGO = 'ENJOY'.
I_END_OF_LIST_GRID =.
ENDFORM. " top_of_page
*& Form form_fill_table
text
--> p1 text
<-- p2 text
FORM form_fill_table .
clear wa_events.
wa_events-name = 'top-op-page1'.
wa_events-form = 'top-of-page'.
append wa_events to it_events.
ENDFORM. " form_fill_tablehi ,
First upload images in SAP using transaction se78
http://www.howforge.com/step-by-step-upload-bitmap-images-to-sap
Then use that Image name to call using function module
in top of -page
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'KAL1_LOGO'
it_list_commentary = lt_top_of_page_no_sel.
Regards
Deepak. -
Display amount in ALV Grid with different Decimal Places based on Currency
HI Experts,
Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2.
we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
AED---22.56
KWD---225.65
i need to display values like AED : 22.56HI Experts,
Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2. we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
AED---22.56
KWD---225.65 (converting this value to 22.565 using BAPI_CURRENCY_GETDECIMALS according to currency in my Report)
i need to display values like AED : 22.56
KWD---22.565 but here field is NETWR with 2 decimal.
Need to Display amount in ALV Grid with different Decimal Places based on Currency
Regards,
Dileep Kumar Reddy -
Opening a selection screen in display mode
I have an ALV grid created in OOPS. Each line of this ALV has name of a report and its variant name. Here I have created a button on toolbar. When a user selects a line and clicks this button, selection screen of the selected report is to be opened in display mode with selection screen filled as per its variant. Both the report name and varaint name will be same as the selected line. I am able to open the selection with varaint filled, but it comes in editable mode. How do I make it non-editable mode?
Hi,
For making your selection screen non editable you will have to disable them for input.
For this you will have to modify the screen structure.
try this:
loop at screen
if screen-fieldname = 'XYZ'.
screen-input = '0'.
endif.
modify screen.
endloop.
You can write this code at selection screen of the program which calls this selection screen.
Call this code under a condition, so that it get triggeres only when you call this screen form the ALV. -
Going back to selection screen from Change mode in ALV.
Hello Gurus,
I am working on a issue related to ALV where ALV becomes editable when user clicks on change button. The Change button is a custom button defined in application toolbar of ALV display.
case ucomm.
WHEN 'TBACK'.
leave to screen 0.
when 'CHNG'.
loop at it_apst01.
WA_FIELD_LST-EDIT = 'X'.
* Then some field symbol stuff is there
MODIFY FIELD_LST from wa_field_lst transporting edit
where FIELDNAME = <FS5>.
ENDIF.
endif.
endloop.
ENDIF.
describe table gt_alv lines c_hits.
c_alv_hits = c_hits.
concatenate text-010 c_alv_hits 'hits' into c_alv_title separated
by space.
perform display_report tables gt_alv USING c_alv_title.
form display_report tables p_outtab using p_title.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = lv_progname
i_callback_pf_status_set = 'ALV_STATUS'
i_callback_user_command = 'ALV_UCOMM'
* i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = is_layout
it_fieldcat = field_lst
* is_variant = g_variant
it_event_exit = gt_event_exit
i_save = 'A'
it_sort = it_sort
i_screen_start_column = i_start_col
i_screen_start_line = i_start_ln
i_screen_end_column = i_end_col
i_screen_end_line = i_end_ln
tables
t_outtab = p_outtab
exceptions
program_error = 1
others = 2.
endform.
Everything is working ok. But when I click on Back button,the screen goes first to the ALV display mode from edit mode, then user has to click one time more the back button to go to selection screen because the FM 'REUSE_ALV_GRID_DISPLAY' is called once again when user clicks
on change button because I am making the EDIT flag = 'X' and then calling FM again.
Is there a way that when user clicks on Back button, he will directly go to Change Screen -> Selection screen instead of going to Change screen -> Display screen -> Selection screen
Regards,
Rajesh.You must not call the FM 'REUSE_ALV_GRID_DISPLAY' again to make it editable. Instead you can call the FM REUSE_ALV_GRID_LAYOUT_INFO_GET and REUSE_ALV_GRID_LAYOUT_INFO_SET to make your grid editable / non-editable.
Like this:
REPORT grid_edit.
TYPE-POOLS: slis.
* Data to be displayed
DATA: gt_sflight TYPE TABLE OF sflight.
DATA: gs_layout TYPE slis_layout_alv.
parameters: p_test type flag.
start-of-selection.
* Selection
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
* Eingabebereit
gs_layout-edit = 'X'.
* Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'SFLIGHT'
is_layout = gs_layout
TABLES
t_outtab = gt_sflight.
*& Form user_command
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: ls_layout TYPE slis_layout_alv.
IF r_ucomm = '&DATA_SAVE'.
MESSAGE i000(0k) WITH text-001.
CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
IMPORTING
es_layout = ls_layout.
IF sy-subrc <> 0.
ENDIF.
ls_layout-edit = ' '.
CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_SET'
EXPORTING
is_layout = ls_layout.
ENDIF.
ENDFORM. "user_command
In this example, when you SAVE, it will give you one Information message and than make the Layout to non-editable mode. When you press back button, it will get you back to selection screen.
Regards,
Naimesh Patel -
How to delete the selected rows with a condition in alv
dear all,
i am using the code in object oriented alv.
WHEN 'DEL'.
PERFORM delete_rows.
FORM delete_rows.
DATA : lv_rows LIKE lvc_s_row.
data : wa_ROWs like LVC_S_ROW.
FREE : gt_rows.
CALL METHOD alv_grid->get_selected_rows
IMPORTING
et_index_rows = gt_rows.
IF gt_rows[] IS INITIAL.
MESSAGE s000 WITH text-046.
EXIT.
ENDIF.
loop at gt_rows into wa_ROWs .
if sy-tabix ne 1.
wa_ROWs-INDEX = wa_ROWs-INDEX - ( sy-tabix - 1 ).
endif.
delete gt_sim INDEX wa_ROWs-INDEX .
endloop.
the rows to be deleted from int.tab gt_sim not in the alv display.
all the rows should not be deleted if one of the field in gt_sim eq 'R'.
how to check this conditiondear jayanthi,
ok if i am coding like that as u mentioned ,
it will exit the loop when first time the field value is 'R'.
if any of the selected rows contains field value 'R'. it shold not delete all the selected rows.
as u suggested it will not delete after first time the field value is r.
i am deleting it by tab index so,
suppose if i am selecting the row without field value R say its tabix is 1.
the next row with tabix 2 with field value R.
it deletes the first row and exits , it should not delete the first row also. -
Not able to download all the rows to excel sheet from alv grid display
Hi experts,
I am not able to download all the rows which are displayed in alv grid display for some material numbers.
for some materials i am able to download, i used two ways to download 1) from icon(local file) on grid 2) menu list->export.
i checked in debugging till selecting the spread sheet pop up window, i am able to see all the data in internal table.
Can you suggest me what will be the problem....
thanks in advance,hi sandeep,
sorry for didnt specify clearly.
note: EX: "asaasdada in this sentence i said " this symbol is special character not the text.
building final internal table code
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = p_capid
datuv = sy-datum
ehndl = '1'
mktls = 'X'
mehrs = 'X'
mmory = '1'
mtnrv = p_matnr
stlal = '1'
stpst = 0
svwvo = 'X'
werks = p_werks
vrsvo = 'X'
TABLES
stb = i_stb
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
i_stb1[] = i_stb[].
IF NOT i_stb1[] IS INITIAL.
SORT i_stb1 BY idnrk.
DELETE ADJACENT DUPLICATES FROM i_stb1 COMPARING idnrk.
SELECT bmatn ematn FROM ampl INTO TABLE i_ampl
FOR ALL ENTRIES IN i_stb1
WHERE bmatn = i_stb1-idnrk AND
datuv LE sy-datum AND
datub GE sy-datum.
SELECT
matnr
bwkey
verpr
stprs
bwprh
FROM mbew
INTO TABLE i_mbew
FOR ALL ENTRIES IN i_stb1
WHERE
matnr EQ i_stb1-idnrk AND
bwkey EQ i_stb1-werks.
IF NOT i_stb1[] IS INITIAL.
SELECT matnr werks beskz
dzeit webaz plifz
ekgrp
INTO TABLE i_marc
FROM marc
FOR ALL ENTRIES IN i_stb1
WHERE matnr = i_stb1-idnrk
AND werks = i_stb1-werks.
SORT i_marc BY matnr werks.
ENDIF.
CLEAR i_ekpo.
CLEAR i_vend.
IF NOT i_stb1[] IS INITIAL.
SELECT ebeln ebelp matnr werks loekz aedat
netpr peinh
INTO TABLE i_ekpo
FROM ekpo
FOR ALL ENTRIES IN i_stb1
WHERE matnr = i_stb1-idnrk
AND werks = i_stb1-werks.
SORT i_ekpo BY matnr ASCENDING
aedat DESCENDING
ebeln DESCENDING
ebelp DESCENDING.
IF NOT i_ekpo IS INITIAL.
SELECT k~ebeln k~lifnr l~name1
INTO TABLE i_vend
FROM ekko AS k INNER JOIN lfa1 AS l
ON k~lifnr EQ l~lifnr
FOR ALL ENTRIES IN i_ekpo
WHERE ebeln = i_ekpo-ebeln.
SORT i_vend BY ebeln.
ENDIF.
ENDIF.
ENDIF.
i_ampl1[] = i_ampl[].
IF NOT i_ampl1[] IS INITIAL.
SORT i_ampl1 BY ematn.
DELETE ADJACENT DUPLICATES FROM i_ampl1 COMPARING ematn.
SELECT matnr mfrpn mfrnr FROM mara INTO TABLE i_mara
FOR ALL ENTRIES IN i_ampl1
WHERE matnr = i_ampl1-ematn.
ENDIF.
SORT i_ampl BY bmatn.
IF NOT i_stb[] IS INITIAL.
SELECT stlty stlnr stlkn stpoz idnrk potx1 potx2
INTO TABLE i_stpo
FROM stpo
FOR ALL ENTRIES IN i_stb
WHERE stlty = i_stb-stlty
AND stlnr = i_stb-stlnr
AND stlkn = i_stb-stlkn
AND stpoz = i_stb-stpoz
AND idnrk = i_stb-idnrk.
SORT i_stpo BY stlty stlnr stlkn stpoz idnrk.
ENDIF.
LOOP AT i_stb INTO wa_stb.
READ TABLE i_marc INTO wa_marc
WITH KEY matnr = wa_stb-idnrk
werks = wa_stb-werks
BINARY SEARCH.
IF sy-subrc = 0.
wa_outtab-beskz = wa_marc-beskz.
wa_outtab-dzeit = wa_marc-dzeit.
wa_outtab-webaz = wa_marc-webaz.
wa_outtab-plifz = wa_marc-plifz.
wa_outtab-ekgrp = wa_marc-ekgrp.
ENDIF.
READ TABLE i_ekpo INTO wa_ekpo
WITH KEY matnr = wa_stb-idnrk.
IF sy-subrc = 0.
wa_outtab-netpr = wa_ekpo-netpr.
wa_outtab-peinh = wa_ekpo-peinh.
READ TABLE i_vend INTO wa_vend
WITH KEY ebeln = wa_ekpo-ebeln
BINARY SEARCH.
IF sy-subrc = 0.
wa_outtab-lifnr = wa_vend-lifnr.
wa_outtab-name_sup = wa_vend-name1.
ENDIF.
ENDIF.
READ TABLE i_stpo INTO wa_stpo
WITH KEY stlty = wa_stb-stlty
stlnr = wa_stb-stlnr
stlkn = wa_stb-stlkn
stpoz = wa_stb-stpoz
idnrk = wa_stb-idnrk
BINARY SEARCH.
IF sy-subrc = 0.
wa_outtab-potx1 = wa_stpo-potx1.
wa_outtab-potx2 = wa_stpo-potx2.
ENDIF.
READ TABLE i_mbew INTO wa_mbew
WITH KEY
matnr = wa_stb-idnrk
bwkey = wa_stb-werks.
IF sy-subrc IS INITIAL.
MOVE:
wa_mbew-verpr TO wa_outtab-verpr,
wa_mbew-stprs TO wa_outtab-stprs,
wa_mbew-bwprh TO wa_outtab-bwprh.
ENDIF.
wa_outtab-matnr = p_matnr.
wa_outtab-posnr = wa_stb-posnr.
wa_outtab-stufe = wa_stb-stufe.
wa_outtab-idnrk = wa_stb-idnrk.
wa_outtab-ojtxb = wa_stb-ojtxp.
wa_outtab-menge = wa_stb-menge.
wa_outtab-meins = wa_stb-meins.
MOVE: wa_stb-zzitem_draw_no TO wa_outtab-zzitem_draw_no.
IF wa_stb-upskz = 'X'.
SELECT * FROM stpu INTO TABLE i_stpu
WHERE stlty = wa_stb-stlty AND
stlnr = wa_stb-stlnr AND
stlkn = wa_stb-stlkn AND
stpoz = wa_stb-stpoz.
ENDIF.
LOOP AT i_stpu INTO wa_stpu.
wa_outtab-upmng = wa_stpu-upmng.
wa_outtab-ebort = wa_stpu-ebort.
wa_outtab-uposz = wa_stpu-uposz.
CONCATENATE v_ebort wa_stpu-ebort INTO v_ebort
SEPARATED BY space.
ENDLOOP.
MOVE strlen( v_ebort ) TO v_len.
MOVE: 0 TO x,
128 TO y.
DATA : lt_tab TYPE TABLE OF swastrtab.
DATA : ls_tab LIKE LINE OF lt_tab.
DATA : lv_ebort TYPE string.
CLEAR lv_ebort. CLEAR lt_tab.
MOVE v_ebort TO lv_ebort.
CALL FUNCTION 'SWA_STRING_SPLIT'
EXPORTING
input_string = lv_ebort
max_component_length = 128
TABLES
string_components = lt_tab
EXCEPTIONS
max_component_length_invalid = 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.
IF lt_tab[] IS NOT INITIAL.
LOOP AT lt_tab INTO ls_tab.
CLEAR lv_ebort.
MOVE: ls_tab-str TO lv_ebort.
CONDENSE lv_ebort.
MOVE lv_ebort TO wa_outtab-ebort.
APPEND wa_outtab TO i_outtab.
CLEAR:
wa_outtab-matnr,
wa_outtab-posnr,
wa_outtab-zzitem_draw_no,
wa_outtab-ojtxb,
wa_outtab-menge,
wa_outtab-meins,
wa_outtab-uposz,
wa_outtab-upmng,
wa_outtab-verpr,
wa_outtab-stprs,
wa_outtab-bwprh,
wa_outtab-lifnr,
wa_outtab-name_sup,
wa_outtab-potx1,
wa_outtab-potx2,
wa_outtab-netpr,
wa_outtab-peinh.
* wa_outtab-idnrk.
ENDLOOP.
ELSE.
APPEND wa_outtab TO i_outtab.
ENDIF.
CLEAR v_ebort.
CLEAR: wa_stpu.
REFRESH: i_stpu.
LOOP AT i_ampl INTO wa_ampl WHERE bmatn = wa_stb-idnrk.
READ TABLE i_mara INTO wa_mara WITH TABLE KEY matnr = wa_ampl-ematn.
IF sy-subrc = 0.
LOOP AT i_outtab INTO wa_outtab
WHERE
idnrk = wa_stb-idnrk AND
flag NE 'X'.
wa_outtab-mfrpn = wa_mara-mfrpn.
wa_outtab-mfrnr = wa_mara-mfrnr.
SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
MOVE 'X' TO wa_outtab-flag.
MODIFY i_outtab FROM wa_outtab
TRANSPORTING mfrpn mfrnr name1 flag.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
CLEAR:
wa_outtab-matnr,
wa_outtab-posnr,
wa_outtab-zzitem_draw_no,
wa_outtab-ojtxb,
wa_outtab-ebort,
* wa_outtab-idnrk,
wa_outtab-menge,
wa_outtab-meins,
wa_outtab-uposz,
wa_outtab-upmng,
wa_outtab-verpr,
wa_outtab-stprs,
wa_outtab-bwprh,
wa_outtab-lifnr,
wa_outtab-name_sup,
wa_outtab-potx1,
wa_outtab-potx2,
wa_outtab-netpr,
wa_outtab-peinh.
wa_outtab-mfrpn = wa_mara-mfrpn.
wa_outtab-mfrnr = wa_mara-mfrnr.
SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
APPEND wa_outtab TO i_outtab.
ENDIF.
ENDIF.
REFRESH i_stpu.
CLEAR i_stpu.
ENDLOOP. CLEAR: wa_matnr1, wa_mfrnr, wa_outtab.
ENDLOOP.
Edited by: srinivasareddy j on Mar 9, 2011 7:16 AM
Edited by: srinivasareddy j on Mar 9, 2011 7:20 AM -
HI ABAP Gurus,
In selection screen i want to make selectoption/parameter field in displaymode( User cant change that field it shud appear but in display mode).
Plz help me regarding this.
I am using At selection-screen output for this as declaring Modif id in slect-option/parameter. but its not working.
Regards,
Shakyaassign that field to a modif id abc .
and do the coding as
at selection screen output.
loop at screen.
if screen-group1 = 'ABC'.
screen-input = '0'. "<----to enable display mode
modify screen.
endif.
endloop.
execute this code
tables likp.
select-options : s_vbeln for likp-vbeln modif id ABC,
s_erdat for likp-erdat modif id PQR,
S_LFART FOR LIKP-LfART MODIF ID XYZ.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'ABC'.
SCREEN-input = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'PQR'.
SCREEN-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
regards,
vijay -
Copa Report selection screen in display mode
Dear Friends:
In COPA Report, we have sales group,Fiscal year and Currency type in our selection screen,sales group should be in display mode i.e. the user
must not be able to change the sales group.
How to reslove the problem.Please advise.
Thanks&Regards
MSReddyHello
Create some authourization checks for the user. Try to check with BASIS team.
Also check if you can default entries for a particular user.
reg -
Selection screen in display mode
Hi all,
I have a selection screen with 2 radio buttons & 2 text boxes. If I click the first radio button, the 2nd text box shud be in display mode & if I click the 2nd radio button, the 1st text box shud be in display mode.
How to do it?
Thanks in advance.
SELECTION-SCREEN BEGIN OF BLOCK MODE WITH FRAME TITLE title.
parameters : s_pr radiobutton group g1,
s_po radiobutton group g1.
select-options : s_prnum for eban-banfn.
select-options : s_ponum for eban-ebeln.
SELECTION-SCREEN END OF BLOCK MODE.
Pls look into the code above.
G.VijayHi vijaykumar,
1. simple.
2. your code only,
just copy paste.
3. It will work as u require.
4.
report abc.
TABLES : EBAN.
SELECTION-SCREEN BEGIN OF BLOCK MODE WITH FRAME TITLE title.
parameters : s_pr radiobutton group g1 <b>USER-COMMAND RAD DEFAULT 'X'</b>,
s_po radiobutton group g1.
select-options : s_prnum for eban-banfn <b>MODIF ID M1</b>.
select-options : s_ponum for eban-ebeln <b>MODIF ID M2</b>.
SELECTION-SCREEN END OF BLOCK MODE.
<b>at selection-screen output.</b>
LOOP AT SCREEN.
IF S_PR = 'X' AND SCREEN-GROUP1 = 'M2'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
IF S_PO = 'X' AND SCREEN-GROUP1 = 'M1'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
regards,
amit m. -
Default value in selection screen in display mode
Hai Friends,
In my selection screen i have a parameter PA_LEVEL, this should have a default value as 10 but it should not be in the change mode. i want that to be in the display mode as in FAGLL03 ( Ledger value ).
how can i do this.
Moderator message - Please do not ask such basic questions. This can easily be answered by searching the forum.
Edited by: Rob Burbank on Apr 16, 2009 12:18 PMHi,
Use LOOP AT SCREEN...ENDLOOP. in the AT SELECTION-SCREEN OUPTUT event to disable the input field.
LOOP AT SCREEN.
IF screen-name CS 'FIELDNAME'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Maybe you are looking for
-
I turn it off and it will wait anywhere from a few seconds to a few hours and turn itself back on. You can see how that can get annoying and I can't seem to solve the problem.
-
When i click on the download itunes 7.0 it just says thank you but...
it doesnt show up on my computer or show any change! What do i do at the thank you page or whatever
-
I've just discovered a few directories containing my CR2 Raw files are showing a question mark in the Lightroom Gallery. This says that "The following files (related to this photo) were present before, but are now missing", with the name of the .xmp
-
Hello , I have a problem with teststand with synchronizing , I must say i'm new in teststand but i have red all the manuals... In my new program i'm trying to test 30 cards . There are 3 steps : 1. Init - Should be only one time . 2. Test - which i n
-
How create combo/dropdown list in Acrobat toolbar?
Hi! How create combo/dropdown list in my custom Acrobat toolbar (using plugins SDK)?