Dynamically Create ALV or List Viwer
Dear Gurus,
i have one table with 4 fields (MODULE/LINE/OVEN/NOS)
and there values are follows
Module1/Line1/Oven1/5
Module1/Line1/Oven2/2
Module1/Line1/Oven3/3
Module1/Line1/Oven4/5
Module1/Line2/Oven1/4
Module1/Line2/Oven2/3
Module1/Line2/Oven3/6
Module2/Line1/Oven1/7
Module2/Line2/Oven1/9
Module2/Line2/Oven2/1
Module2/Line3/Oven1/2
Module2/Line3/Oven2/1
Module2/Line3/Oven3/4
Module2/Line3/Oven4/4
Module2/Line3/Oven5/6
my problem is.........i need to get this for display in ALV or List viwer
I selected wot is the Module
then line numbers should be in columns and Oven number should be in rows the Qty placed in relevant index
Ex if i select Module 2 display shoud be like follows
Module2
Line1-Line2-Line3
Oven179--
2
Oven2--1--
1
Oven3----
4
Oven4----
4
Oven5----
6
no of lines in module no of ovens for lines will change time to time therefore i want to create display layout in dynamically
please help me to solve this.
HI,
see this code this may be useful for u.
write:/10 'line1',20 'line2',30 'line3'.
write:/ 'oven1','7' under 'line1','9' under 'line2','2' under 'line3'.
write:/ 'oven2','1' under 'line2','1' under 'line3'.
write:/ 'oven3','4' under 'line3'.
write:/ 'oven4','4' under 'line3'.
write:/ 'oven5','6' under 'line3'.
rgds,
bharat.
Similar Messages
-
Dynamic created alv adding each tax code in bottom of column.
Hi expert,
i created dynamic alv using dynamic internal table and want to add each column value in bottom of each column
example :1
2
3
total
this is not simple alv report it's dynamic alv.
pls give me code.
regards.
VikashIn your dynamic internal tables, does all fields can be summed?
If yes, I would do like this. Create a generic a variable say V_FIELD. Assume maximum program may have 30 fields.
data v_field type char30
data v_num type char2.
data v_field1 type char30.
data v_field30 type char30.
do.
add 1 to v_num.
CONCATENATE 'V_FIELD' v_num into v_field.
assign (v_field) to <fld>."This holds the value of the field. Initially 0.
ASSIGN COMPONENT sy-index OF STRUCTURE <YOUR_DYNAMIC_STURCT> TO <fld_value>.
if sy-subrc = 0.
<fld> = <fld> + <fld_value>.
else.
exit.
endif.
enddo.
As the DO loop process it sums up for each column total into each variable. Once complete data is processed through, add these variable to as new record to internal table.
If all fields are not summed type of field then validate by the on the field type and process the logic -
Dynamic Change of FieldCatalog in OO ALV Secondary List
Dear All,
i have Scenario like when i go to secondary list on some event, the fieldcatlog for the info is generated. then again i go back and choose some other event, now the secondary fieldcatalog list should contain few extra fields which are not being displayed. i am refreshing the fieldcatalog and filling the fieldcatalog table with new fields everytime. but the system displays only the first generated fieldcatalog.
any ideas what can be done?
Thanks & Regards
RahulHello Rahul
The following sample report <b>ZUS_SDN_TWO_ALV_GRIDS_A</b> shows how to dynamically change the fieldcatalog of the second ALV list depending on which customer has been selected (by double-clicking) on the first ALV list.
*& Report ZUS_SDN_TWO_ALV_GRIDS_A
*& Screen '0100' contains no elements.
*& ok_code -> assigned to GD_OKCODE
*& Flow logic:
* PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
* PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
REPORT zus_sdn_two_alv_grids_a.
" Dynamic fieldcatalog on second ALV list
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_knvv TYPE STANDARD TABLE OF knvv.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_row TYPE i.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
CHECK ( sender = go_grid1 ).
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
md_row = e_row-index.
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = '1000'.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
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 splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 2
columns = 1
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
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.
* Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
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.
* Display data
gs_layout-grid_title = 'Customers'.
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
is_layout = gs_layout
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
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.
gs_layout-grid_title = 'Customers Details (Sales Areas)'.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNVV'
is_layout = gs_layout
CHANGING
it_outtab = gt_knvv " empty !!!
EXCEPTIONS
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.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
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.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
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.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
* User has pushed button "Display Details"
WHEN 'DETAIL'.
PERFORM entry_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ENTRY_SHOW_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM entry_show_details .
* define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1,
ls_fcat TYPE lvc_s_fcat,
lt_fcat TYPE lvc_t_fcat.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM knvv INTO TABLE gt_knvv
WHERE kunnr = ls_knb1-kunnr.
CALL METHOD go_grid2->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = lt_fcat.
" Logic of fieldcatalog modification:
" 1st customer selected -> show 1 column only
" 2nd customer selected -> show 2 columns only
" 3rd customer selected -> show 3 columns
LOOP AT lt_fcat INTO ls_fcat.
IF ( syst-tabix <= ld_row ).
ls_fcat-no_out = ' '.
ELSE.
ls_fcat-no_out = 'X'.
ENDIF.
MODIFY lt_fcat FROM ls_fcat.
ENDLOOP.
go_grid2->set_frontend_fieldcatalog( lt_fcat ).
ENDFORM. " ENTRY_SHOW_DETAILS
Regards
Uwe -
To color selected cells in dynamically created table in ALV.
Hi,
The requirement is to display a table (whose columns are dynamic) using ALV n to color few cells of the table based on some condition.
For creating the table dynamically i have used the method cl_alv_table_create=>create_dynamic_table.
Now for coloring the cells i tried to use the field EMPHASIZE .
But when I try this method the whole column is getting colored.
So any suggestions on how to color only particular cells.Hi,
Try this one...
DATA: gs_layout TYPE slis_layout_alv, "Define layout
gt_color TYPE lvc_t_scol WITH HEADER LINE. "Define Internal Table for Cell Colouring
Use below Sample Code after building a Field Catalog:
gs_layout-coltab_fieldname = 'COLINFO'.
" 'it' is the final internal table which contain positive & negative value of Field 'MENGE'
LOOP AT it.
REFRESH gt_color.
CLEAR gt_color.
IF it-menge GE 0.
CLEAR gt_color.
gt_color-fname = 'MENGE'.
gt_color-color-col = cl_gui_resources=>list_col_positive.
gt_color-color-int = 0.
APPEND gt_color.
ELSEIF it-menge LE 0.
CLEAR gt_color.
gt_color-fname = 'MENGE'.
gt_color-color-col = cl_gui_resources=>list_col_negative.
gt_color-color-int = 0.
APPEND gt_color.
ENDIF.
it-colinfo[] = gt_color[].
MODIFY it.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = gs_layout
it_fieldcat = ct_fieldcat
i_save = 'A'
TABLES
t_outtab = it
EXCEPTIONS
program_error = 1
OTHERS = 2.
Hope this solves your problem.
Regards,
Tarun -
How to create 2 ALV output lists in a single output?
Hi guys...
My clients requirement is to create 2 ALV output lists in a single output list.how can i do this?i mean which function module i can use for this requirement?please help me out...
Regards..*& Report ZLCL_ALV_INT_INVOICE *
REPORT ZLCL_ALV_INT_INVOICE .
DATA: O_CONT1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_CONT2 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_GRID1 TYPE REF TO CL_GUI_ALV_GRID,
O_GRID2 TYPE REF TO CL_GUI_ALV_GRID.
DATA: IT_VBRK LIKE VBRK OCCURS 1 WITH HEADER LINE.
DATA: IT_VBRP LIKE VBRP OCCURS 1 WITH HEADER LINE.
DATA: WA_VBRK LIKE VBRK.
*--Layout
DATA: WA_LAYO TYPE LVC_S_LAYO.
CLASS LCL_BILLING DEFINITION
CLASS LCL_BILLING DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK
OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID.
ENDCLASS. "LCL_BILLING DEFINITION
CLASS LCL_BILLING IMPLEMENTATION
CLASS LCL_BILLING IMPLEMENTATION.
METHOD HANDLE_HOTSPOT_CLICK.
IF NOT E_ROW_ID IS INITIAL.
*--Reading selected billing docno
READ TABLE IT_VBRK INTO WA_VBRK INDEX E_ROW_ID-INDEX.
*--GETTING BILLING DOC ITEMS
REFRESH IT_VBRP.
SELECT *
FROM VBRP
INTO TABLE IT_VBRP
WHERE VBELN = WA_VBRK-VBELN.
CALL SCREEN 200.
ENDIF.
ENDMETHOD. "HANDLE_HOTSPOT_CLICK
ENDCLASS. "LCL_BILLING IMPLEMENTATION
SELECT-OPTIONS: S_VBELN FOR IT_VBRK-VBELN.
START-OF-SELECTION.
PERFORM GET_DATA.
SET SCREEN 100.
*& Form GET_DATA
text
FORM GET_DATA .
*--billing header data
SELECT *
FROM VBRK
INTO TABLE IT_VBRK
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'No Data Found'.
ENDIF.
EXIT.
ENDFORM. " GET_DATA
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MENU'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
PERFORM EXIT_PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module PBO_100 OUTPUT
text
MODULE PBO_100 OUTPUT.
IF O_CONT1 IS INITIAL.
CREATE OBJECT O_CONT1
EXPORTING
CONTAINER_NAME = 'VBRK_CONT'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in container'.
EXIT.
ENDIF.
CREATE OBJECT O_GRID1
EXPORTING
I_PARENT = O_CONT1
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in Grid'.
EXIT.
ENDIF.
ENDIF.
*--Layout for 1st grid
WA_LAYO-KEYHOT = 'X'.
WA_LAYO-GRID_TITLE = 'Billing Document Header Data'.
CALL METHOD O_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'VBRK'
IS_LAYOUT = WA_LAYO
CHANGING
IT_OUTTAB = IT_VBRK[]
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in showing grid'.
EXIT.
ENDIF.
*-Setting the focus on the grid
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = O_GRID1 "Grid control object
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in setting focus'.
ENDIF.
*--Event handler registration
SET HANDLER LCL_BILLING=>HANDLE_HOTSPOT_CLICK FOR O_GRID1.
ENDMODULE. " PBO_100 OUTPUT
*& Module STATUS_0200 OUTPUT
text
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'MENU'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
MODULE USER_COMMAND_0200 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 100.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Module PBO_200 OUTPUT
text
MODULE PBO_200 OUTPUT.
IF O_CONT2 IS INITIAL.
CREATE OBJECT O_CONT2
EXPORTING
CONTAINER_NAME = 'VBRP_CONT'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in container'.
EXIT.
ENDIF.
CREATE OBJECT O_GRID2
EXPORTING
I_PARENT = O_CONT2
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in grid linking'.
EXIT.
ENDIF.
CALL METHOD O_GRID2->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'VBRP'
CHANGING
IT_OUTTAB = IT_VBRP[]
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.
*--refreshing the alv grid with the latest content of the internal table
*--which is linked
CALL METHOD O_GRID2->REFRESH_TABLE_DISPLAY
EXCEPTIONS
FINISHED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in Refreshing gird'.
ENDIF.
ENDIF.
ENDMODULE. " PBO_200 OUTPUT
*& Form EXIT_PROGRAM
text
FORM EXIT_PROGRAM .
*--Deallocating the memory
IF NOT O_CONT2 IS INITIAL.
CALL METHOD O_CONT2->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in deallocating memory'.
EXIT.
ENDIF.
CLEAR: IT_VBRP,
IT_VBRP[].
FREE: IT_VBRP,
IT_VBRP[].
ENDIF.
IF NOT O_CONT1 IS INITIAL.
CALL METHOD O_CONT1->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in deallocating memory'.
EXIT.
ENDIF.
CLEAR: IT_VBRK,
IT_VBRK[].
FREE: IT_VBRK,
IT_VBRK[].
ENDIF.
*--Cearing the buffered content
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in clearing Buffer'.
EXIT.
ENDIF.
LEAVE PROGRAM.
ENDFORM. " EXIT_PROGRAM
SCREEN 100
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
MODULE PBO_100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
SCREEN200
PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.
MODULE PBO_200.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0200. -
How to create alv table dynamically by performing action on the button.
Hi all,
my requirement is to create alv table dynamically.
that is i will create two buttons
1) show alv table
2) close alv table
if user selects show alv table then the alv table should be displayed.
and if user selects clsoe alv table then the alv table should be closed.
to create alv table dynamically i have followed this procedure.
under view properties i have added salv_wd_table component. then under the action of showalvbutton i went to code wizard and i have selected instantiate used component component use salv_wd_table. the following code will be generated
with this code i am unable to display alv table dynamically correct me where i went wrong kindly send me the necessary steps how to create alv table dynamically
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_salv_wd_table( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
to close table i have used the following code. with this code i am able to achieve the functionality to delete the alv table
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_salv_wd_table( ).
if lo_cmp_usage->has_active_component( ) is initial.
else.
lo_cmp_usage->Delete_component( ).
endif.
Thanks & Regards,
Naveen
Edited by: naveen.webhelp on Feb 10, 2011 5:52 AMHi
ALV table will be shown in the viewcontainerUI element.
it is shown there empty if you dont fill the node bound to the data node of the interface controller of the comp usage
SALV_WD_TABLE.
and if you are not getting the table filled in the first place.
then check have you mapped the DATA node to some node in the comp controller
wht basically is your requirment is that you want to show ALV gird on click of one button and delete it on click of other button.
there are many ways to do so.
best way is control the visiblity of the viewcontainer UI element which containes the TABLE view of SALV_WD_table comp.
create an attribute of type WDUI_VISIBILITY name say VIS.
now go to the layout and bound hte visible property of the viewcontainer to this attribute VIS.
then in the showalv grid button's eventhandler write
wd_context->set_attribute(
name = 'VIS'
value = '02'
and in the wddoinit and delete alv grid button's event handler write
wd_context->set_attribute(
name = 'VIS'
value = '01'
thanks
sarbjeet singh -
Dynamically creating Coloumn IN ALV
Hi All,
I have a requirement on ALV grid.when i click on one field it need to be dynamically create a Column.Can you please any one can suggest me.
Thank You
UshaHi,
You will have to make use of CL_GUI_ALV_GRID.
You will have to register the event CL_GUI_ALV_GRID=>MC_EVT_ENTER and CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
Set handler for the same.
In the handler method add columns to your internal table.
For understanding event handling go through the example program BCALV_TEST_GRID_EDITABLE.
Regards,
Ankur Parab -
How to create editable ALV grid/list
Hi,
I want to create editable ALV grid/list so that user can modify the data in the ALV.
And when user presses save button data will get saved in Z table.
I dont know how to create editable ALV so could anybody please help me regarding this?
Thanks & regards,
Sameer DhukeHI
check the demo programs BCALV_FULLSCREEN_GRID_EDIT
BCALV_GRID_EDIT
BCALV_TEST_GRID_EDIT_01
BCALV_TEST_GRID_EDITABLE
REUSE_ALV_GRID EDITABLE
ALV Grid editable fields
Just to make things a bit easy
In the layout,there is a property called edit, make it 'X' for the particular field whichever you want to make editable.
Hope this helps,
Suruchi
Message was edited by:
Suruchi Mahajan -
Hi, i'm building a form to gather info on the number of sessions there are in a day. So on this form, there is a drop list which allows the user to select from 1 to 10 sessions.
Now, all the sessions are different times, so i have to create different number of drop based on the number select.
Therefore if the user select 5, 5 new drop list appears and if 8, 8 new drop list appears. These new drop list would show times value for the user to select.
Eg of drop list would have
<select name=...>
<option value='1'>1</option>
i've so far manage to dynamically the select drop boxes but they do not show the option times values as i wish to.
How can i get the drop list to show the options?
can anyone help?
function createSessionTimes(){
var aElement=document.createElement("<select name='Session1'>")
document.body.insertBefore(aElement);
var aElement2=document.createElement("<select name='Session2'><options value='1'>1</option>")
aElement.insertBefore(aElement2);
}Yes, i know this is javascript. but i was hoping there is a jsp way to dynamically create new number of drop lists based on the value of the drop list above.
so far i only seen javascript but i wish to do in jsp alone. Can anyone provide a jsp solution? -
hi all,
I am able to display dynamic alv, but i have 2 lists to display.
Since both lists are field symbols rather than internal tables, am unable to use reuse_block_list_append.
Thanks,
SrikarHi Srikar,
You can use dockingcontainer and split into ToP and Bottom and display the two lists.
Refer sample code:
*-- ALV Grid data declaration
DATA : o_splitter TYPE REF TO cl_gui_splitter_container,
<b>o_alvgrid1</b> TYPE REF TO cl_gui_alv_grid,
<b>o_alvgrid2</b> TYPE REF TO cl_gui_alv_grid,
o_dockingcontainer TYPE REF TO cl_gui_docking_container,
o_container TYPE REF TO cl_gui_custom_container,
cont_on_100 TYPE scrfname VALUE 'SCREEN', " SCREEN
o_container1 TYPE REF TO cl_gui_container,
o_container2 TYPE REF TO cl_gui_container,
i_fieldcat TYPE slis_t_fieldcat_alv,
<b>i_fldcatalog1</b> TYPE lvc_t_fcat,
<b>i_fldcatalog2</b> TYPE lvc_t_fcat,
v_ratio TYPE i,
w_layout1 TYPE lvc_s_layo,
w_layout2 TYPE lvc_s_layo,
w_fldcatalog TYPE lvc_s_fcat,
ok_code LIKE sy-ucomm.
*& Form f0420_create_objects
Create ALV Objects
FORM f0420_create_objects.
v_ratio = 95.
PERFORM objects_create USING:
'o_dockingcontainer' '' v_ratio '' '',
'o_splitter' o_dockingcontainer '' '2' '1'.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
CALL METHOD o_splitter->get_container EXPORTING row = 1
column = 1
RECEIVING container = o_container1.
CALL METHOD o_splitter->get_container EXPORTING row = 2
column = 1
RECEIVING container = o_container2.
Set where the splits on the screen comes
CALL METHOD o_splitter->set_row_height
EXPORTING
id = 1
height = 65
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF NOT sy-subrc IS INITIAL.
PERFORM error_handle USING text-024.
ENDIF.
ENDIF.
Create the alv grids
PERFORM objects_create
USING: <b>'o_alvgrid1' o_container1</b> '' '' '',
<b>'o_alvgrid2' o_container2</b> '' '' ''.
ENDFORM. " f0420_create_objects
*& Form objects_create
Create Objects
FORM objects_create USING value(pobject)
pparent
value(pratio)
value(prows)
value(pcolumns).
CASE pobject.
WHEN 'o_dockingcontainer'.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
IF o_dockingcontainer IS INITIAL.
CREATE OBJECT o_dockingcontainer
EXPORTING
ratio = pratio "amount of screen
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
CHECK NOT sy-subrc EQ 0.
PERFORM error_handle USING text-022.
ENDIF.
ENDIF.
WHEN 'o_splitter'.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
IF o_splitter IS INITIAL.
CREATE OBJECT o_splitter
EXPORTING
parent = pparent
rows = prows
columns = pcolumns
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
CHECK NOT sy-subrc EQ 0.
PERFORM error_handle USING text-023.
ENDIF.
ENDIF.
WHEN 'o_alvgrid1'.
IF <b>o_alvgrid1</b> IS INITIAL.
CREATE OBJECT o_alvgrid1
EXPORTING
i_parent = pparent.
CHECK NOT sy-subrc EQ 0.
PERFORM error_handle USING text-024.
ENDIF.
WHEN <b>'o_alvgrid2'.</b>
IF o_alvgrid2 IS INITIAL.
CREATE OBJECT o_alvgrid2
EXPORTING
i_parent = pparent.
CHECK NOT sy-subrc EQ 0.
PERFORM error_handle USING text-024.
ENDIF.
WHEN OTHERS.
do nothing
ENDCASE.
ENDFORM. " objects_create
*& Form f0430_set_layout
Set Grid Layout
FORM f0430_set_layout.
w_layout1-grid_title = sy-title.
w_layout1-zebra = c_x.
w_layout1-sel_mode = 'A'.
w_layout1-cwidth_opt = c_x.
w_layout2-grid_title = 'Error Records'.
w_layout2-zebra = c_x.
w_layout2-sel_mode = 'A'.
w_layout2-cwidth_opt = c_x.
w_layout2-no_toolbar = c_x.
w_variant-report = sy-repid.
ENDFORM. " f0430_set_layout
*& Form f0440_alv_output
Display output in ALV Grid
FORM f0440_alv_output.
PERFORM <b>display_data_grid1</b> TABLES <i_table>
i_fldcatalog1
USING w_layout1.
DELETE ADJACENT DUPLICATES FROM i_error COMPARING ALL FIELDS.
PERFORM <b>display_data_grid2</b> TABLES i_error
i_fldcatalog2
USING w_layout2.
ENDFORM. " f0440_alv_output
*& Form display_data
ALV Grid Display
FORM display_data_grid1 TABLES p_output
p_fieldcat
USING value(p_layout).
CALL METHOD o_alvgrid1->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = c_a
is_layout = p_layout
CHANGING
it_outtab = p_output[]
it_fieldcatalog = p_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i004 WITH text-026.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " display_data_grid1
*& Form display_data
ALV Grid Display
FORM display_data_grid2 TABLES p_output
p_fieldcat
USING value(p_layout).
CALL METHOD o_alvgrid2->set_table_for_first_display
EXPORTING
i_save = c_a
is_layout = p_layout
CHANGING
it_outtab = p_output[]
it_fieldcatalog = p_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i004 WITH text-026.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " display_data_grid1
*& Module USER_COMMAND_9000 INPUT
PAI
MODULE user_command_9000 INPUT.
CASE ok_code.
WHEN 'EXIT' OR 'CANC'.
PERFORM free_objects:
USING o_alvgrid1 'ALV' text-027,
USING o_alvgrid2 'ALV' text-027,
USING o_dockingcontainer 'DOCKING' text-028.
LEAVE.
WHEN 'BACK'.
PERFORM free_objects:
USING o_alvgrid1 'ALV' text-027,
USING o_alvgrid2 'ALV' text-027,
USING o_dockingcontainer 'DOCKING' text-028.
SET SCREEN '0'.
LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Form free_objects
Free Objects
FORM free_objects USING pobject
value(ptype)
value(ptext).
DATA: l_objectalv TYPE REF TO cl_gui_alv_grid.
CASE ptype.
WHEN 'ALV'.
l_objectalv = pobject.
IF NOT ( l_objectalv IS INITIAL ).
CALL METHOD l_objectalv->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CALL METHOD cl_gui_cfw=>flush.
CLEAR: pobject, l_objectalv.
CHECK NOT sy-subrc EQ 0.
PERFORM error_handle USING ptext.
ENDIF.
WHEN 'DOCKING'.
DATA: lobjectdock TYPE REF TO cl_gui_docking_container.
lobjectdock = pobject.
IF NOT ( lobjectdock IS INITIAL ).
CALL METHOD lobjectdock->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CLEAR: pobject, lobjectdock.
CHECK NOT sy-subrc EQ 0.
PERFORM error_handle USING ptext.
ENDIF.
WHEN OTHERS.
sy-subrc = 1.
PERFORM error_handle
USING text-025.
ENDCASE.
ENDFORM. " free_objects
*& Form error_handle
Error Message
FORM error_handle USING value(ptext).
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-021
txt2 = sy-subrc
txt1 = ptext.
ENDFORM. " error_handle
Reward points if this Helps.
Manish
Message was edited by:
Manish Kumar -
How to download only some fields(dynamically) from alv grid layouts
I have ALV grid list.
I have layouts for selecting sets of fields dynamically.
If I select a particular layout, I want to download only those fields into an Excel sheet.
If I select another layout, I want to download only fields of that layout , into an Excel sheet.
Can u plz write examples.
NarendraHello ,
Here it is.
FIELD-SYMBOLS <FS> TYPE ANY.
DATA: GR_ATTACHMENT TYPE Z48S3_ATTACHMENT,
GT_ATTACHMENT TYPE Z48S3_ATTACHMENT_TAB,
L_F_TITLE TYPE SO_OBJ_DES,
L_R_FIELDCAT LIKE LINE OF GT_FIELDCAT,
L_F_FIELD LIKE L_R_FIELDCAT-FIELDNAME,
L_F_EMAILID TYPE Z48S3_RECEIVER,
L_F_FIRST TYPE C.
IF SY-SYSID EQ G_C_DEV_SYSTEM OR
SY-SYSID EQ G_C_QUA_SYSTEM.
CONCATENATE SY-SYSID '/' SY-MANDT ':' INTO L_F_TITLE.
CONDENSE L_F_TITLE.
CONCATENATE L_F_TITLE SY-TITLE INTO L_F_TITLE SEPARATED BY SPACE.
ELSE.
L_F_TITLE = SY-TITLE.
ENDIF.
G_R_VARIANT-REPORT = SY-REPID.
G_R_VARIANT-VARIANT = P_VARIAN.
CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
EXPORTING
I_DIALOG = 'N'
I_USER_SPECIFIC = 'A'
I_DEFAULT = 'X'
IT_DEFAULT_FIELDCAT = G_T_FIELDCAT
I_LAYOUT = GR_LAYOUT
IMPORTING
ET_FIELDCAT = G_T_FIELDCAT
ES_LAYOUT = GR_LAYOUT
CHANGING
CS_VARIANT = G_R_VARIANT
EXCEPTIONS
ERROR_MESSAGE = 4
OTHERS = 4.
SORT G_T_FIELDCAT BY COL_POS.
PERFORM CREATE_EXCEL_ATTM_HEADING_ROW TABLES GT_ATTACHMENT
G_T_FIELDCAT.
LOOP AT G_T_ALVLIST.
L_F_FIRST = 'X'.
LOOP AT G_T_FIELDCAT INTO L_R_FIELDCAT WHERE NO_OUT IS INITIAL.
CLEAR GR_ATTACHMENT-XNEWLINE.
IF NOT L_F_FIRST IS INITIAL.
GR_ATTACHMENT-XNEWLINE = 'X'.
CLEAR L_F_FIRST.
ENDIF.
CLEAR L_F_FIELD.
CONCATENATE 'G_T_ALVLIST-' L_R_FIELDCAT-FIELDNAME
INTO L_F_FIELD.
CONDENSE L_F_FIELD.
ASSIGN (L_F_FIELD) TO <FS>.
WRITE <FS> TO GR_ATTACHMENT-FIELDVALUE.
UNASSIGN <FS>.
APPEND GR_ATTACHMENT TO GT_ATTACHMENT.
ENDLOOP.
ENDLOOP.
Regards,
Vasanth -
How can we use C# to read dynamic parameter's value list from .rpt?
I'm using Cystal Report 2008. We know starting from CR XI we can create dynamic parameters, the list of items of this kind of parameter are fetching from database. So in general the SQLs to get the list of values for dynamic parameters are stored in the .rpt.
In Crystal Report Designer, if I preview a report with dynamic parameters, it will first query the database and then show the input dialog with list of values from database for user to choose. My question is can we implement the same thing by our C# code? I'm planning to use C# code to read this dynamic parameter's value list from .rpt and render them on the web page. Then pass back the user selected values to the .rpt to run the report after user make the choice. I didn't find any APIs can do this. Is it possible?
Thanks in advance!!Hi,
Can you explain a bit in detail, I have similar scenario. I am using the following code but not getting the Column name for dynamic parameter list.
foreach (ParameterFieldDefinition prm
in reportDocument.DataDefinition.ParameterFields)
try
string vParameterFieldName;
*vParameterFieldName = prm.ParameterFieldName.ToString();*
Shakeel -
Creating ALV reports using OOP concept
After creating many reports i found out that 90% of the coding in a report is copy paste i.e. only 10% of coding effort is required which includes
creating the custom data types and internal table variables ...
populating the data
creating screen,GUI status and GUI title
Just copy paste the below code and do as stated :
*ALV TEMPLATE
*create screen no. 2000
*change flow logic in screen if necessary
*create GUI status and GUI title
*change selection texts and text symbols*
REPORT Y_TEMPLATE_ALV.
TABLES : ."use if range of values required on selection screen.
DATA: zcl_alvgrid TYPE REF TO cl_gui_alv_grid,
zcl_ccontainer TYPE REF TO cl_gui_docking_container,
wa_layout TYPE lvc_s_layo,
it_fieldcat TYPE STANDARD TABLE OF lvc_s_fcat,
wa_fieldcat TYPE lvc_s_fcat,
z_document TYPE REF TO cl_dd_document,
o_docking TYPE REF TO cl_gui_docking_container,"Docking Container
o_split TYPE REF TO cl_gui_easy_splitter_container, "Splitter
o_top_container TYPE REF TO cl_gui_container, "Top Container
o_bottom_container TYPE REF TO cl_gui_container."Bottom Container
TYPES : BEGIN OF TY_FINAL,
"All columns which are to be displayed in the report should be included here
END OF TY_FINAL.
*Add additional Internal Tables's if data is to be extracted from multiple tables
*Then loop at main table and Read the other tables
DATA :IT_DATA TYPE STANDARD TABLE OF , "data extracted from tables can be stored in this internal table variable ..
WA_DATA TYPE ,
iT_alv TYPE STANDARD TABLE OF TY_FINAL, " pass to the method SET_TABLE_FOR_FIRST_DISPLAY of class
ZCL_ALVGRID [Already done ; its just fyi]
WA_alv TYPE TY_FINAL.
DATA :V_CLN(255) TYPE C, " For no. of records
V_LINE TYPE I. " for conversion of integer to character
* Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS:
SELECT-OPTIONS: " PARAMETERS and Range on selection screen
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN OUTPUT.
* START OF SELECTION *
START-OF-SELECTION.
* SELECT * FROM INTO CORRESPONDING FIELDS OF TABLE IT_DATA WHERE ....in ....
IF SY-SUBRC = 0.
LOOP AT IT_DATA INTO WA_DATA.
MOVE-CORRESPONDING WA_DATA TO wa_alv. " if data is fetched from only one table
APPEND wa_alv TO it_alv.
CLEAR : wa_alv,WA_DATA.
ENDLOOP.
DESCRIBE TABLE it_alv LINES V_LINE.
V_CLN = V_LINE.
ENDIF.
END-OF-SELECTION.
PERFORM DISPLAY_ALV.
*& Module STATUS OUTPUT
* text
MODULE STATUS_2000 OUTPUT.
SET PF-STATUS 'STATUS'.
SET TITLEBAR 'ALV'.
* ** Creating Docking Container
CREATE OBJECT o_docking
EXPORTING
* side = cl_gui_docking_container=>dock_at_right
ratio = '95'.
IF sy-subrc EQ 0.
* Splitting the Docking container
CREATE OBJECT o_split
EXPORTING
parent = o_docking
sash_position = 05 "Position of Splitter Bar (in Percent)
with_border = 0. "With Border = 1 Without Border = 0
* Placing the containers in the splitter
o_top_container = o_split->top_left_container .
o_bottom_container = o_split->bottom_right_container .
* Creating the document
CREATE OBJECT z_document
EXPORTING
style = 'ALV_GRID'.
ENDIF.
* Calling the methods for dynamic text
CALL METHOD z_document->add_text
EXPORTING
TEXT = 'No. of Records:'
sap_emphasis = cl_dd_area=>strong. " For bold
* Adding GAP
CALL METHOD z_document->add_gap
EXPORTING
width = 10.
* Adding Text
CALL METHOD z_document->add_text
EXPORTING
TEXT = v_cln.
* Adding Line
CALL METHOD z_document->new_line.
* Display the data
CALL METHOD z_document->display_document
EXPORTING
parent = o_top_container.
IF zcl_alvgrid IS INITIAL .
*----Creating ALV Grid instance
CREATE OBJECT zcl_alvgrid
EXPORTING
i_parent = o_bottom_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Calling the method of ALV to process top of page
CALL METHOD zcl_alvgrid->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = z_document.
* Preparing field catalog.
PERFORM T_FIELDCAT USING:
'1' 'BRNCD' 'BRAND'.
* 'Column no' 'FIELDNAME' 'Column Heading'
WA_LAYOUT-CWIDTH_OPT = 'X'.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-SEL_MODE = 'A'.
* Setting table for first display
CALL METHOD ZCL_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = WA_LAYOUT
CHANGING
IT_OUTTAB = it_alv
IT_FIELDCATALOG = IT_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.
CALL METHOD ZCL_ALVGRID->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.
ENDIF.
ENDMODULE. " STATUS OUTPUT
MODULE USER_COMMAND_2000 INPUT.
DATA: V_OK_CODE TYPE SY-UCOMM,
V_SAVE_OK TYPE SY-UCOMM.
V_OK_CODE = SY-UCOMM.
V_SAVE_OK = V_OK_CODE.
CASE SY-UCOMM.
WHEN 'BACK'.
SET SCREEN 1000.
WHEN 'EXIT'.
LEAVE program.
WHEN OTHERS.
SET SCREEN 1000.
ENDCASE.
CLEAR V_SAVE_OK.
SET SCREEN 0.
LEAVE SCREEN.
ENDMODULE. " USER_COMMAND_2000 INPUT
*& Form T_FIELDCAT
* text
* -->x text
* -->y text
* -->z text
FORM T_FIELDCAT USING VALUE(X) TYPE ANY
VALUE(Y) TYPE ANY
VALUE(Z) TYPE ANY.
WA_FIELDCAT-COL_POS = X.
WA_FIELDCAT-FIELDNAME = Y.
WA_FIELDCAT-COLTEXT = Z.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. " T_FIELDCAT
*& Form DISPLAY_ALV
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY_ALV .
IF NOT it_alv[] IS INITIAL.
CALL SCREEN 2000.
ELSE.
MESSAGE 'No data for Display' TYPE 'I'.
ENDIF.
ENDFORM. " DISPLAY_ALVHello Jay,
Calling methods, creating instances, casting etc are not OOP. When you say you've developed an OO-report you think OO, refer to this blog to see what i mean - Global Data in ABAP OO Programs
BR,
Suhas -
Dynamically creating a Record Group based on Previously entered Record Grou
Forms [32 Bit] Version 10.1.2.3.0 (Production)
Hi,
I know how to dynamically create a record group based on a query and putting the code in When new form instance.
My query is. I have a form which has multiple Record Groups and the user wants to dynamically create subsequent groups based on previous groups.
For example
I have a record group with selects a Location,
when the user selects the Location from a list of values
the 2nd record group called 'Cost Centres' will have to filter out only those with the locations selected above.
How can I populate the 2nd record group at run-time when I do not know what site the user will select?
If I simply populate in when new form instance as in location and just select everything, the list of values populates.
CC field is a LIST ITEM and the list style is a POP LIST, it is not required.
I have put the code in the Location field in the when-list-changed trigger.
I am getting this error:
frm-41337: cannot populate the list from the record group
here is the code:
DECLARE
v_recsql Varchar2(1000); -- The SQL for creating the Record Group.
v_recgrp RecordGroup; -- Record Group
v_status Number; -- Return Value of Populate_Group function.
c_where VARCHAR2(1000);
BEGIN
IF :location = '1' THEN
c_where := ' substr(cost_centre,1,2) in (''01'',''02'')';
ELSIF :location = '2' THEN
c_where := ' substr(cost_centre,1,2) in (''02'',''03'')';
ELSIF :location = '3' THEN
c_where := ' substr(cost_centre,1,2) in (''01'',''11'',''07'')';
ELSE
c_where := ' 1=1'; --EVERYTHING
END IF;
v_recsql := 'SELECT cost_centre, description FROM cost_centres where '||c_where;
-- Create the Record Group
v_recgrp := CREATE_GROUP_FROM_QUERY('v_recgrp', v_recsql);
IF NOT ID_NULL(v_recgrp)
THEN -- No Error, record group has been successfully created.
-- Populate Record Group
v_status := POPULATE_GROUP('v_recgrp');
IF v_status = 0
THEN -- No Error. Record Group has been Populated.
POPULATE_LIST('block.CC', 'v_recgrp');
END IF; -- IF v_status = 0
-- Delete the Record Group as it is no longer needed.
DELETE_GROUP('v_recgrp');
END IF; -- IF NOT ID_NULL(v_recgrp)
END;thanks for your assistance.Hi,
Once record status gets change for block you can not populate/repopulate the list item. Keep those list items as non-database item with different names and create different items as database orignal items. Than assign the values in WHEN-LIST-CHANGE trigger to the actual database items.
-Ammad -
Is it possible to dynamically create form fields in PDF form?
Hi all,
I would like to dynamically create object like textbox, dropdown list from xml data. For example:
When I receive following xml data:
<field name="Check Box" type="selectbox"/>
<field name="Text Field" type="textbox"/>
I want to generate 2 form fields check box and text field with title "Check Box" and "Text Field" accordingly.
Is it possible to do it in javascript for PDF form?
Thank you and regards,
AnhYou cannot dynamically create objects on the fly like that but you can create interpret the XML and create an XDP file (which is the language of the template file) then bring that into Designer and create a PDF from that.
Paul
Maybe you are looking for
-
Looking for a specific Lightroom 3 episode
Can someone help me find a specific Lightroom 3 episode on Adobe TV where Julieanne Kost edit a picture of a dog laying down, I think a golden retriever, and opened it in Photoshop to teach how to select the clear color dog against a dark background.
-
Bought tv show from iTunes but says URL not supported by server. What do I do?
-
Null Exception when XSL Files longer than 8192 char
javax.servlet.jsp.JspException: Error applying stylesheet stylesheets/Sds.xsl 8192 This is the error message obtained where transforming applying an XSL sheet longuer then 8K ! How can we use XSL files > 8k ?? Context: Oracle9iAS (9.0.3.0.0) Containe
-
Starting a external program from java
hi iam trying to start MySQL server from java, the command in dos is as follows C:\mysql\bin\mysql -u username -p ,then the user hits return and the user is prompted to enter a password. i have got as far as entering the the C:\mysql\bin\mysql -u use
-
Using 'like' in record group query
Hi , (Forms 6i) I'm creating a record group dynamically. So in when new item trigger for a list item, i want to list all names from a table like 'a%'; query : select name, to_char(id) id from test_name where name like 'a%'; but i'm not able give sing