ALV Edit - Required Fields
Is there an easy way to make a field required in the ALV grid? I have looked in the field catalog and the layout and can't seem to find a flag to set. Right now I am using "handle_data_changed" to check the required fields in the row. I think this should be a standard "feature" like it is on the table control.
Thanks in advance.
Mike
Is there an easy way to make a field required in the ALV grid? I have looked in the field catalog and the layout and can't seem to find a flag to set. Right now I am using "handle_data_changed" to check the required fields in the row. I think this should be a standard "feature" like it is on the table control.
Thanks in advance.
Mike
Similar Messages
-
hi,
i am using normal alv edit report, in list 2 field date fields, this 2 fields are editable, how to get the date f4 help, pls give me solution
thanks
santhahi i have define this type,
types: begin of TY_FINAL,
CREDATE type SY-DATUM, "SY-DATUM,
DOCNUM(5) type C,
PERSON(35) type C,
TKNUM type TKNUM,
NAME1 type NAME1,
ORT01 type ORT01,
VBELN type VBELN,
AGENT_PNO(4) type C,
AGENT(10) type C,
TO_ORDER(7) type C,
INCO1 type INCO1,
INCO2 type INCO2,
LCNUM type LCNUM,
VSART type VSART,
DATXA type DATXA,
LOADING(10) type C,
DATLOAD(10) type C, "SY-DATUM,
SHIPDATE(10) type C, "SY-DATUM,
DATLOAD type dats "SY-DATUM,
SHIPDATE type SY-DATUM,
ABLAD type ABLAD,
SHIPLOAD type C,
IMPORT TYPE C,
VIA(10) type C,
PORT(10) type C,
MARKS(13) type C,
PRO_DESCR(10) type C,
NTGEW type NTGEW,
BRGEW type BRGEW,
NOTE(15) type C,
WH_SH_DOCU(15) type C,
WHEN_SHIP(15) type C,
ENCLOSURE(10) type C,
ZTERM type VBRK-ZTERM,
VTEXT type VTEXT,
BOX type C,
end of TY_FINAL.
LS_FIELDCAT-FIELDNAME = 'DATLOAD'.
LS_FIELDCAT-INPUT = 'X'.
LS_FIELDCAT-REF_FIELDNAME = 'ERDAT'.
LS_FIELDCAT-REF_TABNAME = 'VBRK'.
LS_FIELDCAT-DATATYPE = 'DATS'.
LS_FIELDCAT-INTTYPE = 'D'.
LS_FIELDCAT-EDIT = 'X'.
LS_FIELDCAT-SELTEXT_L = TEXT-116.
append LS_FIELDCAT to PT_FIELDCAT
Thanks
santha -
ALV edit (qty field is not convertable)
in my ALV program i have used one field MENGE (13,3) (QTY field) in the out put it is showing as 1.000,
when user going to enter a value (5) it is showing as 0.005 but user need it as 5.000.
please solve this question experts.....
Regards
Prasad.EVhi venkatesh,
MENGE is QTY field,
instead of that u can give F (float) field then user can enter 5 it will be display 5.000.... that is best way to use it..
points please.. (if u have satisfied.)
Prasad.
Edited by: EV prasad on Jun 6, 2008 10:10 AM -
Editing a field in ALV and validating the newly entered Value
Hi Experts,
I have an ALV report in grid display (not object oriented). My requirement is to edit a field on the output and write the validations to validate the value that was edited on the ALV output.
This can be done using object oriented coding by using the method check_changed_data. For this to happen, i need to change the entire scope of my report into object oriented, which is like reinventing the wheel.
Since my report was developed using classical ABAP, what needs to be done to get this functionality. Any suggestions are welcome.
Thanks.in the FM 'REUSE_ALV_GRID_DISPLAY' import parameter IS_LAYOUT check out the columsn EDIT and EDIT_COLUMN. Also Use FM 'REUSE_ALV_EVENTS_GET' to get list possible event and pass a subroutine name which will be called when ever event is fired.
example:
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = l_events.
READ TABLE l_events WITH KEY name = slis_ev_top_of_page
INTO g_event.
IF sy-subrc = 0.
MOVE top_of_page TO g_event-form.
APPEND g_event TO t_events.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = t_repid
is_layout = t_layout
it_fieldcat = t_fieldcat[]
i_save = t_save
it_events = t_events[]
TABLES
t_outtab = g_editpos1[]. -
How to edit particular field in alv list display
hi,
i am displaying output using alv list display. my as follows.
runrate maheed a01.
here if i click a01 it has to show iin edit mode earlier it has to show display mode only. when i select by that time it has to show edit mode there i will change into a02 and i will click save button this is my requirement.
anybody can send me the sample code please.
thanks,
maheedhar.tfollowing is my field cata log
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-outputlen = '10'.
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
now i am writng like this
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-EDIT = 'X'. "maheed
w_field-outputlen = '10'.
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
eventhough it is not allowing me to edit the field when i click that field in the output.
thanks,
maheedhar.t -
Editable ALV Quantity/Decimal field
Hi,
I have one column in ALV output which is editable .I have defined that in this way:
data :input type resb-bdmng.
fieldcatalog-fieldname = 'INPUT'.
fieldcatalog-seltext_m = ' Scrap'.
fieldcatalog-col_pos = fieldcatalog-col_pos + 1.
fieldcatalog-input = 'X'.
fieldcatalog-edit ='X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
But if we edit the field in the output it gives error : " Too many decimal places ( maximum 0)"
If we add fieldcatalog-datatype = 'DECIMAL'. then it works fine but in that case it throws dump for toolbar button " Export to the local file " Its functinality is copied from standard interface SAPLKKBL program The dump is The current statement requires chaarater data type object .It cant take decimal fieldcatalogtype . If we remove fieldcatalog-datatype = 'DECIMAL'. then this button works fine but in this case the first error comes "Too many decimal places ( maximum 0)"
Please suggest how can I remove first error without setting fieldcatalog-datatype = 'DECIMAL'. property.
Will definetly ..... if its helpfulhi,
This is a common problrm when yu want to display the values in decimals...if the datatype is any other than character, if u try to export to file,it will throw dump.change the datatype into character in ur internal table itself ,,then calculte the values in decimals and insert to this fieldand display.Now it will allow edit and wont throw dump
Edited by: soniya baboo on Jan 23, 2009 8:07 AM -
How to create required field in alv?
hi friends^^
how to create required field in alv?
i don't find required option in fieldcatalog and others.
is it possible?Source code..
PLANETYPE is key_sel = 'X'.
But does't required field...
REPORT zs32editable1 .
TYPE-POOLS : slis.
DATA : gt_sflight TYPE TABLE OF sflight.
DATA : gt_fieldcat TYPE slis_t_fieldcat_alv,
gs_fieldcat LIKE LINE OF gt_fieldcat,
gs_layout TYPE slis_layout_alv.
START-OF-SELECTION.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE gt_sflight
FROM sflight.
gs_layout-colwidth_optimize = 'X'.
gs_layout-edit = 'X'.
gs_fieldcat-fieldname = 'PLANETYPE'.
gs_fieldcat-key_sel = 'X'.
append gs_fieldcat to gt_fieldcat.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
is_layout = gs_layout
IT_FIELDCAT = gt_fieldcat
TABLES
t_outtab = gt_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. -
How to make WD ALV Editable Fields (Cell) Mandatory (Obligatory) ?
Hello Friends,
I have requirement where I need to make WD ALV editable inputfield as Mandatory fields. I found out that there is no method available to do this.
If anybody has any solution then please reply to this thread.
Thanks,
ChandraHello Friends,
Thanks for your reply. I just wanted to elaborate more on this so that others will benefit from this thread.
I used method SET_STATE from class CL_SALV_WD_UIE_A_INPUT which is super class for class CL_SALV_WD_UIE_INPUT_FIELD.
The code looks as below,
Data: lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
CALL METHOD lr_input_field->set_state
EXPORTING
value = cl_wd_abstract_input_field=>e_state-required.
well, I just forgot to check super class and its available methods...But got clear hint from Tulasi.
Thanks to all.
Chandra -
Edit a field in ALV tree in a subscreen of a module pool
Hi
I want to make a field editable in the ALV tree based on some condtions in a subscreen of a module pool. I used the edit = 'X' field in the fieldcatalog still it is showing the field as display and not edit.
Please help me to get the field as editable and save it to the database table.
Please not this is ALV TREE
Regards,
MozilaHi Mayank,
Thanks for the reply
I am using oops method.
I tried making the field which is to be made editable as wa_fieldcatalog-edit = 'X'. But its not working. I didnt get you when you said edit in layout object.
I also went through the demo programs but these programs are not having editable fields.
My code is as follows:
IF tree4 IS INITIAL.
* create container for alv-tree
l_tree_container_name = 'TREE4'.
CREATE OBJECT l_custom_container
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
* create tree control
CREATE OBJECT tree4
EXPORTING
i_parent = l_custom_container
i_node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
i_item_selection = 'X'
i_no_html_header = 'X'
i_no_toolbar = 'X'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
* create hierarchy
CALL METHOD tree4->set_table_for_first_display
EXPORTING
is_layout = s_layo
CHANGING
it_sort = it_sort
it_outtab = it_final
it_fieldcatalog = it_fieldcat.
ELSE.
CALL METHOD tree4->refresh_table_display
EXPORTING
it_sort = it_sort
EXCEPTIONS
program_error = 1
failed = 2
cntl_system_error = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif. -
To edit the field in the ALV report
Hi,
i want to edit the field of the ALV report what i need to do for that..
Thanks & Regards
Ashu Singhhi,
check the code,
REPORT zalv_fcat.* Output table T006 structure declarationTYPES : BEGIN OF ty_t006.
INCLUDE STRUCTURE t006.
TYPES : END OF ty_t006.*Internal table and wa declaration for T006
DATA : it_t006 TYPE STANDARD TABLE OF ty_t006,
wa_t006 TYPE ty_t006.*declarations for ALV
DATA: ok_code TYPE sy-ucomm,
fieldcatalog for T006
it_fielcat TYPE lvc_t_fcat,
fieldcatalog for fieldcatalog itself:
it_fielcatalogue TYPE lvc_t_fcat,
it_layout TYPE lvc_s_layo.*declaration for toolbar function
DATA: it_excl_func TYPE ui_functions.
Controls to display it_t006 and corresponding fieldcatalog
DATA: cont_dock TYPE REF TO cl_gui_docking_container,
cont_alvgd TYPE REF TO cl_gui_alv_grid.*controls to display the fieldcatalog as editable alv grid and container
DATA: cont_cust TYPE REF TO cl_gui_custom_container,
cont_editalvgd TYPE REF TO cl_gui_alv_grid.*intialization event
INITIALIZATION.*start of selection event
START-OF-SELECTION.
LOCAL CLASS Definition for data changed in fieldcatalog ALV
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_event_receiver DEFINITION
LOCAL CLASS implementation for data changed in fieldcatalog ALV
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_receiver IMPLEMENTATION*data declaration for event receiver
DATA: event_receiver TYPE REF TO lcl_event_receiver.*end of selection event
END-OF-SELECTION.*setting the screen for alv output for table display and
*changed fieldcatalalogue display
SET SCREEN 600.
On this statement double click it takes you to the screen painter SE51. Enter the attributes
*Create a Custom container and name it CCONT and OK code as OK_CODE.
*Save check and Activate the screen painter.
*Now a normal screen with number 600 is created which holds the ALV grid.
PBO of the actual screen , Here we can give a title and customized menus
*Go to SE41 and create status 'STATUS600' and create THE function code 'SUBMIT'
*and 'EXIT' with icons and icon texts
Also create a TitleBar 'TITLE600' and give the relevant title.&----
*& Module STATUS_0600 OUTPUT
MODULE status_0600 OUTPUT.
SET PF-STATUS 'STATUS600'.
SET TITLEBAR 'TITLE600'.
CREATE ALV GRID CONTROL IF DOES NOT EXISTS INITIALLY
IF cont_dock IS INITIAL.
PERFORM create_alv.
ENDIF.ENDMODULE. " STATUS_0600 OUTPUT* PAI module of the screen created. In case we use an interactive ALV or
*for additional functionalities we can create OK codes and based on the
*user command we can do the coding as shown below
*& Module USER_COMMAND_0600 INPUT
MODULE user_command_0600 INPUT.
CASE ok_code.
WHEN 'SUBMIT'.
*TO GET THE CURRENT FIELDCATALOGUE FROM THE FRONTEND
CALL METHOD cont_alvgd->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = it_fielcat.
*refresh the alv
CALL METHOD cont_alvgd->refresh_table_display.
*to Send Buffered Automation Queue to Frontend
CALL METHOD cl_gui_cfw=>flush.*Exit button clicked to leave the program
WHEN 'EXIT'.
LEAVE PROGRAM. ENDCASE.ENDMODULE. " USER_COMMAND_0600 INPUT&----
*& Form CREATE_ALV
&----FORM create_alv.*create a docking container and dock the control at the botton
CREATE OBJECT cont_dock
EXPORTING
dynnr = '600'
extension = 100
side = cl_gui_docking_container=>dock_at_bottom.*create the alv grid for display the table
CREATE OBJECT cont_alvgd
EXPORTING
i_parent = cont_dock.*create custome container for alv
CREATE OBJECT cont_cust
EXPORTING
container_name = 'CCONT'.
*create alv editable grid
CREATE OBJECT cont_editalvgd
EXPORTING
i_parent = cont_cust.* register events for the editable alv
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_data_changed FOR cont_editalvgd. CALL METHOD cont_editalvgd->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.*building the fieldcatalogue for the initial display
PERFORM build_fieldcat CHANGING it_fielcat it_fielcatalogue.*building the fieldcatalogue after the user has changed it
PERFORM change_fieldcat CHANGING it_fielcatalogue.*fetch data from the table
PERFORM fetch_data.* Get excluding functions for the alv editable tool bar APPEND cl_gui_alv_grid=>mc_fc_loc_append_row TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_loc_insert_row TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_loc_cut TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sort TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sort_asc TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sort_dsc TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_subtot TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sum TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_graph TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_info TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_print TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_filter TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_views TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_export TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_paste TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_find TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_loc_copy TO it_excl_func.
*Alv display for the T006 table at the bottom
CALL METHOD cont_alvgd->set_table_for_first_display
CHANGING
it_outtab = it_t006[]
it_fieldcatalog = it_fielcat[].
optimize column width of grid displaying fieldcatalog
it_layout-cwidth_opt = 'X'.* Get fieldcatalog of table T006 - alv might have
modified it after passing.
CALL METHOD cont_alvgd->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = it_fielcat[].to Send Buffered Automation Queue to Frontend CALL METHOD cl_gui_cfw=>flush. Display fieldcatalog of table T006 in editable alv grid
CALL METHOD cont_editalvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
it_toolbar_excluding = it_excl_func
CHANGING
it_outtab = it_fielcat[]
it_fieldcatalog = it_fielcatalogue[].
ENDFORM. " CREATE_alv
*& Form fetch_data
FORM fetch_data.* select data of T006
SELECT * FROM t006 INTO TABLE it_t006 UP TO 50 ROWS.
ENDFORM. " fetch_data
*& Form BUILD_FIELDCAT
FORM build_fieldcat CHANGING it_fldcat TYPE lvc_t_fcat
it_fcat TYPE lvc_t_fcat.
Fieldcatalog for table T006: it_fldcat
to generate the fields automatically CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'T006'
CHANGING
ct_fieldcat = it_fldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.*----
Fieldcatalog for table LVC_T_FCAT:it_fcat
Generate fieldcatalog of fieldcatalog structure.
This fieldcatalog is used to display fieldcatalog 'it_fldcat'
on the top of the screen. CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'LVC_S_FCAT'
CHANGING
ct_fieldcat = it_fcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " BUILD_FIELDCAT
*& Form CHANGE_FIELDCAT
*after the user has modified the fieldcatalogue we build another fieldcat
*for the modified alv display
FORM change_fieldcat CHANGING it_fcat TYPE lvc_t_fcat. DATA ls_fcat TYPE lvc_s_fcat. LOOP AT it_fcat INTO ls_fcat.
ls_fcat-coltext = ls_fcat-fieldname.
ls_fcat-edit = 'X'. IF ls_fcat-fieldname = 'COL_POS' OR ls_fcat-fieldname = 'FIELDNAME'.
ls_fcat-key = 'X'.
ENDIF. MODIFY it_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " CHANGE_FIELDCAT
ref:saptechnical tutorial.
Regards,
Anirban -
Hi,
the subject says it all. I have downloaded the trail version to see if its possible to create a editable pdf with validation(required field) using Adobe Acrobat pro version?
Basically, I will have to create a pdf form where users fill it and send it back to me. there will be required fields (the textbox and check box) that user need to fill before saving the editable pdf?
Is it possible. if so, can someone kind enough to point to me right directions?
Thanks in advance.Thanks for reply. What I am trying to achieve is to give an option for the user to download the pdf form and once the user tries to save the pdf, it validates with the required field. I managed to create the editable pdf with required fields option. I just need that validation to be done when user click on save file. How can I achieve this? thanks so much for your help.
-
Hi gurus in ALV how to edit the fields on out put list
hi gurus in ALV how to edit the fields on out put list
hi
REPORT ZSB_ALV_EDITABLE_SAMPLE.
TABLES: SFLIGHT.
DATA: gc_container TYPE scrfname VALUE 'LIST_AREA',
gc_custom_container TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
gc_grid TYPE REF TO CL_GUI_ALV_GRID,
gs_layout TYPE LVC_S_LAYO,
gt_fieldcat TYPE LVC_T_FCAT.
DATA: ok_code TYPE SY-UCOMM.
DATA: gt_outtab TYPE TABLE OF SFLIGHT.
*DYNPRO
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '100'.
CREATE OBJECT gc_custom_container
EXPORTING
container_name = gc_container
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
CREATE OBJECT gc_grid
EXPORTING
i_parent = gc_custom_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5 .
PERFORM prepare_field_catalog CHANGING gt_fieldcat .
PERFORM prepare_layout CHANGING gs_layout .
PERFORM get_alv_display.
ENDMODULE.
*& Module USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0100 INPUT.
OK_CODE = SY-UCOMM.
IF OK_CODE = 'BACK'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR OK_CODE.
ENDIF.
ENDMODULE.
FORM prepare_field_catalog CHANGING gt_fieldcat TYPE LVC_T_FCAT.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
I_STRUCTURE_NAME = 'SFLIGHT'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fieldcat[].
ENDFORM.
FORM prepare_layout changing p_gs_layout TYPE lvc_s_layo.
p_gs_layout-zebra = 'X'.
p_gs_layout-edit = 'X'.
ENDFORM. " prepare_layout
FORM get_alv_display .
SELECT * FROM sflight INTO TABLE gt_outtab UP TO 10 ROWS.
CALL METHOD gc_grid->set_table_for_first_display
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = gs_layout
CHANGING
it_outtab = gt_outtab
IT_FIELDCATALOG = gt_fieldcat
ENDFORM. " get_alv_display -
Hi,
I'm trying to make a required field check on a ALV field. I can see that the function works as required and produces an error to display in the message_manages
but when I return to the program no error is shown and no red box is displayed arround the field.
Any help is welcome...
Thanks,
Kris
This is my code:
DATA: l_attr_list TYPE cl_wd_dynamic_tool=>t_check_mandattr_tab,
l_attr TYPE cl_wd_dynamic_tool=>t_check_mandattr_struct,
errors TYPE boolean.
l_attr-node_path = 'QUOTATION_TO_CREATE'.
l_attr-element_index = 0.
l_attr-attribute_name = 'KWMENG'.
APPEND l_attr TO l_attr_list.
errors = cl_wd_dynamic_tool=>check_mandatory_attributes(
attribute_list = l_attr_list
display_messages = abap_true
context_root = wd_context
CHECK errors EQ abap_false.Hi Hans,
What ever you said is not possible because while returning to your program, the data won't be saved and it will closed in any situation.
If you want to do like this, Please display the pop-up before you are going to Program saying that " Do you want to save this data?" that time it will display the error and you can do what ever you want.
I think My answer will give helpful information to you. If not please reply with some more information then i will try to reslove your problem
Warm Regards,
Vijay -
Edit single field in single line in ALV
Dear experts,
I have an ALV with many lines.
I need to edit one field in a few of those lines, depending on the data. How can I do that? I aldeady used the EDIT parameter of fieldcat, but it changed the whole column of the table.
Please help.
Thanks,
RoxaniHi again,
1. Just for info purpose.
2. We can use colours
3. Not only the full row color,
we can also manipulate the color in each cell.
4.
IMPORTANT THINGS
a. Extra field in internal table
clr TYPE slis_t_specialcol_alv,
(this field will contain the colour codes)
b. assign fieldname to alv layout
alvly-coltab_fieldname = 'CLR'
c. work area for colour
DATA : clrwa TYPE slis_specialcol_alv.
d. Populating the color
Once again
Loop at ITAB.
*********logic
if itab-field < 0 "---negative
clrwa-fieldname = 'FIELDNAME'. "<--- FIELDNAME FOR COLOR
clrwa-color-col = 6. <------- COLOUR 0-9
APPEND clrwa TO itab-clr.
MODIFY ITAB.
endif.
ENDLOOP.
5. just copy paste in new program
6.
REPORT abc .
NECESSARY / MUST
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
ITAB DECLARATION
DATA : prg TYPE sy-repid.
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : clname(3) TYPE c,
clr TYPE slis_t_specialcol_alv,
END OF itab.
DATA : clrwa TYPE slis_specialcol_alv.
PARAMETERS : a TYPE c.
DATA : flname TYPE slis_fieldname.
SELECT
START-OF-SELECTION.
SELECT * FROM t001
INTO CORRESPONDING FIELDS OF TABLE itab..
LOOP AT itab..
IF SY-TABIX <= 5.
itab-clname = 'C50'.
ELSE.
itab-clname = 'C30'.
ENDIF.
MODIFY itab.
ENDLOOP.
LOOP AT ITAB.
check itab-bukrs = '1000'
clrwa-fieldname = 'BUTXT'.
clrwa-color-col = 6.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
clrwa-fieldname = 'LAND1'.
clrwa-color-col = 4.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
ENDLOOP.
prg = sy-repid.
flname = 'CLNAME'.
alvly-info_fieldname = 'CLNAME'.
alvly-coltab_fieldname = 'CLR'.
LOOP AT ITAB.
if sy-tabix = 3.
clrwa-fieldname = 'BUTXT'.
clrwa-color-col = 6.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
clrwa-fieldname = 'LAND1'.
clrwa-color-col = 1.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
endif.
ENDLOOP
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = prg
i_internal_tabname = 'ITAB'
i_inclname = prg
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
minimum
*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
extra
sy-uname = 'XYZAB'.
prg = sy-repid.
Excluding
DATA : excl TYPE slis_t_extab.
DATA : exclwa TYPE slis_extab.
exclwa = '&OUP'.
APPEND exclwa TO excl.
exclwa = '&ODN'.
APPEND exclwa TO excl.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid
is_layout = alvly
i_callback_user_command = 'ITAB_USER_COMMAND'
it_excluding =
excl
i_save = 'A'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form itab_user_command
text
-->WHATCOMM text
-->WHATROW text
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
BREAK-POINT.
ENDFORM. "itab_user_command
regards,
amit m. -
Hello Abapers,
I am not getting the desired output as per example.
I have followed all the steps as per the example but still a looser can anyone help me in this.
When I execute the program I get the following run time error
Field symbol has not been assigned.
I tried commenting the subroutine call
1} perform Change_fieldcatalogue and fetch data.
and i was getting the 2 custom container (top, bottom) on the screen output this time.
I have also created a screen 600 with all the attributes.
But i have doubt with this statement
Create a Custom container and name it CCONT and OK code as OK_CODE.
Save check and Activate the screen painter.
I hope on the layout screen the one which says custom control is only the custom container but i see that the fct code box is not highlighted then how can i assign a fctcode.
Could you plz also clear this.
Thanks in advance.
Ranjith Nambiar
Program code below
A small note about this program
*& AS : ALV report which displays the contents of the table T006
*& (as a docking container in the bottom) along with the
*& editable ALV which contains the ALV fieldcatalogue table structure.
*& With the available toolbar options of the editable ALV in the output,
*& user can change the fieldcatalogue as per his requirement.
*& When the user clicks 'SUBMIT',the display of the ALV with table T006
*& gets modified and customised accordingly to the user's requirement.
REPORT ZNRD_ALV_EDITABLE.
* Structure declaration for t006
types : begin of ty_t006.
include structure t006.
types : end of ty_t006.
* Internal table and work area declaration for t006.
data : it_t006 type standard table of ty_t006,
wa_t006 type ty_t006.
* Declaration for ALV
data : ok_code type sy-ucomm, " Ok code.
it_fcat type lvc_t_fcat, " Fieldcatalogue.
it_fieldcat type lvc_t_fcat, " Fieldcatalogue for Fieldcatalogue itself.
it_layout type lvc_s_layo.
*Declaration for toolbar functions
data : it_excl_func type ui_functions,
* Controls to display it_t006 and its fieldcatalogue
cont_dock type ref to cl_gui_docking_container,
cont_alvgd type ref to cl_gui_alv_grid,
* Controls to display fieldcatalogue as editable alv gridand container
cont_cust type ref to cl_gui_custom_container,
cont_editalvgd type ref to cl_gui_alv_grid.
initialization.
start-of-selection.
* Local class definition for data changed in fieldcatalogue alv
CLASS lcl_event_receiver definition.
public section.
methods handle_data_changed
for event data_changed of cl_gui_alv_grid
importing er_data_changed.
endclass. " lcl_event_receiver definition.
* Local class implementation for data changed in fieldcatalogue alv
CLASS lcl_event_receiver implementation.
method handle_data_changed.
endmethod. " handle_data_changed.
endclass. "lcl_event_receiver implementation
* Data declaration for event receiver
data : event_receiver type ref to lcl_event_receiver.
end-of-selection.
* Setting the screen for alv output for table display and changed fieldcatalogue display
set screen 600.
*& Module STATUS_0600 OUTPUT
* text
MODULE STATUS_0600 OUTPUT.
SET PF-STATUS 'STATUS600'.
SET TITLEBAR 'TITLE600'.
* Create ALV grid if doesn't exits.
if cont_dock is initial.
perform Create_alv.
endif.
ENDMODULE. " STATUS_0600 OUTPUT
*& Form Create_alv
* text
* --> p1 text
* <-- p2 text
FORM Create_alv.
* Create a docking container and dock the control at the bottom
create object cont_dock
exporting
dynnr = '600'
extension = 100
side = cl_gui_docking_container=>dock_at_bottom.
* Create ALV grid for displaying the table
create object cont_alvgd
exporting
i_parent = cont_dock.
* Create custom container for ALV
create object cont_cust
exporting
container_name = 'CCONT'.
* Create alv editable grid
create object cont_editalvgd
exporting
i_parent = cont_cust.
* Register events for the editable alv
create object event_receiver.
set handler event_receiver->handle_data_changed for cont_editalvgd.
call method cont_editalvgd->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
*Building fieldcatalogue for the initial display
perform Build_fieldcatalogue changing it_fcat it_fieldcat.
* Building the fieldcatalogue after the user has changed it
perform Change_fieldcatalogue changing it_fieldcat.
* Fetch data from the table.
perform Fetch_data.
* Get excluding functions for the alv editable tool bar
APPEND cl_gui_alv_grid=>mc_fc_loc_append_row TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_loc_insert_row TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_loc_cut TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sort TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sort_asc TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sort_dsc TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_subtot TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_sum TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_graph TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_info TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_print TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_filter TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_views TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_export TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_mb_paste TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_find TO it_excl_func.
APPEND cl_gui_alv_grid=>mc_fc_loc_copy TO it_excl_func.
*Alv display for the T006 table at the bottom
CALL METHOD cont_alvgd->set_table_for_first_display
CHANGING
it_outtab = it_t006[]
it_fieldcatalog = it_fcat[].
* optimize column width of grid displaying fieldcatalog
it_layout-cwidth_opt = 'X'.
* Get fieldcatalog of table T006 - alv might have
* modified it after passing.
CALL METHOD cont_alvgd->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = it_fcat[].
*to Send Buffered Automation Queue to Frontend
CALL METHOD cl_gui_cfw=>flush.
* Display fieldcatalog of table T006 in editable alv grid
CALL METHOD cont_editalvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
it_toolbar_excluding = it_excl_func
CHANGING
it_outtab = it_fcat[]
it_fieldcatalog = it_fieldcat[].
ENDFORM. " Create_alv
*& Module USER_COMMAND_0600 INPUT
* text
MODULE USER_COMMAND_0600 INPUT.
case ok_code.
when 'SUBMIT'.
* To get the current fieldcatalogue from the front end
call method cont_alvgd->set_frontend_fieldcatalog
exporting
it_fieldcatalog = it_fieldcat.
call method cont_alvgd->refresh_table_display.
call method cl_gui_cfw=>flush.
when 'EXIT'.
leave program.
endcase.
ENDMODULE. " USER_COMMAND_0600 INPUT
*& Form Build_fieldcatalogue
* text
* <--P_IT_FCAT text
* <--P_IT_FIELDCAT text
FORM Build_fieldcatalogue CHANGING P_IT_FCAT
P_IT_FIELDCAT.
* Fieldcatalog for table T006: it_fldcat
* to generate the fields automatically
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'T006'
CHANGING
ct_fieldcat = it_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
* Fieldcatalog for table LVC_T_FCAT:it_fcat
* Generate fieldcatalog of fieldcatalog structure.
* This fieldcatalog is used to display fieldcatalog 'it_fldcat'
* on the top of the screen.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'LVC_S_FCAT'
CHANGING
ct_fieldcat = it_fcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
ENDFORM. " Build_fieldcatalogue
*& Form Change_fieldcatalogue
* After the user has modified the fieldcatalogue we build another fieldcat
* for the modified alv display
* <--P_IT_FIELDCAT text
FORM Change_fieldcatalogue CHANGING P_IT_FIELDCAT.
DATA ls_fcat TYPE lvc_s_fcat.
LOOP AT it_fcat INTO ls_fcat.
ls_fcat-coltext = ls_fcat-fieldname.
ls_fcat-edit = 'X'.
IF ls_fcat-fieldname = 'COL_POS' OR ls_fcat-fieldname = 'FIELDNAME'.
ls_fcat-key = 'X'.
ENDIF.
MODIFY it_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " Change_fieldcatalogue
*& Form Fetch_data
* text
* --> p1 text
* <-- p2 text
FORM Fetch_data .
select * from t006 into table it_t006 up to 50 rows.
ENDFORM. " Fetch_datacomment this particular section deals with top container.
CALL METHOD cont_editalvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
it_toolbar_excluding = it_excl_func
CHANGING
it_outtab = it_fcat[]
it_fieldcatalog = it_fieldcat[].
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'LVC_S_FCAT' "This is deep strucure
CHANGING
ct_fieldcat = it_fcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
LVC_S_FCAT is a deep structure , so try to comment that section and see. if you want that part , populate the fieldcatalog manually.
Maybe you are looking for
-
External Hard Drive Becomes Read Only
I have a LaCie Hard Drive that Time Machine has been backing up to for about 4 days now. All of a sudden, the external hard drive is read only. When I go into Get Info for the hard drive, I can't even change the read/write permissions - it's all gray
-
How to populate form bean (Action form) from Action (Struts)
Hello to all.. I have a problem populating a from bean in struts from Action class... What I would like is .. 1. how can I populate a formbean from Action so when a page (JSP) with tags will be displayed some tags will be set and some no (depends on
-
Personal hotspot doesn't work.
Hello! After install ios 7 on my iphone 4. Personal hotspot doesn't work.
-
List Region with Dynamic Table name
Trying to build a page that is similar to Query Builder. On the left side of my page, I need to populate a list of table names from a SQL statement. Once the list is created, will need to perform some addtional actions when user clicks onthe specific
-
Issues with Nested AM Transaction
Hi All, I am using JDev 11.1.1.6 and WLS 10.3.6 I am developing an application that contains a number of AMs(Application Module) . Now I clubbed all the AMs under a root AM.by modifying the databindings.cpx and all the necessary pagedefs. Now I ne