Strange behavior in ALV Grid
Hi all, I have an alv grid which it is updated in a report. But when I call the method grid->refresh_table_display the the refresh does not occur properly.
Let me give you an example:
This is the fieldcat:
FORM create_fieldcatalog.
DATA: wa_fc TYPE lvc_s_fcat.
DATA: col_pos TYPE lvc_colpos.
ADD 1 TO col_pos.
wa_fc-col_pos = col_pos.
wa_fc-fieldname = 'LIGHT'.
wa_fc-tabname = 'IT_DATA'.
wa_fc-scrtext_s = text-f01. "QA Result
wa_fc-selddictxt = 'S'.
APPEND wa_fc TO gt_fieldcat.
CLEAR wa_fc.
ADD 1 TO col_pos.
wa_fc-col_pos = col_pos.
wa_fc-fieldname = 'QA_APPROVED_BY'.
wa_fc-scrtext_l = text-f34. "QA: Approved by
wa_fc-selddictxt = 'L'.
APPEND wa_fc TO gt_fieldcat.
CLEAR wa_fc.
ADD 1 TO col_pos.
wa_fc-lzero = 'X'.
wa_fc-no_zero = 'X'.
wa_fc-col_pos = col_pos.
wa_fc-fieldname = 'QA_APPROVAL_DATE'.
wa_fc-scrtext_l = text-f35. "QA: Approval date
wa_fc-selddictxt = 'L'.
APPEND wa_fc TO gt_fieldcat.
CLEAR wa_fc.
ADD 1 TO col_pos.
wa_fc-col_pos = col_pos.
wa_fc-fieldname = 'QA_APPROVAL_COMMENTS'.
wa_fc-scrtext_l = text-f36. "QA: Approval comments
wa_fc-selddictxt = 'L'.
APPEND wa_fc TO gt_fieldcat.
CLEAR wa_fc.
ADD 1 TO col_pos.
wa_fc-lzero = 'X'.
wa_fc-no_zero = 'X'.
wa_fc-col_pos = col_pos.
wa_fc-fieldname = 'QA_APPROVAL_TIME'.
wa_fc-scrtext_l = text-f37. "QA: Approval time
wa_fc-selddictxt = 'L'.
APPEND wa_fc TO gt_fieldcat.
CLEAR wa_fc.
And this is the modification I do:
read table it_data index 1.
it_data-qa_approved_by = 'MYSELF'.
it_data-qa_approved_comments = 'Test'.
it_data-qa_approved_date = '01/01/2008'.
it_data-qa_approved_time = '10:10:10'.
modify it_data.
call method grid->refresh_table_display.
And now in the screen I can see the value 'MYSELF' in all the field of the modified record in the table.
Any ideas why this is happening??
Edited by: Mauro on Jan 24, 2008 3:46 PM
This is the form that does the update:
*& Form approveqa
FORM approveqa USING lcl_index.
DATA: lcl_fields LIKE sval OCCURS 0 WITH HEADER LINE,
l_returncode(1) TYPE c.
DATA: icon_ok LIKE icon-name,
icon_del LIKE icon-name.
READ TABLE it_data INDEX lcl_index.
*- Only for batch that are not settled.
CHECK ( it_data-light NE '1' ).
lcl_fields-tabname = 'YMM_BTCH_APPROVE'.
lcl_fields-fieldname = 'YYAPPBY_QA'.
lcl_fields-fieldtext = 'Approved by'.
IF ( it_data-qa_approved_by IS INITIAL ).
lcl_fields-value = sy-uname.
ELSE.
lcl_fields-value = it_data-qa_approved_by.
ENDIF.
lcl_fields-field_attr = '02'.
APPEND lcl_fields. CLEAR lcl_fields.
lcl_fields-tabname = 'YMM_BTCH_APPROVE'.
lcl_fields-fieldname = 'YYAPPCOMM_QA'.
IF ( NOT it_data-qa_approved_comments IS INITIAL ).
lcl_fields-value = it_data-qa_approved_comments.
ENDIF.
lcl_fields-field_attr = '01'.
lcl_fields-fieldtext = text-t12. "Commentary
lcl_fields-field_obl = 'X'.
APPEND lcl_fields. CLEAR lcl_fields.
lcl_fields-tabname = 'YMM_BTCH_APPROVE'.
lcl_fields-fieldname = 'YYAPPDATE_QA'.
IF ( it_data-qa_approved_date IS INITIAL ).
lcl_fields-value = sy-datum.
ELSE.
lcl_fields-value = it_data-qa_approved_date.
ENDIF.
lcl_fields-field_attr = '02'.
APPEND lcl_fields. CLEAR lcl_fields.
lcl_fields-tabname = 'YMM_BTCH_APPROVE'.
lcl_fields-fieldname = 'YYAPPTIME_QA'.
lcl_fields-fieldtext = text-t13. "Time
IF ( it_data-qa_approved_time IS INITIAL ).
lcl_fields-value = sy-uzeit.
ELSE.
lcl_fields-value = it_data-qa_approved_time.
ENDIF.
lcl_fields-field_attr = '02'.
APPEND lcl_fields. CLEAR lcl_fields.
icon_ok = icon_okay.
icon_del = icon_delete.
CALL FUNCTION 'POPUP_GET_VALUES_USER_BUTTONS'
EXPORTING
formname = 'POPUP_ACTIONS'
programname = 'Y_MMPU_BATCH_APPROVE'
popup_title = text-t05 "QA Approval
ok_pushbuttontext = ''
icon_ok_push = icon_ok
quickinfo_ok_push = text-t06 "OK
icon_button_1 = icon_del
quickinfo_button_1 = text-t07 "Delete
IMPORTING
returncode = l_returncode
TABLES
fields = lcl_fields
EXCEPTIONS
error_in_fields = 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.
IF ( l_returncode EQ space ).
READ TABLE lcl_fields INDEX 1.
it_data-qa_approved_by = lcl_fields-value.
READ TABLE lcl_fields INDEX 2.
it_data-qa_approved_comments = lcl_fields-value.
READ TABLE lcl_fields INDEX 3.
it_data-qa_approved_date = lcl_fields-value.
READ TABLE lcl_fields INDEX 4.
it_data-qa_approved_time = lcl_fields-value.
MODIFY it_data INDEX lcl_index.
ENDIF.
ENDFORM. " approveqa
This form is called from the handle_user_command method whe the user press a button in the ALV Toolbar.
This is the habdle_user_command method:
METHOD handle_user_command.
DATA: lt_rows TYPE lvc_t_row.
DATA: lcl_rows TYPE lvc_s_row.
get selected row
CALL METHOD grid->get_selected_rows
IMPORTING et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF ( sy-subrc NE 0 ).
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
IF ( lt_rows IS INITIAL ).
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'ERROR!'
txt2 = space
txt1 = 'A line must be selected first'.
ELSE.
READ TABLE lt_rows INDEX 1 INTO lcl_rows.
CASE e_ucomm.
WHEN 'STATCHNG'.
PERFORM statchng USING lcl_rows-index. "<-This perform is working ok when updating the table
WHEN 'APPROVE'.
PERFORM approve USING lcl_rows-index.
WHEN 'APPROVEQA'.
PERFORM approveqa USING lcl_rows-index. "<- This is not.
WHEN 'CONTRACT'.
PERFORM contract USING lcl_rows-index.
WHEN 'QASUMMARY'.
PERFORM qasummary USING lcl_rows-index.
ENDCASE.
CALL METHOD grid->refresh_table_display.
ENDIF.
ENDMETHOD. "handle_user_command
I have debuged this program and the data on the internal table is stored correctly, I can see that each field has the correct values stored in it. But when I refresh the display In all the fields is shown the value of the first field only. And if I remove that field from the catalog, then the refresh will show nothing. This is very very rare.
Similar Messages
-
ALV Grid - Very Strange Problem
I am facing a very strange problem in ALV Grid. Ours is a ECC5 system on SAP_APPL SAPKH50011 and SAP_BASIS SAPKB64016.
I have implemented the ALV grid in a screen using classes. This grid by default appears in display mode however it can be switched to change mode and back to display mode using a custom button on the ALV toolbar. When the user clicks the change button the grid appears in editable mode. During the back and forth switching of the ALV between Change/Display modes the ALV grid control is not destroyed however the toolbar, fieldcatalog and ALV contents are refreshed.
The data which is entered in an editable cell is validated using the data_changed event which has been implemented locally. If the validation fails an error message is raised using the message statement which is being issued correctly. Now when I correct the data and then click on another cell in the ALV grid the program is being aborted. Any clue why this is happening??Please check this code
In the PBO of the screen set the field catalog and layout , i think this will help not to refresh the field catalog every time swtich between display and change mode
set titlebar sy-dynnr with p_netwk.
call method g_grid->set_frontend_fieldcatalog
exporting
it_fieldcatalog = gt_fieldcat[].
call method g_grid->set_frontend_layout
exporting
is_layout = gs_layout.
call method g_grid->refresh_table_display.
2. Regarding program abort, please paste the first page of system dump
a® -
Editable ALV Grid column behavior under ITS standalone
Hello experts,
I have a straight forward implementation of an ALV Grid with 3 columns. Two columns are display only and the third is editable. My question only involves the editable column and its behavior in a web browser served by a standalone ITS server. The underlying data type is CURR. The enterable amounts are restricted to a format of 9.99. Even so, a web user can accidentally enter a non-numeric value such as 1.x0 . We have coded a data changed event handler to check the input value for expected amounts. The event handler logic readily identifies the non-numeric value and handles the exception. Although we have full control of the internal table value, there are two problems encountered within the web browser interface:
1) We cannot return the cursor to the problem cell to prevent the user from continuing before correcting the problem.
2) We cannot reset/change to displayed value to the original internal table value (it will only refresh after a save or refresh action). So the user has no visual cue that they've entered a bad value unless they pay close attention.
Running the transaction in SAPGUI, we can force the cursor back to the erroneously cell using "CALL METHOD alv_grid->set_scroll_info_via_id" . This technique does not appear to affect the cursor within the web browser.
After searching SDN forums and SAP documentation it appears that there is no way to programmatically control the ALV Grid active cell within the web browser interface. I'm wondering if the experts can confirm this issue? If that is the way it works within the browser interface could members please suggest "user friendly" approaches to notifying the user of a data entry problem? For example, is POPUP_TO_INFORM to only option? Perhaps there is a JavaScript routine that can enforce the edit format? Please keep in mind that the standard ALV Grid techniques that work in SAPGUI don't necessarily behave the same way in the web browser. I'm most interested in advice regarding the web browser using standalone ITS as it will be another year before we can leverage WebDynPro in this scenario.
Thanks and best regards,
GaryHi Gary,
can you please create a short report which recreates the issue and post the ABAP here. The goal is that webgui and SAPGUI behaves the same way. If they don't we will try to fix it.
Best regards,
Klaus -
Strange Behavior of program while using BAPI_PO_CREATE1
Hello SAP GURUs,
I've created an Upload Program using BAPI_PO_CREATE1 for Mass Service PO Creation.
When I execute the program and Specify the File for uploading, It Gives me errors as
E BAPI 1 No instance of object type PurchaseOrder has been created. External reference:
E MEPO 0 Purchase order still contains faulty items
E 6 436 In case of account assignment, please enter acc. assignment data for item
But when I come back to Selection Screen of the Program and specify the SAME FILE AGAIN and Execute,
The Program runs successfully and generates the PO number.
I have never seen such strange behavior in any BAPIs before.
Pls help..PERFORM refresh_tables.
PERFORM fill_tables.
END-OF-SELECTION.
Display the Summary as an ALV Grid Display
IF NOT ig_mymssg[] IS INITIAL.
PERFORM display_basic_list . "Grid Display
ELSE.
MESSAGE s000 WITH 'No data exists'(051).
STOP.
ENDIF.
*& Form refresh_tables
text
--> p1 text
<-- p2 text
FORM refresh_tables .
REFRESH: ig_fieldcat,
ig_mymssg,
poitem,
poitemx,
poaccount,
poaccountx,
poservices,
ig_return.
wt_itab, record, record2 .
ENDFORM. " refresh_tables
*& Form fill_tables
text
--> p1 text
<-- p2 text
FORM fill_tables .
record2[] = record[].
record3[] = record[].
DELETE ADJACENT DUPLICATES FROM record COMPARING id_no.
DELETE ADJACENT DUPLICATES FROM record2 COMPARING id_no po_item.
SELECT MAX( packno ) FROM esll INTO wrk_packno.
LOOP AT record.
CLEAR : poheader, poheaderx, wa_poitem, wa_poitemx, wa_poservices, wa_poaccount, wa_poaccountx, wa_poschedulex, wa_poschedule.
REFRESH: poitem, poitemx, poaccount, poaccountx, poservices, ig_return, posrvaccessvalues, poschedule, poschedulex.
PERFORM po_header.
LOOP AT record2 WHERE id_no = record-id_no.
wrk_packno = wrk_packno + 1.
PERFORM po_item.
PERFORM po_scheudle.
PERFORM acc_assignment.
PERFORM po_services.
ENDLOOP.
PERFORM create_po.
ENDLOOP.
ENDFORM. " fill_tables
*& Form display_basic_list
text
--> p1 text
<-- p2 text
FORM display_basic_list .
g_repid = sy-repid.
PERFORM f2000_fieldcat_init .
PERFORM display_alv_grid_1.
ENDFORM. " display_basic_list
*& Form f2000_fieldcat_init
text
--> p1 text
<-- p2 text
FORM f2000_fieldcat_init .
REFRESH ig_fieldcat.
PERFORM fill_fields_of_fieldcatalog USING 'IG_MYMSSG'
'STATUS'
c_x
'Status'
'10'.
PERFORM fill_fields_of_fieldcatalog USING 'IG_MYMSSG'
'RECORD'
c_x
'Record'
'20'.
PERFORM fill_fields_of_fieldcatalog USING 'IG_MYMSSG'
'ERRMSG'
'Message'
'100'.
ENDFORM. " f2000_fieldcat_init
*& Form display_alv_grid_1
text
--> p1 text
<-- p2 text
FORM display_alv_grid_1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_structure_name = 'IG_MYMSSG'
i_grid_title = 'LOG'
is_layout = wg_layout
it_fieldcat = ig_fieldcat[]
i_save = c_save
TABLES
t_outtab = ig_mymssg
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.
ENDFORM. " display_alv_grid_1
*& Form fill_fields_of_fieldcatalog
text
-->P_0626 text
-->P_0627 text
-->P_C_X text
-->P_0629 text
-->P_0630 text
FORM fill_fields_of_fieldcatalog USING p_tabname TYPE slis_tabname
p_field TYPE slis_fieldname
p_key TYPE c
p_name
len.
To fill in the fields of the table fieldcatalog depending on the field
CLEAR wg_fieldcat.
wg_fieldcat-fieldname = p_field. " The field name and the table
wg_fieldcat-tabname = p_tabname.. " name are the two minimum req
wg_fieldcat-key = p_key. " Specifies the column as a key
wg_fieldcat-seltext_l = p_name. " Column Header
wg_fieldcat-outputlen = len.
APPEND wg_fieldcat TO ig_fieldcat.
ENDFORM. " fill_fields_of_fieldcatalog
*& Form create_po
text
--> p1 text
<-- p2 text
FORM create_po .
CLEAR : wg_return.
REFRESH : ig_return.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = poheader
poheaderx = poheaderx
IMPORTING
exppurchaseorder = po_no
TABLES
return = ig_return
poitem = poitem
poitemx = poitemx
poschedule = poschedule
poschedulex = poschedulex
poaccount = poaccount
poaccountx = poaccountx
poservices = poservices
posrvaccessvalues = posrvaccessvalues.
SORT ig_return BY type.
READ TABLE ig_return INTO wg_return WITH KEY type = 'S'.
IF sy-subrc EQ 0.
CLEAR : wg_return.
REFRESH : ig_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
CLEAR wg_errmsg.
WRITE icon_green_light AS ICON TO wg_errmsg-status.
CONCATENATE record-id_no po_no INTO wg_errmsg-record SEPARATED BY '/'.
wg_errmsg-record = po_no.
wg_errmsg-errmsg = 'PO created'.
APPEND wg_errmsg TO ig_mymssg.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
READ TABLE ig_return INTO wg_return WITH KEY type = 'E' TRANSPORTING message.
CLEAR wg_errmsg.
WRITE icon_red_light AS ICON TO wg_errmsg-status.
wg_errmsg-record = record-id_no.
wg_errmsg-errmsg = wg_return-message.
APPEND wg_errmsg TO ig_mymssg.
ENDIF.
ENDFORM. " create_po
*& Form po_header
text
--> p1 text
<-- p2 text
FORM po_header .
poheader-comp_code = record-comp_code.
poheader-doc_type = record-doc_type.
poheader-vendor = record-vendor.
poheader-purch_org = 'SERV'.
poheader-pur_group = record-pur_group.
poheader-currency = 'INR'.
poheaderx-comp_code = 'X'.
poheaderx-doc_type = 'X'.
poheaderx-vendor = 'X'.
poheaderx-purch_org = 'X'.
poheaderx-pur_group = 'X'.
poheaderx-currency = 'X'.
ENDFORM. " po_header
*& Form po_item
text
--> p1 text
<-- p2 text
FORM po_item .
DATA : days TYPE num2.
DATA : final_dt TYPE datum.
DATA : is_ok TYPE boole_d.
DATA : msg_hndlr TYPE REF TO if_hrpa_message_handler.
days = 20.
CALL FUNCTION 'HR_ECM_ADD_PERIOD_TO_DATE'
EXPORTING
orig_date = sy-datum
num_days = days
signum = '+'
message_handler = msg_hndlr
IMPORTING
result_date = final_dt
is_ok = is_ok.
CLEAR: wa_poitem,wa_poitemx.
wa_poitem-po_item = record2-po_item.
wa_poitem-short_text = record2-short_text.
wa_poitem-plant = record2-plant.
wa_poitem-matl_group = 'S001'.
wa_poitem-tax_code = 'LA'.
wa_poitem-item_cat = item_cat.
wa_poitem-pckg_no = wrk_packno.
wa_poitem-acctasscat = acctasscat.
wa_poitem-gr_to_date = final_dt.
APPEND wa_poitem TO poitem.
wa_poitemx-po_item = record2-po_item.
wa_poitemx-po_itemx = 'X'.
wa_poitemx-short_text = 'X'.
wa_poitemx-plant = 'X'.
wa_poitemx-tax_code = 'X'.
wa_poitemx-item_cat = 'X'.
wa_poitemx-acctasscat = 'X'.
wa_poitemx-pckg_no = 'X'.
wa_poitemx-matl_group = 'X'.
wa_poitem-gr_to_date = 'X'.
APPEND wa_poitemx TO poitemx.
ENDFORM. " po_item
*& Form PO_SERVICES
text
--> p1 text
<-- p2 text
FORM po_services .
CLEAR: wa_poservices, wa_posrvaccessvalues.
wa_poservices-pckg_no = wrk_packno.
wa_poservices-line_no = '0000000001'.
wa_poservices-outl_ind = 'X'.
wa_poservices-subpckg_no = wa_poservices-pckg_no + 1.
wa_poservices-from_line = '000001'.
APPEND wa_poservices TO poservices.
CLEAR wa_poservices.
wrk_packno = wrk_packno + 1.
wa_poservices-pckg_no = wrk_packno.
wa_poservices-line_no = '0000000002'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = record2-service
IMPORTING
output = record2-service.
wa_poservices-ext_line = '0000000010'.
wa_poservices-service = record2-service.
wa_poservices-quantity = record2-quantity.
wa_poservices-gr_price = record2-gr_price.
wa_posrvaccessvalues-pckg_no = wrk_packno.
wa_posrvaccessvalues-line_no = '0000000002'.
wa_posrvaccessvalues-serial_no = '01'.
wa_posrvaccessvalues-serno_line = '01'.
wa_posrvaccessvalues-quantity = record2-quantity.
wa_posrvaccessvalues-net_value = record2-gr_price.
APPEND wa_poservices TO poservices.
APPEND wa_posrvaccessvalues TO posrvaccessvalues.
ENDFORM. " PO_SERVICES
*& Form ACC_ASSIGNMENT
text
--> p1 text
<-- p2 text
FORM acc_assignment .
DATA : tmp_gl LIKE bapimepoaccount-gl_account.
tmp_gl = '400265'.
CLEAR : wa_poaccount, wa_poaccountx.
wa_poaccount-po_item = record2-po_item.
wa_poaccount-serial_no = '01'.
wa_poaccount-co_area = '1000'.
wa_poaccount-quantity = record2-quantity.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = tmp_gl
IMPORTING
output = wa_poaccount-gl_account.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = record2-orderid
IMPORTING
output = wa_poaccount-orderid.
APPEND wa_poaccount TO poaccount.
wa_poaccountx-po_item = record2-po_item.
wa_poaccountx-serial_no = '01'.
wa_poaccountx-co_area = 'X'.
wa_poaccountx-quantity = 'X'.
wa_poaccountx-gl_account = 'X'.
wa_poaccountx-orderid = 'X'.
APPEND wa_poaccountx TO poaccountx.
ENDFORM. " ACC_ASSIGNMENT
*& Form PO_SCHEUDLE
text
--> p1 text
<-- p2 text
FORM po_scheudle .
CLEAR : wa_poschedule, wa_poschedulex.
wa_poschedule-po_item = record2-po_item.
wa_poschedule-sched_line = '0001'.
wa_poschedule-del_datcat_ext = 'D'.
wa_poschedule-delivery_date = sy-datum.
wa_poschedule-quantity = record2-quantity.
APPEND wa_poschedule TO poschedule.
wa_poschedulex-po_item = record2-po_item.
wa_poschedulex-sched_line = '0001'.
wa_poschedulex-po_itemx = 'X'.
wa_poschedulex-sched_linex = 'X'.
wa_poschedulex-del_datcat_ext = 'X'
wa_poschedulex-delivery_date = 'X'.
wa_poschedulex-quantity = 'X'.
APPEND wa_poschedulex TO poschedulex.
ENDFORM. " PO_SCHEUDLE -
I have a strange problem with an ALV grid.
I have used the FM "LVC_FIELDCATALOG_MERGE" to create a fieldcatalog from a structure. The structure contains a field called NETWR that is based on the NETWR data element (which is a CURR data type).
When the grid is displayed, however, zero values are not displayed - the cell is blank.
I thought the default behaviour for a CURR field was to display zeros?
I have checked and the NO_ZERO field in the fieldcat is initial.
Any other ideas?According to this link, it has to be displayed. Check it one more time whether you set No_zero is initial or not.
http://help.sap.com/saphelp_erp2004/helpdata/en/ff/4649baf17411d2b486006094192fe3/frameset.htm
Warm Regards,
Vijay -
How to identify the modified rows in ALV grid in OO
Hello All,
I have strange problem and i don't know how to solve it?
I have ALV grid and in that ALV grid i have two buttons 'CONT' and 'ALLOC', when the user press 'ALLOC' button i will give a popup to make the user to enter some value.
After entering the value i will do some calicualtions and i will distribute the amount in the fields of ALV grid and i should update the ALVGRID.
Normally we can use CALL METHOD ME->REFRESH_TABLE_DISPLAY.( I have already checked by using this method and it worked fine)
Here is the way my program look like
ALVTREE1
ALVTREE2
|----
ALVGRID
The problem is when i press the other button CONT i am unable to know what values exist in ALVGRID.
How can i find these distributed amount in ALV?
I hope i am clear while explaining problem.
Here is the required code:
method handle_user_command.
data: lt_fields type table of sval,
ls_field type sval,
ls_fieldcatalog type lvc_s_fcat,
ls_merkpl type zvhf_merkpl,
lv_month(2) type n ,
lv_year(4) type n ,
lv_spmon type zvhf_allocation-spmon,
lv_value type p.
field-symbols: <fs> type any,
<ls_merkpl> type zvhf_merkpl.
case e_ucomm.
when 'CNT'.
call method gcl_gui_alv_grid->check_changed_data.
call method dailogbox_container->set_visible
exporting
visible = space.
call method gcl_gui_alv_tree2->frontend_update.
call method gcl_gui_alv_tree2->update_calculations.
clear: gt_merkpl.
when 'ALCT'.
Popup to get the values enterd by the user
ls_field-tabname = 'DD02V'.
ls_field-fieldname = 'DDTEXT'.
append ls_field to lt_fields.
call function 'POPUP_GET_VALUES'
exporting
popup_title = 'Enter value'
start_column = '1'
start_row = '1'
tables
fields = lt_fields
exceptions
error_in_fields = 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.
elseif sy-subrc = 0.
read table lt_fields into ls_field index 1.
if sy-subrc = 0.
gv_value = ls_field-value.
Read the table zvhf_allocation with nodekey in order to get percentages
select * from zvhf_allocation into table gt_allocation
where dvkbur = gs_node_info-nodename.
Read gt_merkpl in order to get existing line in ALV grid
loop at gt_merkpl into ls_merkpl.
*Read FCAT inorder to find the field and move proprtinate value
loop at gt_fieldcatlog3 into ls_fieldcatalog.
*Split is required to match ZVHF_ALLOCATION-SPMON with screen text and to proprtinate the value
split ls_fieldcatalog-scrtext_l at '.' into
lv_month lv_year.
concatenate lv_year lv_month into lv_spmon.
Check whether an entry exist or not in ZVHF_allocation
read table gt_allocation into gs_allocation
with key spmon = lv_spmon binary search.
*If an entry exist proprtinate the value as enterd in table
if sy-subrc = 0.
lv_value = gv_value * gs_allocation-prozent.
lv_value = lv_value / 100.
perform assign_value using ls_fieldcatalog-fieldname lv_value
changing ls_merkpl.
modify gt_merkpl from ls_merkpl.
endif.
endloop.
CALL METHOD gcl_gui_alv_grid->frontend_update.
call method gcl_gui_alv_grid->refresh_table_display
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.
endloop.
endif.
endif.
endcase.
endmethod. "handle_user_command
If you have any further questions please let me know.
Regards,
LisaHello Vijay,
Thanks for you reply,
The event data_changed is not working because i called method refresh_table_display. So the event changed will not be raised after i press button CONT
If i didn't call this method then i can see the value enterd by the user in ALV grid.
So, do you have an more ideas.
Regards,
Lisa -
Hi,
in SE16, browsing MSEG table, when I display a number field such as MENGE I see a strange case:
with classic SE16 output I see a value as "10,000"
with ALV Grid output I see a value as "100,00"
This in a ECC 6.04 box with last Kernel patch 171, last BASIS SP and last ABAP SP.
Have you got any suggest?
Regards.Check if note 1571782 & 1394178 helps.
-
Issue with ALV Grid and events
Hi,
I am creating an ALV Grid with fields Matnr,Charg,Labst,Meins. The first three fields are editable and the last (MEINS) is read only.
Now I am trying to fill the MEINS field programmaticly after entering the MATNR and confirm with enter/return.
I think that I have to "overload" the enter event of the alv grid to fill the MEINS everytime when a MATNR was entered. But I don't know how I could implementing this. Could you give me a hint how I could solve this problem?
(The behavior should look like in transaction MIGO)
ThanksHi Alex
When you press enter an event is triggerd and function code is filled in sy-ucoom or you can say in ok_code. At that time PAI event occurs. In PAI of that screen you need to check ok_code and load new data in table which you passed to ALV and also refresh the ALV.
data: ok_code like sy-ucomm.
PAI----screen 100
case ok_code.
when 'ENTER'.
select data
and refresh ALV
then again call
funtion to display ALV
Regards
Aditya -
Strange behavior - icon thumbnail instead of image - CC@OSX10.10
Hi,
my CC (@OS X 10.10.3) showing a strange behavior using vanishing point filter.
After defining grid and try to paste the image OS X paste the icon thumbnail instead of the image,
Many thanks in advance!!
br
JoachimIt is probably related to the fact that you are setting the tables row height in the renderer this will fire a render message when the height changes. One height is applied to all rows of a table. This means that is you have images of different heights you are continually changing the tables row height and therefore continually rendereing.
My approach would be to have all the images fit into a set size ( say 64*64 ( with scaling if neccesary ) you could then have a popup show the full size image if required. -
Dear Experts,
I have come across a strange scenarion where in the "Export to Excel" functionality from an ALV grid behaves differently for different layout selections.
for eg: I have my output list with 10 fields displayed. If I export the list to the excel using the button from the application tool bar of the grid, my output excel is having only the column headings without any values. Where in say, if i select all the fields of the output list (around 20), then the output is perfect into the excel.
Kindly let me know what would be the problem and how to handle them.
Lots of rewards awaiting.
Thanks.
Arunkumar SHi Arunkumar,
Some time export to excel through Local file-->spreadsheet option behave abnormally.
You can do one thing as you have all your data in internal table.
Add a button " Export to excel" in Menu painter and use following code in subroutine user_command
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
DEFAULT_EXTENSION = 'XLS'
DEFAULT_FILE_NAME = L_FILE_NAME
CHANGING
FILENAME = L_FILENAME
PATH = L_PATH
FULLPATH = L_FULLPATH.
thanks,
shilpa -
Hi All,
We've created an ALV grid using classes in R3 and we're testing it in WebGUI. All of those scenarios are working fine in R3 however the behavior in WebGUI is different. We're encountering a problem wherein the cellstyles are not being reflected (eg. a particular cell for a particular row should be grayed out if a particular field has this value). Furthermore, if we enter a value in this field, it should automatically populate values for other fields (eg. column name - PERNR. Once pernr is entered; column name - NAME should have a value automatically). Another thing is, the Refresh button is missing in WebGUI. One more problem is that the error message for that particular column was not shown. We're using the add_protocol_entry method, so it should generate a pop-up screen.
Any solution for all these problems? Are these problems limitations of the ALV Grid in WebGUI?
We'll appreciate all your responses. Thanks a lot.Have a look at example code: BCALV_GRID_01, where they suppress the error by catching it...
If you are using the ABAP Grid Control (OO object), you can still create the ALV list as a spool listing for the background job.
The easiest way to do this is to put all the create object statements and method calls for the custom container and ALV grid object inside a subroutine (for example, present_grid).
All that is required is a simple check of the sy-batch variable to determine if the program is being executed in the foreground or background.
e.g. if sy-batch is initial.
call screen 0100.
else.
perform present_grid.
endif.
In a PBO module of screen 0100, the subroutine present_grid is also performed.
The set_table_for_first_display method will be invoked in the routine present_grid, however, due to the job being executed in the background, the ALV list output will be written as spool output for the background job. -
Problem: User has problems to export ALV Grid to Excel...
Hello experts,
I have a very strange problem with an single user: when she tries to export ALV Grid data from SAP into Excel by List/Export/Spreadsheet, she's only able to export this to an xml-based file on her local client, every other user gets the popup to choose the spreadsheet format (XXL...).
What I did so far:
- Look up Excel Makro Security --> the same as on other desktops
- SAP GUI Patch Level --> the same as on other desktops
- Test with an different user on her desktop on SAP Report S_ALR_87012284 --> it worked perfectly
- User parameters are the same as for the test user
- Security regarding ALV is the same (S_GUI ACTVT = 61...)
Has there ever been a similar problem to anyone else?
Many thanks in advance for your feedback!Hi ,
This problem looks very weired. Just try running that FM from SE37 from the same system and see that what is happening there.... if the problem is similar then it is not the problem of your report and some patch may be missing in that system. -
Hi Folks,
I have developed a report using ALV GRID for an user. However when he tries to export it to excel my field LIFNR (vendor no.) its 1 character short.
For example:
ALV GRID VIEW:
103190325 2000004610 37,900.00
EXCEL File:
10319032 2000004610 37,900.00
This is pretty strange for me, never had this problem before. Can anyone help me with this problem.
Thanks in advance for your help.
Regards,
Gilberto Li
Edited by: Gilberto Li on Nov 6, 2008 4:28 PMHi Naimesh,
Thanks for your reply.
Yes I have checked the output length for the field. Right now I have it on 12 just in case, but LIFNR is a 10 character field, and I am still having this problem.
When I hit the button for a preview on the grid it shows like this:
10319032... 2000004610 37,900.00
Strangely, don't know why this last digit is getting cutted.
Thanks again.
Regards,
Gilberto Li -
Up and Down Buttons in ALV Grid
Hi,
If you open the Sorting Screen of an ALV Grid, you can select Columns you want to see and you can rearange them by clicking this Up and Down Buttons. Are these up and down buttons Standard or are they only available in this Sorting Screen? Because i also want to allow the user to sort entries in an own ALV Grid by rearranging the entries with Up and Down buttons. Do i have to add them by my own or is there a standard feature. I saw that there is an Move Row Function, but i did not found any documentation on that.
Thanks,Jonhy:
This is a little example with ALV, you can see basically are tree things:
1.- Create fieldcat
2.- Have internal table with informacion
3.- CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
All buttons into ALV Tool Bar are standar, and you can hide/show them, or in some case changed a lot of behavior.
Documentation?
TAW10_3 ALV Grid control Unit, is a excelent chapter to start.
TYPE-POOLS: slis.
TABLES: SPFLI.
data: IT_SPFLI like spfli occurs 0 with header line.
data: t_fieldcat TYPE slis_t_fieldcat_alv,
fs_fieldcat LIKE LINE OF t_fieldcat.
select-options: s_carrid for spfli-carrid,
s_connid for spfli-connid.
SELECT * FROM SPFLI INTO TABLE it_spfli
where CARRID in s_carrid and
CONNID in s_connid .
fs_fieldcat-fieldname = 'CARRID'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 1.
fs_fieldcat-key = 'X'.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat .
fs_fieldcat-fieldname = 'CONNID'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 2.
fs_fieldcat-key = 'X'.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat .
fs_fieldcat-fieldname = 'DISTANCE'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 3.
fs_fieldcat-key = ' '.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat.
fs_fieldcat-fieldname = 'CITYFROM'.
fs_fieldcat-ref_tabname = 'SPFLI'.
fs_fieldcat-col_pos = 4.
fs_fieldcat-key = ' '.
APPEND fs_fieldcat TO t_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = t_fieldcat
TABLES
t_outtab = it_spfli.
Enjoy the example.
Regards
José Luis -
ALV GRID download truncates the last digit of invoice
Hi Experts,
I am facing a production issue related to ALV grid download. When we click export to local file -> spread sheet,
if it is downloaded to Excel file, invoice last digit is truncated.
Can any body face this problem ?
Please let me know if any body has clue to solve this strange issue.
Thanks,
Balaji.T.Hi,
check the type of field used for invoice list. Make it type vbeln. Also try using EXit_alpha_output FM and modify the table for invoice numbers.
Thanks,
Sam.
Maybe you are looking for
-
SQL Developer paste problem for large text in Linux
Hello, I have a problem. I cannot paste large text (> 5000 lines) into the editor of a clob column. Pasting in general works. I mean I can paste the whole content e.g. to gedit or I can paste partially the text into the sql developer editor but not a
-
Essbase report script in ODI procedure/variable
Hi, Is there a way to call an existing report script in essbase in an ODI procedure/variable? BEST! Edited by: 867760 on Sep 1, 2011 2:39 PM
-
Invalid username or password when trying to start/stop SES
I've recently taken over this project as the previous person left the company. Last week everything was running just fine. This week, when I tried to go to either the search page or the admin page, I see: Internet Explorer can not display the Webpage
-
Wanting to upgrade from 10.4.11 to 10.6 - Am I able?
Greetings, sorry if this has been asked prior, there is a TON of topics here and I became a bit overwhelmed. I am wanting to upgrade my iMac running 10.4.11 to Snow Leopard. I Understand I need to purchase the entire box set, not just the $29 upgrade
-
Edited photos from iphone 4s not saving when transferred to computer!!!
How come after I enhance my photos on my iphone4s and I transfer them to my computer, the changes don't save? Doesn't that defeat the purpose of editing them from your phone? Can this be fixed?