Unlock a row in alv - make fields editable
Hello,
I have to solve the following problem: I am using ALV FM and I have to display a non-writable alv. When a user selects a line and clicks a button, this line must change to editable mode. I found the example below. At first glance, it seemed to be what I had looked for. But on the second glance I figured out, that it does the opposite of what I need.
When I set "FIELDCAT-EDIT = space." and "LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED." the whole table rests in locked mode. Could someone please tell me, how to lock all rows and set a single row editable?
Thanks in advance
REPORT ZTESTALV.
TYPE-POOLS: SLIS.
*- Fieldcatalog
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
*- For Events
DATA:IT_EVENTS TYPE SLIS_T_EVENT.
DATA: X_FIELDCAT TYPE LVC_S_FCAT,
X_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA:X_LAYOUT TYPE LVC_S_LAYO.
"{ FOR DISABLE
DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
"} FOR DISABLE
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE
END OF IT_VBAP.
DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
SELECT VBELN
POSNR
UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP.
DATA:L_POS TYPE I VALUE 1.
CLEAR: L_POS.
L_POS = L_POS + 1.
X_FIELDCAT-SELTEXT = 'VBELN'.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
x_fieldcat-ref_field = 'VBELN'.
x_fieldcat-ref_table = 'VBAK'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SELTEXT = 'POSNR'.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
<b>"{FOR DISABLE HERE 6ROW IS DISABLED
SY-TABIX = 6.
LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = cl_gui_alv_grid=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 10.
INSERT LS_EDIT INTO TABLE LT_EDIT.
LS_EDIT-FIELDNAME = 'POSNR'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 6.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB TRANSPORTING
HANDLE_STYLE .
X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
"} UP TO HERE</b>
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT_LVC = X_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCAT
TABLES
T_OUTTAB = IT_VBAP[]
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.
Message was edited by:
Achim Beckmann
The problem is solved.
Similar Messages
-
How to make field editable in ALV tree in OOPs?
Hi Gems,
Again I need help from you all.
I am writing a program using OOPs and the uotput will be in ALV tree. I need to make a field editable in a perticular row.
I am doing it using layout but the program is giving error during
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
This method is returning sy-subrc = 2 and I am unable to get the output.
I am using below code to make the field editable:
DATA: LT_LAYOUT_ITEM TYPE LVC_T_LAYI,
LS_LAYOUT_ITEM TYPE LVC_S_LAYI.
LS_LAYOUT_ITEM-FIELDNAME = 'ACPCKTWRT'. "ACPCKTWRT is the field name in the Internal table
LS_LAYOUT_ITEM-EDITABLE = 'X'.
APPEND LS_LAYOUT_ITEM TO LT_LAYOUT_ITEM.
CALL METHOD G_ALV_TREE->ADD_NODE
EXPORTING
I_RELAT_NODE_KEY = FP_RELAT_KEY
I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
IS_OUTTAB_LINE = LS_TMP_FINFCNO "structure of the internal table
IS_NODE_LAYOUT =
IT_ITEM_LAYOUT = LT_LAYOUT_ITEM "Added layout to make the field editable
I_NODE_TEXT = LV_NODE_TEXT "Node text
IMPORTING
E_NEW_NODE_KEY = FP_NODE_KEY
EXCEPTIONS
RELAT_NODE_NOT_FOUND = 1
NODE_NOT_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.
Please help me and let me know how to get the solution.Hello
The ALV tree control is not intended for making values editable (e.g. see
[How to make ALV tree columns editable|http://sap.ittoolbox.com/groups/technical-functional/sap-abap/how-to-make-alv-tree-columns-editable-2052414])
However, if you need an editable tree control then you have to use a different class (e.g. CL_ITEM_TREE_MODEL or CL_COLUMN_TREE_MODEL) but you will not have the ALV functionality of the ALV tree control.
Regards
Uwe -
How to make fields editable in an custom enhancement
Hi Experts,
My requirement is to perform some custom validations against a field FKONT(BSEG) at the line item level of FB60 and display appropriate message and make the incorrect field editable.
I have implemented an implicit enhancement point in include MF05AFGENJ.
The error messages are coming but I am unable to make the GL account, cost center and profit center fields editable.
Please let me know how to make the above fields editable after displaying the error message.
For reference, I have done the coding like this:
IF sy-tcode = 'FB60' .
CHECK GL_ITEMS IS NOT INITIAL.
DATA: L_COUNT TYPE I,
L_STRING TYPE STRING,
L_FKONT TYPE FIPLS,
L_TABIX TYPE SY-TABIX,
G_FLAG TYPE C.
DATA: WA_ZZFSTP LIKE ZZFSTP. "Work area for ZZFSTP table
CONSTANTS:C_MK TYPE TXJCD VALUE 'MK0000000'.
*-- Validating the Financial budget item field
IF GL_ITEMS-FKONT IS NOT INITIAL.
SELECT SINGLE FKONT
INTO L_FKONT
FROM ZFSTP
WHERE FKONT = GL_ITEMS-FKONT. "cost center
IF SY-SUBRC NE 0.
CLEAR: G_FLAG.
G_FLAG = 'X'.
MESSAGE W003(ZZFI) WITH 'Please enter 'Financial' 'Budget Item Field' DISPLAY LIKE 'E'.
EXIT.
ENDIF.
*-- Copying the first line item financial budget item field to all the line items in the internal table
DESCRIBE TABLE GL_ITEMS LINES L_COUNT.
IF L_COUNT > 1.
READ TABLE GL_ITEMS INDEX 1.
IF SY-SUBRC = 0.
CLEAR: L_FKONT.
L_FKONT = GL_ITEMS-FKONT.
*-- Assign the tax jurisdiction codes in all the line items
LOOP AT GL_ITEMS.
CLEAR: L_TABIX.
L_TABIX = SY-TABIX.
GL_ITEMS-FKONT = L_FKONT.
GL_ITEMS-TXJCD = C_MK.
*-- Copy the first financial budget item number and tax jurisdiction code MK0000000 in all line items
MODIFY GL_ITEMS INDEX L_TABIX TRANSPORTING FKONT TXJCD.
*-- Populate tax jurisdiction and FKONT financial budget item number in XBSEG table
L_TABIX = L_TABIX + 1. "top record in XBSEG is for header
READ TABLE XBSEG INDEX L_TABIX.
IF SY-SUBRC = 0.
XBSEG-FKONT = L_FKONT.
XBSEG-TXJCD = C_MK.
MODIFY XBSEG INDEX L_TABIX.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF. "describe statement
CLEAR: WA_ZZSTP.
*-- Validate the amount and GL account against the FKONT(financial budget item) number
SELECT SINGLE FKONT
ZZWRBTR
ZZHKONT
ZZKOSTL
ZZPRCTR
INTO CORRESPONDING FIELDS OF WA_ZZFSTP
FROM ZFSTP
WHERE FKONT EQ GL_ITEMS-FKONT.
IF sy-subrc EQ 0.
IF BSEG-WRBTR > WA_ZZFSTP-ZWRBTR.
CLEAR: G_FLAG.
G_FLAG = 'X'.
MESSAGE W003(ZZFI) WITH 'Amount entered' 'cannot be' 'greater than ' WA_ZFSTP-ZZWRBTR DISPLAY LIKE 'E'.
EXIT.
ELSE.
CLEAR: G_FLAG.
G_FLAG = 'X'.
SET CURSOR FIELD 'GL_ITEMS-HKONT'.
MESSAGE W003(ZZFI) WITH 'Incorrect GL account' 'number entered for' 'given financial' 'budget item number'.
EXIT.
ELSE.
*-- Check for cost center and profit center at line item level
LOOP AT GL_ITEMS.
*-- Both cost center and profit center is initial.
IF GL_ITEMS-KOSTL IS INITIAL AND GL_ITEMS-PRCTR IS INITIAL.
CLEAR: G_FLAG.
G_FLAG = 'X'.
SET CURSOR FIELD 'GL_ITEMS-PRCTR' LINE SY-STEPL.
SET CURSOR FIELD 'GL_ITEMS-KOSTL' LINE SY-STEPL.
MESSAGE W003(ZZFI) WITH 'Please enter' 'cost center' 'or' 'profit center'.
EXIT.
*-- Either cost center or profit center is initial
ELSEIF GL_ITEMS-KOSTL IS INITIAL AND GL_ITEMS-PRCTR IS NOT INITIAL.
CHECK GL_ITEMS-PRCTR NE WA_ZZFSTP-ZPRCTR.
CLEAR: G_FLAG.
G_FLAG = 'X'.
SET CURSOR FIELD 'GL_ITEMS-PRCTR' LINE SY-STEPL.
MESSAGE W003(ZZFI) WITH 'Incorrect profit' 'center entered' 'for given' 'financial budget item' DISPLAY LIKE 'E'.
EXIT.
ELSEIF GL_ITEMS-KOSTL IS NOT INITIAL AND GL_ITEMS-PRCTR IS INITIAL.
CHECK GL_ITEMS-KOSTL NE WA_ZFSTP-ZKOSTL.
CLEAR: G_FLAG.
G_FLAG = 'X'.
SET CURSOR FIELD 'GL_ITEMS-KOSTL' LINE SY-STEPL.
MESSAGE W003(ZZFI) WITH 'Incorrect cost' 'center entered' 'for given' 'financial budget item' DISPLAY LIKE 'E'.
EXIT.
ENDIF.
ENDLOOP.
ENDIF. "GL Account
ENDIF. "Amount check
ENDIF. "SY-SUBRC check
ENDIF.
EXPORT G_FLAG FROM G_FLAG TO MEMORY ID 'ZER'.
Please let me know how to make GLaccount,cost center and profit center fields editable.
Regards,
Sangeeta.Hi.. chaek the below links. may be useful to u.
Making Table control records Editable / Non-editable
Table control with both Editable and non Editable fields
Regards,
KP. -
How to make fields editable in Personal Profile Application(WDA)
Hi Experts,
I am not able to make the passport field field editable in Personal Profile Application.
The passport field is uneditable. How do we make it editable so that user can enter Identity No.
Please help.
Regards,
PritiHi Priti,
Do not maintain use case B* - This is not editable.
Maintain Use case A* - This is editable.
Did you maintain entries in this below table.
In this table - V_T7XSSPERSUBTY
Regards
Somu -
How to make field editable in Tcode WPED
Hi,
Its about upgrade of IS Retail from ECC5.0 to ECC6.0.
For Inbound IDOCS coming from POS to SAP System, IDOCs which are in unprocessed category in WPER Tcode.
Now problem is in Tcode WPED there is a transaction date field which is now non editable in ECC6.0
I want to make it modifiable.
Earlier in ECC5.0 It was editable.
So how to make that field modifiable.
Regards,
DivyaThanks Chenna
But that field is sometimes coming editable and sometimes not.....may be it depends on some condition.....but I want to make it editable always whenever an Inbound IDOC is in "To be processed" status in WPER tcode.
Iam going in that screen where field is coming uneditable is:
Tcode WPER -
> Inbound IDOC processing---> to be processed idocs---> double clicking on Idoc Number (comes on WPED screen with non-editable fields in overview table).
If I'm double clicking on that transaction date field it goes to the screen whcih shows Sales Audit Editor: Item list of aggregate sales.
Suggest me how to make it editable.
bye
Divya -
Hello experts.
I had a trouble with sap crm webclient. I added standard field (nationality_text) into view. just added, no more. But this field is non-editable, and greyed. How to make this field editable? this field is from but000 table.HI Ayrat,
You can enhance the component and field and generate P method.
Based on the mode you can change the property of the field and make it editable and display only as per the requirement.
Sample Code :
DATA : lv_website TYPE string.
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter~fp_fieldtype.
IF iv_display_mode = abap_false.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_input.
ELSE.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.
ENDIF.
WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
rv_value = 'clickobject'.
ENDCASE.
Please check the impact before enhancing th standard field.
Regards,
Akshay Ruia -
ABAP IAF - Make Fields Editable in Offline Scenario
Hello all,
Good day!
I just want to ask if its possible to make field modifiable for the ABAP Interactive Adobe Forms (transaction SFP) in an Offline Scenario?
I ask because when I set a textfield as (user entered) during the preview section in the Livecycle Design Editor the fields can be modified. However once I use the FM to generate the print preview and save the PDF locally the field cannot be modified.
Is there a way in how to make this possible?
I hope to hear from you soon.
Thanks and RegardsChad,
I just had the same issue.
I created an offline, interactive form in SFP and just called it using ABAP. The form came up and I could enter data, BUT it would not save.
The trick is to make sure you provide a valid interface mapping between a DDIC object and the interface.
Create an DDIC structure that matches your form fields, and make sure you pass it in the FM call and it's defined in the interface. Then map the fields to your form fields.
btw, i'm using
SFPDOCPARAMS-FILLABLE = 'X'.
SFPDOCPARAMS-DYNAMIC = 'X'. -
How to make fields editable in an alv tree
hi
there is an alv grid for which tree view shud also be made. The cells that are editable in the grid should also be editable in the tree.
please let me know how to make the specific cells of the tree editableafter setting the edit field in the field catalogue its bot working.
i am posting the code snippet.
please let me know what else should be done and how to add INPUT field to the fieldcat.
field-symbols: <fs_fieldcat> type lvc_s_fcat.
data: l_tabix type sy-tabix.
data: g_fieldcatalog type lvc_t_fcat,
wa_fcat like line of g_fieldcatalog.
data : hide type c value 'X'.
call function 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'RSTHIE_M'
i_client_never_display = 'X'
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = g_fieldcatalog.
***-set table header on middle width
LOOP AT g_fieldcatalog ASSIGNING <fs_fieldcat>.
<fs_fieldcat>-FIX_COLUMN = 'X'.
<fs_fieldcat>-edit = 'X'.
ENDLOOP. -
UNLOCKING single row in ALV using Funtions
hai,
Actually i am displaying a table in ALV USING FUNCTIONS and i am locking key values.
Now my reqment is , if i press (NEW, COPY )button then i have to add one new row and that row should be Unlocked to insert values.
Is it possible USING FUNCTIONS(I have a solution using CLASSES)Hi ramesh,
it is possible with the LVC FM.i gave the sample yesterday did you check that..
if not check it to day..
REPORT ZTESTALV.
TYPE-POOLS: SLIS.
*- Fieldcatalog
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV..
*- For Events
DATA:IT_EVENTS TYPE SLIS_T_EVENT.
DATA: X_FIELDCAT TYPE LVC_S_FCAT,
X_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA:X_LAYOUT TYPE LVC_S_LAYO.
"{ FOR DISABLE
DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
"} FOR DISABLE
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE
END OF IT_VBAP.
DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
SELECT VBELN
POSNR
UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP.
DATA:L_POS TYPE I VALUE 1.
CLEAR: L_POS.
L_POS = L_POS + 1.
X_FIELDCAT-SELTEXT = 'VBELN'.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
x_fieldcat-ref_field = 'VBELN'.
x_fieldcat-ref_table = 'VBAK'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SELTEXT = 'POSNR'.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
"{FOR DISABLE HERE 6ROW IS DISABLED
SY-TABIX = 6.
LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 10.
INSERT LS_EDIT INTO TABLE LT_EDIT.
LS_EDIT-FIELDNAME = 'POSNR'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 6.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB TRANSPORTING
HANDLE_STYLE .
X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
"} UP TO HERE
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT_LVC = X_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCAT
TABLES
T_OUTTAB = IT_VBAP[]
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.
Regards
vijay -
How to set some rows in ALV to be editable or some non editable.
Dear all Gurus,
I'm facing a situation here, I need your assistance.
I'm creating a alv table where the user can enter a data and then this will be uploaded into the system. Now upon validation some records might fail and would need some changes and some records that had no problems would have been successfully posted.
When the program returns to the user i want the successful one's to be greyed out and not editable. I'm not sure on how i could acess the rows of the table. I tried few classes and an all i could manage was to change the table setting and configs.
Below i've pasted the code on how i've code my alv table. Please advice on how i could access the rows and disable the successfull ones. Please.
METHOD wddoinit .
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
l_interface TYPE REF TO iwci_salv_wd_table,
l_model TYPE ref to cl_salv_wd_config_table, "Contains all characteristics of a table(collumns, fields, etc)
lt_columns TYPE salv_wd_t_column_ref, " Table type
lt_fields TYPE salv_wd_t_field_ref, " Table type
l_btn_ins TYPE REF TO cl_salv_wd_fe_button,
l_btn_del TYPE REF TO cl_salv_wd_fe_button,
l_btn_sell_all TYPE REF TO cl_salv_wd_fe_button,
l_btn_dell_all TYPE REF TO cl_salv_wd_fe_button,
l_btn_calc TYPE REF TO cl_salv_wd_fe_button,
l_btn_save TYPE REF TO cl_salv_wd_fe_button,
l_function TYPE REF TO cl_salv_wd_function,
l_column TYPE REF TO cl_salv_wd_column,
l_header TYPE REF TO cl_salv_wd_column_header,
lr_input_1 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_2 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_3 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_4 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_5 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_6 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_7 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_8 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_9 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_10 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_11 TYPE REF TO cl_salv_wd_uie_input_field,
lr_input_12 TYPE REF TO cl_salv_wd_uie_input_field,
l_link TYPE REF TO cl_salv_wd_uie_button.
CONSTANTS:
zzto TYPE string VALUE 'ZZTO',
zzfrom TYPE string VALUE 'ZZFROM',
takeoff_date TYPE string VALUE 'TAKEOFF_DATE',
read_date TYPE string VALUE 'READ_DATE',
takeoff_time TYPE string VALUE 'TAKEOFF_TIME',
read_time TYPE string VALUE 'READ_TIME',
ac_hrs TYPE string VALUE 'AC_HRS',
le_hrs TYPE string VALUE 'LE_HRS',
re_hrs TYPE string VALUE 'RE_HRS',
ac_cycle TYPE string VALUE 'AC_CYCLE',
re_cycle TYPE string VALUE 'RE_CYCLE',
le_cycle TYPE string VALUE 'LE_CYCLE',
ltext TYPE string VALUE 'LTEXT'.
l_ref_cmp_usage = wd_this->wd_cpuse_multi_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
*Map the interface.
l_interface = wd_this->wd_cpifc_multi_alv( ).
DATA:
node_mdoc TYPE REF TO if_wd_context_node,
elem_mdoc TYPE REF TO if_wd_context_element.
navigate from <CONTEXT> to <MDOC> via lead selection
node_mdoc = wd_context->get_child_node( name = if_create_mass_entry=>wdctx_mdoc ).
l_interface->set_data( r_node_data = node_mdoc ).
*Map the model
wd_this->l_model = l_interface->get_model( ).
*Map the columns
lt_columns = wd_this->l_model->if_salv_wd_column_settings~t_columns.
*Map the fields
lt_fields = wd_this->l_model->if_salv_wd_field_settings~t_fields.
cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
EXPORTING r_model = wd_this->l_model
allowed = abap_false ). " try abap_true
*Enable or Disable the ALV desired outlook and design
wd_this->l_model->if_salv_wd_table_settings~delete_header( ).
wd_this->l_model->if_salv_wd_table_settings~set_selection_mode(
value = cl_wd_table=>e_selection_mode-auto ).
wd_this->l_model->if_salv_wd_table_settings~set_width( value = '100%' ).
wd_this->l_model->if_salv_wd_table_settings~set_visible_row_count( value = '10' ).
wd_this->l_model->if_salv_wd_table_settings~set_read_only( value = abap_false ).
wd_this->l_model->if_salv_wd_std_functions~set_filter_filterline_allowed( value = abap_true ).
wd_this->l_model->if_salv_wd_std_functions~set_sort_headerclick_allowed( value = abap_true ).
wd_this->l_model->if_salv_wd_std_functions~set_export_allowed( value = abap_false ).
*Adding functionalities to the ALV
*'Insert Row' Button
CREATE OBJECT l_btn_ins.
l_btn_ins->set_text( 'Insert Row' ).
l_btn_ins->set_tooltip( 'To enter a new row' ).
l_btn_ins->set_image_source( value = 'ICON_INSERT_ROW' ).
l_function = wd_this->l_model->if_salv_wd_function_settings~create_function( id = 'INSERT' ).
l_function->set_position( value = '1' ).
l_function->set_editor( value = l_btn_ins ).
*'Delete Row' Button
CREATE OBJECT l_btn_del.
l_btn_del->set_text( 'Delete Row' ).
l_btn_del->set_tooltip( 'Delete the selected row' ).
l_btn_del->set_image_source( value = 'ICON_DELETE_ROW' ).
l_function = wd_this->l_model->if_salv_wd_function_settings~create_function( id = 'DELETE' ).
l_function->set_position( value = '2' ).
l_function->set_editor( value = l_btn_del ).
*'Select All' Button
CREATE OBJECT l_btn_sell_all.
l_btn_sell_all->set_text( 'Select All' ).
l_btn_sell_all->set_tooltip( 'Select all entered record' ).
l_btn_sell_all->set_image_source( value = 'ICON_INSERT_ROW' ).
l_function = wd_this->l_model->if_salv_wd_function_settings~create_function( id = 'SELECT' ).
l_function->set_position( value = '3' ).
l_function->set_editor( value = l_btn_sell_all ).
*'Deselect All' Button
CREATE OBJECT l_btn_dell_all.
l_btn_dell_all->set_text( 'Deselect All' ).
l_btn_dell_all->set_tooltip( 'Deselect all records selected' ).
l_btn_dell_all->set_image_source( value = 'ICON_DESELECT_ALL' ).
l_function = wd_this->l_model->if_salv_wd_function_settings~create_function( id = 'DESELECT' ).
l_function->set_position( value = '4' ).
l_function->set_editor( value = l_btn_dell_all ).
*'Calculate' Button
CREATE OBJECT l_btn_calc.
l_btn_calc->set_text( 'Calculate Hours' ).
l_btn_calc->set_tooltip( 'Calculate hours of each record' ).
l_btn_calc->set_image_source( value = 'ICON_CALCULATION' ).
l_function = wd_this->l_model->if_salv_wd_function_settings~create_function( id = 'CALC' ).
l_function->set_position( value = '5' ).
l_function->set_editor( value = l_btn_calc ).
*'Save' Button
CREATE OBJECT l_btn_save.
l_btn_save->set_text( 'Save All' ).
l_btn_save->set_tooltip( 'Save all' ).
l_btn_save->set_image_source( value = 'ICON_SYSTEM_SAVE' ).
l_function = wd_this->l_model->if_salv_wd_function_settings~create_function( id = 'SAVE' ).
l_function->set_position( value = '6' ).
l_function->set_editor( value = l_btn_save ).
FIELD-SYMBOLS: <fs_column> TYPE salv_wd_s_column_ref.
LOOP AT lt_columns ASSIGNING <fs_column>.
l_column = <fs_column>-r_column.
l_column->get_header( RECEIVING value = l_header ).
l_header->set_ddic_binding_field( value = if_salv_wd_c_column_settings=>ddic_bind_none ).
CASE <fs_column>-id .
WHEN zzfrom.
CREATE OBJECT lr_input_1 EXPORTING value_fieldname = zzfrom.
l_header->set_text( value = 'Flt Fr' ).
l_column->set_position( value = '1' ).
l_column->set_cell_editor( lr_input_1 ).
l_column->set_visible( '0' ).
WHEN zzto.
CREATE OBJECT lr_input_2 EXPORTING value_fieldname = zzto.
l_header->set_text( value = 'Flt To' ).
l_column->set_position( value = '2' ).
l_column->set_cell_editor( lr_input_2 ).
WHEN takeoff_date.
CREATE OBJECT lr_input_3 EXPORTING value_fieldname = takeoff_date.
l_header->set_text( value = 'Takeoff Date' ).
l_column->set_position( value = '3' ).
l_column->set_cell_editor( lr_input_3 ).
WHEN read_date.
CREATE OBJECT lr_input_4 EXPORTING value_fieldname = read_date.
l_header->set_text( value = 'Landing Date' ).
l_column->set_position( value = '4' ).
l_column->set_cell_editor( lr_input_4 ).
WHEN takeoff_time.
CREATE OBJECT lr_input_5 EXPORTING value_fieldname = takeoff_time.
l_header->set_text( value = 'Takeoff Time' ).
l_column->set_position( value = '5' ).
l_column->set_cell_editor( lr_input_5 ).
WHEN read_time.
CREATE OBJECT lr_input_6 EXPORTING value_fieldname = read_time.
l_header->set_text( value = 'Landing Time' ).
l_column->set_position( value = '6' ).
l_column->set_cell_editor( lr_input_6 ).
WHEN ac_hrs.
CREATE OBJECT lr_input_7 EXPORTING value_fieldname = ac_hrs.
l_header->set_text( value = 'Flt Time' ).
l_column->set_position( value = '7' ).
l_column->set_cell_editor( lr_input_7 ).
WHEN le_hrs.
CREATE OBJECT lr_input_8 EXPORTING value_fieldname = le_hrs.
l_header->set_text( value = 'LH Eng Runtime' ).
l_column->set_position( value = '8' ).
l_column->set_cell_editor( lr_input_8 ).
WHEN re_hrs.
CREATE OBJECT lr_input_9 EXPORTING value_fieldname = re_hrs.
l_header->set_text( value = 'RH Eng Runtime' ).
l_column->set_position( value = '9' ).
l_column->set_cell_editor( lr_input_9 ).
WHEN ac_cycle.
CREATE OBJECT lr_input_10 EXPORTING value_fieldname = ac_cycle.
l_header->set_text( value = 'No. of Landings' ).
l_column->set_position( value = '10' ).
l_column->set_cell_editor( lr_input_10 ).
WHEN re_cycle.
CREATE OBJECT lr_input_11 EXPORTING value_fieldname = re_cycle.
l_header->set_text( value = 'RH Eng Start' ).
l_column->set_position( value = '11' ).
l_column->set_cell_editor( lr_input_11 ).
WHEN le_cycle.
CREATE OBJECT lr_input_12 EXPORTING value_fieldname = le_cycle.
l_header->set_text( value = 'LH Eng Start' ).
l_column->set_position( value = '12' ).
l_column->set_cell_editor( lr_input_12 ).
WHEN ltext.
CREATE OBJECT l_link.
l_link->set_image_source( value = 'ICON_CREATE_TEXT' ).
l_link->set_text_fieldname( ltext ).
l_link->set_tooltip( value = 'Create Log' ).
l_header->set_text( value = 'Enter Log').
l_column->set_cell_editor( l_link ).
l_column->set_h_align( cl_wd_table_column=>e_h_align-center ).
l_column->set_position( value = '13' ).
WHEN OTHERS.
l_column->set_visible( '01' ).
ENDCASE.
ENDLOOP.
ENDMETHOD.
Your any help is highly appreciated. Thank you.
Regards,
VinodOk, here you go.
In your context, apart from your display fields, add another attribute READ_ONLY, type char01. And lets assume you want the field by name field_1 to be editable or not based on some validation. Your code will be like this to initialize the ALV.
DATA:
l_alv_model TYPE REF TO cl_salv_wd_config_table,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lt_col TYPE SALV_WD_T_COLUMN_REF,
ls_col TYPE SALV_WD_S_COLUMN_REF,
lr_input_field type ref to cl_salv_wd_uie_input_field.
l_alv_model = l_ref_interfacecontroller->get_model( ).
l_alv_model->IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY( abap_false ).
lr_column_settings ?= l_alv_model.
lt_col = lr_column_settings->get_columns( ).
LOOP AT lt_col INTO ls_col where ID = 'FIELD_1'.
create object lr_input_field exporting value_fieldname = ls_col-id.
lr_input_field->set_read_only_fieldname( 'READ_ONLY' ).
ls_col-r_column->set_cell_editor( lr_input_field ).
ENDLOOP.
In your event handler, you read your node, do a get_static_attributes_table. Perform all validations. Loop through your internal table and set the field READ_ONLY as 'X' when validation succeeds. Do READ_ONLY = space when validation fails. Then do a bind_elements. Now the rows for which read_only is false, will be editable and vice versa.
Hope I was clear enough. Get back if you have any doubts.
Regards,
Nithya -
ALV grid field editable/non editable at runtime
Hi All,
I am working on alv grid using containers. I have to make few cells in grid to editable and few othres to non editable which I did using styles by defining table type lvc_t_styl and updating my main internal table. Now once grid is displayed for first time (using set_table_for_first_display) it has required fields in editable and non editable as required. But now on triggering of data_changed event I have to change the editable cells to non editable and the non editable cells to editable. I tried doing this as same way as I have done before calling set_table_for_first_display method i.e. by defining table of type lvc_t_styl in data_changed event and modifying my main internal table but this time the editable fields are changed to non editable and again becomes editable. Same problem with non editable cells also. They become editable and again becomes non ediatble of there own. Can anyone suggest any solution.
<b>Note: Points awarded for helpful answers</b>
nullHi,
Check this link.I am explaining the steps for this.
Kindly reward points by clicking the star on the left of reply,if it helps.<a href="https://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database(OOPS)">Editing OOPS ALV</a> -
SALV objects - make field editable
I want to understand how to make a field on an ALV grid editable using teh SALV object classes.
This is easy to do when you execute the set_table_for_first_display method in the cl_gui_alv_grid class by setting the field catalog EDIT option equal to 'X'.
How is this done using the SALV object methods?
Thanks!Hi,
unfrotunately it is not supported. Check this link:
ALV with cl_salv_table: How can I make certain cells editable?
Regards -
Hi
I am displaying one quanity field in alv. which is in Editable mode. while running and editing it is behaving strangly. if I enter the value 7,00 it is becoming 0,07 in the internal table .
Please guide me in this regard.
jaffer vali shaikJaffer Please check the Below.
Case#1.
REPORT ztest_alv_oo22.
TYPE-POOLS: slis.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_cat TYPE slis_fieldcat_alv.
DATA: BEGIN OF it_data OCCURS 0,
vbeln TYPE vbeln,
matnr TYPE matnr,
menge TYPE p DECIMALS 2,
END OF it_data.
DO 10 TIMES.
it_data-menge = '10.00'.
APPEND it_data.
ENDDO.
wa_cat-fieldname = 'VBELN'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Test'.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
wa_cat-fieldname = 'POSNR'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Test'.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
wa_cat-fieldname = 'MENGE'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Qty'.
wa_cat-edit = 'X'.
wa_cat-decimals_out = 2.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_data
EXCEPTIONS
program_error = 1.
*& Form user_command
* text
* -->UCOMM text
* -->SELFIELD text
FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield.
BREAK-POINT.
ENDFORM. "user_command
Case#2. with out Decimals_out option.
REPORT ztest_alv_oo22.
TYPE-POOLS: slis.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_cat TYPE slis_fieldcat_alv.
DATA: BEGIN OF it_data OCCURS 0,
vbeln TYPE vbeln,
matnr TYPE matnr,
menge TYPE p DECIMALS 2,
END OF it_data.
DO 10 TIMES.
it_data-menge = '10.00'.
APPEND it_data.
ENDDO.
wa_cat-fieldname = 'VBELN'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Test'.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
wa_cat-fieldname = 'POSNR'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Test'.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
wa_cat-fieldname = 'MENGE'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Qty'.
wa_cat-edit = 'X'.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_data
EXCEPTIONS
program_error = 1.
*& Form user_command
* text
* -->UCOMM text
* -->SELFIELD text
FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield.
BREAK-POINT.
ENDFORM. "user_command
Change the Qty in the output and use refresh .
and see. -
Make field editable when checkbox is checked, otherwise given read-only value
I'm attempting to make a fillable PDF form, from and existing document, using Acrobat Pro that does the following:
Purpose of form is to provide customer a way to agree to purchase a custom artwork.
The artwork has a base price, ArtworkPrice. (The ArtworkPrice field is editable)
The customer can choose to include a picture frame. (AddFrame checkbox 'Yes'.)
Choosing 'Yes' to add a frame adds an amount. (The FramePrice field is editable only if AddFrame checkbox is checked)
Otherwise, Leaving AddFrame unchecked fills the FramePrice field with a value of 0.00.
The TotalPrice is calculated as the sum of the ArtworkPrice and the FramePrice fields. (The TotalPrice field is read-only)
So...this part of the form looks essentially of like this:
AddFrame? [ ] Yes
ArtworkPrice $__________ + FramePrice $__________ = TotalPrice $__________
The FramePrice field must be 0.00 (and not editable) at all times unless the AddFrame checkbox is selected.
How can I do this?Add this code to the MouseUp event of AddFrame:
if (this.getField("AddFrame").value=="Off") {
this.getField("FramePrice").value = 0;
this.getField("FramePrice").readonly = true;
} else {
this.getField("FramePrice").value = "";
this.getField("FramePrice").readonly = false; -
How to make a particular field editable in a Form/Empty View
Hi All,
I want make a particular field editable in a Form View. Means i have 5 fields in the Form View and out of 5 fields i want to make one field editable or input field. Can you plz tell me how to do that?
thanks & regards
MadhusudanHi,
You can achieve the same by two methords.
1) Goto configuration of the view in which you want to make fields editable/ non editable. Click on your field. Click on field properties. On the menu you can click on Display only. It will make your field non editable. If you remove the check, it will be editable.
2) Goto Get_I_fieldname methord of your field. There write code rv_disable= 'FALSE'. Field will become editable. rv_disable= 'TRUE' will make field non editable.
Best regards
Pankaj Kumar
Maybe you are looking for
-
Mail says my home directory is full
I've been having some major system problems of late. Following the successful restoration of my laptop's hard drive today I launched Mail. It was very sluggish & came up with the error message: "Mail cannot update your mailboxes because your home dir
-
Earlier, I changed my Apple account details to reflect my new email address. I also changed the password. iCloud seems not to 'know' this. It's service is disabled until I login in. But the default email address shown on the login page is the old ema
-
Truncated (incomplete) Page-Thumbnail View (6.03)
On my Windows XP 64 machine that is running two 1920x1200 monitors via NVIDIA Quadro FX 4600 with the latest drivers I am having the following problem: in both Acrobat and InDesign the page thumbnail views do not show all of the thumbnail whatever th
-
Installation of SAP Productivity PAK - Installation Guide
Hi Everybody, We need to install SAP Productivity PAK . I am looking for more information on this in terms of Installation guide, pre-requisites, installation steps and configuration steps. I would appreciate if any of our members help me by sharing
-
Storing documents like pdf format in database? use inter media object?
Hi, Is there a way to store documents,for example in pdf format, using oracle inter media? or is there another control that can be used? I'm working with Jdeveloper9.0.3 and have recently started using juimagecontrol to store images and it is working