When do we need field catalog merge in ALV
Hi all,
When do we actually need fieldcatalog merge in ALV's
Regards
Saroja.
Hi
When you want the field catalog to be populated directly from the internal table or a structure, you can use this function module. If you are populating the field catalog from an internal table in an include other than your top include, then the include name also has to be passed to the function module.
reward if helpful
regards,
madhu
Similar Messages
-
Doubt in using field catalog merge function
hi all,
When I am using the function maodule reuse_alv_fieldcatalog_merge for building the field catalog in alv list,it was giving abend message as
'Field catalog is empty'.
what might be the reason for such message?can some one help me out with the solution to get rid of that.
I cant populate the catalog manually because I need to display nearly 40 fields in the output.
Thanks in advance.hI
Supports the creation of the field catalog for the ALV function modules
based either on a structure or table defined in the ABAP Data
Dictionary, or a program-internal table.
The program-internal table must either be in a TOP Include or its
Include must be specified explicitly in the interface.
The variant based on a program-internal table should only be used for
rapid prototyping since the following restrictions apply:
o Performance is affected since the code of the table definition must
always be read and interpreted at runtime.
o Dictionary references are only considered if the keywords LIKE or
INCLUDE STRUCTURE (not TYPE) are used.
If the field catalog contains more than 90 fields, the first 90 fields
are output in the list by default whereas the remaining fields are only
available in the field selection.
If the field catalog is passed with values, they are merged with the
'automatically' found information.
Below is an example ABAP program which will populate a simple internal table(it_ekpo) with data and
display it using the basic ALV grid functionality(including column total). The example details the main
sections of coding required to implement the ALV grid functionality:
Data declaration
Data retrieval
Build fieldcatalog
Build layout setup
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
* i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
* IT_EVENTS = GT_XEVENTS
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL -
Field catalog merge in Classes
Hi,
I need to use field catalog merge without using FM . not manual field catalog.I want to call Class and use in ALV.
Regards,
NandhaHi Nandha,
why you can't use FM?
it's common to use LVC_FIELDCATALOG_MERGE using ALV GRID CONTROLL (with class). -
AlV! Field Catalog Merge!
Hi!
What is Field catalog merge in ALVHi,
YOU HAVE TWO WAYS TO BUILD A FIELD CATALOG
1) FIRST METHOD
data w_fieldcat type slis_fieldcat_alv.
type-pools : slis.
tables : sflight.
data : i_fieldcat type slis_T_fieldcat_alv.
data v_repid like sy-repid.
data : begin of i_sflight occurs 0,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
end of i_sflight.
w_fieldcat-tabname = 'I_SFLIGHT'.
w_fieldcat-fieldname = 'CARRID'.
w_fieldcat-outputlen = '10'.
w_fieldcat-col_pos = '1'.
w_fieldcat-row_pos = '1'.
w_fieldcat-seltext_l = 'Carrie ID'.
w_fieldcat-seltext_M = 'Carrie ID'.
w_fieldcat-seltext_S = 'Carrie ID'.
w_fieldcat-HOTSPOT = 'X'.
append w_fieldcat to i_fieldcat.
clear w_fieldcat.
w_fieldcat-tabname = 'I_SFLIGHT'.
w_fieldcat-fieldname = 'CONNID'.
w_fieldcat-outputlen = '10'.
w_fieldcat-col_pos = '1'.
w_fieldcat-row_pos = '1'.
w_fieldcat-seltext_l = 'CONNI ID'.
w_fieldcat-seltext_M = 'CONNI ID'.
w_fieldcat-seltext_S = 'CONNIID'.
w_fieldcat-HOTSPOT = 'X'.
append w_fieldcat to i_fieldcat.
clear w_fieldcat.
w_fieldcat-tabname = 'I_SFLIGHT'.
w_fieldcat-fieldname = 'FLDATE'.
w_fieldcat-outputlen = '10'.
w_fieldcat-col_pos = '1'.
w_fieldcat-row_pos = '1'.
w_fieldcat-seltext_l = 'FLDATE.
w_fieldcat-seltext_M = 'FLDATE'.
w_fieldcat-seltext_S = 'FLDATE'.
w_fieldcat-HOTSPOT = 'X'.
append w_fieldcat to i_fieldcat.
clear w_fieldcat.
2) SECOND METHOD
data w_fieldcat type slis_fieldcat_alv.
type-pools : slis.
tables : sflight.
data : i_fieldcat type slis_T_fieldcat_alv.
data v_repid like sy-repid.
data : begin of i_sflight occurs 0,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
end of i_sflight.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = v_repid
i_internal_tabname = 'I_SFLIGHT'
i_inclname = v_repid
changing
ct_fieldcat = I_fieldcatalog_TYPE.
Reward points if helpful
THANKS
Venki -
Field Catalog in the ALV reports...
Hi Friends,
When we set a field catalog for a field, it will carry same properties for all the records in the list under that field. My question is whether we can have a record or some records without the properties of that field catalog. Hope you guys understood my question.
Thanx in advance,
RamHi Ram ,
you can make your fieldcatalog for that field by only giving the name of field and rest of the required field property as blank '' or as per your requirement.
regards
Saj -
Field catalog update in ALV grid
Hi All,
When you're changing an existing field catalog in an ALV grid, there's a possibility this change will not appear immediately in the list display.
Can anyone explain this,
Kind regards,
Rob Makelaar.
The NetherlandsHi Rob
ALV as an encapsulated object uses some kind of buffer for the field catalog. You can switch buffer capabilities with the parameter <b>"I_BUFFER_ACTIVE"</b> of the method <b>"set_table_for_first_display"</b>.
The use of this parameter is explained as follows:
<i>Flag to be set by the application if the method call is static. This means the method is always called with the same field catalog. In this case, the field catalog can be held in a special buffer. This accelerates the display of small lists, in particular.</i>
And as an additional point, you should have marked this thread as a question thread since you require some answer. If you want so, you can do this by editing your original post and check relevant checkbox under the editbox. This way you can reward points to helpful posts using the scala at the left of each particular post and you can mark a question as solved to save SDNers's times.
Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a> -
ALV int report using field catalog merge
Hi folks,
Can anyone here please provide me an alv interactive report?
K.Kiran.report zialv_edit_simple1 .
include <icon>.
Definition of Grid event-handler class
class lcl_grid_event_receiver definition.
public section.
methods:
toolbar for event toolbar
of cl_gui_alv_grid
importing e_object
e_interactive
,user_command for event user_command
of cl_gui_alv_grid
importing e_ucomm
. " Period
endclass.
*mplementation of Grid event-handler class
class lcl_grid_event_receiver implementation.
Method for handling all creation/modification calls to the toolbar
method toolbar.
data : ls_toolbar type stb_button.
Define Custom Button in the toolbar
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EDIT' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'EDIT' to ls_toolbar-text.
move icon_change_text to ls_toolbar-icon.
move 'Click2Edit' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'UPDA' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'UPDATE' to ls_toolbar-text.
move icon_system_save to ls_toolbar-icon.
move 'Click2Update' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EXIT' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'EXIT' to ls_toolbar-text.
move icon_system_end to ls_toolbar-icon.
move 'Click2Exit' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
endmethod.
Method to handle user commands from toolbar
method user_command.
case e_ucomm .
when 'EDIT'.
perform set_input.
when 'UPDA'.
perform refresh_disp.
perform update_table.
when 'EXIT'.
leave program.
endcase.
endmethod.
endclass.
Declarations
parameters:
p_intab type dfies-tabname default 'SAPLANE'.
data :
dref type ref to data,
it_grid_fcat type lvc_t_fcat,
struct_grid_lset type lvc_s_layo,
tab_info like table of dfies.
field-symbols :
<fs_tab> like line of tab_info,
Output Structure****
<it_disptab> type table.
data :
ok_code like sy-ucomm
,save_ok like sy-ucomm
Container Object [grid_container]
,grid_container type ref to cl_gui_custom_container
Control Object [grid]
,grid type ref to cl_gui_alv_grid
Event-Handler Object [grid_handler]
,grid_handler type ref to lcl_grid_event_receiver
. " period
Begin of process logic
start-of-selection.
call screen '0100'.
*& Module STATUS_0100 OUTPUT
PBO module ...Displays the Grid
module status_0100 output.
A L V G R I D
if grid_container is initial.
create object grid_container
exporting
container_name = 'CCONTAINER1'.
create object grid
exporting
i_appl_events = 'X'
i_parent = grid_container.
create object grid_handler.
set handler:
grid_handler->user_command for grid,
grid_handler->toolbar for grid .
*Assigning the input value to <fs_tab>-tabname
assign p_intab to <fs_tab>-tabname .
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = <fs_tab>-tabname
changing
ct_fieldcat = it_grid_fcat.
*Creating internal table
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_grid_fcat
importing
ep_table = dref.
assign dref->* to <it_disptab>.
perform populate_grid_data .
call method grid->set_ready_for_input
exporting
i_ready_for_input = 0.
*Enabling the grid to edit mode,
*setting table name as title of the grid
struct_grid_lset-edit = 'X'. "To enable editing in ALV
struct_grid_lset-grid_title = p_intab.
call method grid->set_table_for_first_display
exporting
is_layout = struct_grid_lset
changing
it_outtab = <it_disptab>
it_fieldcatalog = it_grid_fcat
. " Period
endif.
endmodule.
*& Module USER_COMMAND_0100 INPUT
module user_command_0100 input.
****User Commands are handled as events in method user_command.
endmodule. " USER_COMMAND_0100 INPUT
*& Form EXIT_PROGRAM
form exit_program.
call method grid_container->free.
call method cl_gui_cfw=>flush.
leave program.
endform. " EXIT_PROGRAM
*& Form populate_grid_data
form populate_grid_data.
select * from (p_intab) into corresponding fields of table <it_disptab>.
endform. " populate_grid_data
FORM refresh_disp *
form refresh_disp.
call method grid->refresh_table_display.
endform.
FORM update_table *
form update_table.
modify (p_intab) from table <it_disptab>.
call method grid->set_ready_for_input
exporting
i_ready_for_input = 0.
endform.
FORM set_input *
form set_input.
call method grid->set_ready_for_input
exporting
i_ready_for_input = 1.
endform.
Screen Logic :
process before output.
module status_0100.
process after input.
module user_command_0100. -
Hi ,
I have passed the internal table name which is going to be displayed in the output to the parameter I_Tablename in REUSE_ALV_FIELDCATALOG_MERGE, but its going to the short dump... If i pass the structure name say zstru to I_Structurename in the function module its not going to the dump... Any one can please explain where exactly the problem is ... and one more thing i am working with ECC 6.0 Version..
Thank & Regards.
Laxman.P
B'lore.Paas the name of internal table in CAPS and within commas
eg
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-CPROG
I_INTERNAL_TABNAME = 'GT_HEAD'
I_STRUCTURE_NAME = 'ZHRG_MED'
CHANGING
CT_FIELDCAT = P_FCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_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.
U can also try the following code without commas
FORM init_fieldcat USING itab type any
incl type any.
DATA: ls_fieldcat TYPE slis_fieldcat_alv,
i_repid LIKE sy-repid.
i_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_repid
i_internal_tabname = itab
I_STRUCTURE_NAME =
i_client_never_display = 'X'
i_inclname = incl
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 0
program_error = 0
OTHERS = 0.
ENDFORM. " INIT_FIELDCAT
Reward points , if useful -
'Field Catalog not Found' - ALV Grid using CustomContainer+Fcat
The Following piece of code throws 'Field Catalgo not found'
Please give me necessary changes in the code.
Thanks & Regards
Harsha Ch.
*& Report ZCHK_ALV_CUSCONT1 *
REPORT zchk_alv_cuscont1 .
DATA itab LIKE STANDARD TABLE OF mara WITH HEADER LINE.
SELECT matnr meins mbrsh FROM mara INTO CORRESPONDING FIELDS OF TABLE itab UP TO 10 ROWS.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
DATA fcat1 TYPE lvc_t_fcat WITH HEADER LINE.
DATA fcat TYPE STANDARD TABLE OF lvc_s_fcat.
DATA: c1 TYPE REF TO cl_gui_custom_container.
DATA: a1 TYPE REF TO cl_gui_alv_grid.
CREATE OBJECT c1 EXPORTING container_name = 'CC_ALV'.
CREATE OBJECT a1 EXPORTING i_parent = c1.
PERFORM populate_fcat.
PERFORM generate_grid.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form POPULATE_FCAT
text
--> p1 text
<-- p2 text
FORM populate_fcat .
fcat1-reptext = 'MATNR'.
fcat1-fieldname = 'MATNR'.
fcat1-col_pos = '1'.
APPEND fcat1.
CLEAR fcat1.
fcat1-reptext = 'MEINS'.
fcat1-fieldname = 'MEINS'.
fcat1-col_pos = '2'.
APPEND fcat1.
CLEAR fcat1.
fcat1-reptext = 'MBRSH'.
fcat1-fieldname = 'MBRSH'.
fcat1-col_pos = '3'.
APPEND fcat1.
CLEAR fcat1.
ENDFORM. " POPULATE_FCAT
*& Form GENERATE_GRID
text
--> p1 text
<-- p2 text
FORM generate_grid .
CALL METHOD a1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'MARA'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = itab[]
IT_FIELDCATALOG = fcat
IT_SORT =
IT_FILTER =
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.
ENDFORM. " GENERATE_GRIDHi
This works fine:
*& Report ZCHK_ALV_CUSCONT1 *
DATA ITAB LIKE STANDARD TABLE OF MARA WITH HEADER LINE.
DATA FCAT1 TYPE LVC_T_FCAT WITH HEADER LINE.
DATA FCAT TYPE STANDARD TABLE OF LVC_S_FCAT.
DATA: C1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: A1 TYPE REF TO CL_GUI_ALV_GRID.
START-OF-SELECTION.
SELECT MATNR MEINS MBRSH FROM MARA INTO CORRESPONDING FIELDS OF TABLE
ITAB UP TO 10 ROWS.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* TEXT
MODULE STATUS_0100 OUTPUT.
* PERFORM POPULATE_FCAT.
PERFORM GENERATE_GRID.
ENDMODULE. " STATUS_0100 OUTPUT
* FORM POPULATE_FCAT *
FORM POPULATE_FCAT .
FCAT1-REPTEXT = 'MATNR'.
FCAT1-FIELDNAME = 'MATNR'.
FCAT1-COL_POS = '1'.
APPEND FCAT1.
CLEAR FCAT1.
FCAT1-REPTEXT = 'MEINS'.
FCAT1-FIELDNAME = 'MEINS'.
FCAT1-COL_POS = '2'.
APPEND FCAT1.
CLEAR FCAT1.
FCAT1-REPTEXT = 'MBRSH'.
FCAT1-FIELDNAME = 'MBRSH'.
FCAT1-COL_POS = '3'.
APPEND FCAT1.
CLEAR FCAT1.
ENDFORM. " POPULATE_FCAT
* FORM GENERATE_GRID *
FORM GENERATE_GRID .
CHECK C1 IS INITIAL.
CREATE OBJECT C1 EXPORTING CONTAINER_NAME = 'CC_ALV'.
CREATE OBJECT A1 EXPORTING I_PARENT = C1.
CALL METHOD A1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'MARA'
CHANGING
IT_OUTTAB = ITAB[].
ENDFORM. " GENERATE_GRID
Max -
Translation of the Field label that is passe in the field catalog on ALV
Hiii
i there a way to make ALV column field label in different language
let say i have 3 radio button language english , french , and dutch
depending on the radio button selected i want my alv column fields to be display in that language.
note i am using field catalog merge and alv list.
i know that can be done by forcing value in the fieldcat-fieldname
something like that
IF english
fieldcat-fieldname = English
If frence
fieldcat-fieldname = french
if dutch
fieldcat-fieldname = dutch
but suppose i have 50 field then i must do that with all 50 field for each language
i there some more easier way like setting sy-langu or setting language in the fieldcatHi newbie82 c,
the easiest way is to use the SAP logon language and have all texts in program defines as text fields. The text fields are translated once and fetched always correct according to logon language.
If you want to switch languages by radiobutton, you may define one create_fieldcat routine for each language.
Regards,
Clemens -
ALV report using the field catalog
which is the quickest way to generate an ALV report using the field catalog merge. without needing to build the field catalog manually .
is it easier to create a structure and passe it in the field catalog merge . if yes can i have an example plzzzzhI
Supports the creation of the field catalog for the ALV function modules
based either on a structure or table defined in the ABAP Data
Dictionary, or a program-internal table.
The program-internal table must either be in a TOP Include or its
Include must be specified explicitly in the interface.
The variant based on a program-internal table should only be used for
rapid prototyping since the following restrictions apply:
o Performance is affected since the code of the table definition must
always be read and interpreted at runtime.
o Dictionary references are only considered if the keywords LIKE or
INCLUDE STRUCTURE (not TYPE) are used.
If the field catalog contains more than 90 fields, the first 90 fields
are output in the list by default whereas the remaining fields are only
available in the field selection.
If the field catalog is passed with values, they are merged with the
'automatically' found information.
Below is an example ABAP program which will populate a simple internal table(it_ekpo) with data and
display it using the basic ALV grid functionality(including column total). The example details the main
sections of coding required to implement the ALV grid functionality:
Data declaration
Data retrieval
Build fieldcatalog
Build layout setup
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
* i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
* IT_EVENTS = GT_XEVENTS
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL -
Reg: ALV Field catalog refresh
Hello All,
Initially I have to display an ALV grid. Upon a buttons click(User Command) , an additional col should be displayed for which the field catalog of the ALV needs to be changed. Iam using FM ''REUSE_ALV_GRID_DISPLAY'.My question is , how cld v refresh filedcatalog ? To refresh the grid data , we use selfield-refresh = 'X'. Is there any thing some thing like that to refresh fieldcat or v have to build the fieldcat again?
I have pasted part of code below:
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = 'TRIGS_IGT_WRKLIST'
CHANGING
ct_fieldcat = c_tab_fieldcat_main.
LOOP AT c_tab_fieldcat_main ASSIGNING <l_wa_fieldcat_main>.
IF <l_wa_fieldcat_main>-fieldname = 'BUSTRANSCAT_TEXT' OR
<l_wa_fieldcat_main>-fieldname = 'VALUATION_AREA' OR
<l_wa_fieldcat_main>-fieldname = 'VALUATION_CLASS' OR
<l_wa_fieldcat_main>-fieldname = 'COMPANY_CODE' OR
<l_wa_fieldcat_main>-fieldname = 'PRODUCT_TYPE' OR
<l_wa_fieldcat_main>-fieldname = 'SECURITY_ACCOUNT' OR
<l_wa_fieldcat_main>-fieldname = 'SECURITY_ID' OR
<l_wa_fieldcat_main>-fieldname = 'IGT_STATUS_TEXT' OR
<l_wa_fieldcat_main>-fieldname = 'POSDATE' OR
<l_wa_fieldcat_main>-fieldname = 'TRLDATE' OR
<l_wa_fieldcat_main>-fieldname = 'COMPANY_ID' OR
<l_wa_fieldcat_main>-fieldname = 'COUNTERPARTY' OR
<l_wa_fieldcat_main>-fieldname = 'UNITS' OR
<l_wa_fieldcat_main>-fieldname = 'POSITION_CURR' OR
<l_wa_fieldcat_main>-fieldname = 'DEAL_NUMBER' OR
<l_wa_fieldcat_main>-fieldname = 'POSITION_AMT' .
ELSE.
<l_wa_fieldcat_main>-no_out = 'X'.
ENDIF.
Assign postion
IF <l_wa_fieldcat_main>-fieldname = 'BUSTRANSCAT_TEXT'.
<l_wa_fieldcat_main>-col_pos = 2.
<l_wa_fieldcat_main>-ddictxt = 'M'.
<l_wa_fieldcat_main>-outputlen = '5'.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'COMPANY_CODE'.
<l_wa_fieldcat_main>-col_pos = 3.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'VALUATION_AREA'.
<l_wa_fieldcat_main>-col_pos = 4.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'PRODUCT_TYPE'.
<l_wa_fieldcat_main>-col_pos = 5.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'SECURITY_ID'.
<l_wa_fieldcat_main>-col_pos = 6.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'SECURITY_ACCOUNT'.
<l_wa_fieldcat_main>-col_pos = 7.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'DEAL_NUMBER'.
<l_wa_fieldcat_main>-col_pos = 8.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'IGT_STATUS_TEXT'.
<l_wa_fieldcat_main>-col_pos = 9.
<l_wa_fieldcat_main>-ddictxt = 'M'.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'POSDATE'.
<l_wa_fieldcat_main>-col_pos = 10.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'TRLDATE'.
<l_wa_fieldcat_main>-col_pos = 11.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'COMPANY_ID'.
<l_wa_fieldcat_main>-col_pos = 12.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'UNITS'.
<l_wa_fieldcat_main>-col_pos = 13.
ENDIF.
IF <l_wa_fieldcat_main>-fieldname = 'POSITION_AMT'.
<l_wa_fieldcat_main>-col_pos = 14.
ENDIF.
ENDLOOP.
CASE sy-ucomm.
WHEN 'MATCH'.
READ TABLE c_tab_fieldcat_main ASSIGNING <l_wa_fieldcat_main>
WITH KEY fieldname = 'MATCHED'.
CHECK sy-subrc EQ 0.
<l_wa_fieldcat_main>-col_pos = 1.
<l_wa_fieldcat_main>-seltext_s = 'Matched Pairs'.
<l_wa_fieldcat_main>-seltext_m = 'Matched Pairs'.
<l_wa_fieldcat_main>-seltext_l = 'Matched Pairs'.
<l_wa_fieldcat_main>-no_out = ' '.
WHEN 'REVERSAL'.
READ TABLE c_tab_fieldcat_main ASSIGNING <l_wa_fieldcat_main>
WITH KEY fieldname = 'ICON_REVERSAL'.
CHECK sy-subrc EQ 0.
<l_wa_fieldcat_main>-col_pos = 1.
<l_wa_fieldcat_main>-icon = 'X'.
<l_wa_fieldcat_main>-outputlen = 3.
<l_wa_fieldcat_main>-no_out = ' '.
ENDCASE.
Thanks,
SriHi
U need to use the fm REUSE_ALV_GRID_LAYOUT_INFO_SET, here you can change the catalog table.
Max -
External field catalog & Info object catalogs - Role - in Flexible upload
1) What is the role of Info Object catalogs maintained in the Data Basis & the Source Data Basis?
Please be kind enough to mention a scenario u2013 underlining their utility in the consolidation process.
Like u2026.
Are they used for loading master data from source system to the BCS system?
Can they be used in the flexible upload u2013 data collection function?
Are they used for as a source of AFD data?
I came across the below documentation on flexible upload - in an SAP material.
*When uploading from a field catalog, you also have the option of using mapping. In this case, the file structure no longer has to correspond with the structure of the data basis.*
Understood the above 2 points.
*Rather, you can assign a BW InfoObjectCatalog that acts as the data structure description for the file here. You specify this InfoObjectCatalog in Customizing for the data basis.*
2)Does the above statement implies that we need not do any setting in the field catalog tab of the flexible upload? If yes, what do we do?
In the flexible upload u2013 field catalog tab u2013 we define the data structure for the file we upload (correct me if Iu2019m wrong).
If you use an external field catalog, you have to specify how you want to map the data structure for the file to the structure for the data basis.
3)Pls give an example of an external field catalog.
4)Can we use an external field catalog in the upload of RFD?
Many Thanks
Kind Regards,
KumarThere are two possibilities of using Infoobject catalog in SEM-BCS (it is true for both catalogs, characteristics and key figures):
u2022 In a data basis. The system adds these chars and KFs that are sitting in the defined in the Data Basis catalogs to u201CAdditional Fieldsu201D of each data stream (the tab strip u201CData Stream Fieldsu201D in data basis. If you check some of these fields and generate data basis, these additional infoobjects will be placed into appropriate ODS/DSO objects and you will be able to use them for uploading of some extra information.
Without indicating the Infoobject Catalog for Chars youu2019ll not be able to configure a new functionality of "assets/liabilities" at all.
u2022 In a source data basis.
After including source data basis to your data basis youu2019ll be able to use external infoobjects catalog in a method of the category Flexible Upload. Tick the flag of using the external catalog and choose the SDB. In the mapping tab youu2019ll have a possibility to choose from those chars and KFs that are located in the catalogs.
This might be used for upload of ANY data, RFD, AFD or master data.
The scenarios, I guess, are rather obvious.
Hope this helps. -
When I use Field catalog merge I get an error
i Get a runtime error where it says the internal table passes to field catalog marge has a different fields than I_INTERNAL_TABNAME . What could be the problem.
Thank youAre you passing the internal table name and field name as the same or different and also check the data type of the fieldcatalog internal table that you are passing to this FM
Check this code for ur reference.
REPORT ZMK_SHIPMENT_ALV
no standard page heading
line-size 105
line-count 50(5)
message-id zz.
TABLES *
tables : vttk, "Shipment Header
vttp, " Shipment Item
lips. " Delivary Item
***TYPE-POOLS *
type-pools : slis.
*WORK AREAS *
Work area for field catalog table
data : wa_fldcat type slis_fieldcat_alv.
Work area for Events table
data : wa_events type slis_alv_event.
Work area for layout.
data : wa_layout type slis_layout_alv.
*INTERNAL TABLES *
Shimpment Details
data : begin of itab occurs 0,
tknum like vttk-tknum,
shtyp like vttk-shtyp,
tpnum like vttp-tpnum,
vbeln like vttp-vbeln,
end of itab.
data : begin of itab1 occurs 0,
vbeln like lips-vbeln,
posnr like lips-posnr,
matnr like lips-matnr,
lfimg like lips-lfimg,
meins like lips-meins,
end of itab1.
For field catalog table
data : it_fldcats type slis_t_fieldcat_alv.
For Events table
data : it_event type slis_t_event.
For layout.
data : it_layout type slis_layout_alv.
For field catalog table
data : it_fldcats1 type slis_t_fieldcat_alv.
For Events table
data : it_event1 type slis_t_event.
data : v_repid like sy-repid.
*Data Declaration
data: v_index type sy-index,
v_vbeln like lips-vbeln.
*SELECT-OPTIONS
selection-screen begin of block b with frame title text-001.
select-options : s_tknum for vttk-tknum .
selection-screen end of block b.
*INITIALIZATION
initialization.
v_repid = sy-repid.
*START-OF-SELCTION
start-of-selection.
perform populate-data.
sort itab by tknum.
top-of-page.
write : 'Shipment wise Delivary Report'.
end-of-selection.
perform build-fieldcatalog.
perform modify-fieldcatalog.
perform build-events.
perform modify-events.
perform set-layout.
perform set-pfstatus.
perform list-display.
*& Form populate-data
Retrives the Shipment data depending on the selection criteria *
FORM populate-data.
select vttk~tknum
vttk~shtyp
vttp~tpnum
vttp~vbeln
into table itab
from vttk
join vttp
on vttptknum = vttktknum
where vttk~tknum in s_tknum.
if sy-subrc <> 0.
message e999 with 'NO DATA FOUND'.
exit.
endif.
ENDFORM. " populate-data
*& Form build-fieldcatalog
text
--> p1 text
<-- p2 text
form build-fieldcatalog.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = v_repid
i_internal_tabname = 'ITAB'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = it_fldcats
exceptions
inconsistent_interface = 1
program_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.
endform. " BUILD-FIELDCATALOG
*& Form build-events
text
--> p1 text
<-- p2 text
FORM build-events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = it_event
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " build-events
*& Form set-layout
text
--> p1 text
<-- p2 text
FORM set-layout.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-no_colhead = space.
wa_layout-no_vline = space.
ENDFORM. " set-layout
*& Form list-display
text
--> p1 text
<-- p2 text
FORM list-display.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT = wa_layout
IT_FIELDCAT = it_fldcats
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = it_event
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
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.
ENDFORM. " list-display
*& Form modify-fieldcatalog
text
--> p1 text
<-- p2 text
FORM modify-fieldcatalog.
loop at it_fldcats into wa_fldcat.
case wa_fldcat-fieldname.
when 'TKNUM'.
wa_fldcat-seltext_l = 'Ship No.'.
wa_fldcat-col_pos = 1.
wa_fldcat-ddictxt = 'L'.
when 'SHTYP'.
wa_fldcat-seltext_l = 'Ship Type'.
wa_fldcat-col_pos = 2.
wa_fldcat-ddictxt = 'L'.
when 'TPNUM'.
wa_fldcat-seltext_l = 'Item No.'.
wa_fldcat-col_pos = 3.
wa_fldcat-ddictxt = 'L'.
when 'VBELN'.
wa_fldcat-seltext_l = 'Delivary No.'.
wa_fldcat-hotspot = 'X'.
wa_fldcat-col_pos = 4.
wa_fldcat-ddictxt = 'L'.
endcase.
modify it_fldcats from wa_fldcat.
endloop.
ENDFORM. " modify-fieldcatalog
*& Form modify-events
text
--> p1 text
<-- p2 text
form modify-events.
read table it_event with key name =
slis_ev_top_of_page into wa_events.
if sy-subrc = 0.
wa_events-form = 'HEADER-OF-REPORT'.
modify it_event from wa_events index sy-tabix.
clear wa_events.
endif.
read table it_event with key name =
slis_ev_end_of_page into wa_events.
if sy-subrc = 0.
wa_events-form = 'FOOTER-OF-REPORT'.
modify it_event from wa_events index sy-tabix.
clear wa_events.
endif.
endform. " modify-events
*& Form HEADER-OF-REPORT
text
--> p1 text
<-- p2 text
FORM HEADER-OF-REPORT.
write : 'Shipment Wise Delivary Report'.
ENDFORM. " HEADER-OF-REPORT
*& Form FOOTER-OF-REPORT
text
--> p1 text
<-- p2 text
FORM FOOTER-OF-REPORT.
write : 'End of Report'.
ENDFORM. " FOOTER-OF-REPORT
*& Form USER_COMMAND
User command for Calling Transaction VT03N, Execute and Refresh
FORM user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
V_INDEX = P_SELFIELD-TABINDEX. " holds the selected table index
CASE p_ucomm.
WHEN '&IC1'.
IF p_selfield-fieldname eq 'VBELN'.
perform secondary_list.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND
*& Form secondary_list
text
--> p1 text
<-- p2 text
FORM secondary_list.
perform get_data1.
perform build-fieldcatalog1.
perform modify-fieldcatalog1.
perform build-events1.
perform modify-events1.
perform set-layout.
perform set-pfstatus.
perform list-display1.
ENDFORM. " secondary_list
*& Form build-fieldcatalog1
text
--> p1 text
<-- p2 text
FORM build-fieldcatalog1.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = v_repid
i_internal_tabname = 'ITAB1'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = it_fldcats1
exceptions
inconsistent_interface = 1
program_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.
ENDFORM. " build-fieldcatalog1
*& Form modify-fieldcatalog1
text
--> p1 text
<-- p2 text
FORM modify-fieldcatalog1.
loop at it_fldcats into wa_fldcat.
case wa_fldcat-fieldname.
when 'VBELN'.
wa_fldcat-seltext_l = 'Delivary No.'.
wa_fldcat-col_pos = 1.
wa_fldcat-ddictxt = 'L'.
when 'POSNR'.
wa_fldcat-seltext_l = 'Item No'.
wa_fldcat-col_pos = 2.
wa_fldcat-ddictxt = 'L'.
when 'MATNR'.
wa_fldcat-seltext_l = 'Material'.
wa_fldcat-col_pos = 3.
wa_fldcat-ddictxt = 'L'.
when 'LFIMG'.
wa_fldcat-seltext_l = 'Quantity'.
wa_fldcat-col_pos = 4.
wa_fldcat-ddictxt = 'L'.
when 'MEINS'.
wa_fldcat-seltext_l = 'Unit of Measure'.
wa_fldcat-col_pos = 5.
wa_fldcat-ddictxt = 'L'.
endcase.
modify it_fldcats from wa_fldcat.
endloop.
ENDFORM. " modify-fieldcatalog1
*& Form build-events1
text
--> p1 text
<-- p2 text
FORM build-events1.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = it_event1
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " build-events1
*& Form modify-events1
text
--> p1 text
<-- p2 text
FORM modify-events1.
read table it_event1 with key name =
slis_ev_top_of_page into wa_events.
if sy-subrc = 0.
wa_events-form = 'HEADER_OF_REPORT_2'.
modify it_event1 from wa_events index sy-tabix.
clear wa_events.
endif.
ENDFORM. " modify-events1
*& Form list-display1
text
--> p1 text
<-- p2 text
FORM list-display1.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT = wa_layout
IT_FIELDCAT = it_fldcats1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = it_event1
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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = itab1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " list-display1
*& Form get_data1
text
--> p1 text
<-- p2 text
FORM get_data1.
READ TABLE itab INDEX V_INDEX.
v_vbeln = itab-vbeln.
select vbeln
posnr
matnr
lfimg
meins
from lips
into table itab1
where vbeln eq v_vbeln.
ENDFORM. " get_data1
*& Form header_of_report_2
text
--> p1 text
<-- p2 text
FORM header_of_report_2.
write: 'Delivary item list'.
ENDFORM. " header_of_report_2
*-- callling a transaction code by passing the initial screen value.
*& Form USER_COMMAND
form user_command using p_ucomm like sy-ucomm
p_selfield type slis_selfield.
data : l_index like sy-index,
l_refbn like cooi-refbn.
l_index = p_selfield-tabindex. " holds the selected table index
clear l_refbn.
case p_ucomm.
when '&IC1'.
clear l_refbn.
read table it_outtab index l_index.
if sy-subrc eq 0.
l_refbn = it_outtab-refbn.
if not l_refbn is initial.
set parameter id 'BES' field l_refbn.
call transaction 'ME23' and skip first screen.
endif.
else.
message e999 with text-014.
endif.
endcase.
endif. -
Multi row field catalog in ALV
Hi everyone!
Is there a way to have more than one row in the field catalog for a alv grid display? I've found row_pos but I can't make it work. I need a a row with monts on it and in another row there should be fields called 'hours' and 'costs' for every month. I don't know if I'm making any sense here. Anyway, thanks for your help, I hope someone knows how to do this!
Zigor.Hi,
I think you need to use
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FCAT
IT_EVENTS = EVE[]
I_TABNAME_HEADER = 'ITAB'
I_TABNAME_ITEM = 'JTAB'
I_STRUCTURE_NAME_HEADER = 'LFA1'
I_STRUCTURE_NAME_ITEM = 'EKKO'
IS_KEYINFO = KINFO
TABLES
T_OUTTAB_HEADER = ITAB[]
T_OUTTAB_ITEM = JTAB[]
aRs
Maybe you are looking for
-
Making Multiple Digital Signatures Read-only in Form (Acrobat 9)
I have created a form which includes two (2) digital signature fields. What needs to occur with the form is Person1 fills the form and then digitally signs it thereby making the form fields read-only . Person2 then digitally signs the form which sh
-
How can I play all songs from an artist in the ipad 2, with the new IOS 5?
in the music app (which was named ipod before the update for the IOS 5) I want to play all songs for a certain artist that have different albums, but I dont know how. hope someone can help me
-
When I plug my new iphone 4s into my pc, itunes freezes
When i plug my new iphone 4s into my pc, itunes recognises devise but when I open it it freezes itunes. Can anyone help? When I first plugged phone in, itunes automatically opened but it was a new itunes with none of my files on. But if I was to open
-
Well i cant seem to be able to activate my ipod touch can someone help me?
um hello? well i hook up my ipod (4th gen) and i have no idea of what to do and imreally upset considering i just got it
-
Can't get camera to play for log and capture.
Please help. I am in the middle of a huge project and I am stumped. I literally could log and capture without issue last night. Today, I can rewind and fast forward with log and capture, but when I press "PLAY" I get the spinning beach ball. I have b