Event for Editing a cell in Tableview Iterator
Hi,
I'm doing a program for displaying the Material Details with Quantity as Editable Field.
I want to edit the Quantity during runtime & it should reflect it in the Internal Table.
If i edit the Quantity field & goto the next row then then the Quantity that i entered is getting refreshed.
Thanks & Regards,
Padmam.
when ever you make server round trip, you need to read each selected row & column to get the updated value.
Refer the Standard program "SBSPEXT_TABLE" Page "TableViewMultiLineEdit.bsp". This will solve the issue.
Raja T
Similar Messages
-
FocusLost event for JTable during cell editing
When a cell in a JTable is getting edited, how can I get notified of the focusLost event? I added the focus listener using JTable.addFocusListener, but the focusLost of the listener is not called when a cell inside the table is getting edited (it works fine otherwise). I am aware of the client property terminateEditOnFocusLost to solve this problem in 1.4 but I can't use it since I am still on 1.3.1_04.
Suggestions welcome.http://forum.java.sun.com/thread.jsp?forum=57&thread=431440
-
Keyboard shortcut for editing current cell?
The help document and my well chosen attempts has yielded no relief from having to click the cell with a mouse to edit it's contents.
Has anyone found a keyboard shortcut to edit the current cell content?Dear Bekins (and noisyscott):
Thank you for answering this question with an awesome tip (and thank you scott for asking in the first place).
Just what the doctor ordered.
Thank you, thank you, thank you! -
JavaScript for BSP (Dropdownlistbox in a tableview iterator)
...unfortunatly i have problems to put the generated html into the post...if anyone would like to have it i will be glad to send it to you by email.
This parameter does not actually allow you to enter your own style - I got annoyed by it myself when I started working with iterators.
If you debug a bit into the code of the method R_TXT_CELL of class CL_SAPTABLECELL you come across this part:
IF p_style IS NOT INITIAL.
SPLIT p_style AT ';' INTO TABLE styletable.
LOOP AT styletable ASSIGNING <style>.
SPLIT <style> AT ':' INTO stylename stylevalue.
TRANSLATE stylename TO LOWER CASE.
IF stylename EQ 'celldesign'.
From this (and the follow-up lines) we can learn that the only style attribute that can be used has to be called <b>'celldesign'</b>, and its allowed values are the ones in the table m_tableview->m_htmlb_tableview->mc_render_lib_d2_rt_validation->_et_stcd (runtime name of course).
For a quick reference, here are the values of this table:
STANDARD
ALTERNATING
TRANSPARENT
NEGATIVE
POSITIVE
TOTAL
SUBTOTAL
SUBTOTAL_LIGHT
BADVALUE_DARK
BADVALUE_MEDIUM
BADVALUE_LIGHT
CRITICALVALUE_DARK
CRITICALVALUE_MEDIUM
CRITICALVALUE_LIGHT
GOODVALUE_DARK
GOODVALUE_MEDIUM
GOODVALUE_LIGHT
GROUP_HIGHLIGHTED
GROUP_HIGHLIGHTED_LIGHT
KEY_MEDIUM
GROUP_LEVEL1
GROUP_LEVEL2
GROUP_LEVEL3
MARKED
FILTER
FILTERICON
POPIN
So, we have to live with this possibility - otherwise you would have to use a HTML element which you place into the cell, and which you can apply your styles to.
Cheers,
Max -
How to raise on click event for Single Markable cell in WD Table
Hi All,
I want to raise an event when a cell is clicked on Single Markable Cell and get the row and column of that cell.
I have tried all the events of the table and also On Enter event of input Field.
But I am not able to trigger on click event .
Please help me out. Points will be rewarded.
Thanks,
AnilHi Anil,
If the cell editor is a link to action then it triggers the ON CLICK event , Write the following code into
the ON CLICK event handler to get the selected Row and Column ID.
Event Properties is a node with two attributes Name and Value of type string.
data: lr_node type ref to if_wd_context_node,
lt_event_properties type wd_this->elements_event_properties,
ls_event_properties type wd_this->element_event_properties.
field-symbols: <l_value> type any.
* fill internal table
ls_event_properties-name = 'COLUMN_ID'.
ls_event_properties-value = r_param->column.
append ls_event_properties to lt_event_properties.
ls_event_properties-name = 'INDEX'.
ls_event_properties-value = r_param->index.
append ls_event_properties to lt_event_properties.
ls_event_properties-name = 'ATTRIBUTE'.
ls_event_properties-value = r_param->attribute.
append ls_event_properties to lt_event_properties.
assign r_param->value->* to <l_value>.
ls_event_properties-name = 'VALUE'.
ls_event_properties-value = <l_value>.
append ls_event_properties to lt_event_properties. -
Event for edit fields in Object ALV grid
Hi community,
I've building an ALV Grid in a SubDynpro of Tabstrip...
Any fields are edit.
I would like refresh my internal table at data changed of ALV object but if not assign a field at F4 event this result
not refresh.
Thanks everybody,
AntonelloHi Antonello Didonna,
Use this code, its working:-
After the user edits any records and performs an action then place this code.
Say when user presses a button with function code 'EXECUTE', and all the changes from the output screen in ALV reflects back to internal table.
* handle the code execution based on the function code encountered
CASE sy-ucomm.
* when the function code is EXECUTE then process the selected records
WHEN 'EXECUTE'.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
" now your internal table data is changed as in ALV output
" append your code
WHEN OTHERS.
" your code
ENDCASE.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir -
Custom UIView not receiving touch events for fast mouse clicks in simulator
I'm having a problem in the simulator where if I click fast in a UIView inside a table cell that is setup to receive touch events, it doesn't receive them. But if I click slow (holding down the button for a little bit) the view gets the touch events. I can't test it on the device. Is this a known problem in the simulator?
Thanks.Hi George,
Thanks a lot for your quick response and jumping to help.
I am so frustrated that I did not get touch event for the custom cell.
I also tried your solution for a custom UIImageView, I put the codes of PhotoView.h, PhotoView.m and TestTouchAppDelegate.m here: Please help to look into it for me.
// PhotoView.h
// Molinker
// Created by Victor on 6/18/08.
// Copyright 2008 _MyCompanyName_. All rights reserved.
#import <UIKit/UIKit.h>
@interface PhotoView : UIImageView {
CGPoint touchPoint1;
CGPoint touchPoint2;
@property (nonatomic) CGPoint touchPoint1;
@property (nonatomic) CGPoint touchPoint2;
@end
// PhotoView.m
// Molinker
// Created by Victor on 6/18/08.
// Copyright 2008 _MyCompanyName_. All rights reserved.
#import "PhotoView.h"
@implementation PhotoView
@synthesize touchPoint1;
@synthesize touchPoint2;
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
self.userInteractionEnabled = YES;
return self;
- (void)drawRect:(CGRect)rect {
// Drawing code
// Handles the start of a touch
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
UITouch *touch = [touches anyObject];
touchPoint1 = [touch locationInView:self];
// Handles the end of a touch event.
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
UITouch *touch = [touches anyObject];
touchPoint2 = [touch locationInView:self];
if(touchPoint1.x>touchPoint2.x)
//move Left
NSLog(@"Move Left");
if(touchPoint1.x<touchPoint2.x)
//move Right
NSLog(@"Move Right");
- (void)dealloc {
[super dealloc];
@end
// TestTouchAppDelegate.m
// TestTouch
// Created by Victor on 6/17/08.
// Copyright _MyCompanyName_ 2008. All rights reserved.
#import "TestTouchAppDelegate.h"
#import "RootViewController.h"
#import "PhotoView.h"
@implementation TestTouchAppDelegate
@synthesize window;
@synthesize navigationController;
- (id)init {
if (self = [super init]) {
return self;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Configure and show the window
//[window addSubview:[navigationController view]];
UIImage *myImage= [UIImage imageNamed: @"scene1.jpg"];
CGRect frame = CGRectMake (0, 20, 300, 400);
PhotoView *myImageView1 = [[UIImageView alloc ] initWithFrame:frame];
myImageView1.userInteractionEnabled = YES;
myImageView1.image = myImage;
[window addSubview:myImageView1];
[window makeKeyAndVisible];
- (void)applicationWillTerminate:(UIApplication *)application {
// Save data if appropriate
- (void)dealloc {
[navigationController release];
[window release];
[super dealloc];
@end
Message was edited by: Victor Zhang -
Help with editing a cell in a JTable. DESPERATE
Hi! Is there someone out there that could help with some source code for editing a cell in my JTable when I run it as an applet??
It works fine when I run it as an application.
I manage to select the row and write a number in it, but I can't get out of the cell (it seems that the program stops??). I want to enter an integer in a cell and when I click enter or with the mouse in an other cell the value that I enter should update some other cell( multiply the entered value with some fixed number and update a cell in a second coloumn)
I am really desperate now..... I have thought about using a MouseListener....
I am using a tablemodel that is from AbstractTableModel.Are you using some cell editors?
While converting inside them, you might be getting some exceptions (like parseexception)which is stopping you from proceeding further.
Are you using your own tablemodel with custom datatypes?
Hope this helps,
Ramkumar -
HTMLB TableView Iterator & Edit columns, cells
Hi friends,
I am getting errors when , I tried to edit the columns, & Cells of HTMLB TableView by using Iterator.Actually, I got the whole edit buttons and when I edit the values of particular column & cell fileds, it is not saving the values, instead it is giving same old values. The code I used is as follows.
<u><b>To Edit the columns,</b></u>
method
IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS.
FIELD-SYMBOLS: <def> LIKE LINE OF p_column_definitions.
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
<def>-COLUMNNAME = 'STUDENTID'.<def>-EDIT = 'X'.
endmethod.
<u><b>To Edit the cells,</b></u>
RENDER_CELL_START Method:
method
IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.
CASE p_column_key.
WHEN 'ICON'.
WHEN 'STUDENTID'.
IF p_edit_mode IS NOT INITIAL.
ENDIF.
WHEN 'SDATE'.
IF p_edit_mode IS NOT INITIAL.
ENDIF.
ENDCASE.
endmethod.
<u><b>To Edit the SDATE cells,</b></u>
WHEN 'SDATE'.
IF p_edit_mode IS NOT INITIAL.
DATA: date TYPE STRING.
date = m_row_ref->SDATE.
p_replacement_bee = CL_HTMLB_INPUTFIELD=>FACTORY(
id = p_cell_id
value = date
type = 'DATE'
showHelp = 'TRUE'
cellValue = 'TRUE' ).
ENDIF.
Why the either column or cell is not saving the new values, when I edit them? where it went wrong? please mail me in this regard.
regards
CSM ReddyHi REDDY CSM
To learn coding these Methods.
You need to learn everything from scratch about MVC.
To learn functionalities of Methods in Controller and how to use them,its Better,if you start with some tutorial(Little application) on MVC.
Here is link,Just follow this,You will get some Exposure to these methods.
http://help.sap.com/saphelp_erp2005/helpdata/en/c8/101c3a1cf1c54be10000000a114084/frameset.htm
Rest keep posting whenever you face and Problem..
Happy Coding..!!
Vijay Raheja -
Keypressed event for a particular edited cell of jtable
hi friend,
how to write the key pressed event for the edited cell of jtable which having focus on that particular cell.
pls help me out.[http://catb.org/~esr/faqs/smart-questions.html]
[http://mindprod.com/jgloss/sscce.html]
db -
Writting Events for TableView Buttons
Hi SDN,
I created a table view in a jsp dynpage which has one of the columns type as button.i got it by using "setColumnType" attribute of tableview.
now i want to fire server and client events onclick of those buttons.how to achieve it? can we write client and server events for those buttons as like normal buttons.
if yes tell me how and where to write?
explain me with example (coding) if possible.
Thanks & Regards,
Art.
/points will be rewarded/Hi Subathra,
Thank you for ur reply.i know that we can achieve it using "setOnCellClick " but i want to know whether we can use the normal attributes of a button for this button placed in a cell of a tableview.
if yes how to use it.is there any relation between cell renderer attribute and my requirement.
<b><u>Note:</u></b>
you can share ur ideas about other components also which can be used in a tableview (inputfield,link,image...) and writting events for those components.
Thanks & Regards,
Art -
How to disable/enable the cells for editing column wise in JTable in java?
Hi All,
Can any one tell me how to disable the cells for editing by column wise in JTable?
Here depending upon the radio button selected, I need 2 disable some columns for editing
and enable some columns for editing?
how can I do tat using JAVA?
Any sample code is of great help to me.
Thanks in Advancehttp://java.sun.com/docs/books/tutorial/uiswing/components/table.html
~ -
Binding different events to a form depending if it is used for edit or create new.
Hi,
I succesfully have separated presentation from logic (events, etc...) using the code behind article at adobe site. This is pretty nice but now I have a little problem. Think about I have two forms one for edit and the other to add a new user. Usually this forms are allmost the same only some logic change and just few controls if any.
What I would like to do (don't know if this is best way to do it, for me it does):
1) Create Add form.
2) Create a view state to change this add form to edit when needed (I think just few changes if any will be needed)
3) Now the problem, I need to bind different logic if I'm in edit or add new user form. Is there any way to attach different functionality
to the form component to let it behave the way I need depending on the mode (edit or new)? I have seen include can be used but can it be used conditionally?
Example:
if( in edit mode)
include ("src/usermanagement_editlogic.as"))
else( in add mode)
include ("src/usermanagement_addlogic.as"))
As I previously said I'm pretty new to flex but I think this is a good way to do things and have everything splitted. If anyone has a better way to do it I would be really happy to hear it .
Thanks in advance,
Aron.Using forms for create/edit or login/register are similar scenarios. Usually, you can take care of those by simply changing states.
Doing different includes is complicating things; you can just include all the code, and just use what you need depending on the state you are in.
Before you get into conditionally including things, or creating a bunch of different events, look at this little simple tutorial on using states, which happens to use a login/register form as an example: http://www.adobe.com/devnet/flex/quickstart/creating_states/.
HTH,
Carlos -
Composite Element in Tableview Iterator
I want to use a <phtmlb:matrix> element in a tableview iterator to arrange the content of a cell.
I tried to follow Brians Weblog on composite elements.
In my test example, I just want to combine two fields of t000 into one cell. Of course I know, that concatenation would be more easy here, but that would not answer my questions.
Thought it could look like this:
METHOD render_cell_start.
DATA:
l_o_matrix TYPE REF TO cl_phtmlb_matrix,
l_o_bsp_element TYPE REF TO cl_bsp_element,
l_string TYPE STRING.
CASE p_tableview_id.
WHEN 'TABLE_T000'.
l_o_matrix = cl_phtmlb_matrix=>factory( ).
WHILE o_page_context->element_process( element = l_o_matrix )
= cl_bsp_element=>co_element_continue.
Cell 1
CLEAR: l_o_matrix->mc_backgrounddesign,
l_o_matrix->mc_design,
l_o_matrix->mc_separation.
l_o_matrix->do_set_data( element_name = 'matrixCell' ).
l_string = me->t000-mandt.
l_o_bsp_element = cl_htmlb_textview=>factory( text = l_string ).
WHILE o_page_context->element_process( element = l_o_bsp_element )
= cl_bsp_element=>co_element_continue.
ENDWHILE.
Cell 2
CLEAR: l_o_matrix->mc_backgrounddesign,
l_o_matrix->mc_design,
l_o_matrix->mc_separation.
l_o_matrix->mc_halign = 'LEFT'.
l_o_matrix->mc_valign = 'TOP'.
l_o_matrix->do_set_data( element_name = 'matrixCell' ).
l_string = me->t000-mtext.
l_o_bsp_element = cl_htmlb_textview=>factory( text = l_string ).
WHILE o_page_context->element_process( element = l_o_bsp_element )
= cl_bsp_element=>co_element_continue.
ENDWHILE.
ENDWHILE.
p_replacement_bee = l_o_matrix.
ENDCASE.
ENDMETHOD.
However, that does not work.
First, the list of T000-MANDT fields is rendered twice:
into the tableview and into a list before the tableview.
Second: T000-MTEXT does not show up at all.
What do I do wrong?
I feel that I do not completely understand how the rendering is processed.
Thanks for our help.
JuergenThe following is the example from Brian's weblog, updated for design2003. It doesn't use the Matrix however. Perhaps it will help.
It still doesn't render quite like it did under design2002. I'm not sure if there is a good way to combine multiple input fields into one cell any longer. I know others have had a problem with this as well. I will have to look closer at your matrix attempt.
when 'SEATS'.
if p_edit_mode is initial.
data: max type string, occ type string,
value type string.
max = m_row_ref->seatsmax + m_row_ref->seatsmax_b
+ m_row_ref->seatsmax_f.
occ = m_row_ref->seatsocc + m_row_ref->seatsocc_b
+ m_row_ref->seatsocc_f.
condense: max, occ.
concatenate occ ` / ` max into value.
p_replacement_bee = cl_htmlb_textview=>factory(
text = value ).
else.
data: icon_plane2 type string.
icon_plane2 = cl_bsp_mimes=>sap_icon(
id = 'ICON_WS_PLANE' ).
data: image type ref to cl_htmlb_image.
image = cl_htmlb_image=>factory(
id = p_cell_id
src = icon_plane2 ).
data: if_first type ref to cl_htmlb_inputfield.
if_first = cl_htmlb_inputfield=>factory( id = p_cell_id
id_postfix = '_first'
type = 'INTEGER' size = '4' ).
if_first->value = m_row_ref->seatsocc_f.
data: if_bus type ref to cl_htmlb_inputfield.
if_bus = cl_htmlb_inputfield=>factory( id = p_cell_id
id_postfix = '_bus'
type = 'INTEGER' size = '4' ).
if_bus->value = m_row_ref->seatsocc_b.
data: if_econ type ref to cl_htmlb_inputfield.
if_econ = cl_htmlb_inputfield=>factory( id = p_cell_id
id_postfix = '_econ'
type = 'INTEGER' size = '4' ).
if_econ->value = m_row_ref->seatsocc.
data: tag_gl type ref to cl_htmlb_gridlayout,
tag_glc_if1 type ref to cl_htmlb_gridlayoutcell,
tag_glc_if2 type ref to cl_htmlb_gridlayoutcell,
tag_glc_if3 type ref to cl_htmlb_gridlayoutcell.
tag_gl = cl_htmlb_gridlayout=>factory(
columnsize = '3' rowsize = '1' ).
tag_glc_if1 = cl_htmlb_gridlayoutcell=>factory(
columnindex = '1' rowindex = '1' ).
tag_glc_if2 = cl_htmlb_gridlayoutcell=>factory(
columnindex = '2' rowindex = '1' ).
tag_glc_if3 = cl_htmlb_gridlayoutcell=>factory(
columnindex = '3' rowindex = '1' ).
data: seats_bee type ref to cl_bsp_bee_table.
create object seats_bee.
seats_bee->add( level = 1 element = tag_gl ).
seats_bee->add( level = 2 element = tag_glc_if1 ).
seats_bee->add( level = 3 element = if_first ).
seats_bee->add( level = 2 element = tag_glc_if2 ).
seats_bee->add( level = 3 element = if_bus ).
seats_bee->add( level = 2 element = tag_glc_if3 ).
seats_bee->add( level = 3 element = if_econ ).
p_replacement_bee = seats_bee.
endif.
Message was edited by: Thomas Jung -
F4 for Editable field in ALV, display Name but capture ID
Hi Friends,
I have a ALV for which i have defined a Structure, which is passed to Fieldcatlog.
I have defined a Search help - ZUSER_NAME which has following fields to display.
USERID - USR02-BNAME
FNAME
LNAME
FULLNAME
So my structure for fieldcatalog has User-id which is linked to this search help with Domain XUBNAME.
So in my report i made this User-Id as editable and F4 available, everything is working fine.
when user does a F4, its displaying Userid,Fname,Lname and complete name.upon selection and save i am capturing the id and storing in the ztable.
But now i have a requirement that when user selects a value from this search help on F4, i need to display Fullname but capture the User Id. How can i do that?
This is something similar to the one we have in BSP- key-value pair.
how to do this in ALV.
Appreciate if someone can guide me thru.
Thanks,
Simha
Edited by: Simha on Sep 6, 2008 2:24 PMhai , this is example code for editing the F4 display .. check out this
REPORT zalv_editf4display.
*Type pools for alv
TYPE-POOLS : slis.
*structure for t582a tbale
TYPES : BEGIN OF ty_table,
infty TYPE infty,
pnnnn TYPE pnnnn_d,
zrmkz TYPE dzrmkz,
zeitb TYPE dzeitb,
dname TYPE dianm,
davo TYPE davo,
davoe TYPE davoe,
END OF ty_table.
*Structure for infotype text
TYPES : BEGIN OF ty_itext,
infty TYPE infty,
itext TYPE intxt,
sprsl TYPE sprsl,
END OF ty_itext.
*Structure for output display
TYPES : BEGIN OF ty_output,
infty TYPE infty,
itext TYPE intxt,
pnnnn TYPE pnnnn_d,
zrmkz TYPE dzrmkz,
zeitb TYPE dzeitb,
dname TYPE dianm,
davo TYPE davo,
davoe TYPE davoe,
END OF ty_output.
*internal table and work area declarations
DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_pbo TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
wa_table TYPE ty_table,
wa_output TYPE ty_output,
wa_ittext TYPE ty_itext.
*Data declarations for dropdown lists for f4
DATA: it_dropdown TYPE lvc_t_drop,
ty_dropdown TYPE lvc_s_drop,
*data declaration for refreshing of alv
stable TYPE lvc_s_stbl.
*Global variable declaration
DATA: gstring TYPE c.
*Data declarations for ALV
DATA: c_ccont TYPE REF TO cl_gui_custom_container, "Custom container object
c_alvgd TYPE REF TO cl_gui_alv_grid, "ALV grid object
it_fcat TYPE lvc_t_fcat, "Field catalogue
it_layout TYPE lvc_s_layo. "Layout
*ok code declaration
DATA:
ok_code TYPE ui_func.
*initialization event
INITIALIZATION.
*start of selection event
START-OF-SELECTION.
*select the infotypes maintained
SELECT infty
pnnnn
zrmkz
zeitb
dname
davo
davoe
FROM t582a UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE it_table.
*Select the infotype texts
IF it_table[] IS NOT INITIAL.
SELECT itext
infty
sprsl
FROM t582s
INTO CORRESPONDING FIELDS OF TABLE it_ittext
FOR ALL ENTRIES IN it_table
WHERE infty = it_table-infty
AND sprsl = 'E'.
ENDIF.
*Apppending the data to the internal table of ALV output
LOOP AT it_table INTO wa_table.
wa_output-infty = wa_table-infty.
wa_output-pnnnn = wa_table-pnnnn.
wa_output-zrmkz = wa_table-zrmkz.
wa_output-zeitb = wa_table-zeitb.
wa_output-dname = wa_table-dname.
wa_output-davo = wa_table-davo.
wa_output-davoe = wa_table-davoe.
For texts
READ TABLE it_ittext INTO wa_ittext WITH KEY infty = wa_table-infty.
wa_output-itext = wa_ittext-itext.
APPEND wa_output TO it_output.
CLEAR wa_output.
ENDLOOP.
Calling the ALV screen with custom container
CALL SCREEN 0600.
*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
*create 2 buttons with function code 'SAVE' and 'EXIT'.
GIVE A SUITABLE TITLE
*& Module STATUS_0600 OUTPUT
text
MODULE status_0600 OUTPUT.
SET PF-STATUS 'DISP'.
SET TITLEBAR 'ALVF4'.
ENDMODULE. " STATUS_0600 OUTPUT
calling the PBO module ALV_GRID.
*& Module PBO OUTPUT
text
MODULE pbo OUTPUT.
*Creating objects of the container
CREATE OBJECT c_ccont
EXPORTING
container_name = 'CCONT'.
create object for alv grid
create object c_alvgd
exporting
i_parent = c_ccont.
SET field for ALV
PERFORM alv_build_fieldcat.
Set ALV attributes FOR LAYOUT
PERFORM alv_report_layout.
CHECK NOT c_alvgd IS INITIAL.
Call ALV GRID
CALL METHOD c_alvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
i_save = 'A'
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 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.
ENDMODULE. " PBO OUTPUT
*& Form alv_build_fieldcat
text
<--P_IT_FCAT text
*subroutine to build fieldcat
FORM alv_build_fieldcat.
DATA lv_fldcat TYPE lvc_s_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '1'.
lv_fldcat-fieldname = 'INFTY'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 8.
lv_fldcat-scrtext_m = 'Infotype'.
lv_fldcat-icon = 'X'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '2'.
lv_fldcat-fieldname = 'PNNNN'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Structure'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '3'.
lv_fldcat-fieldname = 'ITEXT'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 60.
lv_fldcat-scrtext_m = 'Description'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '5'.
lv_fldcat-fieldname = 'ZRMKZ'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 1.
lv_fldcat-scrtext_m = 'PERIOD'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '6'.
lv_fldcat-fieldname = 'ZEITB'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 5.
lv_fldcat-scrtext_m = 'Time constraint'.
lv_fldcat-edit = 'X'.
*To avail the existing F4 help these are to
*be given in the field catalogue
lv_fldcat-f4availabl = 'X'.
lv_fldcat-ref_table = 'T582A'.
lv_fldcat-ref_field = 'ZEITB'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '7'.
lv_fldcat-fieldname = 'DNAME'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Dialogmodule'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '8'.
lv_fldcat-fieldname = 'DAVO'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Start'.
lv_fldcat-edit = 'X'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '9'.
lv_fldcat-fieldname = 'DAVOE'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'End'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
*To create drop down for the field 'DAVO'
with our own f4 help
ty_dropdown-handle = '1'.
ty_dropdown-value = ' '.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '1'.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '2'.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '3'.
APPEND ty_dropdown TO it_dropdown.
CALL METHOD c_alvgd->set_drop_down_table
EXPORTING
it_drop_down = it_dropdown.
LOOP AT it_fcat INTO lv_fldcat.
CASE lv_fldcat-fieldname.
To assign dropdown in the fieldcataogue
WHEN 'DAVO'.
lv_fldcat-drdn_hndl = '1'.
lv_fldcat-outputlen = 15.
MODIFY it_fcat FROM lv_fldcat.
ENDCASE.
ENDLOOP.
ENDFORM. " alv_build_fieldcat
*& Form alv_report_layout
text
<--P_IT_LAYOUT text
*Subroutine for setting alv layout
FORM alv_report_layout.
it_layout-cwidth_opt = 'X'.
it_layout-col_opt = 'X'.
it_layout-zebra = 'X'.
ENDFORM. " alv_report_layout
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.
*& Module PAI INPUT
text
MODULE pai INPUT.
*To change the existing values and refresh the grid
*And only values in the dropdown or in the default
*F4 can be given , else no action takes place for the dropdown
*and error is thrown for the default F4 help and font changes to red
*and on still saving, value is not changed
c_alvgd->check_changed_data( ).
*Based on the user input
*When user clicks 'SAVE;
CASE ok_code.
WHEN 'SAVE'.
*A pop up is called to confirm the saving of changed data
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'SAVING DATA'
text_question = 'Continue?'
icon_button_1 = 'icon_booking_ok'
IMPORTING
answer = gstring
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*When the User clicks 'YES'
IF ( gstring = '1' ).
MESSAGE 'Saved' TYPE 'S'.
*Now the changed data is stored in the it_pbo internal table
it_pbo = it_output.
*Subroutine to display the ALV with changed data.
PERFORM redisplay.
ELSE.
*When user clicks NO or Cancel
MESSAGE 'Not Saved' TYPE 'S'.
ENDIF.
**When the user clicks the 'EXIT; he is out
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
CLEAR: ok_code.
ENDMODULE. " PAI INPUT
*& Form REDISPLAY
text
--> p1 text
<-- p2 text
FORM redisplay .
*Cells of the alv are made non editable after entering OK to save
CALL METHOD c_alvgd->set_ready_for_input
EXPORTING
i_ready_for_input = 0.
*Row and column of the alv are refreshed after changing values
stable-row = 'X'.
stable-col = 'X'.
*REfreshed ALV display with the changed values
*This ALV is non editable and contains new values
CALL METHOD c_alvgd->refresh_table_display
EXPORTING
is_stable = stable
EXCEPTIONS
finished = 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. " REDISPLAY
Maybe you are looking for
-
I can't get into my books in my library on Adobe Editions 4, they are there and it is asking me for vendor id and password. When I put them in, it is saying vendor id is no good.
-
Problem in a VI changing from 32 to 64 bits
Hi, He have a custom program to acquire images from a Pulnix 6710CL. It used to work in LabVIEW 2009 (32 bits) installed in a Windows 7 operated computer (32 bits also). Due to computer updates, we are now using Windows 7, 64 bits and have installed
-
DVCPro HD 1080i60 codec mismatch in CS5
Hello, I am trying to render in After Effects to a playback device in my TV station called the Omneon, which specifies it wants DVCPRO HD 1080i60. In CS3, this worked perfectly, rendering out a 16x9 render at 1920x1080. However, now that we've upgrad
-
How to add a custom metadata to a file In UCM?
I am new in UCM. I have just installed and configured environment. My default configuration includes a file store for documents and a database for a metadata and search functionalities. I want to add content profiles to define the custom metadata opt
-
Iphone 5s update to ios 7.1 touch id cant scan at all? help!
iphone 5s update to ios 7.1 touch id cant scan at all? help!