ALV GRID on EP problem.
ALV GRID report with predefined layout with intermediate sum for one column - when placed on portal displays without sum/detail icon (not possible go to detail view).
Does anyone know, how to solve this ?
Thank You.
Hi Dmytro,
I'm experiencing the same problem you just described.
Did you find a way to solve this?
Kind regards,
Simone
Similar Messages
-
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 -
ALV Grid - Display/change Problem
Hi Guys,
I have a peculiar problem. I have developed a Module pool application containing two screens. In the first screen I have a input field and 2 buttons for display and change. When I enter the value and press Displaythe second screen is called which shows an ALV grid in the respective display mode. But If I come back and press change I could not get the change mode for the ALV grid still it remains in the Display mode. Again if rerun the transaction and press change it shows the ALV grid in change mode but if we press back and choose display then it is not getting changed still remains as such. In all at the first run what ever the mode is chosen it remains stationery. I am using OOALV and i have tried flushing the container, grid and also refreshing the ALV. But could not trace the problem. If you guys have worked or can put some inputs please reply back.
Jagath.Please find the attached code...
from the first screen 100 i am assigning the flag w_display or w_change based on the okcode. in the second screen 200 PBO i have the following code:
MODULE status_0200 OUTPUT.
SET PF-STATUS 'STAT200'.
SET TITLEBAR 'TIT200'.
if w_display eq 'X'.
perform grid_display.
else.
perform grid_change.
endif.
ENDMODULE. " STATUS_0200 OUTPUT
Now in perform display I have the following code:
form grid_display .
Set the Fieldcatalog.
REFRESH t_fieldcat.
PERFORM get_field_catalog.
set the Layout.
CLEAR wa_layout.
wa_layout-cwidth_opt = 'X'.
wa_layout-stylefname = 'CELLTAB'.
set the Variant
w_variant-report = sy-repid.
Create the Instance for container
IF lcl_custom_disp IS INITIAL.
CREATE OBJECT lcl_custom_disp
EXPORTING
PARENT =
container_name = 'CONTAINER1'
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 the object for ALV grid
CREATE OBJECT lcl_grid_disp
EXPORTING
i_parent = lcl_custom_disp
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.
Create the object for events
CREATE OBJECT lcl_events.
SET HANDLER lcl_events->handle_top_of_list FOR lcl_grid_disp.
Display the ALV.
CALL METHOD lcl_grid_disp->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = ' '
is_layout = wa_layout
CHANGING
it_outtab = t_final[]
it_fieldcatalog = t_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
Refresh the ALV grid
CALL METHOD lcl_grid_disp->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
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.
ENDIF.
endform. " grid_display
In the perform change the same code is followed for different object with the fieldcatalog is changed to edit based on flag.
Set the Fieldcatalog.
REFRESH t_fieldcat.
PERFORM get_field_catalog.
set the Layout.
CLEAR wa_layout.
wa_layout-cwidth_opt = 'X'.
wa_layout-stylefname = 'CELLTAB'.
set the Variant
w_variant-report = sy-repid.
Create the Instance for container
IF lcl_custom_chng IS INITIAL.
CREATE OBJECT lcl_custom_chng
EXPORTING
PARENT =
container_name = 'CONTAINER1'
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 the object for ALV grid
CREATE OBJECT lcl_grid_chng
EXPORTING
i_parent = lcl_custom_chng
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.
Create the object for events
CREATE OBJECT lcl_events.
SET HANDLER lcl_events->handle_top_of_list FOR lcl_grid_chng.
SET HANDLER lcl_events->handle_data_changed FOR lcl_grid_chng.
SET HANDLER lcl_events->handle_data_changed_finished FOR lcl_grid_chng.
Display the ALV.
CALL METHOD lcl_grid_chng->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = ' '
is_layout = wa_layout
CHANGING
it_outtab = t_final[]
it_fieldcatalog = t_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
Refresh the ALV grid
CALL METHOD lcl_grid_chng->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
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.
ENDIF.
Please let me know if you require some more inputs?
Jagath -
Alv Grid ctrl + y problem
hi all, I have a problem with an editable alv grid, if I copy multiple lines with ctrl + y and paste them in the last line the program creates new rows...but i don't want the creation of new rows.
Any suggestion?
Many thanks,
LucaSo how do you see it? You want to fit couple rows in one empty line? It's not too logical, is it? Ensure you have enough number of rows below the line you are trying to paste your copied lines. So if you copy 3 lines, you will have to start pasting from 3rd line from the bottom at most (not below that one).
Regards
Marcin -
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® -
ALV Grid Report spool problem with column with no data
Hello All,
I have created a simple alv grid report the report has a description field of 40 ch for which I have made the display length as 20 ch . This works fine in the foreground but when I run the report in background when there is no data in this column this being overwritten with the next column. Which is causing a mismatch between the header and the data below it.
Also when I try to download the report in foreground into excel the columns are not matching with the headers this again happens for columns when there is no data.
Kindly please suggest what is going wrong.
Thanks,
ranjanHi,
For checking the output from background job, check the job and enter JDBG in the command bar and execute.
Check the field catalog and the table contents in debugging just before display.
Edited by: Jayanthi Jayaraman on Dec 2, 2010 4:09 AM -
Problems with ALV grid refresh
Hello,
I am writing a relatively simple wd application, I enter a few values in the select-options and display the data in an ALV grid. My problem seems to be that the grid values do not refresh if I change the selection conditions.
On going through the forum I saw a few posts which ask me to call the Node->Invalidate( ) method, but on using that my grid refreshes completely and data does not appear again, even on changing the input values.
I have pasted the ALV portion of the code from my onAction method - could you suggest what I could do to correct this? I realise this is a relatively stupid question, but I am very new to this technology and am trying to learn. Thanks in advance.
***Database selection (this works fine, tested in debug)
Bind the data to the context
dyn_node = wd_context->get_child_node( name = 'TIME_ENTRY' ).
dyn_node->bind_table( icatsdb ).
Connect to the component Usage of the ALV
l_ref_cmp_usage = wd_this->wd_cpuse_display_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
Through the interface controller of the ALV Component set the DATA node dynamically
l_ref_interfacecontroller = wd_this->wd_cpifc_display_alv( ).
l_ref_interfacecontroller->set_data( r_node_data = dyn_node ).
SudhaHi,
Did you change the statement <b>SET PF-STATUS 'ZIMP'</b> to <b>SET PF-STATUS 'ZLIQ'</b> ? If not, please do that, and run the program after activation.
Reward points if the asnwer is helpful.
Regards,
Mukul -
ALV Grid Problem - User command Back Cancel Exit
Hi Guys,
I was trying to use the ALV grid and my problem is, on the grid display, when i try to hit the back button or exit or cancel, then a blank screen appears and i need to hit either back or other buttons one more time to go back to the selection screen.
Is there any thing I am missing here? Please suggest me the solution.
Thanks in advance,
Srinivas.hi srinivas,
we have 2 options in this case.
1) i think ur using EVENTS_GET function module. If u use sometimes we are facing this kind of problem. i think accroding to my knowliege its bug in SAP....
2) See in debug mode what is the user command for this back button everty time USERCOMMAND FOR BACK BUTTON not 'BACK' .If it ios correct plaese add the code for back button in user command event.
if u dont want to face that problem remove that events_get fm and write the code manually. i am not sure abt ur code.
i hope u got the point what i am saying.
Thanks,
Maheedhar -
How to Enable Export button on toolbar of alv grid??
Hi guys,
I display my data in Alv grid format,
The problem is that in the standard toolbar of the alv i can't find the standard button for Exporting in spreadsheet & when i try
to get it from the menu it's disabled along with all the Export functionalities..how can i solve this problem?
Thanks in advance,
Regards,Yes sure there it is:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_top_of_page = 'TOP_OF_PAGE'
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = 'STANDARD_FULLSCREEN'
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_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 =
IT_FIELDCAT = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = itab
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.
P.S: I tried copying standard status of program saplkkbl into my program then specified its name which is 'STANDARD_FULLSCREEN' inside my function call parameters ..but the toolbar now is completely disabled with no standard
icons whatsoever!.what shall i do?
Thanks -
Display 2 rows per entry with ALV Grid
Hi Experts,
I need to display the results of a report with ALV Grid. The Problem is: I need to display the resultdata (some numbers etc..) in one row and then add a second row with the longtext.
The ALV should look somthing like this:
resultdata1 resultdata2 resultdata3
longtext1
resultdata1 resultdata2 resultdata3
longtext1
resultdata1 resultdata2 resultdata3
longtext1
Can anyone of you give me hint on how to do that?
(The row_pos and col_pos ind the fieldcat do not do the trick )
Thanx
Felixhi ,
You can do this
resultdata1 resultdata2 resultdata3
longtext1
resultdata1 resultdata2 resultdata3
longtext1
resultdata1 resultdata2 resultdata3
longtext1
Create two internal table .
one for : resultdata1 resultdata2 resultdata3
second for longtext1
see that both tables have matching primary key .
then can match the data and append in another third table .
regards
Deepak. -
Displaying amounts in ALV grid
hi,
iam fetching ESBTR from FEBKO which i have to display using ALV grid.
but the problem is when there is no value in that field it should display zeros 0.00
but it is displaying space.
can somebody help me in this.
nehahi,
I tried using no_zero property also .Iam sending the sample code . please check it.
*& Report ZTEST17 *
REPORT ZTEST17 .
type-pools: slis.
types: begin of x_tab1,
bukrs type bukrs,
hbkid type hbkid,
hktid type hktid,
bankn type bankn,
waers type waers,
hkont type hkont,
ESBTR type ESBTR_EB,
AZDAT type AZDAT_EB,
end of x_tab1,
begin of x_tab2,
KUKEY type KUKEY_EB,
ESBTR type ESBTR_EB,
AZDAT type AZDAT_EB,
waers type waers,
end of x_tab2.
data: t_tab1 type standard table of x_tab1,
w_tab1 type x_tAb1,
t_tab2 type standard table of x_tab2,
w_tab2 type x_tab2.
data: g_bukrs type bukrs,
g_hbkid type hbkid,
g_hktid type hktid,
g_kukey type KUKEY_EB.
DATA: afield TYPE slis_fieldcat_alv,
t_fieldcat TYPE slis_t_fieldcat_alv.
data: l_tabix type sy-tabix.
select-options: s_bukrs for g_bukrs,
s_hbkid for g_hbkid,
s_hktid for g_hktid,
s_kukey for g_kukey.
SELECT bukrs hbkid hktid bankn waers hkont
INTO CORRESPONDING FIELDS OF TABLe t_tab1
FROM t012k
WHERE bukrs IN s_bukrs
AND hbkid IN s_hbkid
AND hktid IN s_hktid.
LOOP AT T_TAB1 into w_tab1.
l_tabix = sy-tabix.
SELECT kukey esbtr azdat waers
INTO TABLE t_tab2
FROM febko
WHERE anwnd = '0001'
AND hkont = w_tab1-hkont
AND bukrs = w_tab1-bukrs
AND kukey IN s_kukey.
SORT t_tab2 BY kukey DESCENDING.
READ TABLE t_tab2 into w_tab2 INDEX 1.
if sy-subrc eq 0.
move w_tab2-esbtr TO w_tab1-esbtr .
modify t_tab1 from w_tab1 index l_tabix.
endif.
endloop.
CLEAR afield.
afield-fieldname = 'BUKRS'.
afield-ref_tabname = 'BSEG'.
afield-ref_fieldname = 'BUKRS'.
afield-col_pos = '1'.
APPEND afield TO t_fieldcat.
House Bank Account
CLEAR afield.
afield-fieldname = 'HBKID'.
afield-ref_tabname = 'T012K'.
afield-ref_fieldname = 'HBKID'.
afield-col_pos = '2'.
APPEND afield TO t_fieldcat.
House Bank Account ID
CLEAR afield.
afield-fieldname = 'HKTID'.
afield-ref_tabname = 'T012K'.
afield-ref_fieldname = 'HKTID'.
afield-col_pos = '3'.
APPEND afield TO t_fieldcat.
Bank Name
CLEAR afield.
afield-fieldname = 'BANKN'.
afield-ref_tabname = 'BNKA'.
afield-ref_fieldname = 'BANKN'.
afield-col_pos = '4'.
APPEND afield TO t_fieldcat.
Currency
CLEAR afield.
afield-fieldname = 'WAERS'.
afield-ref_tabname = 'TCURC'.
afield-ref_fieldname = 'WAERS'.
afield-col_pos = '5'.
APPEND afield TO t_fieldcat.
G/L Account
CLEAR afield.
afield-fieldname = 'HKONT'.
afield-ref_tabname = 'T012K'.
afield-ref_fieldname = 'HKONT'.
afield-col_pos = '6'.
APPEND afield TO t_fieldcat.
Bank Account Balance
CLEAR afield.
afield-fieldname = 'ESBTR'.
afield-no_zero = ' '.
afield-reptext_ddic = 'Bank Statement Balance'.
afield-just = 'L'.
afield-cfieldname = 'KRW'.
afield-ref_fieldname = 'ESBTR'.
afield-ref_tabname = 'FEBKO'.
afield-col_pos = '7'.
APPEND afield TO t_fieldcat.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = t_fieldcat
TABLES
t_outtab = t_tab1[]
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. -
Problem while alv grid display exporting to excel sheet
Hi,
I have done an ALV report using reuse_alv_grid _display , out put is fine , but when i click on excel view icon i could only see an excel sheet without any data ., but when i use export to local file and choose spread sheet its giving the data in excel, but the user wants to click only the excel view icon.
Best RegardsHi,
Check this link
[Problem with Excel button in ALV Grid...URGENT;
Regards,
Sathish Reddy. -
Urgent : Problem with Editable ALV Grid for Quantity and Currency Fields
Hi All,
I am using Editable ALV Grid display and have quantity and value as editable fields in the display.
When user changes these values these values are not changing properly .
For the quantity field the domain is MENG13 with 3 deciamal places and here if we enter 500 it takes it as 0.500 .
The same problem is for the currency field. Here the Domain is WERT7 with 3 decimal places.
Here also it takes last 2 digits after decimal places by default.
Please advice how to get proper values in this case from ALV editable fields.
Thanks and Regards
Harshad
Edited by: Harshad Rahirkar on Dec 25, 2007 7:39 AMfor all the currency field , it will display like that only.
u have to manipulate uin program before displaying.
if they are giving 500, in program multiply with 100 and move it to table.
when u are getting from table, divinde and display.
this is what I am doing.
Reward if helpfull. -
Problem While Saving the editable ALV GRID
Dear Experts,
I have a scenario in which i am display the ALV(using class) with some data in the custom container of module pool screen in the non-editable mode.Also i have save and edit buttons.If i click the edit button i have written the code to edit the some columns in the ALV grid, it is working fine.After editing it,when i click the save button then ALV has to refreshed with edited data and then it should go to non editable mode but it is not working.I have written the code for changing the editable ALv to non editable mode as follows :
call method c_alvgd->set_ready_for_input
exporting
i_ready_for_input = 0.
*****Row and column of the alv are refreshed after changing values
stable-row = 'X'.
stable-col = 'X'.
*REfreshed ALV display with the changed values
*This ALV is non editable and contains new values
call method c_alvgd->refresh_table_display
exporting
is_stable = stable
exceptions
finished = 1
others = 2.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Could you Suggest me solution for this issue ?
Thanks & Regards,
R.Dhineshraj.Dhinesh,
I suppose that you are able to get your changes values on screen but not able to get your field in DISPLAY mode from editable mode, let me know if this is not your problem.
When you press SAVE, after the PAI, again PBO will run and hence the editable code for that field will overwrite which will keep it editable.
So, do something like this.
data: gv_edit value 'X'..... "global variable in TOP include
PBO....
loop at ...
if gv_edit = 'X'.
CALL METHOD lo_alv->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
else.
CALL METHOD lo_alv->set_ready_for_input
EXPORTING
i_ready_for_input = 0.
endif.
endloop.
PAI.
when 'SAVE'.
gv_edit = space.
When 'EDIT'.
gv_edit = 'X'.
Regards,
Diwakar -
ALV GRID Problem with reading contents
Hi there! I'm quite new with ABAP and I have some problems with the syntax of it. Maybe I should first describe my aim and then I'll show you my code.
1. I read contents from two database tables, called 'zbc_dan_registry' and 'zbc_dan_category'.
'zbc_dan_registry' has 2 columns: name, value.
zbc_dan_category' has 1 column: category.
Now I want to have an ALV Grid, that displays the contents of 'zbc_dan_registry' and one additional column with dropdown fields, where the user can select a category for each row. This is, what my code already does.
Now I want to save the contents of the whole table in a new table 'zbc_dan_registrz' (you see: 'registrz', not 'registry'!) with 3 columns:
name, category, value.
My problem is, how can I read the contents of the ALV Grid, with the user selected category for each row, and save them in an internal table? I've tried to adapt the code of "BCALV_EDIT_04", but I don't get it running.
Some detailled help would be great, you know, I'm really working hard to understand ABAP, but it's really hard for me. Thanks for your support and help!!
Here's my code so far:
*& Report ZBC400_DAN_TESTNO4
REPORT ZBC400_DAN_TESTNO4.
DATA: lt_registrz TYPE TABLE OF zbc_dan_regstrz WITH HEADER LINE,
lt_category TYPE TABLE OF zbc_dan_category WITH HEADER LINE,
ls_category TYPE zbc_dan_category, "Struktur Kategorie
ok_code LIKE sy-ucomm,
container_r TYPE REF TO cl_gui_custom_container,
grid_r TYPE REF TO cl_gui_alv_grid,
gc_custom_control_name TYPE scrfname VALUE 'CONTAINER_REG',
fieldcat_r TYPE lvc_t_fcat,
layout_r TYPE lvc_s_layo,
lt_ddval TYPE lvc_t_drop,
ls_ddval TYPE lvc_s_drop,
c TYPE i.
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA g_verifier TYPE REF TO lcl_event_receiver.
DATA: BEGIN OF gt_outtab OCCURS 0.
INCLUDE STRUCTURE zbc_dan_regstrz.
DATA: celltab TYPE lvc_t_styl.
DATA: END OF gt_outtab.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
TYPES: BEGIN OF lt_registrz_key. "Struktur mit den Schlüsseln der Tabelle 'Registry'
TYPES: name TYPE zbc_dan_name,
value TYPE zbc_dan_value,
category TYPE zbc_dan_cat.
TYPES: END OF lt_registrz_key.
TYPES: ls_registrz_keys TYPE STANDARD TABLE OF lt_registrz_key,
ls_registrz_table TYPE STANDARD TABLE OF zbc_dan_regstrz.
METHODS: get_inserted_rows EXPORTING inserted_rows TYPE ls_registrz_keys.
METHODS: refresh_delta_tables.
METHODS: handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.
* METHODS: get_inserted_rows EXPORTING inserted_rows TYPE registrz_keys.
* METHODS: refresh_delta_tables.
PRIVATE SECTION.
DATA: inserted_rows TYPE ls_registrz_keys.
DATA: error_in_data TYPE c.
METHODS: get_cell_values IMPORTING row_id TYPE int4 pr_data_changed TYPE REF TO cl_alv_changed_data_protocol EXPORTING key TYPE lt_registrz_key.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
DATA: ls_good TYPE lvc_s_modi,
ls_new TYPE lvc_s_moce.
error_in_data = space.
IF error_in_data = 'X'.
CALL METHOD er_data_changed->display_protocol.
ENDIF.
ENDMETHOD.
METHOD get_cell_values.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING i_row_id = row_id i_fieldname = 'NAME'
IMPORTING e_value = key-name.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING i_row_id = row_id i_fieldname = 'VALUE'
IMPORTING e_value = key-value.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING i_row_id = row_id i_fieldname = 'CATEGORY'
IMPORTING e_value = key-category.
ENDMETHOD.
METHOD get_inserted_rows.
inserted_rows = me->inserted_rows.
ENDMETHOD.
METHOD refresh_delta_tables.
clear me->inserted_rows[].
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
SELECT client name value
INTO CORRESPONDING FIELDS OF TABLE lt_registrz FROM zbc_dan_regstry.
SELECT category INTO CORRESPONDING FIELDS OF TABLE lt_category FROM zbc_dan_category.
CALL SCREEN 0100.
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK'.
SET SCREEN 0.
MESSAGE ID 'BC400' TYPE 'S' NUMBER '057'.
WHEN 'SAVE'.
PERFORM save_data.
WHEN OTHERS.
ENDCASE.
ENDMODULE.
MODULE clear_ok_code OUTPUT.
CLEAR ok_code.
ENDMODULE.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'DYNPRO100'.
SET TITLEBAR 'D0100'.
ENDMODULE.
MODULE display_alv OUTPUT.
PERFORM display_alv.
ENDMODULE.
FORM display_alv.
IF grid_r IS INITIAL.
*----Creating custom container instance
CREATE OBJECT container_r
EXPORTING
container_name = gc_custom_control_name
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.
*--Exception handling
ENDIF.
*----Creating ALV Grid instance
CREATE OBJECT grid_r
EXPORTING
i_parent = container_r
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
CREATE OBJECT g_verifier.
SET HANDLER g_verifier->handle_data_changed FOR grid_r.
*----Preparing field catalog.
PERFORM prepare_field_catalog CHANGING fieldcat_r.
*----Preparing layout structure
PERFORM prepare_layout CHANGING layout_r.
*----Here will be additional preparations
*--e.g. initial sorting criteria, initial filtering criteria, excluding
*--functions
CALL METHOD grid_r->set_table_for_first_display
EXPORTING
* I_BUFFER_ACTIVE =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
is_layout = layout_r
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
CHANGING
it_outtab = lt_registrz[]
it_fieldcatalog = fieldcat_r
* IT_SORT =
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ELSE.
CALL METHOD grid_r->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ENDIF.
CALL METHOD grid_r->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD grid_r->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
ENDFORM.
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZBC_DAN_REGSTR2'
CHANGING
ct_fieldcat = pt_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
LOOP AT pt_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'NAME'.
ls_fcat-coltext = 'Name'.
ls_fcat-outputlen = '40'.
MODIFY pt_fieldcat FROM ls_fcat.
WHEN 'VALUE'.
ls_fcat-coltext = 'Wert'.
ls_fcat-outputlen = '30'.
MODIFY pt_fieldcat FROM ls_fcat.
WHEN 'CATEGORY'.
LOOP AT lt_category into ls_category.
ls_ddval-handle = 1.
ls_ddval-value = ls_category-category.
* ls_ddval-style = cl_gui_alv_grid=>mc_style_enabled.
APPEND ls_ddval TO lt_ddval.
ENDLOOP.
CALL METHOD grid_r->set_drop_down_table
EXPORTING it_drop_down = lt_ddval.
ls_fcat-edit = 'X'.
ls_fcat-drdn_hndl = '1'.
ls_fcat-coltext = 'Kategorie'.
MODIFY pt_fieldcat FROM ls_fcat.
ENDCASE.
ENDLOOP.
ENDFORM.
FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
ps_layout-zebra = 'X'.
ps_layout-grid_title = 'Kategorie zur Registry hinzufügen'.
ps_layout-smalltitle = 'X'.
ENDFORM.
FORM save_data.
DATA: ls_ins_keys TYPE g_verifier->ls_registrz_keys,
ls_ins_key TYPE g_verifier->lt_registrz_key,
ls_registrz TYPE zbc_dan_regstrz,
ls_outtab LIKE LINE OF gt_outtab,
lt_instab TYPE TABLE OF zbc_dan_regstrz.
CALL METHOD g_verifier->get_inserted_rows IMPORTING inserted_rows = ls_ins_keys.
LOOP AT ls_ins_keys INTO ls_ins_key.
READ TABLE gt_outtab INTO ls_outtab
WITH KEY name = ls_ins_key-name
value = ls_ins_key-value
category = ls_ins_key-category.
IF sy-subrc = 0.
MOVE-CORRESPONDING ls_outtab TO ls_registrz.
APPEND ls_registrz TO lt_instab.
ENDIF.
ENDLOOP.
INSERT zbc_dan_regstrz FROM TABLE lt_instab.
CALL METHOD g_verifier->refresh_delta_tables.
ENDFORM.Hi Hans,
You raised the Question in the Webdynpro ABAP forum. Here its very diffcult to get the answer from this forum. Please close it here and raise the same question in ABAP General Forum there you will get faster and so many anwsers.
Please close the question here.
Warm Regards,
Vijay
Maybe you are looking for
-
Hp laserjet 1022 = this printer is not supported under windows 7 shares?
hp laserjet 1022 => this printer is not supported under windows 7 shares?
-
Goods Receipt Indicator (WEPOS) in grey status
Dear GURU, I need your support for the issue in object. For services item Goods Receipt Indicator (WEPOS) in the Delivery tab is in gray status and is not possible to change this. Why this field is in grey status? Do you have any idea for changing re
-
My early 2008 MacBook suddenly crashed and displayed a white screen with the apple emblem which had lines through it and was pixelated. Now it won't boot up past the apple screen and still has lines through. I reset the dram and it didn't fix the pro
-
Hey Experts, I want an heads-up and detail information on Transport Request from the Development Box to the QA Box. Appreciate if you can send me any useful doc on the same at my emai id- [email protected] Thanks, Paddy
-
No Publish button - AIR for iOS and Android
Hi, I upgrade Web Premium from CS5 to CS5.5. I have a big problem with publishing for mobile devices. When I am in Publishing settings I cany see buttons :OK, Cancel and the most important Publish. For OK I ken press Enter, for Cancel Esc, but it loo