Alv grid (automatic) message error
I've written a table maintenance program with an editable alv grid as per SAP example (BCALV_EDIT_04).
It works like a charm except for the NON desired message error log on a specific field/column (<b>PROD_NUM</b>) for appended rows. That is, when I click 'ENTER' (or 'check entries' button) a message error log is raised somehow, which I didn't cater for!
I am calling my grid as follows:
*...initialize alv grid
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = ps_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab[].
I also cater for changed data event as follows:
SET HANDLER g_event_receiver->handle_data_changed FOR g_grid.
*---register ENTER to raise event DATA_CHANGED.
CALL METHOD g_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
As said before, I don't handle any checks for data (or existance) integrity or anything of the sort in my handle_data_changed method. This error seems to be raised almost automatically.
My field catalog is derived from the structure. In the structure, PROD_NUM is defined as Built-in type CHAR 02.
Is there a way to deactivate this error checking?
Nhlanhla Ndlovu
Hi,
Try following code..
*...initialize alv grid
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = ps_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab[].
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SET HANDLER g_event_receiver->handle_data_changed FOR g_grid.
*---register ENTER to raise event DATA_CHANGED.
CALL METHOD g_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
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,
Shashank
Similar Messages
-
ALV Grid: Problem with errors
Hi,
Many of you must have definitely experienced this problem.
I have some default rows on ALV screen for user to enter data.
Say field1, field2 are in the fields list. Now if user puts values in field2, I consider that as a change and I validate entire row. Say field1 is mandatory. I show an error on field1 when field2 has been changed by adding protocol entry.
Now if user changes different row and presses enter, mod_cells does not contain entries related to field1 for first row even though protocol contains errors for field1 on first row. Because of this, first row is not getting validated again.
I added adding an entry in mod_cells for field1. It does not seem to work.
Please let me know if you have any solution for this problem.
Thanks.
Srinivas.Hi Aaron,
set_selected_cells or so is the method. then user is positioned at the error cell.
regards,
Clemens -
ALV Grid with size of the whole screen
I need to create ALV Grid, that fits any screen. How can i do this?
I tried cl_gui_docing_container, but in the constructor it's possible to make it to occupy only 95% of the screen.If you are using a custom control on the screen and then a custom container you can easily do this.
Create a screen(Size 200 x 240), place a custom control on the screen and make it to the max size 200 x 240. Now in the attributes of the custom control, check the Resizing option for both horizontal and vertical, with some minimum numbers there.
Now, your ALV grid automatically occupies all the space available on the screen irrespective of the size if the screen and you will have only one scroll bar.
Regards,
Ravi
Note - Please mark all the helpful answers -
Display error message in ALV grid using OOPS
Hi,
I have a requirement to display report in ALV. I have created ALV grid using OOPS with three editable cells and 1 button on toolbar. When user enter values in Ediatble cell and click on the Toolbar button, sales order item should be assigned to contract.
When the user select the row and click on toolbar button, a salesorder item should be assigned to contract and i am using BAPI and fine with BAPI. All the error message should be displayed in a popup and the corresponding failed row should change its color .
Once the user identified the failed row, he can edit the value in the ediatble cells and should reprocess in the same screen ( without going back to selection screen).
To display POP Up, I am using FM BAL_LOG_CREATE, BAL_LOG_MSG_ADD, BAL_DSP_PROFILE_NO_TREE_GET, BAL_CNTL_CREATE.
by using above 4 FM , i can display POP UP. but i cannot change the color of the failed row.
Once I identified the failed row and reprocess from the same screen , I am successful in processing the failed row, but my error log still has the reprocessed row as failed row because, error log is not refreshing.
Please suggest me how to clear error log which was created by using the above FM's and change the color of the failed row .
Thanks in AdvanceHi
Please suggest me how to clear error log which was created by using the above FM's....
U can use BAL_LOG_REFRESH
....and change the color of the failed row
You need to insert a new field for Colour Attributes in your output table and input its name in the layout structure:
IS_LAYOUT-INFO_FNAME = <field name for colour>
The field has to be a CHAR 3 and its value can be -
> Cxy
C is a constant
x is the colour number (from 1 to 9)
y is intensified (0 = off, 1 = on)
After changing the value of output table you need to run the method REFRESH_TABLE_DISPLAY for refreshing the output
Max -
Capturing the error messages generated by ALV Grid
Hi,
I have a ALV Grid, and a field date of DATS type.
If i enter wrong date a message pops up with invalid date entry.
How can i capture this error message in ALV Grid.Hi,
Instead of displaying the error message directly, capture the message into a string variable and display it along with the grid display.
Thanks,
Sri. -
Runtime error while trying to execute custom F4 help in OOP ALV grid.
Dear All,
I am trying to add custom search help for one of my column in ALV grid. I'm using OOP ALV, when i click for search help for that column, the system shows runtime error like below.
I am new to OOP concept and tried to follow program BCALV_EDIT_03. But not getting this error occur. Please help me.
With regards.Hi,
In order to be able to provide a search help for a field in an ALV you must do the following things.
1) The field where F4 help need to be attached needs to be made editable.
2) Create an event handler class to handle the ONF4 event. You can refer the following code:
CLASS lcl_alv1_handler DEFINITION.
PUBLIC SECTION.
"Tohandle F4 helps
METHODS handle_f4 FOR EVENT onf4 OF cl_gui_alv_grid
IMPORTING e_fieldname e_fieldvalue es_row_no er_event_data
et_bad_cells e_display.
ENDCLASS.
CLASS lcl_alv1_handler IMPLEMENTATION.
METHOD handle_f4.
CASE e_fieldname.
WHEN 'LIFNR'. "Set F4 for courier vendor
SELECT lifnr name1 FROM lfa1 INTO TABLE lt_lifnr.
IF lt_lifnr IS NOT INITIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'LIFNR'
window_title = 'Vendors'
value_org = 'S'
TABLES
value_tab = lt_lifnr
return_tab = lt_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc = 0.
READ TABLE gt_final INTO wa_final_t INDEX es_row_no-row_id.
IF sy-subrc = 0.
READ TABLE lt_return INTO wa_return INDEX 1.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_return-fieldval
IMPORTING
output = lv_lifnr.
wa_final_t-lifnr = lv_lifnr.
MODIFY gt_final FROM wa_final_t INDEX es_row_no-row_id.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDCASE.
CALL METHOD o_alv->refresh_table_display.
ENDMETHOD.
ENDCLASS.
In the above method, GT_FINAL-LIFNR is being overwritten by the LIFNR you had selected from F4 help. So we will call the refresh_table_display after it to see the result in the ALV.
3) After creating the ALV object, add the fields to which the F4 has to be added. For this you
need to declare an internal table based on lvc_t_f4. Use the following code. Here O_ALV is my ALV object.:
CREATE OBJECT o_container
EXPORTING
container_name = 'CUSTCON'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT o_alv
EXPORTING
i_parent = o_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR : gt_f4, wa_f4.
wa_f4-fieldname = 'LIFNR'.
wa_f4-register = 'X'.
wa_f4-getbefore = space.
wa_f4-chngeafter = space.
APPEND wa_f4 TO gt_f4.
Here I am assigning F4 to LIFNR field in the final internal table that is displayed using ALV.
After this register this field for F4.
CALL METHOD o_alv->register_f4_for_fields
EXPORTING
it_f4 = gt_f4.
CREATE OBJECT o_alv_handler.
SET HANDLER : o_alv_handler->handle_f4 FOR o_alv1.
The object o_alv_handler is created based on the event handler class.
I hope that this will solve your issue. Revert if this is solved.
Rgards,
Abijith -
Error in field catalog in ALV grid display using classes at do_sum = "X'.
Hi,
I'm using classes in ALV Grid display.
the code for the field catalog is going to dump because of the statement in the field catalog for field 'netwr',do_sum = 'X'.
that do_sum = 'X' is not working and going to dump when executed.with out that do_sum it is working fine. the error in dump analysys is showing sap standard incude LSLVCF01.
assign component
<ls_fieldcat>-fieldname of structure rt_data to <g_field>.
if sy-subrc ne 0.
message x000(0k).
endif.
sy-subrc is 4 when the program is being executed.
CODE:
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
ls_fcat-fieldname = 'VBELN1'.
ls_fcat-ref_field = 'VBELN'.
ls_fcat-ref_table = 'VBRK'.
ls_fcat-coltext = 'Invoice No'.
ls_fcat-seltext = 'Invoice No'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'BUDAT'.
ls_fcat-ref_table = 'BKPF'.
ls_fcat-coltext = 'Invoice Date'.
ls_fcat-seltext = 'Invoice Date'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'NETWR'.
ls_fcat-ref_field = 'NETWR'.
ls_fcat-ref_table = 'VBRK'.
ls_fcat-coltext = 'Value of Invoice'.
ls_fcat-seltext = 'Value of Invoice'.
ls_fcat-datatype = 'CURR'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ENDFORM.
can u please look in the code and rectify the error,
would appeciate ur response.
regards,
veera.Hi,
try this..
ls_fcat-fieldname = 'NETWR'.
ls_fcat-ref_field = 'NETWR'.
ls_fcat-ref_table = 'VBRK'.
ls_fcat-coltext = 'Value of Invoice'.
ls_fcat-seltext = 'Value of Invoice'.
ls_fcat-datatype = 'CURR'.
ls_fcat-do_sum = 'X'.
<b>ls_fcat-cfieldname = 'WAERS'.</b>
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
Regards
vijay -
To display a popup message alongwith ALV grid
Hi Experts,
I have a requirement where I need to display data using ALV Grid. Also, in case there are any errors encountered during the data extraction I need to inform the user about it by using either a popup message or a status message stating that he needs to check the error log. To display the error log I have provided a push button which will take the user to another screen where he can see all the errors encountered.
Can anyone please let me know as to how to accomplish the task of displaying a status message alongwith a ALV grid display?
Looking forward to your reply.
-Warm regards,
Prajakta K.use exception handling and pop up.........
try following in grid..
*--Exception handling
ENDIF .
ENDIF .
WHEN 'EU' .
READ TABLE gt_list INDEX ls_selected_row-row_id .
IF sy-subrc = 0 .
CALL FUNCTION 'ZPOPUP_CONV_CURR_AND_DISPLAY'
EXPORTING monun = 'EU'
quant = gt_list-paymentsum.
ENDIF .
ENDCASE .
ENDFORM . -
Control Framework: Fatal error - GUI cannot be reached-ALV Grid in Bckgrnd
I have an ALV grid which dumps in the background. But works fine in the foreground.
I thought I am not using Control framework anywhere. But I get 'COntrol framework :Fatal error - GU cannot be reached' error.
I am using a docking container that I have split using a splitter.
I have no custom container in my screen. What else could be causing the Control framework error ? Any suggestions is appreciated. But please do not tell me to use 'REUSE_ALV*' or Classical reporting
Here are the PBO modules of my screen and here are my data declarations.
ALV Data declarations :
data :gt_sort type lvc_t_sort,
gr_event_handler TYPE REF TO lcl_event_handler ,
o_docking type ref to cl_gui_docking_container,"Docking Container
o_grid type ref to cl_gui_alv_grid,"Grid
o_split type ref to cl_gui_easy_splitter_container,"Splitter
o_top_container type ref to cl_gui_container, "Top Container
o_bottom_container type ref to cl_gui_container,"Bottom Container
o_document type ref to cl_dd_document. "Document
module status_0100 output.
if o_docking is initial.
set pf-status 'ZSTATUS_0100'.
set titlebar 'ZTITLE_0100'.
Creating Objects
perform create_objects.
Filling top of page
perform fill_top_of_page.
Filling the fieldcatalog table
perform build_fieldcat. "we already got'em
Displaying the output
perform display_output.
endif.
Here is the Form Create_objects called in the PBO.
form create_objects .
Creating Docking Container
CREATE OBJECT o_docking
EXPORTING
RATIO = '95'.
IF sy-subrc eq 0.
Splitting the Docking container
CREATE OBJECT o_split
EXPORTING
PARENT = o_docking
sash_position = 25 "Position of Splitter Bar (in Percent)
with_border = 0. "With Border = 1 Without Border = 0
Placing the containers in the splitter
o_top_container = o_split->top_left_container .
o_bottom_container = o_split->bottom_right_container .
Creating Grid
CREATE OBJECT o_grid
EXPORTING
i_parent = o_bottom_container.
Creating the document
CREATE OBJECT o_document
EXPORTING
style = 'ALV_GRID'.
CREATE OBJECT gr_event_handler .
ENDIF.
endform. " create_objects
form fill_top_of_page .
data : lv_char(255) type c.
Calling the methods for dynamic text
CALL METHOD o_document->add_gap
EXPORTING
width = 140.
CALL METHOD o_document->add_text
EXPORTING
text = 'Plant Attainment Report '
sap_fontsize = 'Large'
sap_color = cl_dd_area=>list_key_int
sap_emphasis = cl_dd_area=>strong. " For bold
Display the data
CALL METHOD o_document->display_document
EXPORTING
parent = o_top_container.
Calling the method of ALV to process top of page
CALL METHOD o_grid->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = o_document.
endform. " fill_top_of_page
form display_output .
gx_variant-report = sy-repid.
gs_layout-zebra = 'X'.
gs_layout-sel_mode ='X'.
gs_layout-cwidth_opt = 'X'.
call method o_grid->set_table_for_first_display
exporting
is_variant = gx_variant
i_save = 'A'
is_layout = gs_layout
changing
it_fieldcatalog = it_fldcat
it_outtab = <gt_tabletotal>.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SET HANDLER gr_event_handler->handle_print_top_of_page FOR o_grid .
endform. " display_output
Edited by: Shareen Hegde on Jul 23, 2009 5:03 PM (I have no clue why
.. doesn't work anymore. My code looks messed up..Sorry folks!Nilesh,
If i put all these create objects inside the IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL. ENDIF , will I be still able to use ,
call method o_grid->set_table_for_first_display
exporting
is_variant = gx_variant
i_save = 'A'
is_layout = gs_layout
changing
it_fieldcatalog = it_fldcat
it_outtab = <gt_tabletotal>.
in background ? WIll I not get - OBJECTS_OBJREF_NOT_ASSIGNED erorr ?
How can I call the set_table_for_first_display without creating the object reference ?
Here is my creat object routine.
form create_objects .
* Creating Docking Container
IF CL_GUI_ALV_GRID=>OFFLINE( ) .
CREATE OBJECT o_docking
EXPORTING
RATIO = '95'.
IF sy-subrc eq 0.
* Splitting the Docking container
CREATE OBJECT o_split
EXPORTING
PARENT = o_docking
sash_position = 25 "Position of Splitter Bar (in Percent)
with_border = 0. "With Border = 1 Without Border = 0
* Placing the containers in the splitter
o_top_container = o_split->top_left_container .
o_bottom_container = o_split->bottom_right_container .
* Creating Grid
CREATE OBJECT o_grid
EXPORTING
i_parent = o_bottom_container.
* Creating the document
CREATE OBJECT o_document
EXPORTING
style = 'ALV_GRID'.
ENDIF.
CREATE OBJECT gr_event_handler .
endif.
endform. " create_objects -
Hello,
I have implemented an output display using OO ALV grid. At the point of data change I check the entered data and issue a message if necessary. after the message is issued the program exits immediately at any type of input(double click, enter etc) Is it not possible to issue messages during event processing of OO ALV grid?
Thx
AliHi
Instead of Error message, pass Information message.
Message 'Event Captured!!' type 'I'.
Best regards,
Prashant -
ALV GRID Display function module giving Run time error
Hello Experts,
I have ALV report, In which I am using ALV grid dispaly FM to display the report.
But when my out table which I am passing to FM is empty that time ALV grid display shows blank ALV report. but when out table is not empty that time I am getting the Run time error, which shows message "Field symbol has not yet been assigned".
Can any one please help me out in this.
ThanksTYPES: BEGIN OF type_out,
col00 TYPE ytlet-rzzyyproduct,
col01 TYPE ytlet-kslvt,
col02 TYPE ytlet-kslvt,
col03 TYPE ytlet-kslvt,
col04 TYPE ytlet-kslvt,
col05 TYPE ytlet-kslvt,
col06 TYPE ytlet-kslvt,
col07 TYPE ytlet-kslvt,
col08 TYPE ytlet-kslvt,
col09 TYPE ytlet-kslvt,
col10 TYPE ytlet-kslvt,
col11 TYPE ytlet-kslvt,
col12 TYPE ytlet-kslvt,
col13 TYPE ytlet-kslvt,
col14 TYPE ytlet-kslvt,
col15 TYPE ytlet-kslvt,
col16 TYPE ytlet-kslvt,
col17 TYPE ytlet-kslvt,
col18 TYPE ytlet-kslvt,
col19 TYPE ytlet-kslvt,
col20 TYPE ytlet-kslvt,
col21 TYPE ytlet-kslvt,
col22 TYPE ytlet-kslvt,
col23 TYPE ytlet-kslvt,
col24 TYPE ytlet-kslvt,
col25 TYPE ytlet-kslvt,
col26 TYPE ytlet-kslvt,
col27 TYPE ytlet-kslvt,
col28 TYPE ytlet-kslvt,
col29 TYPE ytlet-kslvt,
col30 TYPE ytlet-kslvt,
col31 TYPE ytlet-kslvt,
col32 TYPE ytlet-kslvt,
col33 TYPE ytlet-kslvt,
col34 TYPE ytlet-kslvt,
col35 TYPE ytlet-kslvt,
col36 TYPE ytlet-kslvt,
col37 TYPE ytlet-kslvt,
col38 TYPE ytlet-kslvt,
col39 TYPE ytlet-kslvt,
col40 TYPE ytlet-kslvt,
col41 TYPE ytlet-kslvt,
col42 TYPE ytlet-kslvt,
col43 TYPE ytlet-kslvt,
col44 TYPE ytlet-kslvt,
END OF type_out.
DATA: t_fieldcat TYPE slis_t_fieldcat_alv, "Field catelog table
w_fieldcat TYPE slis_fieldcat_alv, "Field catelog Work area
w_layout TYPE slis_layout_alv, "Layout structure
w_event TYPE slis_alv_event, "Event structure
t_event TYPE slis_t_event, "Event structure
t_sort TYPE STANDARD TABLE OF slis_sortinfo_alv,
t_callback_main_user_command TYPE slis_formname,
v_selfield TYPE slis_selfield.
FIELD-SYMBOLS: <ksl>.
FORM DISPLAY_REPORT .
*Prepare Field Catlog
PERFORM creat_field_catlog.
*Set layout
PERFORM set_layout.
*Get Event
PERFORM get_event.
*Display Report
PERFORM display_alv_report.
ENDFORM. " DISPLAY_REPORT
FORM creat_field_catlog .
PERFORM add_fields_catlog USING:
'01' 'RZZYYPRODUCT' 'IT_OUT' 'MPMs' ' ',
'02' 'KSLVT' 'IT_OUT' 'License Fee' ' ',
'03' 'KSLVT' 'IT_OUT' 'Ad Sales' ' ',
'04' 'KSLVT' 'IT_OUT' 'Promo Fees' ' ',
'05' 'KSLVT' 'IT_OUT' 'Total Ad Sales/Promo' ' ',
'06' 'KSLVT' 'IT_OUT' 'Other' ' ',
'07' 'KSLVT' 'IT_OUT' 'Total' ' ',
'08' 'KSLVT' 'IT_OUT' 'Dom Station' ' ',
'09' 'KSLVT' 'IT_OUT' 'Basic Cable/Free VOD' ' ',
'10' 'KSLVT' 'IT_OUT' 'License Fee' ' ',
'11' 'KSLVT' 'IT_OUT' 'Ad Sales (incl Internet)' ' ',
'12' 'KSLVT' 'IT_OUT' 'Promo Fees' ' ',
'13' 'KSLVT' 'IT_OUT' 'Ad Sales & Promo Fees' ' ',
'14' 'KSLVT' 'IT_OUT' 'Foreign' ' ',
'15' 'KSLVT' 'IT_OUT' 'Pay TV' ' ',
'16' 'KSLVT' 'IT_OUT' 'Other' ' ',
'17' 'KSLVT' 'IT_OUT' 'Total' ' ',
'18' 'KSLVT' 'IT_OUT' 'Home Entertainment' ' ',
'19' 'KSLVT' 'IT_OUT' 'SPTI' ' ',
'20' 'KSLVT' 'IT_OUT' 'All Other Divisions' ' ',
'21' 'KSLVT' 'IT_OUT' 'Total' ' ',
'22' 'KSLVT' 'IT_OUT' 'Total Revenue' ' ',
'23' 'KSLVT' 'IT_OUT' 'PV Net Down & Producers Share' '',
'24' 'KSLVT' 'IT_OUT' 'Total Net Revenue' ' ',
'25' 'KSLVT' 'IT_OUT' 'Development Expense' ' ',
'26' 'KSLVT' 'IT_OUT' 'SOP Deficits' ' ',
'27' 'KSLVT' 'IT_OUT' 'Amortization' ' ',
'28' 'KSLVT' 'IT_OUT' 'Other COS ' ' ',
'29' 'KSLVT' 'IT_OUT' 'Total COS' ' ',
'30' 'KSLVT' 'IT_OUT' 'Profit Before Releasing' ' ',
'31' 'KSLVT' 'IT_OUT' 'Gross Profit %' ' ',
'32' 'KSLVT' 'IT_OUT' 'SPT' ' ',
'33' 'KSLVT' 'IT_OUT' 'Home Entertainment' ' ',
'34' 'KSLVT' 'IT_OUT' 'SPTI' ' ',
'35' 'KSLVT' 'IT_OUT' 'All Other Divisions' ' ',
'36' 'KSLVT' 'IT_OUT' 'Other' ' ',
'37' 'KSLVT' 'IT_OUT' 'Total' ' ',
'38' 'KSLVT' 'IT_OUT' 'Gross Profit' ' ',
'39' 'KSLVT' 'IT_OUT' 'SPT' ' ',
'40' 'KSLVT' 'IT_OUT' 'Home Entertainment' ' ',
'41' 'KSLVT' 'IT_OUT' 'SPTI' ' ',
'42' 'KSLVT' 'IT_OUT' 'All Other Divisions' ' ',
'43' 'KSLVT' 'IT_OUT' 'Other' ' ',
'44' 'KSLVT' 'IT_OUT' 'Total' ' ',
'45' 'KSLVT' 'IT_OUT' 'Net Margin' ' '.
ENDFORM. " CREAT_FIELD_CATLOG
*& Form ADD_FIELDS_CATLOG
Filling of field Catlog
FORM add_fields_catlog USING p_colpos
p_fildname
p_tabname
p_fildtext
p_ndisplay.
w_fieldcat-row_pos = '1'.
w_fieldcat-col_pos = p_colpos.
w_fieldcat-fieldname = p_fildname.
w_fieldcat-tabname = p_tabname.
w_fieldcat-reptext_ddic = p_fildtext.
w_fieldcat-no_out = p_ndisplay.
APPEND w_fieldcat TO t_fieldcat.
CLEAR: w_fieldcat.
ENDFORM. " ADD_FIELDS_CATLOG
*& Form SET_LAYOUT
Set Layout
FORM set_layout .
w_layout-colwidth_optimize = 'X'.
ENDFORM. " SET_LAYOUT
*& Form GET_EVENT
text
FORM get_event .
w_event-name = 'TOP-OF-PAGE'.
w_event-form = 'F_TOP-OF_PAGE'.
APPEND w_event TO t_event.
ENDFORM. " GET_EVENT
*& Form TOP-OF-PAGE
Top of Page
FORM top-of-page.
DATA : t_list_commentry TYPE slis_t_listheader,
w_header TYPE slis_listheader,
lv_text(90) TYPE c,
l_text(90) TYPE c,
lv_rundate(10) TYPE c,
lv_runtime(10) TYPE c.
CONSTANTS: c_space(2) TYPE c VALUE ' ',
c_space2(6) TYPE c VALUE ' '.
w_header-typ = 'S'.
w_header-key = 'Program:'.
w_header-info = sy-repid.
APPEND w_header TO t_list_commentry.
WRITE: sy-datum TO lv_rundate MM/DD/YYYY.
WRITE: sy-uzeit TO lv_runtime USING EDIT MASK '__:__:__'.
CLEAR w_header.
w_header-typ = 'S'.
w_header-key = text-021.
w_header-info = lv_rundate.
APPEND w_header TO t_list_commentry.
CLEAR: w_header.
w_header-typ = 'S'.
w_header-key = 'User Id'.
w_header-info = sy-uname.
APPEND w_header TO t_list_commentry.
CLEAR: w_header.
w_header-typ = 'S'.
w_header-key = 'Run Date'.
w_header-info = lv_rundate.
APPEND w_header TO t_list_commentry.
CLEAR: w_header.
w_header-typ = 'S'.
w_header-key = 'Run Time'.
w_header-info = lv_runtime.
APPEND w_header TO t_list_commentry.
CLEAR: w_header.
w_header-typ = 'H'.
w_header-key = 'order'.
w_header-info = 'MCR Report'.
APPEND w_header TO t_list_commentry.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_list_commentry.
ENDFORM. "TOP-OF-PAGE
FORM display_alv_report .
CONSTANTS : gc_save TYPE c VALUE 'A'. "Save Layout
t_callback_main_user_command = c_user_command.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = t_callback_main_user_command
i_callback_top_of_page = 'TOP-OF-PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = w_layout
it_fieldcat = t_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
i_save = gc_save
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_out
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ENDIF. -
Runtime Error - TABLE_FREE_IN_LOOP in editable ALV GRID
While modifying editable ALV Grid, (CL_GUI_ALV_GRID) I am getting an unexpected dump as follows -
"Runtime Error TABLE_FREE_IN_LOOP".
In a Editable ALV grid whenever new row is added using standard append row button, And while saving, i check for any initial values, in that case iam displaying a warning message. So after that when i try to modify the row, and press enter key, Iam getting this dump "TABLE_FREE_IN_LOOP".
Can you please help on this regard.
Thanks in advance..
Best regards,
Prasad.Hello Krishna
take a additional internal table which is exactly of same type of the internal table which you want to modify . try modifying the second internal table. and then proceed for db update(if required).
Regards,
Suvendu -
Hi ALV masters,
Plz help me ..
I have an ALV grid report where i have the data in my final table t_final.
now i'm trying to populate the fieldcat using FM reuse_alv_fieldcatalog_merge but its not at all getting populated.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = l_repid
I_INTERNAL_TABNAME = 'T_Final'
I_INCLNAME = l_repid
CHANGING
CT_FIELDCAT = T_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
Please help me and if possibl try to send som sample code also.
Thanks in advance..Hi Mukesh,
this is my code.
plz tell where i'm going rong..
*& Report ZMMR_CHANGES *
Title : Material Master: Display Changes *
Description : This ABAP report will collectively list all material *
master changes to the fields specified in the selection*
criteria. *
Request No : SRDK922644 *
Author : Praveen Reddy *
Created on : 14-FEB-2007 *
REPORT ZMMR_CHANGES
NO STANDARD PAGE HEADING
message-id ZSPR.
TYPE-POOLS : SLIS.
TABLES : CDHDR , " Change document header
CDPOS , " Change document item
MARAV , " View Table for Logical DB MGM
MARC , " Plant Data for Material
MVKE . " Sales Data for Material
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF BLOCK GENERAL WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS :
S_OBJCLS FOR CDHDR-OBJECTCLAS ,
S_MATNR FOR CDHDR-OBJECTID ,
S_WERKS FOR MARC-WERKS ,
S_VKORG FOR MVKE-VKORG ,
S_VTWEG FOR MVKE-VTWEG ,
S_TABNAM FOR CDPOS-TABNAME ,
S_FNAME FOR CDPOS-FNAME ,
S_CHGIND FOR CDPOS-CHNGIND ,
S_DATE FOR CDHDR-UDATE ,
S_USER FOR CDHDR-USERNAME .
SELECTION-SCREEN END OF BLOCK GENERAL.
SELECTION-SCREEN END OF BLOCK A.
*Data : G_WERKS LIKE MARC-WERKS ,
G_VKORG LIKE MVKE-VKORG ,
G_VTWEG LIKE MVKE-VTWEG ,
G_DESC LIKE MARAV-MAKTX .
TYPES : BEGIN OF TY_FOR_DISP ,
OBJCLASS LIKE CDHDR-OBJECTCLAS ,
OBJID LIKE CDHDR-OBJECTID ,
WERKS LIKE MARC-WERKS ,
VKORG LIKE MVKE-VKORG ,
VTWEG LIKE MVKE-VTWEG ,
DESC LIKE MARAV-MAKTX ,
TABNAME LIKE CDPOS-TABNAME ,
FNAME LIKE CDPOS-FNAME ,
CHNGIND LIKE CDPOS-CHNGIND ,
UDATE LIKE CDHDR-UDATE ,
USERNAME LIKE CDHDR-USERNAME ,
VALUE_OLD LIKE CDPOS-VALUE_OLD ,
VALUE_NEW LIKE CDPOS-VALUE_NEW ,
END OF TY_FOR_DISP .
TYPES : BEGIN OF TY_CDHDR,
OBJCLASS LIKE CDHDR-OBJECTCLAS ,
OBJID LIKE CDHDR-OBJECTID ,
CHNGIND LIKE CDPOS-CHNGIND ,
CHANGENR LIKE CDHDR-CHANGENR ,
UDATE LIKE CDHDR-UDATE ,
USERNAME LIKE CDHDR-USERNAME ,
VALUE_OLD LIKE CDPOS-VALUE_OLD ,
VALUE_NEW LIKE CDPOS-VALUE_NEW ,
END OF TY_CDHDR .
TYPES : BEGIN OF TY_CDPOS,
TABNAME LIKE CDPOS-TABNAME ,
FNAME LIKE CDPOS-FNAME ,
CHANGENR LIKE CDHDR-CHANGENR ,
CHNGIND LIKE CDPOS-CHNGIND ,
TABKEY LIKE CDPOS-TABKEY ,
FIELDTEXT LIKE DFIES-FIELDTEXT,
UDATE LIKE CDPOS-UDATE ,
USERNAME LIKE CDPOS-USERNAME ,
VALUE_OLD LIKE CDPOS-VALUE_OLD ,
VALUE_NEW LIKE CDPOS-VALUE_NEW ,
END OF TY_CDPOS .
DATA : T_FOR_DISP TYPE STANDARD TABLE OF TY_FOR_DISP
WITH HEADER LINE ,
T_CDHDR TYPE STANDARD TABLE OF TY_CDHDR
WITH HEADER LINE ,
T_CDPOS TYPE STANDARD TABLE OF TY_CDPOS
WITH HEADER LINE .
DATA : G_LANGU LIKE SY-LANGU,
G_TABIX LIKE SY-TABIX,
G_DATE LIKE SY-DATUM.
DATA : G_WERKS LIKE MARC-WERKS ,
G_VKORG LIKE MVKE-VKORG ,
G_VTWEG LIKE MVKE-VTWEG ,
G_DESC LIKE MARAV-MAKTX .
*------ALV Grid Field Catalog Fields
DATA: T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
T_FIELDCAT_H LIKE T_FIELDCAT WITH HEADER LINE.
*------End
CONSTANTS : C_MATERIAL(10) VALUE 'MATERIAL' ,
C_OBJCLASS(10) VALUE 'OBJCLASS' ,
C_OBJECTID(8) VALUE 'OBJID' ,
C_WERKS(5) VALUE 'WERKS' ,
C_VKORG(5) VALUE 'VKORG' ,
C_VTWEG(5) VALUE 'VTWEG' ,
C_DESC(4) VALUE 'DESC' ,
C_TABNAME(7) VALUE 'TABNAME' ,
C_FNAME(5) VALUE 'FNAME' ,
C_CHNGIND(7) VALUE 'CHNGIND' ,
C_UDATE(5) VALUE 'UDATE' ,
C_USERNAME(8) VALUE 'USERNAME' ,
C_VALUE_OLD(9) VALUE 'VALUE_OLD' ,
C_VALUE_NEW(9) VALUE 'VALUE_NEW' .
*CONSTANTS: C_TABNAM_FOR_ALV_FM TYPE SLIS_TABNAME VALUE 'T_FOR_DISP'.
INITIALIZATION *****************
INITIALIZATION.
CLEAR: T_CDHDR,
T_CDPOS,
T_FIELDCAT,
T_FIELDCAT_H,
T_FOR_DISP.
REFRESH:T_CDHDR,
T_CDPOS.
CLEAR : CDHDR, " Change document header
CDPOS. " Change document items
****START-OF-SELECTION.
START-OF-SELECTION.
*-FETCHING DETAILS of Changes done
PERFORM SUB_GET_DETAILS.
Get the field description.
PERFORM SUB_CALL_DDIF_FIELDINFO_GET.
****END-OF-SELECTION.
END-OF-SELECTION.
*--DISPLAYING DATA IN ALV
PERFORM SUB_DISPLAY_ALV.
*& Form SUB_GET_DETAILS
This subrouting is used to get Final output which will shown in
ALV Grid From Table CDPOS.
FORM SUB_GET_DETAILS.
SELECT OBJECTCLAS
OBJECTID
CHANGENR
UDATE
USERNAME
INTO TABLE T_CDHDR
FROM CDHDR
WHERE OBJECTCLAS IN S_OBJCLS
AND OBJECTID IN S_MATNR
AND TABNAME IN S_TABNAM
AND FNAME IN S_FNAME
AND CHNGIND IN S_CHGIND
AND UDATE IN S_DATE
AND UDATE IN S_DATE
AND USERNAME IN S_USER .
IF SY-SUBRC <> 0.
WRITE:/ TEXT-003.
ENDIF.
LOOP AT T_CDHDR.
CLEAR T_FOR_DISP.
IF T_CDHDR-OBJCLASS = C_MATERIAL.
SELECT SINGLE MAKTX
INTO G_DESC
FROM MARAV
WHERE MATNR = T_CDHDR-OBJID+0(18)
AND SPRAS = SY-LANGU.
ENDIF.
T_FOR_DISP-DESC = G_DESC.
CLEAR G_DESC.
CLEAR T_FOR_DISP.
T_FOR_DISP-OBJCLASS = T_CDHDR-OBJCLASS .
T_FOR_DISP-OBJID = T_CDHDR-OBJID .
T_FOR_DISP-UDATE = T_CDHDR-UDATE .
T_FOR_DISP-USERNAME = T_CDHDR-USERNAME .
*ENDIF.
APPEND T_FOR_DISP.
ENDLOOP.
*ENDIF.
SELECT
TABNAME
FNAME
CHANGENR
CHNGIND
TABKEY
UDATE
USERNAME
VALUE_OLD
VALUE_NEW
FROM CDPOS
INTO TABLE T_CDPOS
FOR ALL ENTRIES IN T_CDHDR
CDHDRCHANGENR = CDPOSCHANGENR
WHERE
CHANGENR EQ T_CDHDR-CHANGENR
AND TABNAME IN S_TABNAM
AND FNAME IN S_FNAME
AND CHNGIND IN S_CHGIND .
AND UDATE IN S_DATE.
AND OBJECTID IN S_DATE
AND USERNAME IN S_USER .
IF SY-SUBRC <> 0.
WRITE:/ TEXT-003.
ENDIF.
*CLEAR T_FOR_DISP.
READ TABLE T_CDPOS
WITH KEY CHANGENR = T_CDHDR-CHANGENR.
CLEAR : G_WERKS,
G_VKORG,
G_VTWEG.
G_DESC .
IF T_CDPOS-TABNAME = 'MARC'.
G_WERKS = T_CDPOS-TABKEY+21(4).
ENDIF.
CHECK G_WERKS IN S_WERKS.
IF SY-SUBRC = 0.
T_FOR_DISP-WERKS = G_WERKS.
ENDIF.
IF T_CDPOS-TABNAME = 'MVKE'.
G_VKORG = T_CDPOS-TABKEY+21(4).
ENDIF.
CHECK G_VKORG IN S_VKORG.
T_FOR_DISP-VKORG = G_VKORG.
G_VTWEG = T_CDPOS-TABKEY+25(2).
CHECK G_VTWEG IN S_VTWEG.
T_FOR_DISP-VTWEG = G_VTWEG.
T_FOR_DISP-TABNAME = T_CDPOS-TABNAME.
T_FOR_DISP-FNAME = T_CDPOS-FNAME.
T_FOR_DISP-CHNGIND = T_CDPOS-CHNGIND.
T_FOR_DISP-VALUE_OLD = T_CDPOS-VALUE_OLD.
T_FOR_DISP-VALUE_NEW = T_CDPOS-VALUE_NEW.
APPEND T_FOR_DISP.
ENDLOOP.
ENDLOOP.
CLEAR T_FOR_DISP.
ENDFORM. " SUB_GET_DETAILS
*& Form SUB_DISPLAY_ALV
This Subroutine is used to display data to ALV Grid from internal *
tables T_CDHDR & T_CDPOS. which is filled in subroutine *
SUB_GET_DETAILS *
FORM SUB_DISPLAY_ALV .
BREAK-POINT.
DATA: l_layout type slis_layout_alv,
l_title type lvc_title,
l_repid like sy-repid.
l_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = l_repid
I_INTERNAL_TABNAME = 'TY_FOR_DISP'
I_INCLNAME = l_repid
CHANGING
CT_FIELDCAT = T_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
WRITE:/ 'ERROR IN CALLING ALV FM'.
ENDIF.
*----Change Field Heading We move All field data from T_FIELDCAT To
*----another Internal table with header line namely T_FIELDCAT_H
*CLEAR T_FIELDCAT_H[].
REFRESH T_FIELDCAT_H[].
BREAK-POINT.
MOVE T_FIELDCAT[] TO T_FIELDCAT_H[].
CLEAR G_TABIX.
LOOP AT T_FIELDCAT_H.
G_TABIX = SY-TABIX.
CASE T_FIELDCAT_H-FIELDNAME.
WHEN C_OBJCLASS.
T_FIELDCAT_H-SELTEXT_L = TEXT-004.
T_FIELDCAT_H-SELTEXT_M = TEXT-004.
T_FIELDCAT_H-SELTEXT_S = TEXT-004.
T_FIELDCAT_H-OUTPUTLEN = 15.
WHEN C_OBJECTID.
T_FIELDCAT_H-SELTEXT_L = TEXT-005.
T_FIELDCAT_H-SELTEXT_M = TEXT-005.
T_FIELDCAT_H-SELTEXT_S = TEXT-005.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_DESC.
T_FIELDCAT_H-SELTEXT_L = TEXT-006.
T_FIELDCAT_H-SELTEXT_M = TEXT-006.
T_FIELDCAT_H-SELTEXT_S = TEXT-006.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_WERKS.
T_FIELDCAT_H-SELTEXT_L = TEXT-007.
T_FIELDCAT_H-SELTEXT_M = TEXT-007.
T_FIELDCAT_H-SELTEXT_S = TEXT-007.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_VKORG.
T_FIELDCAT_H-SELTEXT_L = TEXT-008.
T_FIELDCAT_H-SELTEXT_M = TEXT-008.
T_FIELDCAT_H-SELTEXT_S = TEXT-008.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_VTWEG.
T_FIELDCAT_H-SELTEXT_L = TEXT-009.
T_FIELDCAT_H-SELTEXT_M = TEXT-009.
T_FIELDCAT_H-SELTEXT_S = TEXT-009.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_TABNAME.
T_FIELDCAT_H-SELTEXT_L = TEXT-010.
T_FIELDCAT_H-SELTEXT_M = TEXT-010.
T_FIELDCAT_H-SELTEXT_S = TEXT-010.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_FNAME.
T_FIELDCAT_H-SELTEXT_L = TEXT-011.
T_FIELDCAT_H-SELTEXT_M = TEXT-011.
T_FIELDCAT_H-SELTEXT_S = TEXT-011.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_CHNGIND.
T_FIELDCAT_H-SELTEXT_L = TEXT-012.
T_FIELDCAT_H-SELTEXT_M = TEXT-012.
T_FIELDCAT_H-SELTEXT_S = TEXT-012.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_UDATE.
T_FIELDCAT_H-SELTEXT_L = TEXT-013.
T_FIELDCAT_H-SELTEXT_M = TEXT-013.
T_FIELDCAT_H-SELTEXT_S = TEXT-013.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_USERNAME.
T_FIELDCAT_H-SELTEXT_L = TEXT-014.
T_FIELDCAT_H-SELTEXT_M = TEXT-014.
T_FIELDCAT_H-SELTEXT_S = TEXT-014.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_VALUE_OLD.
T_FIELDCAT_H-SELTEXT_L = TEXT-015.
T_FIELDCAT_H-SELTEXT_M = TEXT-015.
T_FIELDCAT_H-SELTEXT_S = TEXT-015.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN C_VALUE_NEW.
T_FIELDCAT_H-SELTEXT_L = TEXT-016.
T_FIELDCAT_H-SELTEXT_M = TEXT-016.
T_FIELDCAT_H-SELTEXT_S = TEXT-016.
T_FIELDCAT_H-OUTPUTLEN = 20.
WHEN OTHERS.
CONTINUE.
ENDCASE.
MODIFY T_FIELDCAT_H.
CLEAR T_FIELDCAT_H.
ENDLOOP.
*BREAK-POINT.
MOVE T_FIELDCAT_H[] TO T_FIELDCAT[].
*----End
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = l_repid
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = l_title
is_layout = l_layout
it_fieldcat = t_fieldcat
i_save = 'A'
tables
t_outtab = T_FOR_DISP[]
exceptions
program_error = 1
others = 2.
IF SY-SUBRC <> 0.
WRITE:/ TEXT-017.
ENDIF.
ENDFORM. " SUB_DISPLAY_ALV
*& Form TOP_OF_PAGE
This subrouting is used to show heading to ALV Grid. This
subrouting is called from subrouting 'SUB_DISPLAY_ALV', Function
'REUSE_ALV_GRID_DISPLAY' & export param 'i_callback_top_of_page'
*Form TOP_OF_PAGE.
DATA : L_HEADER TYPE SLIS_T_LISTHEADER,
L_HEADER_H TYPE SLIS_LISTHEADER.
DATA : L_FROMDAT(10) TYPE C,
L_TODATE(10) TYPE C.
*CONSTANTS : C_DOT(1) TYPE C VALUE '.',
C_L_HEADER_H_TYP(1) VALUE 'H'. "---ALV Grid Header Type
CLEAR : L_HEADER.
**--To Manage Date Format
CONCATENATE S_DATE-LOW+6(2)
C_DOT
S_DATE-LOW+4(2)
C_DOT
S_DATE-LOW+0(4)
INTO L_FROMDAT.
CONCATENATE S_DATE-HIGH+6(2)
C_DOT
S_DATE-HIGH+4(2)
C_DOT
S_DATE-HIGH+0(4)
INTO L_TODATE.
**---End
IF L_TODATE <> '00.00.0000'.
CONCATENATE 'Purchase Org:'(014)
S_VKORG-LOW
'PO changes from'(015)
L_FROMDAT
'To'(013)
L_TODATE
INTO L_HEADER_H-INFO SEPARATED BY SPACE.
ELSE.
G_DATE = SY-DATUM.
CONCATENATE 'CHANGES: '
G_DATE
INTO L_HEADER_H-INFO SEPARATED BY SPACE.
ENDIF.
Main report header
L_HEADER_H-TYP = C_L_HEADER_H_TYP.
APPEND L_HEADER_H TO L_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = L_HEADER
I_LOGO = ''.
*ENDFORM. "TOP_OF_PAGE
Plz look into this and suggest me ..thanks a lot. -
ALV Grid handle_data_changed error?
Hi all,
I've been working on an implementation of an ALV grid in which the user has the ability to edit certain fields. I want to capture those changed values in my program. I've implemented a lcl_event_handler class and I've defined a method within the class to process the data_changed event. I've also defined and instantiated a handle to the class. I've also registered the mc_evt_enter event with the ALV grid. When I run the grid and change a value the data_changed event fires as you would expect. The trouble is an error message is returned which says "Field ty_pan-gsmng is not defined in the ABAP dictionary". I pass a reference to a custom type I defined within the program to the ALV grid...you guessed the name...ty_plan. One of the editable fields within the custome type is gsmng. I'm curious...do I have to pass a reference to a table or type defined within the ABAP dictionary or can I get this code to work with my custom type?
Thanks in advance...Mat.As follows:
DATA: obj_handler TYPE REF TO lcl_event_handler.
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_data_changed.
DATA: ls_good TYPE lvc_s_modi.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
Order Quantity
WHEN 'GSMNG'.
Order Start
WHEN 'PSTTR'.
Order Finish
WHEN 'PEDTR'.
All other fields
WHEN OTHERS.
ENDCASE.
ENDLOOP.
ENDMETHOD.
Call the method to display the data in ALV grid
CALL METHOD obj_alv_grid->set_table_for_first_display
EXPORTING
is_layout = wa_layo
i_structure_name = 'ty_plan'
is_variant = gs_variant
i_save = gv_save_variant
CHANGING
it_outtab = pt_plan
it_fieldcatalog = pt_fieldcat
it_sort = lt_sort
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
OTHERS = 3.
CALL METHOD obj_alv_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
CALL METHOD obj_alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD obj_alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
CREATE OBJECT obj_handler.
SET HANDLER obj_handler->handle_data_changed FOR obj_alv_grid. -
ALV Grid Control Double click error
Hi
In my Editable ALV Grid Control I input the data ,then click save, the program display error msg if any errors , then i double click in any field ,after that I exit from the program , here i dont want this after double click also the control should be on the same field.Pleace help me out this issue.
THXBut what you will do with the error data. you tell me that.
Don't update some error values to DB.
if you don't want error then check this sample code.
report ztest_alv_edit.
data: it_flight type standard table of sflight.
data: it_fcat type lvc_t_fcat,
wa_fcat type lvc_s_fcat.
data: grid type ref to cl_gui_alv_grid,
cont type ref to cl_gui_custom_container.
class lcl_event_receiver definition deferred.
data: g_handler type ref to lcl_event_receiver.
* CLASS lcl_event_receiver DEFINITION
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
* CLASS lcl_event_receiver IMPLEMENTATION
class lcl_event_receiver implementation.
method handle_data_changed.
"this is important
"this will stop poping the message
clear er_data_changed->mt_protocol.
endmethod. "handle_data_changed
endclass. "lcl_event_receiver IMPLEMENTATION
start-of-selection.
select * from sflight
into table it_flight
up to 20 rows.
end-of-selection.
call screen 100.
*& Module STATUS_0100 OUTPUT
* text
module status_0100 output.
set pf-status 'STATUS'.
if cont is initial.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'SFLIGHT'
changing
ct_fieldcat = it_fcat
exceptions
inconsistent_interface = 1
program_error = 2.
create object cont
exporting
container_name = 'CONT'
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
wa_fcat-edit = 'X'.
wa_fcat-checktable = '!'.
modify it_fcat from wa_fcat transporting edit checktable
where fieldname = 'FLDATE'
create object grid
exporting
i_parent = cont
exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
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.
call method grid->set_table_for_first_display(
changing
it_outtab = it_flight
it_fieldcatalog = it_fcat
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
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.
"Important for editable grid
call method grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
create object g_handler.
"setting the handler
set handler g_handler->handle_data_changed for grid.
endif.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
module user_command_0100 input.
"important method to trigger the DATA_CHANGED event
call method grid->check_changed_data.
case sy-ucomm.
when 'BACK'.
leave to screen 0.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
Maybe you are looking for
-
Why do we need a valid credit card in order to publish books?
I'm 15, and I don't have a credit card, yet I want to publish a book for free (of course) onto iBooks from iBooks Author and so I tried to create a free account, and it says I can't do it because I don't have a valid credit card. There's no way my pa
-
Hello i have a problem with a power mac that i just upgraded. I have put Mac os 10.2 on it and after the computer restarted. I got the apple and then it had a one of those dont enter symbols a O with a slash. so if any one knows what this mean would
-
Power usage with external LCD monitor?
Hi All, I'm wondering if using my MBP with an external screen would significantly reduce the laptop's battery endurance as my 5 months old MBP seems to have lowered its battery endurance to approx. 2.5 hours from the original state of 5 hours. in Sys
-
Need help Deactivating Photoshop Elements 9 on old computer
Okay, so, here we go. Originally I had Elements 9 installed on my old computer, but that computer suffered a massive hardware failure and I am unable to deactivate Elements 9 on it. On this computer I am currently using I have Elements 9 on it as wel
-
How do I include icloud sent messages in my sent box on Mail
Hello I file my mail on my Mac. I am running 10.8.5, Mail 6.6. I have a Sent box that looks like an arrow that contains my .Mac mail. Inside mailboxes I have created there is a mailbox Sent Messages (iCloud) that I didn't create. This mailbox also ap