Alv field with string
hi,
I HAVE A TABLE IN WHICH ONE FIELD SAY F1 IS OF TYPE STRING
I HAVE CREATED AN ALV REPORT IN WHICH THIS FIELD F1 IS editable
when i press save button it ads the new row in the database
the Problem lies here is that the output length is viewed only to lenght of 15 infact outlen of fieldcatalog is set to 30
and i could only ad 30 character at max infact of being a type string
how can i add data in the table through alv with lenght more than 256 characters
(1) How do you build the transparent table with type string field. This type is not allowed in transparent table.
Do you mean CHAR (til 255) or LCHR type (<a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBDIC/BCDWBDIC.pdf">BC - ABAP Dictionary</a>)
<i><b>STRING</b>: Character string with variable length This type can only be used in types (data
elements, structures, table types) and domains. It cannot be used in database tables. In ABAP, this type is implemented as a reference to a storage area of variable size.
<b>CHAR</b>: Character string. Fields of type CHAR may have a maximum length of only 255 in tables. If longer character fields are to be used in tables, you must choose data type LCHR. There are no restrictions on the length of such fields in structures.
<b>LCHR</b>: Character string of any length, but with a minimum of 256 characters. Fields of this type must be located at the end of transparent tables and must be preceded by a length field of type INT2. If there is an INSERT or UPDATE in ABAP programs, this length field must be filled with the length actually required. A fields of this type cannot be used in the WHERE condition of a SELECT statement.</i>
(2) Use of long text (in fact that's your need ?) in ALV
<i>1. Declare the internal and the external length of the field to the ALV Grid Control.
For fields with DDIC reference, the ALV Grid Control automatically uses the internal and the external length.
For fields without DDIC reference, you must specify the internal length using field INTLEN and the external length using field DD_OUTLEN of the field catalog (see Parameters for Fields Without DDIC Reference).
2. Specify the conversion exit using field EDIT_MASK of the field catalog (see Formatting Column Contents).
3. Pass the field catalog with method</i>
If you really need long text, you may declare an output length of say 80 in the ALV grid, and provide an icon to edit a very-long text (via a popup screen with a container and a use of class cl_gui_textedit for example)
Regards
Similar Messages
-
Alv field with f4 help without using class
Hi,
Can any one give me a program of "Alv field with f4 help without using class".
Thanking you in advance.hi
<b>Linking F4 Help to Fields</b>
For the last section, we will deal with linking F4 help to fields. It is easy. As usual, define, implement and register the event onf4 at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the onf4 event. For this you must prepare a table of type LVC_T_F4 and register this table using the method register_f4_for_fields. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
􀂾 Pass the fieldname to FIELDNAME
􀂾 Set REGISTER to make the field registered,
􀂾 Set GETBEFORE to provide field content transport before F4 in editable mode
􀂾 Set CHNGEAFTER to make the data changed after F4 in editable mode.
DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
lt_f4-fieldname = 'PRICE'.
lt_f4-register = 'X' .
lt_f4-getbefore = 'X' .
APPEND lt_f4 .
CALL METHOD gr_alvgrid->register_f4_for_fields
EXPORTING
it_f4 = lt_f4[] .
Preparing table for the fields to be registered to trigger F4 event
METHOD handle_on_f4 .
PERFORM f4_help USING e_fieldname es_row_no .
er_event_data->m_event_handled = 'X' .
ENDMETHOD .
A sample onf4 method implementation
Again, we set the attribute er_event_data->m_event_handled to prevent further processing of standard F4 help.
regards
Ravish
<b>
reward if useful</b> -
Getting all VARCHAR fields with string length different then x
Hello,
I am trying to get from a table all the rows which contain in a certain varchar field a string length different than x (5 i.e.):
varchar field
treds
fd <-
grgrt
sdfsdfsdf <-
fdsds
the marked rows will been given out.
Thanks!Term, the Oracle SQL manual contains documentation on the Oracle functions. Most of the functions can be classified as either character functions, number (math) functions, date functions, and conversion functions.
If you are going to work with Oracle you will benefit from looking on the list of available functions to become familiar with what is available.
HTH -- Mark D Powell -- -
ALV report with internal in field symbol
Hi Shifu ABAP,
I have ALV report.
My problem is when I tried to do sum using the sum icon. I got a message 'desired operation cannot be performed for column 'Dignostic delay'. Is it because I used field symbol, then when I clicked on the column it didn't recorgnise the field.
FYI.
1)The internal table for my ALV report is stored in field symbol.
2)I dont have a problem to display the report.
3)I had to set 'do_sum' at ALV field category, still doesn't work
My source code to define ALV category.
loop at i_qpcd into wa_qpcd.
CLEAR ls_fieldcat2.
ls_fieldcat2-col_pos = pos2.
ls_fieldcat2-fieldname = wa_qpcd-code.
ls_fieldcat2-reptext_ddic = wa_qpcd-desc.
ls_fieldcat2-just = 'C'.
ls_fieldcat2-do_sum = 'X'.
APPEND ls_fieldcat2 TO gt_fieldcat2.
endloop.
My source code call the ALV FM
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZMPMR001_Q1OOT'
i_callback_pf_status_set = 'PF_STATUS_SET'
is_layout = ls_layout
it_fieldcat = gt_fieldcat2[]
is_print = ls_print
TABLES
t_outtab = <l_table>
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.
Thanks a lot in advance for your attention.my situation is like this, declare the internal tble
1) data : begin of itab occurs 0,
code like qpcd-code,
desc like QPCT-KURZTEXT,
end of itab.
2) populate the itab like this
code desc
01 desc 1
02 desc 2
03 desc 3
3) take the selected record converted it into new dynamic internal table using field symbol declare as table, now the component of this new table are 01, 02 and 03.
4) populate the new table with some data, so technically my new table structure will be like this
01 02 03
1 0 1
0 0 3
2 2 2
5) display the new table in ALV report, in ALV I tried to sum-up each of column.
6) Question : HOW can I convert the componet 01, 02 and 03 as an integer/numeric field.
Regards
Nislina -
Create a Procedural ALV Report with editable fields and save the changes
Hi,
I am new to ABAP. I have created a Procedural ALV Report with 3 fields. I want to make 2 fields editable. When executed, if the fields are modified, I want to save the changes. All this I want to do without using OO concepts. Please help . Also, I checked out the forum and also the examples
BCALV_TEST_GRID_EDIT_01
BCALV_TEST_GRID_EDIT_02
BCALV_TEST_GRID_EDIT_04_FORMS
BCALV_TEST_GRID_EDITABLE
BCALV_EDIT_01
BCALV_EDIT_02
BCALV_EDIT_03
BCALV_EDIT_04
BCALV_EDIT_05
BCALV_EDIT_06
BCALV_EDIT_07
BCALV_EDIT_08
BCALV_FULLSCREEN_GRID_EDIT
But all these are using OO Concepts.
Please help.
Regards,
SmruthiTABLES: 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,
line_color(4) TYPE c, "Used to store row color attributes
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.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
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-edit = 'X'
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-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-info_fieldname = 'LINE_COLOR'.
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_pf_status_set = 'STATUS'
i_callback_top_of_page = 'TOP-OF-PAGE'
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.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
DATA: ld_color(1) TYPE c.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
LOOP AT it_ekko INTO wa_ekko.
ld_color = ld_color + 1.
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
MODIFY it_ekko FROM wa_ekko.
ENDLOOP.
ENDFORM. " DATA_RETRIEVAL
FORM top-of-page *
FORM top-of-page.
WRITE:/ 'This is First Line of the Page'.
ENDFORM.
FORM status *
FORM status USING rt_extab TYPE slis_t_extab. .
SET PF-STATUS 'ALV'.
ENDFORM.
FORM USER_COMMAND *
--> RF_UCOMM *
--> RS *
FORM user_command USING rf_ucomm LIKE sy-ucomm
rs TYPE slis_selfield.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
CASE rf_ucomm.
when 'SAVE'.
get all the modified entries and store them in an internal table and udpate them in to the required transaction or your custom table.
endcase.
endform.
ENDFORM.
here u need to 2 performs for PF status and USER_COMMAND in the ALV parameters.
create a custom PF status and create push buttons and assign your ok codes in your PF status.
if the field has to be edited in the ALV then pass EDIT = 'X' for that field in the fieldcatlog preparation.
Hope this will help you.
Regards,
phani. -
Hi guru's,
I want to create an ALV list with only a char255 field.
<all_table> contains data of sflight and is of type sflight(dynamically).
I want to show the data as one line.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = 'TPPARFIL'
fieldname = 'LINE'
TABLES
dfies_tab = it_dfies.
READ TABLE it_dfies INDEX 1.
IF sy-subrc IS INITIAL.
MOVE-CORRESPONDING it_dfies TO wa_fieldcat.
wa_fieldcat-scrtext_s = 'Results:'.
APPEND wa_fieldcat TO gt_fieldcat.
ENDIF.
t_output[] = <all_table>.
CALL FUNCTION 'LVC_TRANSFER_TO_SLIS'
EXPORTING
it_fieldcat_lvc = gt_fieldcat
IMPORTING
it_fieldcat_alv = it_fieldcat_alv.
PERFORM fill_alv_layout.
* Show list
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = lv_repid
i_grid_title = sy-title
is_layout = gs_layout
it_fieldcat = it_fieldcat_alv[]
TABLES
t_outtab = t_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form fill_alv_layout
FORM fill_alv_layout.
CLEAR: gs_layout.
gs_layout-max_linesize = 160.
gs_layout-min_linesize = 160.
gs_layout-detail_initial_lines = 'X'.
gs_layout-zebra = 'X'.
gs_layout-edit_mode = 'A'.
gs_layout-numc_sum = 'X'.
gs_layout-colwidth_optimize = 'X'.
gs_layout-window_titlebar = sy-title.
gs_layout-totals_only = 'X'.
ENDFORM. " fill_alv_layout
When I run this it only gives an empty view of the fields with type char255.
Regards,
Wimhi,
As per your code I think your internal table is empty. Please set debugger after internal table fill and check. If the data is there then please check your field catalog entry.
Regards,
Sachin -
Dear Colleagues,
I develop an ALV grid with OO standard methods. Before the first display of the table I define the editable fields. It works fine.
I have a problem : if the table is empty and I press the standard icons "Append a line" or "Insert a line", the new line don't have the defined editable characteristics.for fields. Is there a standard method which I have forgotten ?
Thanks a lot and kind regards
Petervs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_cut.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_undo.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
* Displaying the output in ALV Grid
vs_layout_grid-no_rowmark = 'X'.
vs_layout_grid-zebra = 'X'.
vs_layout_grid-cwidth_opt = 'X'.
vs_layout_grid-edit = 'X'.
vs_layout_grid-ctab_fname = 'CT'.
vs_layout_grid-stylefname = 'CELLTAB'.
CALL METHOD v_grid->set_table_for_first_display
EXPORTING
i_save = 'X'
is_layout = vs_layout_grid
it_toolbar_excluding = i_toolbar_excluding[]
CHANGING
it_outtab = itab[]
it_fieldcatalog = it_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE 'ALV Grid display unsuccessful' TYPE 'I'.
STOP.
ENDIF. " IF sy-subrc NE 0
ELSE. " IF w_custom_container...
* Refresh the container if it already exists
CALL METHOD v_grid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE 'Refreshing the container is not successful' TYPE 'I'.
STOP.
ENDIF. -
Editable field with F4 help in alv tree output using cl_gui_alv_tree
HI
i need Editable field with F4 help in alv tree output using cl_gui_alv_tree
Regards
NareshHi Naresh,
Pass the field catalog with the additional parameter (ls_fcat-edit = 'X'.).
for F4 help if the data element have the search help it automatically will come. other wise include the additional parameter in the field catalog (ls_fcat-F4AVAILABL = 'X')
Reward if found helpful.
Regards,
Boobalan Suburaj -
How to set a string field with people picker control group
Hi Guys
I have a problem with a form list, when I need to set a string field with de content of people picker control that have more than one "user".
Is there any way to put in string a list of user like the people picker control shows in a form?
The really problem is I don't know how to read an array of user in a formula rule.
any example or idea should be appreciated.
tnks.Hi ,
Please try out in following way :
/// <summary>
/// Set value to people picket control
/// </summary>
/// <param name="key"></param>
/// <param name="ppl"></param>
/// <param name="item"></param>
private void SetDatatoPeopleEditor(string key, PeopleEditor ppl, SPListItem item)
try
if (item[key] != null)
string users = string.Empty;
SPFieldUserValueCollection userCol = new SPFieldUserValueCollection(web, item[item.Fields.GetField(key).Id].ToString());
foreach (SPFieldUserValue usrItm in userCol)
users += usrItm.User.ToString() + ",";
ppl.CommaSeparatedAccounts = users.Remove(users.LastIndexOf(","), 1);
catch (Exception ex)
lblErrorMessage.Text = ex.Message;
private SPUser GetAccountName(PeopleEditor accountPE)
SPUser user = null;
string strAccountName = String.Empty;
try
for (int i = 0; i < accountPE.ResolvedEntities.Count; i++)
PickerEntity objEntity = (PickerEntity)accountPE.ResolvedEntities[i];
user = web.AllUsers[objEntity.Key];
return user;
catch (Exception ex)
return user;
It works for me . -
Hiding fields with zeros or blanks in ALV using factory classes
Hi all,
I am using Factory Method for displaying ALV.
And I want to hide all the fields with Zeros or Blanks.
Any help wud be rewarded.
Thanks
PreetiHi,
Below is the code used to hide a particular field ,here it is MANDT.This code is put after the factory method.
data: lr_columns type ref to cl_salv_columns.
lr_columns = gr_table->get_columns( ).
lr_columns->set_optimize( abap_true ).
data: lr_column type ref to cl_salv_column.
try.
lr_column = lr_columns->get_column( 'MANDT' ).
lr_column->set_technical( if_salv_c_bool_sap=>true ).
catch cx_salv_not_found.
endtry.
Thanks. -
Need help with string field formula
Post Author: dshallah
CA Forum: Formula
What I am trying to accomplish:
The report has item numbers and each item number has the
potential to be associated with up to three u2018binsu2019. So the fields are u2018item
numberu2019, u2018bin1, u2018bin2u2019 and u2018bin3u2019.
I tried to write a u2018if thenu2019 statement that would only show
records that had a value of less than 1 in each u2018binu2019 field. When I try to
write the statement I get a message that says u2018A string is required hereu2019 and
it highlights the number 1 in my statement. I have a feeling itu2019s because the u2018binu2019
fields are string fields and not number fieldsu2026? So I am not sure the proper
procedure to correct this. Thus help is needed and appreciated.
Here is what I wrote:
if {IC_LOC_HIST.BIN_NAME_1} < 1 then
{IC_LOC_HIST.BIN_NAME_1}
What is correct way to write a statement that will show me
the zero values in each column of bin fields?
Thanks!Post Author: bettername
CA Forum: Formula
You must have a non-numeric value in there somewhere - up in the top left of the formula editor window, it'll show you the variables you've passed to the formula, which should help track down what's going on.
You could try and check that the value is a number first by using something like:
if isnull({IC_LOC_HIST.BIN_NAME_1}) = false and isnumeric({IC_LOC_HIST.BIN_NAME_1}) = false and then "Error - Should be a Number!"
else
if isnumeric({IC_LOC_HIST.BIN_NAME_1}) = true and tonumber({IC_LOC_HIST.BIN_NAME_1})<1 then {IC_LOC_HIST.BIN_NAME_1}) -
ALV program with Field Catalog
Hi ,
Can any body please provide me sample ALV programs with Field Catalog and GRID DISPLAY. and also please give me the steps for writing the program.
Thanks in advance.
KPHi,
For ALV GRID DISPLAY (using <b>OOPS</b>),
1)Create an object of the <b>container</b>(an instance of a class like cl_gui_custom_container).
2)Create an object of the <b>ALV using class cl_gui_alv_grid</b> and give the CONTAINER name that you define in your screen layout as the parent of the ALV.
3)Call the method <b>SET_TABLE_FOR_FIRST_DISPLAY</b> of the class cl_gui_alv_grid.
4)<b>Field catalog</b> is used when you want a variation of the standard structure to be displayed on your ALV.A variable of table type <b>LVC_T_FCAT</b> is defined and variations can be made as per the requirements.The variable is then passed in the method SET_TABLE_FOR_FIRST_DISPLAY.
<b>A SAMPLE PROGRAM:</b>
REPORT SAMPLE:
*-- GLOBAL DATA DECLARATIONS FOR ALV
<b>DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.</b>
DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
<b>DATA gr_ccontainer TYPE REF TO cl_gui_custom_container.</b>
DATA gt_fieldcat TYPE lvc_t_fcat.
Data:i_spfli type table of spfli.
*The value CC_ALV is given to the custom container in the screen layout
START-OF-SELECTION.
select * from spfli into table i_spfli.
Call screen 100.
MODULE STATUS_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
*Create container
<b>CREATE OBJECT gr_ccontainer
EXPORTING container_name = gc_custom_control_name.</b>
*Create ALV
<b>CREATE OBJECT gr_alvgrid
EXPORTING i_parent = gr_ccontainer.</b>
*field catalog
<b>PERFORM prepare_field_catalog CHANGING gt_fieldcat.</b>
*to display the ALV
<b>CALL METHOD gr_alvgrid->set_table_for_first_display</b>
EXPORTING
I_STRUCTURE_NAME = 'SPFLI'
CHANGING
it_outtab = i_spfli[]
it_fieldcatalog = gt_fieldcat.
ENDMODULE. "display_alv OUTPUT
MODULE USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
IF sy-ucomm = 'BACK' OR
sy-ucomm = 'EXIT' OR
sy-ucomm = 'CANCEL'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE.
*& Form prepare_field_catalog
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
ls_fcat-ref_table = 'SPFLI'.
ls_fcat-fieldname = 'CARRID'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'CONNID'.
ls_fcat-ref_table = 'SPFLI'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'DEPTIME'.
ls_fcat-ref_table = 'SPFLI'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'ARRTIME'.
ls_fcat-ref_table = 'SPFLI'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
endform.
<b>For more sample programs refer:</b>http://www.geocities.com/victorav15/sapr3/abap_ood.html#d_grid
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
<b>-->download the PDF from following link.</b>
www.abap4.it/download/ALV.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
<b>Some more:</b>
http://www.sap-hefte.de/download/dateien/1025/087_leseprobe.pdf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
http://www.alvgmbh.de/dwnload/gonio_t.pdfhttp://
<b>You can get all demo programs for ALV:</b>Go to se38 and type BCALV* and press F4 for all demo porgrams.
Regards,
Beejal
**Reward if this helps -
AutoPopulating a field with a string plus value from another field
Hi: I have a table with two fields
create table LINKREQUEST (
requestid int primary key,
INCIDENT_NUMBER varchar2(16),
REQUESTID is auto populated using a sequence. I want to auto populate the INCIDENT field with the string "INC" plus the value from REQUESTID. Can someone help.
TIA
RaviREQUESTID is auto populated using a sequence. I want to auto populate the INCIDENT field with the string "INC" plus the value from REQUESTIDSomething like this?:
SQL> create table linkrequest (
requestid int primary key,
incident_number varchar2(16)
Table created.
SQL> create sequence linkrequest_seq
Sequence created.
SQL> create or replace trigger linkrequest_trg before insert on linkrequest
for each row
begin
select linkrequest_seq.nextval,
case when :new.incident_number = 'INC' then 'INC' || linkrequest_seq.nextval else :new.incident_number end
into :new.requestid, :new.incident_number from dual;
end;
Trigger created.
SQL> insert into linkrequest (incident_number) values ('XY')
1 row created.
SQL> insert into linkrequest (incident_number) values ('INC')
1 row created.
SQL> insert into linkrequest (incident_number) values ('VW')
1 row created.
SQL> insert into linkrequest (incident_number) values ('INC')
1 row created.
SQL> select * from linkrequest
REQUESTID INCIDENT_NUMBER
1 XY
2 INC2
3 VW
4 INC4
4 rows selected. -
Download all columns into Excel from an ALV along with hidden fields
Hello Everyone,
I have an alv, in which the fieldcat have fields with no_out = 'X'. When I m trying to download the output by selecting the fields with no_out='X' in the output, they are not getting downloaded. But I can see them in the alv output.
IS there any other way to do this or should I just take off no_out = 'X'?
Thanks,
RushiHi Rushi,
You can add your own button in PF-Status. And add your required functionality.
So if thei new added button is added, program will prepare fielname table first and then will download Excel file using function module 'GUI_DOWNLOAD'. You can keep some constant filename and filepath (C:\test.xls) and everytime you can overwrite the same filename and give success message after downloading file.
If you want different fielnpath, then you can get that on selection screen.
Hope this will help you.
Regards,
Anil -
Compare editable alv output with database fields
I generated 1 editable alv report with attaching flat file data,
but i want to change the wrong fields in alv output and compare with database filds for validation.
but when i do this . it takes previous entries of flat file.
how can i solve it?Your title is much better than in the first post, however your problem description hasn't changed.
Let me guess, you are importing a flat file, present the contents in an editable ALV grid, some values are being changed, and now the changed values do not reflect in the internal table, instead you are seeing the values as imported from the file?
If yes -> FAQ, please search for the many previous discussions of this topic.
Thomas
Maybe you are looking for
-
Textfree push notifications were working fine and then stopped. Have the push notifications settings on and do not disturb off. Any help appreciated.
-
Whenever I try to view a PDF file, I'm getting the error message "Before viewing PDF documents in this browser you must launch Adobe Reader and accept the End User License Agreement, then Quit and relaunch the browser." I have the new Adobe Reader bu
-
Any idea why builders are deprecated in JavaFX 8 ?
Hi All, Greetings! I have worked with JavaFX 2.X. Now I am trying my hand in JavaFX 8 early access. I found that all the builders are deprecated in the jfx 8 build. Do anybody have any idea regarding this.? Thanks & Regards, Sai Pradeep Dandem.
-
JSF 2.1.7 requirements
Hi, I'd like to know if JSF 2.1.7 requires servlet 3 or 2.5: if I look at pom http://repo1.maven.org/maven2/com/sun/faces/jsf-api/2.1.7/jsf-api-2.1.7.pom there is indicated servlet 3, but it seems referred to JSF 2.2 (see also tag name: "Oracle's imp
-
I got Apple TV today ..All is fine..BUT I cannot play my photos through the computer to the TV.. I have a MC OS X 10.6.8 all updates are current .. THE ICON THAT ALLOWS AIR PLAY is not on toolbar ..It is on iTunes toolbar.. But not on iPhoto.. Frien