Error messages - alv
hi
coul u tell me the funtion module for checking the errors in alvs
hi,
could u pls tell me the problem u r facing...
regards,
siva
Similar Messages
-
Error message in a table (not ALV)
Hi there,
i know that in ALV an error-message appears and the cell is marked if an user puts a not allowed value in the cell.
Now i want to achieve the same in my non-alv-table. If a user enters a value in a specific cell, i want to output a message and mark the specific cell as "wrong". Can anyone provide me with a code-example?
Best regards
DavidHI,
Even in table cell if a value is entered that is not permitted ,system issues an error message and highlights the cell after some action is performed.
Case1: Suppose you enter a character value in date field and perform some action system performs the checks, issues an error message an higlights the cell.
Case 2: If validation of the entered value needs to be done programatically after an action is performed the use the below logici in the WDOBEFOREACTION method.
a) Get the node binded to the table( lo_node = wd_context->get_child_node('Node Name").
b) Using the node reference get alll the elements using the method GET_ELEMENTS of IF_WD_CONTEXT_NODE i.e lo_node.
c) Now loop at list of elements and for each element use the method GET_STATIC_ATTRIBUTES to get the attribute values
d) Do the required validation if some error is found use REPORT_ATTRIBUTE_ERROR_MESSAGE using the attribute name and element refernece.
Hope this helps.
Regards,
Madhu. -
Displaying Custom Error Message in ALV
Hello Experts,
Usually, when an error occurs in editable ALV, the standard WD ALV functionality marks the particular error cell in red and displays the error message.
I want the same functionality for custom error messages in event ON_DATA_CHECK. I'm able to display the message, but looking for a way to mark cells as well.
Please help....Hello friend,
I think this link will help you much more clear on the coloring of the ALV concepts.
http://help.sap.com/saphelp_smehp1/helpdata/en/5f/ec57c72a1349c8bfdda56d976e9399/frameset.htm
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393?QuickLink=index&overridelayout=true
Thanks,
Sri Hari -
How to raise error message from PAI of oops ALV report
Hi All,
I have a requirement to raise error message form editable oops alv . After entering the data and then press SAVE button .
Please help.
Thanks in AdvanceHI SK,
Write a Local class (Event Handeler) to handel the events. In Editable ALV once the user enter a value, CL_GUI_ALV_GRID will raise an event called DATA_CHANGED.
1. Define and Implement a local class to handle that event.
In the implementation of this class you need to get data from imported object to an internal table, then compare the same with the ALV output table.
* Local Class to handler the events raised from the ALV Grid
CLASS LCL_EVENT_HANDLER DEFINITION.
PUBLIC SECTION.
* Method to handel EDIT event, DATA_CHANGED of CL_GUI_ALV_GRID
METHODS : ON_DATA_CHANGE FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED.
ENDCLASS.
* Event handler class Implementation
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
METHOD ON_DATA_CHANGE.
DATA : LT_MODIFY TYPE LVC_T_MODI,
LS_MODIFY TYPE LVC_S_MODI.
* Copying changed data into intenal table from Object
LT_MODIFY = ER_DATA_CHANGED->MT_MOD_CELLS.
* Modifying the ouptut table with the changed values
IF LT_MODIFY[] IS NOT INITIAL.
*Compare the ALV Output table with LT_MODIFY
ENDIF.
ENDMETHOD.
ENDCLASS.
Then raise a message on required condition in the same method.
Note: To trigger the above method, you need to set event handler before displaying ALV (before calling method SET_TABLE_FOR_FIRST_DISPLAY)
* Creating object for the Local event handler class
CREATE OBJECT GR_HANDLER.
* Set handler (call method of Event_handler) to handler Edit event
SET HANDLER GR_HANDLER->ON_DATA_CHANGE FOR GR_GRID.
Regards,
Vijay -
Hi All,
I have developed a report.
After start-of-selection, i have written a perform statement, in which the data is getting retrieved for printing the same in ALV layout.
If there is no data available in the table, the code will raise an error message stating ' No data is available". This error message statment is in this PERFORM statement....
But this error message will be triggered in the different page which will be blank...
Now user would like to have the message in the same page (selection screen).
How to resolve this issue....??????
Pelase guide me.....
Regards
Pavan
Message was edited by:
Pavan SanganalHi,
when your internal table is empty
give the message like
when u r in start of selection event then
form
message i000( zmessage ) with ' no data found'.
stop.
endform.
this provides u again the selection screen,
regards,
venkatesh -
Error message log in session method of ALV report,
In ALV report please let me know:
1) In session method:
where all error messages are stored,I know that error messages are stored in a log file, so please tell me where is it stored.
2)transaction method:
How to handle error messages in transaction methos(for eg if a weight field text box value is negative)Ans for 2nd point.
CALL TRANSACTION c_mb USING i_bdcdata
MODE g_ctumode
UPDATE g_cupdate
MESSAGES INTO i_messtab.
COMMIT WORK.
IF sy-subrc EQ 0. " BDC Executed Successfully
CLEAR wa_messtab.
LOOP AT i_messtab INTO wa_messtab .
IF wa_messtab-msgtyp = 'S' AND
wa_messtab-msgid = 'M7' AND
wa_messtab-msgnr = '060'.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = wa_messtab-msgid
msgnr = wa_messtab-msgnr
msgv1 = wa_messtab-msgv1
msgv2 = wa_messtab-msgv2
msgv3 = wa_messtab-msgv3
msgv4 = wa_messtab-msgv4
IMPORTING
message_text_output = l_msg.
APPEND l_msg TO i_sucsess.
CLEAR l_msg.
g_docsuc = 1.
ELSE.
IF wa_messtab-msgtyp = 'E'.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = wa_messtab-msgid
msgnr = wa_messtab-msgnr
msgv1 = wa_messtab-msgv1
msgv2 = wa_messtab-msgv2
msgv3 = wa_messtab-msgv3
msgv4 = wa_messtab-msgv4
IMPORTING
message_text_output = l_msg.
g_errflg = 1.
APPEND l_msg TO i_error.
CLEAR: l_msg.
ENDIF. -
Editable ALV - how to throw an error message for a specific line & field
Hi all,
I've implemented an editable ALV and also the ON_DATA_CHECK event to check the values, entered in the ALV. So this works fine and I can check the values.
But now, I want to throw an error message corresponding to the field in the ALV, where the error occured.
How can I throw this error message corresponding to a specific line/field in the ALV?
I was using REPORT_ATTRIBUTE_ERROR_MESSAGE and REPORT_ELEMENT_ERROR_MESSAGE but without success.
I'm also using a loop over the "CHANGES" in the ALV and within this loop, I use
elem_alv = node_alv->get_element( index = <change>-element_index )
to get the element for the message.
CALL METHOD lo_message_manager->REPORT_ELEMENT_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'my message'
ELEMENT = elem_alv
* ATTRIBUTES =
* PARAMS =
* MSG_USER_DATA =
* IS_PERMANENT = ABAP_FALSE
* SCOPE_PERMANENT_MSG = CO_MSG_SCOPE_CTXT_ELEMENT
* MSG_INDEX =
* CANCEL_NAVIGATION =
* IS_VALIDATION_INDEPENDENT = ABAP_FALSE.
2.) is it right, that for an editable ALV, I can't use the WDDOBEFOREACTION to do the checks?
If I try to use this, I can't get the values of my ALV table to check it.
Thanks,
AndreasHi Andreas,
I have tried to replicate your problem and I am getting the desired output. I have a row by name TEMP_NEW in my ALV and I want to throw an error message whenever the user enters a value of 4 for that particular field. Please find my coding as below. The important thing is where we perform the actual comparison between the r_value and 4. r_value is defined in SALV_WD_S_TABLE_MOD_CELL as reference to type DATA. So suppose the user enters a value of say 3 in the TEMP_NEW field of the ALV then r_value would contain 3 but if you observe its type in debugging mode it would be as TYPE REF TO I and not TYPE I. So you cannot directly say something like:
"if ls_modified_cells-r_value = 3" as this would lead to a syntax error. Define a field-symbol say <temp> and then use it to get the actual value into it by saying like:
ASSIGN ls_modified_cells-r_value->* TO <temp>.
Then you can use this <temp> for comparison in your IF statement like:
IF <temp> = 3.
Find the entire coding as below:
METHOD check_data.
DATA: lr_node TYPE REF TO if_wd_context_node,
lr_element TYPE REF TO if_wd_context_element,
ls_modified_cells TYPE salv_wd_s_table_mod_cell.
FIELD-SYMBOLS <temp> TYPE data.
" get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
lr_node = wd_context->get_child_node( name = 'NODE' ).
LOOP AT r_param->t_modified_cells INTO ls_modified_cells.
lr_element = lr_node->get_element( index = ls_modified_cells-index ).
IF ls_modified_cells-attribute = 'TEMP_NEW'.
" Get the value extracted into the field symbol from the reference variable
ASSIGN ls_modified_cells-r_value->* TO <temp>.
" Use the value present in this field-symbol for your comparison
IF <temp> = 4.
" report message
CALL METHOD lo_message_manager->report_attribute_error_message
EXPORTING
message_text = 'Sample message text'
element = lr_element
attribute_name = ls_modified_cells-attribute.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
Hope this helps resolve your problem.
Regards,
Uday -
*& Report ZAREPAS22
REPORT zarepas22 LINE-SIZE 250.
TABLES : vbak,vbap,likp,lips,vbrk,vbrp,kna1,vbfa.
DATA : ok_code LIKE sy-ucomm,
g_container TYPE scrfname VALUE 'BCALV8_GRID_DEMO_0100_VASU',
docking TYPE REF TO cl_gui_docking_container,
splitter_1 TYPE REF TO cl_gui_splitter_container,
splitter_2 TYPE REF TO cl_gui_splitter_container,
splitter_3 TYPE REF TO cl_gui_splitter_container,
cell_top1 TYPE REF TO cl_gui_container,
cell_bottom1 TYPE REF TO cl_gui_container,
cell_top2 TYPE REF TO cl_gui_container,
cell_bottom2 TYPE REF TO cl_gui_container,
cell_left TYPE REF TO cl_gui_container,
cell_middle TYPE REF TO cl_gui_container,
cell_right TYPE REF TO cl_gui_container,
grid1 TYPE REF TO cl_gui_alv_grid,
grid2 TYPE REF TO cl_gui_alv_grid,
grid3 TYPE REF TO cl_gui_alv_grid,
grid4 TYPE REF TO cl_gui_alv_grid,
grid5 TYPE REF TO cl_gui_alv_grid.
DATA: li_fieldcat1 TYPE lvc_t_fcat,
li_fieldcat2 TYPE lvc_t_fcat,
li_fieldcat3 TYPE lvc_t_fcat,
li_fieldcat4 TYPE lvc_t_fcat,
li_fieldcat5 TYPE lvc_t_fcat,
lv_layout TYPE lvc_s_layo,
lv_variant TYPE disvariant.
TYPES:BEGIN OF gty_itab1,
vbeln TYPE vbak-vbeln,
kunnr TYPE vbak-kunnr,
erdat TYPE vbak-erdat,
END OF gty_itab1.
TYPES:BEGIN OF gty_itab2,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
kwmeng TYPE vbap-kwmeng,
netwr TYPE vbap-netwr,
END OF gty_itab2.
TYPES:BEGIN OF gty_itab3,
vbeln TYPE likp-vbeln,
ernam TYPE likp-ernam,
erzet TYPE likp-erzet,
posnr TYPE lips-posnr,
matnr TYPE lips-matnr,
END OF gty_itab3.
TYPES:BEGIN OF gty_itab4,
vbeln TYPE vbrk-vbeln,
fkart TYPE vbrk-fkart,
posnr TYPE vbrp-posnr,
fkimg TYPE vbrp-fkimg,
END OF gty_itab4.
TYPES:BEGIN OF gty_itab5,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
name2 TYPE kna1-name2,
END OF gty_itab5.
DATA:gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
gwa_itab1 TYPE gty_itab1.
DATA:gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
gwa_itab2 TYPE gty_itab2.
DATA:gt_itab3 TYPE STANDARD TABLE OF gty_itab3,
gwa_itab3 TYPE gty_itab3.
DATA:gt_itab4 TYPE STANDARD TABLE OF gty_itab4,
gwa_itab4 TYPE gty_itab4.
DATA:gt_itab5 TYPE STANDARD TABLE OF gty_itab5,
gwa_itab5 TYPE gty_itab5.
Global data
DATA: gt_fieldcat TYPE STANDARD TABLE OF lvc_s_fcat,
gwa_fieldcat LIKE LINE OF gt_fieldcat.
Macro to fill field catalog
DEFINE m_fill_field_catalog.
gwa_fieldcat-tabname = &1.
gwa_fieldcat-fieldname = &2.
gwa_fieldcat-scrtext_s = &3.
gwa_fieldcat-scrtext_l = &4.
Append field catalog details to field catalog internal table
append gwa_fieldcat to gt_fieldcat.
END-OF-DEFINITION.
*selection screen for selecting range of values
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln. " OBLIGATORY. " OBLIGATORY
SELECTION-SCREEN END OF BLOCK b1.
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender. " sending control, i.e. ALV grid that raised event
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
*DEFINE LOCAL DATA.
*DISTINGUISH ACCORDING TO SENDING GRID INSTANCE
CASE sender.
WHEN grid1.
READ TABLE gt_itab1 INTO gwa_itab1 INDEX e_row-index.
CHECK ( gwa_itab1-vbeln IS NOT INITIAL ).
CALL METHOD grid1->set_current_cell_via_id
EXPORTING
is_row_no = es_row_no.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'ORDER_DETAILS'.
WHEN grid2.
READ TABLE gt_itab2 INTO gwa_itab2 INDEX e_row-index.
CHECK ( gwa_itab2-vbeln IS NOT INITIAL ).
CALL METHOD grid2->set_current_cell_via_id
EXPORTING
is_row_no = es_row_no.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'DELIVERY_DETAILS'.
WHEN grid3.
READ TABLE gt_itab3 INTO gwa_itab3 INDEX e_row-index.
CHECK ( gwa_itab3-vbeln IS NOT INITIAL ).
CALL METHOD grid3->set_current_cell_via_id
EXPORTING
is_row_no = es_row_no.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'BILLING_DETAILS'.
WHEN grid4.
READ TABLE gt_itab4 INTO gwa_itab4 INDEX e_row-index.
CHECK ( gwa_itab4-vbeln IS NOT INITIAL ).
CALL METHOD grid4->set_current_cell_via_id
EXPORTING
is_row_no = es_row_no.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'BILLING_DETAILS'.
WHEN grid5.
READ TABLE gt_itab5 INTO gwa_itab5 INDEX e_row-index.
CHECK ( gwa_itab5-kunnr IS NOT INITIAL ).
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT vbeln kunnr erdat FROM vbak INTO TABLE gt_itab1
WHERE vbeln IN s_vbeln.
creating docking container
CREATE OBJECT docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc EQ 0.
ENDIF.
Create splitter container
CREATE OBJECT splitter_1
EXPORTING
parent = docking
rows = 1
columns = 3
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
ENDIF.
Get cell container
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cell_left.
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = cell_middle.
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 3
RECEIVING
container = cell_right.
Create 2nd splitter container
CREATE OBJECT splitter_2
EXPORTING
parent = cell_left
rows = 2
columns = 1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
ENDIF.
Get cell container
CALL METHOD splitter_2->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cell_top1.
CALL METHOD splitter_2->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = cell_bottom1.
Create 3rd splitter container
CREATE OBJECT splitter_3
EXPORTING
parent = cell_middle
rows = 2
columns = 1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
ENDIF.
Get cell container
CALL METHOD splitter_3->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cell_top2.
CALL METHOD splitter_3->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = cell_bottom2.
Create ALV grids
CREATE OBJECT grid1
EXPORTING
i_parent = cell_top1
EXCEPTIONS
OTHERS = 5.
IF sy-subrc EQ 0.
ENDIF.
CREATE OBJECT grid2
EXPORTING
i_parent = cell_bottom1
EXCEPTIONS
OTHERS = 5.
IF sy-subrc EQ 0.
ENDIF.
CREATE OBJECT grid3
EXPORTING
i_parent = cell_top2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc EQ 0.
ENDIF.
CREATE OBJECT grid4
EXPORTING
i_parent = cell_bottom2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc EQ 0.
ENDIF.
CREATE OBJECT grid5
EXPORTING
i_parent = cell_right
EXCEPTIONS
OTHERS = 5.
IF sy-subrc EQ 0.
ENDIF.
Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid1.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid2.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid3.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid4.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid5.
lv_layout-zebra = 'X'.
lv_layout-cwidth_opt = 'X'.
lv_variant = 'ZAREPAS22'.
Display data
PERFORM prepare_alv_fieldcat1 CHANGING li_fieldcat1.
*commented lines i suppose to include here....
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_variant = lv_variant
i_save = 'A'
i_default = space
is_layout = lv_layout
CHANGING
it_outtab = gt_itab1
it_fieldcatalog = li_fieldcat1
EXCEPTIONS
OTHERS = 4.
PERFORM prepare_alv_fieldcat2 CHANGING li_fieldcat2.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
is_variant = lv_variant
i_save = 'A'
i_default = space
is_layout = lv_layout
CHANGING
it_outtab = gt_itab2
it_fieldcatalog = li_fieldcat2
EXCEPTIONS
OTHERS = 4.
PERFORM prepare_alv_fieldcat3 CHANGING li_fieldcat3.
CALL METHOD grid3->set_table_for_first_display
EXPORTING
is_variant = lv_variant
i_save = 'A'
i_default = space
is_layout = lv_layout
CHANGING
it_outtab = gt_itab3
it_fieldcatalog = li_fieldcat3
EXCEPTIONS
OTHERS = 4.
PERFORM prepare_alv_fieldcat4 CHANGING li_fieldcat4.
CALL METHOD grid4->set_table_for_first_display
EXPORTING
is_variant = lv_variant
i_save = 'A'
i_default = space
is_layout = lv_layout
CHANGING
it_outtab = gt_itab4
it_fieldcatalog = li_fieldcat4
EXCEPTIONS
OTHERS = 4.
PERFORM prepare_alv_fieldcat5 CHANGING li_fieldcat5.
CALL METHOD grid5->set_table_for_first_display
EXPORTING
is_variant = lv_variant
i_save = 'A'
i_default = space
is_layout = lv_layout
CHANGING
it_outtab = gt_itab5
it_fieldcatalog = li_fieldcat5
EXCEPTIONS
OTHERS = 4.
Link the docking container to the target dynpro
CALL METHOD docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
EXCEPTIONS
OTHERS = 4.
IF sy-subrc EQ 0.
ENDIF.
NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
SET TITLEBAR 'xxx'.
Refresh display of detail ALV list
CALL METHOD grid2->refresh_table_display
EXCEPTIONS
OTHERS = 2.
IF sy-subrc EQ 0.
ENDIF.
Refresh display of detail ALV list
CALL METHOD grid3->refresh_table_display
EXCEPTIONS
OTHERS = 2.
IF sy-subrc EQ 0.
ENDIF.
Refresh display of detail ALV list
CALL METHOD grid4->refresh_table_display
EXCEPTIONS
OTHERS = 2.
IF sy-subrc EQ 0.
ENDIF.
Refresh display of detail ALV list
CALL METHOD grid5->refresh_table_display
EXCEPTIONS
OTHERS = 2.
IF sy-subrc EQ 0.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR
'EXIT' OR
'CANCEL'.
SET SCREEN 0.LEAVE SCREEN.
USER HAS PUSHED BUTTON "DISPLAY OREDERS"
WHEN 'ORDER_DETAILS'.
PERFORM order_show_details.
WHEN 'DELIVERY_DETAILS'.
PERFORM delivery_show_details.
WHEN 'BILLING_DETAILS'.
PERFORM billing_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR : ok_code.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ORDER_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM order_show_details .
define local data
DATA:
ld_row TYPE i,
gwa_itab1 TYPE vbak.
CALL METHOD grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_itab1 INTO gwa_itab1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT kunnr name1 name2 FROM kna1 INTO TABLE gt_itab5
WHERE kunnr = gwa_itab1-kunnr.
SELECT vbeln posnr matnr kwmeng netwr FROM vbap INTO TABLE gt_itab2
WHERE vbeln = gwa_itab1-vbeln.
*REFRESH: gt_LIPS.
ENDFORM. " ORDER_SHOW_DETAILS
*& Form DELIVERY_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM delivery_show_details .
define local data
DATA:
ld_row TYPE i.
gwa_itab2 TYPE vbap.
CALL METHOD grid2->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_itab2 INTO gwa_itab2 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT SINGLE * FROM vbfa WHERE vbelv = gwa_itab2-vbeln
AND vbtyp_n = 'J'.
SELECT posnr matnr FROM lips INTO TABLE gt_itab3
WHERE vbeln = vbfa-vbeln
AND vgpos = gwa_itab2-posnr.
*REFRESH: gt_LIPS.
ENDFORM. " DELIVERY_SHOW_DETAILS
*& Form BILLING_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM billing_show_details .
define local data
DATA:
ld_row TYPE i.
gwa_itab3 TYPE lips.
CALL METHOD grid3->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_itab3 INTO gwa_itab3 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT SINGLE * FROM vbfa WHERE vbelv = gwa_itab3-vbeln
AND vbtyp_n = 'M'.
SELECT posnr fkimg FROM vbrp INTO TABLE gt_itab4
WHERE vbeln = vbfa-vbeln
AND vgpos = gwa_itab3-posnr.
ENDFORM. " BILLING_SHOW_DETAILS
*& Form prepare_alv_fieldcat
FORM prepare_alv_fieldcat1 CHANGING lpi_fieldcat1 TYPE lvc_t_fcat.
m_fill_field_catalog 'GTY_ITAB1' 'VBELN' 'Ord Num'(004) 'Order Number'(005).
m_fill_field_catalog 'GTY_ITAB1' 'kunnr' 'sold party'(006) 'SOLD TO PARTY'(007).
m_fill_field_catalog 'GTY_ITAB1' 'ERDAT' 'Ord Date'(008) 'Order Date'(009).
lpi_fieldcat1[] = gt_fieldcat[].
REFRESH gt_fieldcat.
ENDFORM. "prepare_alv_fieldcat1
*& Form prepare_alv_fieldcat
text
-->LPI_FIELDCAT text
FORM prepare_alv_fieldcat2 CHANGING lpi_fieldcat2 TYPE lvc_t_fcat.
m_fill_field_catalog 'GTY_ITAB2' 'vbeln' 'sales Doc'(010) 'sales document'(011).
m_fill_field_catalog 'GTY_ITAB2' 'POSNR' 'sales Doc'(012) 'sales documentITEM'(013).
m_fill_field_catalog 'GTY_ITAB2' 'matnr' 'Mat num'(014) 'material number'(015).
m_fill_field_catalog 'GTY_ITAB2' 'kwmeng' '*** ord qty'(016) 'cumilative order qty'(017).
m_fill_field_catalog 'GTY_ITAB2' 'netwr' 'nwt val'(018) 'net val of item'(019).
lpi_fieldcat2[] = gt_fieldcat[].
REFRESH gt_fieldcat.
ENDFORM. "prepare_alv_fieldcat2
*& Form prepare_alv_fieldcat
text
-->LPI_FIELDCAT text
FORM prepare_alv_fieldcat3 CHANGING lpi_fieldcat3 TYPE lvc_t_fcat.
m_fill_field_catalog 'GTY_ITAB3' 'posnr' 'del item'(020) 'delivery item'(021).
m_fill_field_catalog 'GTY_ITAB3' 'matnr' 'mat num'(022) 'material number'(023).
lpi_fieldcat3[] = gt_fieldcat[].
REFRESH gt_fieldcat.
ENDFORM. "prepare_alv_fieldcat3
*& Form prepare_alv_fieldcat
text
-->LPI_FIELDCAT text
FORM prepare_alv_fieldcat4 CHANGING lpi_fieldcat4 TYPE lvc_t_fcat.
m_fill_field_catalog 'GTY_ITAB4' 'posnr' 'bill item'(024) 'billing item'(025).
m_fill_field_catalog 'GTY_ITAB4' 'fkimg' 'act inv'(026) 'actuval inv qty'(028).
lpi_fieldcat4[] = gt_fieldcat[].
REFRESH gt_fieldcat.
ENDFORM. "prepare_alv_fieldcat4
*& Form prepare_alv_fieldcat
text
-->LPI_FIELDCAT text
FORM prepare_alv_fieldcat5 CHANGING lpi_fieldcat5 TYPE lvc_t_fcat.
m_fill_field_catalog 'GTY_ITAB5' 'kunnr' 'cust no'(029) 'cust number'(030).
m_fill_field_catalog 'GTY_ITAB5' 'name1' 'name1'(031) 'name1'(032).
m_fill_field_catalog 'GTY_ITAB5' 'name2' 'name2'(033) 'name2'(034).
lpi_fieldcat5[] = gt_fieldcat[].
REFRESH gt_fieldcat.
ENDFORM. "prepare_alv_fieldcat5
*appending
*FORM append_catalog1 USING value(p_fname)
value(p_tname)
value(p_coltext).
DATA : v_fcat TYPE lvc_s_fcat.
v_fcat-fieldname = p_fname.
v_fcat-ref_table = p_tname.
v_fcat-coltext = p_coltext.
APPEND v_fcat TO li_fieldcat1.
*ENDFORM. "append_catalogHi Srinivas,
What is the Report Requirement,
What is the Error Message u r getting. -
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 -
FBV0 transaction error messages in ALV screen
hi all,
In transaction FBV0 the error messages are coming in a completely seperate page. Even the success message with document number that used to come up at bottom of screen or Information box is also coming on the next ALV screen. How can I get rid of showing a complete new ALV screen with messages. It has happened after ECC6 upgrade.
Thanks,
FSHello,
See if this is coming for a single user or all the users.
If this is for a single user you can see FB00 to check user settings.
If this is happening with all the users, contact your basis administrator.
Regards,
Ravi -
Handling error messages in OOPs ALV
The question below is foolish.But I am a beginner so please excuse.
I have successfully displayed an OOPs ALV which displays the material, batch and plant.
A custom toolbar button(delete batches) has been appended to the standard toolbar.
Now when I do not select any rows from the ALV and click the button(delete batches) I have ensured that an error message flahes at the bottom of the screen.
If I repeat the same procedure without coming out of the program it exits from the program itself. i want to avoid this.
I want to flash the error message continually without coming out of the program till the user commits the mistake. Please note that I have not used any leave screen commands etc.
Can someone please help me..
Thanks in advanceI assume you have the ON TOOLBAR event regiistered and the ENTER event for example.
method constructor .
create object grid_container1
exporting
* container_name = 'CCONTAINER1'.
container_name = cfname.
create object grid1
exporting
i_parent = grid_container1.
set handler z_object->on_user_command for grid1.
set handler z_object->on_toolbar for grid1.
set handler z_object->handle_data_changed for grid1.
set handler z_object->handle_data_changed_finished for grid1.
set handler z_object->on_dubbelklik for grid1.
set handler z_object->on_hotspot for grid1.
call method grid1->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
endmethod.
So the easy way to do this is in your ON USER COMMAND routine when you can check to see if you selected any rows and the issue a popup warnimg message with the standard SAP MESSAGE statement.
For example in my TEST function here I call a method to get the selected cell.
If none are selected you can then issue your message and you will then be returned back to your GRID display after the user presses the OK button on the message popup.
the grid1 object refers to the class cl_gui_alv_grid.
in your case call a method that gets selected cells rather than selected cell. Use the standard method in cl_gui_alv_grid.
If nothing selected then issue your message.
(Note that your method ON DATA CHANGE / ON DATA CHANGED FINISHED might also be entered as well so insure that you haven't got any coding in these methods that will interfere with processing flow).
method on_user_command .
* FOR EVENT before_user_command OF cl_gui_alv_grid
* IMPORTING
* e_ucomm
* sender
case e_ucomm.
when 'EXIT'.
leave program.
when 'EXCEL'.
call method me->download_to_excel.
when 'SAVE'.
when 'PROC'.
call method me->process.
when 'REFR'.
call method me->refresh.
when 'SWITCH'.
call method me->switch.
when 'TEST'.
call method me->get_cell.
endcase.
method get_cell .
break-point 1.
call method grid1->get_current_cell
importing
e_row = ls_row
e_value = ls_value
e_col = ls_col
es_row_id = ls_row_id
es_col_id = ls_col_id
es_row_no = ls_row_no.
endmethod.
cheers
jimbo -
Prob. while using error message in OOPS ALV
Friends,
I have developed an OOPS ALV to display the records with cost field as editable. And the cost should not accept decimals values, if the user enter the same (12.56) and click the save button (user-defined) then need to populate the error message. I am populating the error message, then the user change the value (12) and click the save, then in the ALV screen the chanegd value 12 is automatically back to prv. one 12.56 and the same error messgae is displaying.
If i change the message type from Error to Info, then its working fine... but the client wants only error message. So anybody came across the same scenario? if yes.. pls share the solution..
Ganesh CHi,
In this case, after the error message issued though the value is corrected , corrected data is not transferred to progarm.
Program still works with old data. Check how you are issuing message and how you refereshing the table after user inputs.
you can check program BCALV_EDIT_03 for vlidating fileds.
I believe you can simply refer a data element which does not accepts decimal values.
Regards,
Ravi. -
Error Messages popup in editable ALV
Hello All,
Iam working on Editable ALV as a table maintainance for a Ztable and usng OOPs for that.
Lets say i have material and plant fields for editing in ALV.
If the user enters some junk value in the material field, its automatically getting validated and giving an error message with a popup.
my question is, is there any way we can restrict this popup messages with error and have our own messages insted ?
Appriciate your help in this.
Thanks.check out this thread, where the poster wanted to append custom messages to the standard SAP messages... check otu the refresh_protocol method to see if you can clear out pre-existing SAP messages...
Re: editable alv: add custom validation and display "errors" in protocol li -
Is there a list of what specific error messages mean that are returned from ALV function calls. I have the following code that has data in the IMAT table but the 'REUSE_ALV_LIST_DISPLAY' returns a 1 error code.
REPORT Z_ALVGRID_INTERNAL.
tables:
pa0001, zhr_adweather.
types: begin of ts_imat ,
orgeh like PA0001-ORGEH,
ename like PA0001-ENAME,
pernr like PA0001-PERNR,
wapernr like zhr_adweather-pernr,
wa_date_taken like zhr_adweather-date_taken,
wa_hours_taken like zhr_adweather-hours_taken,
wa_expire_date like zhr_adweather-expire_date,
wa_makeup_date like zhr_adweather-makeup_date,
wa_makeup_hours like zhr_adweather-makeup_hours,
wa_results like zhr_adweather-results,
end of ts_imat.
Data:
imat type table of ts_imat, " internal table
gs_imat type ts_imat. " work area for the table
data:
gs_zhr_adweather type zhr_adweather,
gs_pernr like pa0001-pernr,
gs_orgeh like pa0001-orgeh,
gs_ename like pa0001-ename.
data i_repid like sy-repid.
data i_lines like sy-tabix.
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
start-of-selection.
select single pernr orgeh ename from pa0001
into (gs_imat-pernr, gs_imat-orgeh, gs_imat-ename)
where pernr = '00000053'.
select single * from zhr_adweather
into gs_zhr_adweather
where pernr = '00000053'.
if sy-subrc = 0.
gs_imat-wapernr = gs_zhr_adweather-pernr.
gs_imat-wa_date_taken = gs_zhr_adweather-date_taken.
gs_imat-wa_hours_taken = gs_zhr_adweather-hours_taken.
gs_imat-wa_expire_date = gs_zhr_adweather-expire_date.
gs_imat-wa_makeup_date = gs_zhr_adweather-makeup_date.
gs_imat-wa_makeup_hours = gs_zhr_adweather-makeup_hours.
gs_imat-wa_results = gs_zhr_adweather-results.
endif.
append gs_imat to imat.
clear i_lines.
describe table imat lines i_lines.
if i_lines lt 1.
write: /
'No materials found.'.
exit.
endif.
end-of-selection.
i_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = i_repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
I_CALLBACK_PROGRAM = i_repid
IT_FIELDCAT = int_fcat
I_SAVE = 'A'
TABLES
T_OUTTAB = IMAT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.I was able to get it working by moving values to int_fcat.
(see FORM BUILD_FIELDCATA .)
REPORT Z_ESP_ALVGRID_INTERNAL.
tables:
pa0001, zhr_adweather.
types: begin of ts_imat ,
orgeh like PA0001-ORGEH,
ename like PA0001-ENAME,
pernr like PA0001-PERNR,
wapernr like zhr_adweather-pernr,
wa_date_taken like zhr_adweather-date_taken,
wa_hours_taken like zhr_adweather-hours_taken,
wa_expire_date like zhr_adweather-expire_date,
wa_makeup_date like zhr_adweather-makeup_date,
wa_makeup_hours like zhr_adweather-makeup_hours,
wa_results like zhr_adweather-results,
wa_outstanding like zhr_adweather-hours_taken,
end of ts_imat.
Data:
imat type standard table of ts_imat, " internal table
gs_imat type ts_imat. " work area for the table
data:
gs_zhr_adweather type zhr_adweather,
gs_pernr like pa0001-pernr,
gs_orgeh like pa0001-orgeh,
gs_ename like pa0001-ename.
data i_repid like sy-repid.
data i_lines like sy-tabix.
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV with header line.
start-of-selection.
SELECT-OPTIONS:
S_PERNR FOR gs_pernr.
select single pernr orgeh ename from pa0001
into (gs_imat-pernr, gs_imat-orgeh, gs_imat-ename)
where pernr = s_PERNR.
if sy-subrc = 0.
endif.
select single * from zhr_adweather
into gs_zhr_adweather
where pernr = s_PERNR.
if sy-subrc = 0.
gs_imat-wapernr = gs_zhr_adweather-pernr.
gs_imat-wa_date_taken = gs_zhr_adweather-date_taken.
gs_imat-wa_hours_taken = gs_zhr_adweather-hours_taken.
gs_imat-wa_expire_date = gs_zhr_adweather-expire_date.
gs_imat-wa_makeup_date = gs_zhr_adweather-makeup_date.
gs_imat-wa_makeup_hours = gs_zhr_adweather-makeup_hours.
gs_imat-wa_results = gs_zhr_adweather-results.
gs_imat-wa_outstanding = gs_zhr_adweather-hours_taken - gs_zhr_adweather-makeup_hours.
endif.
append gs_imat to imat.
clear i_lines.
describe table imat lines i_lines.
if i_lines lt 1.
write: /
'No materials found.'.
exit.
endif.
end-of-selection.
perform build_fieldcata.
i_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
IT_FIELDCAT = int_fcat[]
TABLES
T_OUTTAB = IMAT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
write: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.
*& Form BUILD_FIELDCATA
text
--> p1 text
<-- p2 text
FORM BUILD_FIELDCATA .
clear int_fcat.
int_fcat-fieldname = 'ORGEH'.
int_fcat-seltext_l = 'ORGANIZATIONAL UNIT'.
int_fcat-col_pos = 1.
append int_fcat.
clear int_fcat.
int_fcat-fieldname = 'ENAME'.
int_fcat-seltext_l = 'EMPLOYEE NAME'.
int_fcat-col_pos = 2.
append int_fcat.
clear int_fcat.
int_fcat-fieldname = 'PERNR'.
int_fcat-seltext_l = 'PERSONNEL NUMBER'.
int_fcat-col_pos = 3.
append int_fcat.
clear int_fcat.
int_fcat-fieldname = 'WAPERNR'.
int_fcat-seltext_l = 'Z-PERNR'.
int_fcat-col_pos = 4.
append int_fcat.
clear int_fcat.
int_fcat-fieldname = 'WA_HOURS_TAKEN'.
int_fcat-seltext_l = 'HOURS TAKEN'.
int_fcat-col_pos = 6.
append int_fcat.
clear int_fcat.
int_fcat-fieldname = 'WA_DATE_TAKEN'.
int_fcat-seltext_l = 'DATE OF AW LEAVE TAKEN'.
int_fcat-col_pos = 5.
append int_fcat.
clear int_fcat.
int_fcat-fieldname = 'WA_EXPIRE_DATE'.
int_fcat-seltext_l = 'EXPIRATION DATE'.
int_fcat-col_pos = 7.
append int_fcat.
clear int_fcat.
int_fcat-fieldname = 'WA_MAKEUP_DATE'.
int_fcat-seltext_l = 'DATE OF AW MAKEUP'.
int_fcat-col_pos = 8.
append int_fcat.
clear int_fcat.
int_fcat-fieldname = 'WA_MAKEUP_HOURS'.
int_fcat-seltext_l = 'HOURS OF AW MAKEUP'.
int_fcat-col_pos = 9.
append int_fcat.
clear int_fcat.
int_fcat-fieldname = 'WA_OUTSTANDING'.
int_fcat-seltext_l = 'OUTSTANDING BALANCE'.
int_fcat-col_pos = 10.
append int_fcat.
clear int_fcat.
int_fcat-fieldname = 'WA_RESULTS'.
int_fcat-seltext_l = 'EXPIRED LEAVE RESULTS'.
int_fcat-col_pos = 11.
append int_fcat.
ENDFORM. -
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.
Maybe you are looking for
-
Is it possible to circumvent read-only after a pdf has been signed?
Hi, my pdf has a signature field. In the signed event I have make all fields read-only. Is it possible for someone to come along and make them not read-only anymore? It seems the easiest way to make my document tamper-proof. Thank you.
-
Outlook 2011 for MAC keeps asking for password
Outlook for MAC 2011 keeps asking me for google password. It wont accept what i put in. The password is correct along with name because it works when I enter it in google. I recently updated password. Need help in fixing or finding problem. Error
-
Oracle Database Express Edition 10g Download Issue
Hi everyone. I just downloaded the freeware Oracle Database Express Edition without any apparent problems. However, when I attempt to go to the Express Edition Homepage, which is location http://127.0.0.1:8080/apex, I get the message that my Internet
-
Hi Friends, We are some business scenario such like for a Purchase order with 20 line items and each line item is have say 100 pcs of quantity. During GR we have to make GR for each pcs as separate item with individual batch number hence for complete
-
SAP Treasury - GL account display
Hi Treasury Experts I made postings to Fixed term deposit in Money market and settled the contract and posted in using TBB1 when i have checked posting log i am able to see transactoin number and GL accounts when i checked GL account balances the lat