Columns selection on a dynamic ALV (With Checkbox)
Hello all,
I have an ALV which display one column per day chosen by the user like that:
EMPLOYEE u2013 DAY01 u2013 DAY02 u2013 DAY03 u2026
Pernr/Name u2013 AUFNR1 u2013 AUFNR2 u2013 AUFNR3 u2026
Pernr/Name u2013 AUFNR1 u2013 AUFNR2 u2013 AUFNR3 u2026
Pernr/Name u2013 AUFNR1 u2013 AUFNR2 u2013 AUFNR3 u2026
My need is to allow the user to select several employees (lines) and several days (DAY1 and DAY3) or one period (DAY1 to DAY3).
After the selection, the user clicks on an ALV button to change the AUFNR data for all employees and days selected.
I'm trying to add a second u2018header lineu2019 or a first line with check box (only for u2018DAYu2019 columns) but I didnu2019t find the solution.
Could you help me?
If needed I can post my code sample.
Thanks in advance.
David
Edited by: David.pac on Dec 12, 2011 3:13 PM
Thanks for Your help.
The date is in fact a CHAR display (not really a date) so that is not the error.
For your information when i select a row in the list (format char YYYYMMDD_HHMM) it seems that Apex do not catch my select in the Session state.
I've change the item name with P2_DATE_FLOW but the problem remain.
This is the debug log if can help
0.03: Application 114, Authentication: CUSTOM2, Page Template: 3644802034190382
0.06: ...Session ID 1868105032215374 can be used
0.06: ...Application session: 1868105032215374, user=Neop
0.06: ...Determine if user "Neop" workspace "2859608277950243" can develop application "114" in workspace "2859608277950243"
0.06: Session: Fetch session header information
0.06: ...Metadata: Fetch page attributes for application 114, page 3
0.06: Fetch session state from database
0.06: Branch point: BEFORE_HEADER
0.06: Fetch application meta data
0.08: Computation point: BEFORE_HEADER
0.08: Processing point: BEFORE_HEADER
0.08: Show page template header
0.08: Computation point: AFTER_HEADER
0.08: Processing point: AFTER_HEADER
0.08: Computation point: BEFORE_BOX_BODY
0.08: Processing point: BEFORE_BOX_BODY
0.08: Region: Report 1
Report 1
0.08: show report
0.09: determine column headings
0.09: parse query as: CFM_MDRE
0.12: binding: ":P2_DATE_FLOW"="P2_DATE_FLOW" value="0"
0.14: print column headings
0.14: rows loop: 15 row(s)
No data found.
Similar Messages
-
How to select multiple records in ALV with out pressing ctrl
Hi Experts,
Is there a way to select multiple records in ALV with out pressing ctrl button on the key board?
Selection and deselection should allow multiple records.
any clue is highly appreciated.
regards,
AjayThe keyboard always plays a role, although with the Shift key you can select blocks of records.
○ CTRLclick, CTRLspacebar
Toggles a selection.
○ SHIFTclick, CTRLshift
Selects the area from the lead selection to the row selected. If no lead selection is set, the selection starts from the first row. In the multiNoLead mode, the selection starts from the row last selected -
How to add Select event in dynamic ALV
Hi,
I have created dynamic ALV and now i want to checked the selected row value.
If in the selected row contain 'A' value then i have to disable the Button given on the screen.
If in the selected row contain B' value then i have to enable the Button given on the screen.
How to add the event once I select the row.
I have done like this . but it is not
lw_api_2->do_dynamic_navigation(
source_window_name = 'ZWDCHHR_EX_TASK_DELE'
source_vusage_name = 'ZWDVHHR_EX_TASK_DELE_USAGE_1'
source_plug_name = 'TO_ALV'
target_component_name = 'SALV_WD_TABLE'
target_component_usage = 'ALV_USAGE1'
target_view_name = 'TABLE'
target_plug_name = 'DEFAULT'
target_embedding_position = 'ZWDVHHR_EX_TASK_DELE/VIEW_DELEG_MY_TASKS' ).
register event handler
lw_cmp_usage_2->add_event_handler(
listener = lw_api_2
handler_name = 'ONSELECT_TAB1'
controller_name = 'INTERFACECONTROLLER'
event_name = 'ON_SELECT' ).
Thanks and regards
Amita GandhiHi Amita,
You can try fetch the number of the row which was leadselected through R_PARAM->INDEX. (This would be just a normal integer variable. You can try check this out in debugging mode. ) Now you can just read the data of this row from the context node by saying as GET_ATTRIBUTE up on the nodes reference with the index as R_PARAM->INDEX.
Regards,
Uday -
Dynamic ALV with Static and Dynamic attributes
Hi All,
In my requirement we have some 5 static attributes and rest attributes needs needs to be dynamically created based upon the input selections. for eg my input for start date and end date is between 201023 to 201152 then weeks between this range should apear as dynamic columns.
i am able to create a dummy alv table display with out populating data into it but unable to set the data to it . Kindly help me in solving this issue.
Regards,
Sana.You might have created a dynamic node, bind the data to this node and after that use the SET_DATA method of ALV interface controller to set the data by passing the dynamically created node.
-
Dynamic Select Query including Dynamic Tables with For all Entries
Hello everyone,
I need to create a select query which involves using of Dynamic Tables.
Suppose I have a dynamic table <d1> which consist of let say 10 records.
Now i need to make a select query putting data into another dynamic table <d2>
CONCATENATE keyfield '=' '<d1>' INTO g_condition SEPARATED BY space.
CONCATENATE g_condition '-' keyfield INTO g_condition.
SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <d1>
FOR ALL ENTRIES IN <d1>
WHERE (g_condition).
But it is giving dump.
Please help me on this....Short text
A condition specified at runtime has an unexpected format.
What happened?
Error in the ABAP Application Program
The current ABAP program "ZNG_CUSTOMWRITE" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
not caught in
procedure "WRITE_ARCHIVE_PROD" "(FORM)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The current ABAP program has tried to execute an Open SQL statement
which contains a WHERE, ON or HAVING condition with a dynamic part.
The part of the WHERE, ON or HAVING condition specified at runtime in
a field or an internal table, contains the invalid value "ZCOURIER-ZCOURIERID".
CONCATENATE keyfield '=' g_header INTO g_condition SEPARATED BY space.
CONCATENATE g_condition '-' keyfield INTO g_condition.
SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <dyn_table1>
FOR ALL ENTRIES IN <dyn_table>
WHERE (g_condition). -
Using dynamic captions with checkboxes
Hello.
I want to create a list of checkboxes, according to a table I get from the context, meaning there would be as much checkboxes as the lines in the table, and their caption would be one of the table's fields.
I turned on Show Dynamic Properties.
First I tried it with one checkbox, with it's caption related directly to the table's field, and it worked - but with only one checkbox displaying the first line's value, of course.
Next I put the checkbox in a subform. The subform is related to the table line, and is repeated for every row, and now the caption is only bound to the field's name, relatively.
So the subform is repeated, but the caption doesn't change at all.
How can it be done?
And can I set the checkbox's caption by code? I tried, but it didn't work.
Best regards,
Udi.Hi,
try using table control (supported in ALC 8.0) and add the checkboxe in the row.
You can then map your data node (structure) with the table.
Ashutosh -
Select single line in ALV with FM REUSE_ALV_GRID_DISPLAY
Hi!
How can i set for select just a single line in ALV? I´m using FM REUSE_ALV_GRID_DISPLAY and in layout structure doesn´t has field SEL_MODE for set.
In my ALV, in left site of colum names has a buttom for select all lines. I would like to hide this buttom. I removed this buttom from toolbar but it appear in left side of colum names yet.
Anybody can help me?I do that but buttom just disappear from toolbar. It still appear in left side of colum name.
My code:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'ALV_USER_COMMAND'
i_callback_pf_status_set = 'F_SET_PF_STATUS'
is_layout = gs_layout
it_fieldcat = gw_fieldcat
TABLES
t_outtab = gw_relat
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM f_set_pf_status USING t_kkblo_t_extab.
DATA: lw_fcode TYPE TABLE OF sy-ucomm.
APPEND '&ALL' TO lw_fcode.
APPEND '&SAL' TO lw_fcode.
SET PF-STATUS 'ALV_STATUS_GUI' EXCLUDING lw_fcode.
ENDFORM. "F_SET_PF_STATUS -
Editable ALV with checkbox, how to use on_change event
Hi experts,
I used an editable ALV. In firs collumn I Used an cell editor checkbox (cl_salv_wd_uie_checkbox). I neet to react on each click on each checkbox in order to do some actions in context, that is not part (mapped) to ALV.
There are IF_SALV_WD_CONFIG~CHANGED event in checkbox class. Is it possible to use (and how) this event for my task ? Any example ?...
Thanks, GabrielHi Gabriel,
Try uisng ON_DATA_CHECK event.
Create a method and assign the above mentioned event. In the method have the folleoing code.
FIELD-SYMBOLS: <l_value> TYPE ANY .
Find the check box that has modified
LOOP AT r_param->t_modified_cells INTO ls_modified_cell
WHERE attribute EQ 'ATTRIBUTE NAME'.
ASSIGN ls_modified_cell-r_value->* TO <l_value> .
CLEAR lv_index .
lv_index = ls_modified_cell-index .
ENDLOOP
<l_value> should have the value. In your case X or space.
You can also find index for that which is lv_index.
So now you know the index so u know in which cell the check box is modified.
Try that.
Thank You,
Gajendra. -
hello!
i have seen the same topic here, but i can't find it again!
can anybody help me?no, i mean a "real" tree..
or is there a possibility to show the data with spaces in front, like
aaaa
bbbb
ccccc
dddd -
could anyone tell me how to display the c: drive in Jtree view and add check box for particular folder files
You might want to take a look here and here as a starting point.
-
Multiple Rows and Columns selection on ALV
Hi all,
What is the best solution to allow the multiple selection or combination of selection (rows and columns) on an ALV ?
I would like to be able to select some rows and some columns and to get the result cells in order to update them.
Thanks in advance for your help.
DavidThanks Srinivas and Seela,
I forgot to precise that my ALV is dynamic, I used the method 'add_new_child_node'.
I tried the different possibilties with method attributes but I don't find the good attributes combination to allow columns selection.
I add also that I have to be able to select several no adjacent columns.
What do you think about this workaround :
Is it possible to add a line on my ALV with checkbox between the header line (with column title) and data line.
I will search using the method add_cell_variant but I don't know if it's possible with dynamic ALV.
Thanks.
David -
Hello Friends,
Im using alv with checkbox and im getting selected checkbox values in my internal table but now i want to pass this internal table to another transaction and want to display the same in table control in screen painter.
also when the user tick the checkbox in the alv grid and click on save button i want tht screen should disappear how can we achieve this?
pls suggest?
Regards,
SunnyHi,
Check with the following link.
http://help.sap.com/saphelp_nw04/helpdata/en/26/46fb40f17af66fe10000000a1550b0/content.htm
ALV GRID update internal table
Regards,
Neelima. -
Textview with totals based on dynamic ALV selections
Hi all, it´s me again, suffering like a mother with my first WDA serious application
I have this ALV with a prices column, with an editable checkbox field, and what my client wants is a field on the screen (I think it must be a Textview) that displays the total sum of all selected rows in the ALV. Of course, this sum must be dynamic, according with the actual selection.
Could anyone tell what should I do?
Thanks a lot, best regards.
Federico AlvarezHi Fedrico,
Seeing your problem, You hv to write the logic on the ON_DATA_CHECK event of the alv grid.
I am giving you a sample code that might helps you.
METHOD on_data_check .
Data declaration for assigning the contract,total and balance(remaining) amount
DATA : lo_nd_contract_payment TYPE REF TO if_wd_context_node,
lo_el_contract_payment TYPE REF TO if_wd_context_element,
ls_contract_payment TYPE wd_this->element_contract_payment,
lv_contract_amount LIKE ls_contract_payment-contract_amount,
lv_value_date LIKE ls_contract_payment-value_date.
Data Declaration
DATA : lo_nd_payment_table TYPE REF TO if_wd_context_node,
lo_el_payment_table TYPE REF TO if_wd_context_element,
ls_payment_table TYPE wd_this->element_payment_table,
lt_payment_table LIKE TABLE OF ls_payment_table,
lv_total_amount LIKE ls_payment_table-amount,
lv_balance_amount LIKE ls_payment_table-amount,
lv_paymeth LIKE ls_payment_table-payment_method,
lt_paycreate TYPE TABLE OF /dmpui/db_str_paycreate,
ls_paycreate TYPE /dmpui/db_str_paycreate.
Data declartion for message manager
DATA : lo_api_controller TYPE REF TO if_wd_controller,
lo_message_manager TYPE REF TO if_wd_message_manager.
get message manager
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
navigate from <CONTEXT> to <PAYMENT_TABLE> via lead selection
lo_nd_payment_table = wd_context->get_child_node( name = wd_this->wdctx_payment_table ).
check for data error in the grid
CHECK r_param->t_error_cells IS INITIAL.
IF lo_nd_payment_table IS NOT INITIAL.
get all declared attrigbutes
lo_nd_payment_table->get_static_attributes_table(
IMPORTING
table = lt_payment_table ).
ENDIF.
lo_el_payment_table = lo_nd_payment_table->get_element( ).
lo_el_payment_table->get_attribute(
EXPORTING
name = `PAYMENT_METHOD`
IMPORTING
value = lv_paymeth ).
lv_total_amount = 0.
wd_assist->gc_total_amount = 0.
IF lt_payment_table[] IS NOT INITIAL.
Looping at the payment internal table*
LOOP AT lt_payment_table INTO ls_payment_table.
lv_total_amount = lv_total_amount + ls_payment_table-amount.
ENDIF.
CLEAR ls_payment_table.
ENDLOOP.
ENDIF.
Passing the Total Amount Value to the Assistance class variable
wd_assist->gc_total_amount = lv_total_amount.
navigate from <CONTEXT> to <CONTRACT_PAYMENT> via lead selection
lo_nd_contract_payment = wd_context->get_child_node( name = wd_this->wdctx_contract_payment ).
get element via lead selection
lo_el_contract_payment = lo_nd_contract_payment->get_element( ).
lo_el_contract_payment->get_attribute(
EXPORTING
name = `CONTRACT_AMOUNT`
IMPORTING
value = lv_contract_amount ).
Calculating the balance amount
lv_balance_amount = lv_contract_amount - wd_assist->gc_total_amount.
get single attribute
lo_el_contract_payment->set_attribute(
EXPORTING
name = `TOTAL_AMOUNT`
value = wd_assist->gc_total_amount ).
lo_el_contract_payment->set_attribute(
EXPORTING
name = `BALANCE_AMOUNT`
value = lv_balance_amount ).
Binding the data to the context node
lo_nd_payment_table->bind_table(
EXPORTING
new_items = lt_payment_table " List of Elements or Model Data
set_initial_elements = abap_true " If TRUE, Set Initial Elements Otherwise Add
ENDMETHOD.
Regards
Manoj Kumar
Edited by: Manoj Kumar on Feb 27, 2009 10:25 AM -
ALV with dynamic columns and description labels in header titles
Hi everybody,
I have to implement an ALV whose columns are not defined until runtime. Is it possible to do that in some simple way? Is it necessary to use objects to define this kind of ALV's?
And another one query, is it possible to add description labels to column headers so that when the user points with the cursor in them he/she gets a little explanation about the detail of the column (for example, description name of the product hierarchy when pointing to the column named with one of the existing hierarchies, i.e 010102102)
Thanks in advance,for your first question check this
Just check this sample from one of the SAP site
ABAP Code Sample for Dynamic Table for ALV with Cell Coloring
Applies To:
ABAP / ALV Grid
Article Summary
ABAP Code Sample that uses dynamic programming techniques to build a dynamic internal table for display in an ALV Grid with Cell Coloring.
Code Sample
REPORT zcdf_dynamic_table.
* Dynamic ALV Grid with Cell Coloring.
* Build a field catalog dynamically and provide the ability to color
* the cells.
* To test, copy this code to any program name and create screen 100
* as described in the comments. After the screen is displayed, hit
* enter to exit the screen.
* Tested in 4.6C and 6.20
* Charles Folwell - [email protected] - Feb 2, 2005
DATA:
r_dyn_table TYPE REF TO data,
r_wa_dyn_table TYPE REF TO data,
r_dock_ctnr TYPE REF TO cl_gui_docking_container,
r_alv_grid TYPE REF TO cl_gui_alv_grid,
t_fieldcat1 TYPE lvc_t_fcat, "with cell color
t_fieldcat2 TYPE lvc_t_fcat, "without cell color
wa_fieldcat LIKE LINE OF t_fieldcat1,
wa_cellcolors TYPE LINE OF lvc_t_scol,
wa_is_layout TYPE lvc_s_layo.
FIELD-SYMBOLS:
<t_dyn_table> TYPE STANDARD TABLE,
<wa_dyn_table> TYPE ANY,
<t_cellcolors> TYPE lvc_t_scol,
<w_field> TYPE ANY.
START-OF-SELECTION.
* Build field catalog based on your criteria.
wa_fieldcat-fieldname = 'FIELD1'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-coltext = 'My Field 1'.
wa_fieldcat-seltext = wa_fieldcat-coltext.
APPEND wa_fieldcat TO t_fieldcat1.
wa_fieldcat-fieldname = 'FIELD2'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-coltext = 'My Field 2'.
wa_fieldcat-seltext = wa_fieldcat-coltext.
APPEND wa_fieldcat TO t_fieldcat1.
* Before adding cell color table, save fieldcatalog to pass
* to ALV call. The ALV call needs a fieldcatalog without
* the internal table for cell coloring.
t_fieldcat2[] = t_fieldcat1[].
* Add cell color table.
* CALENDAR_TYPE is a structure in the dictionary with a
* field called COLTAB of type LVC_T_SCOL. You can use
* any structure and field that has the type LVC_T_SCOL.
wa_fieldcat-fieldname = 'T_CELLCOLORS'.
wa_fieldcat-ref_field = 'COLTAB'.
wa_fieldcat-ref_table = 'CALENDAR_TYPE'.
APPEND wa_fieldcat TO t_fieldcat1.
* Create dynamic table including the internal table
* for cell coloring.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat1
IMPORTING
ep_table = r_dyn_table
EXCEPTIONS
generate_subpool_dir_full = 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.
* Get access to new table using field symbol.
ASSIGN r_dyn_table->* TO <t_dyn_table>.
* Create work area for new table.
CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
* Get access to new work area using field symbol.
ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
* Get data into table from somewhere. Field names are
* known at this point because field catalog is already
* built. Read field names from the field catalog or use
* COMPONENT <number> in a DO loop to access the fields. A
* simpler hard coded approach is used here.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = 'ABC'.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = 'XYZ'.
APPEND <wa_dyn_table> TO <t_dyn_table>.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = 'TUV'.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = 'DEF'.
APPEND <wa_dyn_table> TO <t_dyn_table>.
* Color cells based on your criteria. In this example, a test on
* FIELD2 is used to decide on color.
LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
* Get access to internal table used to color cells.
ASSIGN COMPONENT 'T_CELLCOLORS'
OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
CLEAR wa_cellcolors.
wa_cellcolors-fname = 'FIELD2'.
IF <w_field> = 'DEF'.
wa_cellcolors-color-col = '7'.
ELSE.
wa_cellcolors-color-col = '5'.
ENDIF.
APPEND wa_cellcolors TO <t_cellcolors>.
MODIFY <t_dyn_table> FROM <wa_dyn_table>.
ENDLOOP.
* Display screen. Define screen 100 as empty, with next screen
* set to 0 and flow logic of:
* PROCESS BEFORE OUTPUT.
* MODULE initialization.
* PROCESS AFTER INPUT.
CALL SCREEN 100.
* MODULE initialization OUTPUT
MODULE initialization OUTPUT.
* Set up for ALV display.
IF r_dock_ctnr IS INITIAL.
CREATE OBJECT r_dock_ctnr
EXPORTING
side = cl_gui_docking_container=>dock_at_left
ratio = '90'.
CREATE OBJECT r_alv_grid
EXPORTING i_parent = r_dock_ctnr.
* Set ALV controls for cell coloring table.
wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
* Display.
CALL METHOD r_alv_grid->set_table_for_first_display
EXPORTING
is_layout = wa_is_layout
CHANGING
it_outtab = <t_dyn_table>
it_fieldcatalog = t_fieldcat2.
ELSE. "grid already prepared
* Refresh display.
CALL METHOD r_alv_grid->refresh_table_display
EXPORTING
i_soft_refresh = ' '
EXCEPTIONS
finished = 1
OTHERS = 2.
ENDIF.
ENDMODULE. " initialization OUTPUT -
ALV with multiple header & dynamic columns
Hello All,
I have a requirement where in I need to print multiple header in alv.
For eg.
User Name : <Name_1>
Channel : <Channel_1>
Sale Org : <Sales Org_1>
Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8
User Name : <Name_2>
Channel : <Channel_2>
Sale Org : <Sales Org_2>
Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8
no of columns (Col1 , col2 ) are dynamic . Which would be the best alv type do I need do use? Is it possible using simple alv grid display. How to handle dynamic column.
Thnx.it is not possible with normal grid or list.
I guess it is possible by using ALV Block list
Modified below program to get mutiple header
REPORT z_alv_block_list.
Type-pools
TYPE-POOLS: slis.
Data declarations.
DATA: BEGIN OF t_vbak OCCURS 0,
vbeln TYPE vbeln,
bstnk TYPE vbak-bstnk,
erdat TYPE vbak-erdat,
kunnr TYPE vbak-kunnr,
END OF t_vbak.
DATA: BEGIN OF t_vbap OCCURS 0,
vbeln TYPE vbeln,
matnr TYPE vbap-matnr,
netpr TYPE vbap-netpr,
waerk TYPE vbap-waerk,
kwmeng TYPE vbap-kwmeng,
meins TYPE vbap-meins,
END OF t_vbap.
DATA: t_fieldcatalog1 TYPE slis_t_fieldcat_alv.
DATA: t_fieldcatalog2 TYPE slis_t_fieldcat_alv.
DATA: v_repid TYPE syrepid.
DATA: s_layout TYPE slis_layout_alv.
DATA: v_tabname TYPE slis_tabname.
DATA: t_events TYPE slis_t_event.
start-of-selection event.
START-OF-SELECTION.
v_repid = sy-repid.
Get the fieldcatalog for the first block
PERFORM get_fieldcat1 CHANGING t_fieldcatalog1.
Get the fieldcatalog for the second block
PERFORM get_fieldcat2 CHANGING t_fieldcatalog2.
Get the data for the first block
SELECT vbeln bstnk erdat kunnr UP TO 10 ROWS
INTO TABLE t_vbak
FROM vbak WHERE vbeln > '0060000100'.
Get the data for the second block
SELECT vbeln matnr netpr waerk kwmeng meins UP TO 10
ROWS
INTO TABLE t_vbap
FROM vbap WHERE vbeln > '0060000100'.
init
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid.
First block
v_tabname = 'ITAB1'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = s_layout
it_fieldcat = t_fieldcatalog1
i_tabname = v_tabname
it_events = t_events
TABLES
t_outtab = t_vbak.
Second block
v_tabname = 'ITAB2'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = s_layout
it_fieldcat = t_fieldcatalog2
i_tabname = v_tabname
it_events = t_events
TABLES
t_outtab = t_vbap.
*Display
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
FORM GET_FIELDCAT1
Get the field catalog for the first block
FORM get_fieldcat1 CHANGING lt_fieldcatalog TYPE
slis_t_fieldcat_alv.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
Order number
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'VBELN'.
s_fieldcatalog-tabname = 'T_VBAK'.
s_fieldcatalog-ref_tabname = 'VBAK'.
s_fieldcatalog-ref_fieldname = 'VBELN'.
APPEND s_fieldcatalog TO lt_fieldcatalog.
CLEAR s_fieldcatalog.
Customer purchase order.
s_fieldcatalog-col_pos = '2'.
s_fieldcatalog-fieldname = 'BSTNK'.
s_fieldcatalog-tabname = 'T_VBAK'.
s_fieldcatalog-ref_tabname = 'VBAK'.
s_fieldcatalog-ref_fieldname = 'BSTNK'.
APPEND s_fieldcatalog TO lt_fieldcatalog.
CLEAR s_fieldcatalog.
Creation date.
s_fieldcatalog-col_pos = '3'.
s_fieldcatalog-fieldname = 'ERDAT'.
s_fieldcatalog-tabname = 'T_VBAK'.
s_fieldcatalog-ref_tabname = 'VBAK'.
s_fieldcatalog-ref_fieldname = 'ERDAT'.
APPEND s_fieldcatalog TO lt_fieldcatalog.
CLEAR s_fieldcatalog.
Customer
s_fieldcatalog-col_pos = '4'.
s_fieldcatalog-fieldname = 'KUNNR'.
s_fieldcatalog-tabname = 'T_VBAK'.
s_fieldcatalog-ref_tabname = 'VBAK'.
s_fieldcatalog-ref_fieldname = 'KUNNR'.
APPEND s_fieldcatalog TO lt_fieldcatalog.
CLEAR s_fieldcatalog.
ENDFORM.
FORM GET_FIELDCAT2
Get the field catalog for the second block
FORM get_fieldcat2 CHANGING lt_fieldcatalog TYPE
slis_t_fieldcat_alv.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
Order number
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'VBELN'.
s_fieldcatalog-tabname = 'T_VBAP'.
s_fieldcatalog-ref_tabname = 'VBAP'.
s_fieldcatalog-ref_fieldname = 'VBELN'.
APPEND s_fieldcatalog TO lt_fieldcatalog.
CLEAR s_fieldcatalog.
Material number
s_fieldcatalog-col_pos = '2'.
s_fieldcatalog-fieldname = 'MATNR'.
s_fieldcatalog-tabname = 'T_VBAP'.
s_fieldcatalog-ref_tabname = 'VBAP'.
s_fieldcatalog-ref_fieldname = 'MATNR'.
APPEND s_fieldcatalog TO lt_fieldcatalog.
CLEAR s_fieldcatalog.
Net price
s_fieldcatalog-col_pos = '3'.
s_fieldcatalog-fieldname = 'NETPR'.
s_fieldcatalog-tabname = 'T_VBAP'.
s_fieldcatalog-ref_tabname = 'VBAP'.
s_fieldcatalog-ref_fieldname = 'NETPR'.
s_fieldcatalog-cfieldname = 'WAERK'.
s_fieldcatalog-ctabname = 'T_VBAP'.
APPEND s_fieldcatalog TO lt_fieldcatalog.
CLEAR s_fieldcatalog.
Currency.
s_fieldcatalog-col_pos = '4'.
s_fieldcatalog-fieldname = 'WAERK'.
s_fieldcatalog-tabname = 'T_VBAP'.
s_fieldcatalog-ref_tabname = 'VBAP'.
s_fieldcatalog-ref_fieldname = 'WAERK'.
APPEND s_fieldcatalog TO lt_fieldcatalog.
CLEAR s_fieldcatalog.
Quantity
s_fieldcatalog-col_pos = '5'.
s_fieldcatalog-fieldname = 'KWMENG'.
s_fieldcatalog-tabname = 'T_VBAP'.
s_fieldcatalog-ref_tabname = 'VBAP'.
s_fieldcatalog-ref_fieldname = 'KWMENG'.
s_fieldcatalog-qfieldname = 'MEINS'.
s_fieldcatalog-qtabname = 'T_VBAP'.
APPEND s_fieldcatalog TO lt_fieldcatalog.
CLEAR s_fieldcatalog.
UOM
s_fieldcatalog-col_pos = '6'.
s_fieldcatalog-fieldname = 'MEINS'.
s_fieldcatalog-tabname = 'T_VBAP'.
s_fieldcatalog-ref_tabname = 'VBAP'.
s_fieldcatalog-ref_fieldname = 'MEINS'.
APPEND s_fieldcatalog TO lt_fieldcatalog.
CLEAR s_fieldcatalog.
ENDFORM.
Maybe you are looking for
-
Is there a way to create a rollover on top of a hover state?
I'm trying to do a hover action on top of another hover. Is there a way to do this? Thanks!
-
How to lock transaction codes in ABAP report
Hello all, I'm now planning to lock several transaction codes as a batch job to prevent end users from using locked tr-cds while processing batch jobs during online service period. I found out tr-cd: SM01 to lock tr-cds, but I don't get what I can do
-
Business rules and active databses
All, Are there any good links where I can read about the limitations of active database features (such as constraints and triggers) and other options and alternatives to implementing business rules? Regards
-
Empty rows in a table should not be displayed
Hi, I have an ADF table which contains 10 rows and 5 columsns, in which i have rendered all the values in 5 columns of 5 rows to false. But when displaying the table,the empty rows are displaying by overlapping.. I do not want to display those empty
-
Brand New Apple User trying to import video files from FreeAgent External..
hard drive. Previous Dell owner and now I have converted. I have files saved to my FA Drive in a .MOD version and cannot play them on my Apple. What do I have to do to accomplish this? I have a JVC Everio HD camcorder. Any help for a newbie would be