How to make a field manadatory within ALV Grid using methods and classes
Hi,
I am using ALV Grid using set_table_for_first_display
inside my dialog programming. I have a field called project number inside my grid which has to be made as mandatory field.
I have defined a method called catch_data_changed inside my class lcl_event_receiver. This method captures the changes made to one of the fields inside my ALV grid and displays all the default values of the other fields from the grid.
Now, i have to make project number which is one of my fields inside my ALV grid as mandatory. At the field catalog level i did not find any such option for making a field as required field.
Is there any other way, i can accomplish this within the ALV grid?
from my understanding from ur question, i understood that u want the editable field inside alvgrid to be mandatory.
i dont know anthing in fieldcat, but u can try the following logic.
FORM DATA_CHANGED USING P_ER_DATA_CHANGED TYPE REF TO
CL_ALV_CHANGED_DATA_PROTOCOL .
DATA: L_VALUE TYPE LVC_VALUE,
ls_mod_cell type lvc_s_modi.
READ TABLE P_ER_DATA_CHANGED->MT_MOD_CELLS INTO LS_MOD_CELL.
if sy-subrc = 0.
CALL METHOD P_ER_DATA_CHANGED->GET_CELL_VALUE
EXPORTING
I_ROW_ID = LS_MOD_CELL-row_id
I_FIELDNAME = LS_MOD_CELL-fieldname
IMPORTING
E_VALUE = L_VALUE.
IF LS_MOD_CELL-FIELDNAME <> 'fieldname what u want'
MESSAGE 'ENTER VALUE INTO (fieldname u want) ' TYPE 'I'.
ENDIF.
ELSE.
MESSAGE 'ENTER VALUE INTO (fieldname u want) ' TYPE 'I'.
ENDIF.
Similar Messages
-
ALV grid using methods: how to get modified cells
Hi all,
IAM USING alv grid using methods,
i have few fields as editable
if the user edits any of those fields how can i know which cell is modified and what is the new value.
i tried to use method get_modified_cells
but iam getting a msg saying protected method and u can not use.
please advise.
thanks
JAfarJafar,
You need to Take the Help of DATA_CHANGED event, when ever there is a change in the Grid, it will trigger, here you can capture the Cells which are modified.
in your PAI call the method check changed data
CL_GUI_ALV_GRID-->CHECK_CHANGED_DATA
You need to set the handler for datachanged.
set the handler for this, and register the event modified or enter.
**Handler to Check the Data Change
HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED
E_ONF4
E_ONF4_BEFORE
E_ONF4_AFTER,
**Handle Data Change
METHOD HANDLE_DATA_CHANGED.
DATA: X_CHANGE TYPE LVC_S_MODI. "modified cells
LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO X_CHANGE.
ENDLOOP.
ENDMETHOD. "HANDLE_DATA_CHANGED
Regards
Vijay -
Possible to have vertical scroll bar for a cell in ALV Grid (using methods)
Hi All,
I have a field with length 100 characters on a ALV Grid (using methods)..User doesn't want to scroll all the 100 characters horizontally to see the whole text rather he wants to have a vertical scroll bar for the cell so that he can scroll vertically.
Is it possible to have split the cell text into lines and have a vertical scroll bar for a cell in ALV Grid?
Regards
Jaker.Thanks for the suggestion Balu.I tried this , but while scrolling,headers also getting scrolled.
Becoz of this , if i scroll down to the last row,headers are getting hidden.
Headers should always be static.only the data should scroll.
Since h:datatable is being rendered as one table , i can div tag for this table alone.
If i have seperate datatable for headers alone i can do this .But i should not use two datatables. -
ALV Grid Using Methods-handle_top_of_page
riends please explain how to resolve the below issue.
I am working on ALV Grid using methods & trying to display
page heading using handle_top_of_page event.
I have defined & implemented the above method and in the implementation I have
given a write statement, which has to be displayed on the top of page.
I have also set the handler for top of page.
The program does not have any errors, but top of page event is not triggered, what might be the problem.
Regards,
UshaHi,
Check this code
Class definition :
CLASS v_lcl_event_receiver DEFINITION
CLASS v_lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_print_top_of_page FOR EVENT print_top_of_page OF
cl_gui_alv_grid,
handle_top_of_page FOR EVENT top_of_page OF
cl_gui_alv_grid.
ENDCLASS.
CLASS V_LCL_EVENT_RECEIVER IMPLEMENTATION
CLASS v_lcl_event_receiver IMPLEMENTATION.
METHOD handle_print_top_of_page.
IF sy-pagno = 1.
PERFORM top_of_page.
ENDIF.
ENDMETHOD.
METHOD handle_top_of_page.
PERFORM top_of_page.
ENDMETHOD.
ENDCLASS.
DATA: v_event_receiver TYPE REF TO v_lcl_event_receiver.
FORM top_of_page.
WRITE: text-020,
ENDFORM. " top_of_page
In PBo of the screen
DATA: v_split TYPE REF TO cl_gui_easy_splitter_container,
v_contnr_top TYPE REF TO cl_gui_container,
v_contnr_bot TYPE REF TO cl_gui_container,
v_grid_02 TYPE REF TO cl_gui_alv_grid,
v_html TYPE REF TO cl_dd_document,
v_text20(255) TYPE c,
v_text16(255) TYPE c,
FORM f9000_objects_create.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
Create a container
CREATE OBJECT o_dockingcontainer
EXPORTING
ratio = '95'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE i000 WITH text-e01."Error in creating Docking container
LEAVE LIST-PROCESSING.
ENDIF.
CREATE OBJECT v_split
EXPORTING
parent = o_dockingcontainer
ORIENTATION = 0
sash_position = 25
with_border = 0
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
IF sy-subrc NE 0.
MESSAGE i000 WITH text-e01."Error in creating Docking container
LEAVE LIST-PROCESSING.
ENDIF.
Get the containers of the splitter control
v_contnr_top = v_split->top_left_container.
v_contnr_bot = v_split->bottom_right_container.
CREATE OBJECT o_alvgrid
EXPORTING
i_parent = o_dockingcontainer.
Create an instance of alv control
CREATE OBJECT o_alvgrid
EXPORTING i_parent = v_contnr_bot.
Object for display of selection parameters in HTML top container
CREATE OBJECT v_html
EXPORTING
style = 'ALV_GRID'.
Must be after the SET HANDLER for TOP_OF_PAGE and foreground only
CALL METHOD o_alvgrid->list_processing_events
EXPORTING i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = v_html.
v_text20 = text-020(summary Record counts)Any text.
CALL METHOD v_html->add_gap
EXPORTING
width = 120.
CALL METHOD v_html->add_text
EXPORTING
text = v_text20.
CALL METHOD v_html->new_line.
Display Text-016
v_text16 = text-016.
CALL METHOD v_html->add_gap
EXPORTING
width = 1.
CALL METHOD v_html->add_text
EXPORTING
text = v_text16.
v_text16 = v_sap_recon.
CALL METHOD v_html->add_gap
EXPORTING
width = 1.
CALL METHOD v_html->add_text
EXPORTING
text = v_text16.
CALL METHOD v_html->new_line.
Display the data
CALL METHOD v_html->display_document
EXPORTING
parent = v_contnr_top.
Handle the event
CALL METHOD o_alvgrid->list_processing_events
EXPORTING i_event_name = 'PRINT_TOP_OF_PAGE'.
IN PBO while populating in the output table
FORM f9004_display_data TABLES p_report_tab
p_fieldcat.
CALL METHOD o_alvgrid->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = c_a
is_layout = w_layout
CHANGING
it_outtab = p_report_tab[]
it_fieldcatalog = p_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i000 WITH text-e06."Error in ALV report display
LEAVE LIST-PROCESSING.
ENDIF.
Create object
IF v_event_receiver IS INITIAL.
CREATE OBJECT v_event_receiver.
ENDIF.
SET HANDLER v_event_receiver->handle_print_top_of_page FOR o_alvgrid.
SET HANDLER v_event_receiver->handle_top_of_page FOR o_alvgrid.
Hope this helps. -
How to make a field manadatory to a folder in a form?
Hi,
I'm working on a custom form.
I've 3 folders in that form, I need to make some fields to default values to a particular folder.
How do I do this?
Work around
========
Made the field to default, how ever these fields are showing default values for all the 3 folders.
I need to set the default values only to one particular folder.
Any suggestions on this would appreciate.
Thanks in advance.
--SanthoshWhat do you mean by folders?
Blocks?
Tabs?
Records?
It's not a forms term. -
How to make the editable col. in alv grid scrollable?
friends,
i have made the last col. in my alv grid editable..even though i have declared it as char of length 255, it's showing only 50 characters in the grid..but when i try to type beyond 50 characters, it's not allowing...how to make it scrollable so that it extends beyond 50 char. and capture all the characters typed in that col.? pl suggest..thanks all..
Sathish. RHi, u can extend the length of your last field.
LOOP AT t_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN text-001.
ls_fcat-outputlen = c_10. "10
WHEN text-002.
ls_fcat-outputlen = c_20. "20
WHEN text-003. "your lastfield
ls_fcat-outputlen = c_255. "255
"do nothing
ENDCASE.
*fixed column
ls_fcat-fix_column = c_x.
*changes to take effect
MODIFY t_fieldcat FROM ls_fcat.
IF sy-subrc = 0.
"do nothing
ENDIF.
CLEAR ls_fcat.
ENDLOOP. -
How to add a check box in ALV Grid using SAP R/3 release 4.6b?
Hello everyone,
I hope you all fine.
I'm writing because I have a requirement with ALV Grid, what I need to do, is to insert a checkbox into a cell, I already read the forum to know how to do that, but I'm using a SAP R/3 release 4.6b, and when I execute the program the checkbox is displayed greyout, because this release doesn't have the EDIT property into the slis_t_fieldcat_alv.
Does any body know how to enable the checkbox cell in the ALV Grid for this release?, so it will allow the user to mark the desired rows.
I'll really appreciate if you guys could help me to find a solution.
Thanks for your time.
Regards,
GuillermoHi,
if you need just a check box for each line, try to get rid of this line from your layout.
g_layout-box_fieldname = 'ZZCHECK'.
SAP uses this field to store info about selected lines. Hence you click on the second check box, you select different line and the first line is erased. You can select more line by holding SHIFT + CTRL
Cheers -
How to add icon field in the alv grid output
Hi Experts,
i need to add one icom column in the alvgrid.That icon if the contract is inacitve then it should shows inactive symbol.if the contract is account assignment lock then it should show that lock symbol.Please send me the any code or approach.
Thanks,
Venkat.Hello Venkat
Set<b> ls_fcat-icon = 'X' </b> in the fieldcatalog for the column where you want to display icons. In addition, add the following statement to your report:
TYPE-POOLS: icon. " replaces INCLUDE <icon>.
Do not use the coded values (e.g. '@01@') but the "normal" icon names, e.g. <b>ICON_DETAIL</b>.. In order to see the icon names call transaction SE38/SA38 and run report <b>RSTXICON</b>.
Regards
Uwe -
How to make a field mendatory input in ALV grid
Hi All,
I am using CALL METHOD g_alv_grid_0200->set_table_for_first_display for diplay in an ALV Grid.
I have made few fields in the ALV grid as EDITABLE. Now I want to make them as MENDATORY FOR INPUT.
Can somebody please suggest me how can I do it using any field of field catalogue or any other way !
Timely inputs will be highly appreciated.
Thanks in Advance!!
Chandanhi
we the option of making the field as not mandatory or making the field ready for input or edit
but dont have the option to make the edited field as mandatory.
types: begin of slis_fieldcat_alv_spec,
key_sel(1) type c, " field not obligatory
input(1) type c, " input
edit(1) type c, " internal use only
end of slis_fieldcat_alv_spec.
Regards -
How to make some fields in ALV tree editable
Hello All,
Can any one tell me how to make some fields in ALV tree editable.
If possible please post some code.
Regards,
Lisa.Hi Lisa,
I want to make 3 fields in the ALV tree editable and update the saved values in ztable.
I tried making the wa_fieldcat-edit = 'X' But in vain.
Also i made the layout fields wa_layout-edit = 'X' and wa_layout-edit_mode = 'X'.
But still the alv tree field appears as display.
As you have mentioned in the post as answered, So please guide me to make the field editable.
I am using oops method.
Please provide me code if any.
Thanks & Regards,
Mozila -
How to make a pop up within if else
I'm now making an user interface which will be used to control a remote robot. I want to make it so that when a button is pressed, a window will pop-up and tells the user what the robot is doing. At the moment, I can only make it to show the message in the cmd box. Code is as follow:
class ActionHandler implements java.awt.event.ActionListener
public void actionPerformed(java.awt.event.ActionEvent event)
Object object = event.getSource();
if (object == forwardButton) {
System.out.println("Robot moving fordward");
else if (object == backwardButton) {
System.out.println("Robot moving backward");
else if (object == rotateLeftButton){
System.out.println("Robot rotating to its left");
else if (object == rotateRightButton){
System.out.println("Robot rotating to its right");
The only way to make pop-up which I know is this one:
import javax.swing.*;
public class DisplayTextInWindow {
public static void main(String[] args) {
// create a String variable
String messageText = "Hello world";
// display it in the console window
System.out.println(messageText);
// now display it in its own window
JOptionPane.showMessageDialog( null, messageText );
Which I can put into the code for interface because I can't start another class within an if statement (as far as I know anyway...)
Can anyone please teach me how to make a pop-up within an if else statement?Which I can put into the code for interface because I can't start another class within an if statement (as far as I know anyway...)yes you can.
if (robotRotating)
newClass class = new newClass();
class.methods;
Can anyone please teach me how to make a pop-up within an if else statement?sure
if (robotRotating)
//i think this part is already answered in the previous post
javax.swing.JOptionPane.showMessageDialog(null, "your message here", "your title here", JOptionPane.OK_OPTION);
} -
How to make a field in adobe form noneditable
how to make a field in adobe form noneditable. like info keys..
when this form is sent through worflow the receiver shudnt be able make changes to the field value...(I have a form, which has fields prefilled(like pernr employee name) but these fields are in editable able..(i want only some fields to be uneditable not all)
Edited by: kumar gaurav on Apr 11, 2008 8:04 AMHi,
You can make fields non-editable at runtime using this code:
field.access = "readOnly"
Hope this helps.
Amit -
How to make a field Mandatory in a Table view?
How to make a field Mandatory in a Table view?
The requirement is, the user should not be able to append a new Row, unless and untill he enteres the data in the column SOLD-TO. Now how do i acheive making this field madatory. Normally in Edit form view, we can go in customizing and flag Mandatory, for table view we don't have this option.
Please can anyone of you guide me in this approach?
Jagadish.GHi Jagadish,
have a look in this thread, part of the code you can use in eh_insert method or logic to write enable/disable insert button.
Re: Assignment Block Mandatory
regards
Ismail
Edited by: Ismail Shaik on Oct 21, 2009 11:36 AM -
How to make a field mandatory in billing
How to make a field mandatory in billing document,if m right with the help of incomplition log but how.....
plz reply the full configuration.Hi Mohan,
We normally create a billing document with reference any other document say Order or delivery.
so, all the necessary information in the invoice will be taken from preceeding doucments. Thats way in the order level we check for incompletion log. If any important data is missing in the order level then the succeding documents will not be created.
Thats way in the billing documents all the necessary information will come automatically either from preceeding documents or from master data.
Still you want to make any field mandatory, you can do these by modifieing Billing documents user exists,you can make which ever the fields are mandatory and to be checked before saving. so when you are going to save the invoice, it will check if these fields are maintained or not.
Hope this is clear.
Reward if helpful.
Thanks,
Praveen -
How to make a field required in OAFramework
How to make a field required in OAFramework at runtime?? Please explain in detail if possible.
Thanks
KumarGet the handle of the bean using the following Code
<BeanType> bean = <BeanType>webBean.findIndexedChildRecursive("<Id of bean>");
if(bean!=null && <condition>)
bean.setRequired(true);
}
Maybe you are looking for
-
Need to have static text on every page of a MS Excel report exported from SSRS
I need to place an object with a brief static text message in a report using SQL Server Reporting Services 2008 R2. When that report is exported to MS Excel from Report Manager and viewed, this static text object must appear "once" at the bottom of e
-
Hello Apple Support Team, I'm from Brazil and I would like to know if the unlocked iPhone 5 which is advertesed on the US Apple Store webpage works fine in Brazil. Could someone from Apple please confirm that for me? Thanks in advance.
-
Itunes writes off $ 1 each time they connect to the internet. Shopping at the time was not. For what? How do I know?
-
Firefox doesn't add the installed Silverlight or Flash plugins
Ever since Firefox updated to 17.0.1, the flash and silverlight plugins just disappeared. I tried to clean installing the flash player, it did not work. I tried clean installing an earlier version of flash player, that did not work either. The plugin
-
I see a number of great things on the jQuery site that it offers, but have never understood the process of what to do. I'm sure the new Load Script function simplifies that process, but I'm just plain stuck. Was wondering if Adobe, or anyone, is plan