Display of "Average Values Text in ALV grid"
Hi
I use ALV grid to display the fields from a table. I have 15 columns. I need to do average for four columns.
In the field catalog i did a do_sum for those fields.
When the ALV grid is displayed I get average values for these columns.
Eg. Let suppose the grid looks like
Field1 Field2 Field3 Field4 Field5 Field 6.
vendor1 18 22 6 17 28
vendor1 54 11 16 62 28
vendor1 33 21 26 79 18
35 18 16 52 24
My requirement is I need to display the text "AVERAGE VALUES" . ( I need something like this.)
Field1 Field2 Field3 Field4 Field5 Field 6.
vendor1 18 22 6 17 28
vendor1 54 11 16 62 28
vendor1 33 21 26 79 18
Average values 35 18 16 52 24
Could someone help me in this?
Thanks & Regards
Kavitha
Hello,
you can use event subtotal_text of ALV_GRID.
Regards,
Pedro Santos
Similar Messages
-
Hi ,
I wanted to display a long text in my grid. Suppose I have a field's long text having field length 3000.
It is varying for other fields.
Anybody will tell me how to display the whole long text in alv grid.hi,
if it is a heading then in the field catlog u can do it.
i don know th length limitation.
fieldcatalog-fieldname = 'EBELP'.
<b> fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-seltext_s = 'PO Item'.
fieldcatalog-seltext_l = 'PO Item'.</b>
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
rgds
Anver -
Display additional Text in ALV Grid
Hello,
I have an ALV Grid display and need to display additional information on the top of the list. I have used the grid-title, but the field is defined as 70 characters and thats not enough.
Is it possible to display more text with alv grid?
Regards MichaelHi Ravi,
I´m creating my alv object orientated and I don´t know, how to manage that now. Can You explain me, where and how I have to do it?
My Dynpro has one custom container and I´m calling the method SET_TABLE_FOR_FIRST_DISPLAY in PBO.
And I need the comment to be printed with the ALV by pressing the print button in the toolbar of the ALV
Thank You!
Message was edited by: Michael Schmidt -
How to get Grand Total Text in ALV GRID
Hi Folks,
I am able to get the SUBTOTAL TEXT .....But i need...
How to get Grand Total Text in ALV GRID Display...
Can any one give a Solution for this...Hi Surendar,
Check out this code.. this is showing Total Text in Toal line in the very first column.
REPORT zsales_ord_det_1 .
TABLES: ztable_10.
TYPE-POOLS: slis.
DATA: BEGIN OF it OCCURS 0,
srno(6) type c,
name LIKE ztable_10-name,
age LIKE ztable_10-age,
END OF it.
DATA : BEGIN OF it_temp OCCURS 0,
name LIKE ztable_10-name,
age LIKE ztable_10-age,
END OF it_temp.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA: v_repid LIKE sy-repid,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
gs_layout TYPE slis_layout_alv,
gd_layout TYPE slis_layout_alv,
i_sort TYPE STANDARD TABLE OF slis_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
START-OF-SELECTION.
v_repid = sy-repid.
SELECT * FROM ztable_10 INTO TABLE it_temp.
LOOP AT it_temp .
it-srno = 'Total'.
it-name = it_temp-name.
it-age = it_temp-age.
APPEND it.
ENDLOOP.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'IT'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = i_fieldcat[]
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.
wa_fieldcat-row_pos = 1.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'SRNO'.
wa_fieldcat-tabname = it.
append wa_fieldcat to i_fieldcat.
LOOP AT i_fieldcat INTO wa_fieldcat.
IF wa_fieldcat-fieldname = 'AGE'.
wa_fieldcat-do_sum = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat.
ENDIF.
IF wa_fieldcat-fieldname = 'SRNO'.
Hide this field so that it can display it's content i.e.
Total text in Subtotal level
wa_fieldcat-tech = 'X'.
wa_fieldcat-no_out = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat TRANSPORTING tech no_out.
ENDIF.
ENDLOOP.
wa_sort-spos = 1.
wa_sort-fieldname = 'SRNO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort.
gd_layout-no_totalline = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_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_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = gd_layout
it_fieldcat = i_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = i_sort
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it
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.
Regards,
Seema -
HI ALL,
could any one send me how to display the subtotal Text in ALV grid output with code sample.
with thanks.
kannanhi,
means u want to print some text instead of star ( coming in subtotal) ?
If so than try like,
*& Report ZALV_LIST
REPORT zalv_list.
TABLES : mseg.
TYPE-POOLS : slis.
DATA : BEGIN OF itab OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
line_color(4) TYPE c,
END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
line_color(4) TYPE c,
END OF itab1.
DATA : t_fcat TYPE slis_t_fieldcat_alv,
t_eve TYPE slis_t_event,
t_subtot TYPE slis_t_sortinfo_alv,
subtot LIKE LINE OF t_subtot,
wa_fcat LIKE LINE OF t_fcat,
gd_layout TYPE slis_layout_alv.
DATA : gt_menge LIKE mseg-menge,
st_menge LIKE mseg-menge.
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : doc FOR mseg-mblnr.
SELECTION-SCREEN : END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_cat USING t_fcat.
PERFORM build_eve.
PERFORM build_layout.
START-OF-SELECTION.
PERFORM get_data.
PERFORM display.
*& Form build_cat
text
-->TEMP_FCAT text
FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MBLNR'.
wa_fcat-seltext_m = 'Material Doc.'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MENGE'.
wa_fcat-seltext_m = 'Quantity'.
wa_fcat-do_sum = 'Y'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
subtot-spos = 1.
subtot-fieldname = 'MBLNR'.
subtot-tabname = 'ITAB'.
subtot-up = 'X'.
subtot-group = 'X'.
subtot-subtot = 'X'.
subtot-expa = 'X'.
APPEND subtot TO t_subtot.
ENDFORM. "build_cat
*& Form build_eve
text
FORM build_eve.
DATA : wa_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_eve
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.
READ TABLE t_eve WITH KEY name = slis_ev_top_of_page
INTO wa_eve.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO wa_eve-form.
APPEND wa_eve TO t_eve.
ENDIF.
ENDFORM. "build_eve
*& Form build_layout
text
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-subtotals_text = 'Sub Total'.
ENDFORM. " BUILD_LAYOUT
*& Form get_data
text
FORM get_data.
SELECT mblnr matnr werks menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab
WHERE mblnr IN doc.
SORT itab BY mblnr.
LOOP AT itab.
AT NEW mblnr.
LOOP AT itab WHERE mblnr = itab-mblnr.
st_menge = st_menge + itab-menge.
itab1-mblnr = itab-mblnr.
itab1-matnr = itab-matnr.
itab1-werks = itab-werks.
itab1-menge = itab-menge.
APPEND itab1.
ENDLOOP.
itab1-mblnr = 'Sub_Total'.
itab1-matnr = ''.
itab1-werks = ''.
itab1-menge = st_menge.
itab1-line_color = 'C710'.
APPEND itab1.
itab1-line_color = ''.
CLEAR st_menge.
ENDAT.
ENDLOOP.
LOOP AT itab.
gt_menge = gt_menge + itab-menge.
ENDLOOP.
itab1-mblnr = 'Total'.
itab1-matnr = ''.
itab1-werks = ''.
itab1-menge = gt_menge.
itab1-line_color = 'C310'.
APPEND itab1.
ENDFORM. "get_data
*& Form display
text
FORM display.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_LIST'
is_layout = gd_layout
it_fieldcat = t_fcat
it_sort = t_subtot
it_events = t_eve
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. "display
*& Form top_of_page
text
FORM top_of_page.
WRITE:/ 'Data'.
ENDFORM. "top_of_page
reward if useful....
Edited by: Dhwani shah on Dec 20, 2007 1:20 PM -
How to get a Footer text in alv grid?
Hi,
am using RESUE_ALV_COMMENTARy_write... it is getting only on top of page..
suggest me to get Footer text in ALV GRiD.
Regards,
sodanapalli
Moderator message: please do more research before asking, all points removed (both replies were copy/pasted anyway)
Edited by: Thomas Zloch on May 19, 2011 5:41 PMStep1: Populate the ALV event table with 'END_OF_LIST' event
Step2: Populate the footer text in to an internal table which is of type
slis_t_listheader.
Step3: Create a subroutine with name 'END_OF_LIST' and with in this form we have to call the function module u2018REUSE_ALV_COMMENTARY_WRITEu2019.
Step4: Now call the function module REUSE_ALV_GRID_DISPLAYu2019 to display the ALV report. Whenever u2018END_OF_LIST' event is get fired it executes the subroutine END_OF_LIST and displays the text into the footer of the ALV GRID.
Code:
*& Report Z_TEST_ALV
REPORT z_test_alv.
TYPE-POOLS: slis.
DATA: i_mara TYPE STANDARD TABLE OF mara INITIAL SIZE 0,
i_events TYPE slis_t_event,
i_end_of_page TYPE slis_t_listheader,
w_events TYPE slis_alv_event,
v_repid LIKE sy-repid.
START-OF-SELECTION.
SELECT * FROM
mara INTO TABLE i_mara
UP TO 100 ROWS.
CHECK sy-subrc = 0.
PERFORM populate_alv_event.
PERFORM comment_build USING i_end_of_page[].
PERFORM display_grid.
*& Form POPULATE_ALV_EVENT
FORM populate_alv_event .
Populate event table
w_events-name = 'END_OF_LIST'.
w_events-form = 'END_OF_LIST'.
APPEND w_events TO i_events.
ENDFORM. " POPULATE_ALV_EVENT
*& Form COMMENT_BUILD
FORM comment_build USING p_i_end_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
REFRESH p_i_end_of_page.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = 'This is end of list'(001).
APPEND ls_line TO p_i_end_of_page.
ENDFORM. " COMMENT_BUILD
*& Form end_of_list
FORM end_of_list.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_end_of_page.
ENDFORM. "end_of_list
*& Form DISPLAY_GRID
FORM display_grid .
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_structure_name = 'MARA'
it_events = i_events
TABLES
it_outtab = i_mara
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " DISPLAY_GRID
Check the output where footer will be displayed as 'THIS IS END OF LIST' -
Display 80 characters of PO text in ALV grid column?
Hi Guys,
I just want to display only 80 characters of PO Header text in the ALV grid column and the rest should appear when we move the Mouse on to the each ALV grid'd POtext column. So how is it possible 1st tell me how to display 80 characters of PO text.?
in ME23n u can see the PO header text.
Thanks ,
Gopi.Hi Gopi,
Are you displaying ALV in your custom report and you want to show just 80 char in output?
If this is yes:
You can set ALV column width as 80 CHAR while building field catalog.
Column cell will have complete text but when ALV appears it will first show first 80 char.
thnx,
ags. -
Subtotal Text in ALV Grid and hiding empty row
Hello,
ive got a ALV-Grid with a few fields .. Total on one field subtotal on VKORG, category or some other fields .
after subtotal of one of the 2 named fields i'm reading the literal to the given fields and writing them in the table which is displayed and do a refresh.
i can show the field literal in the alv by adding it into the field cat but than its displayed even if its not filled.
i just want to display that column after filling it - the subtotal of the 2 columns.
and i want to add the text of the literal to the subtotal line. so if the alv grid is closed to display the totals. i want to see what the subtotal is for.
for displaying i use
CALL METHOD lcl_alv_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
is_variant = gs_variant
it_toolbar_excluding = gt_exclude
i_save = x_save
i_default = 'X'
CHANGING
it_outtab = it_alvlist[]
it_fieldcatalog = gt_field_cat.
for refresh
lv_lvc_s_stbl-row = 'X'.
lv_lvc_s_stbl-col = 'X'.
lv_soft_refresh = 'X'.
CALL METHOD lcl_alv_grid->refresh_table_display
EXPORTING
is_stable = lv_lvc_s_stbl
i_soft_refresh = lv_soft_refresh
EXCEPTIONS
finished = 1
OTHERS = 2.
get the selected column to read literal
CALL METHOD lcl_alv_grid->get_selected_columns
IMPORTING
et_index_columns = it_col_tab
EXCEPTIONS
OTHERS = 1.
Hope you can help me and understand my problemHi,
Use the No_out from Reusable types of fieldcat..For example.
IF it_final-field is initial.
READ TABLE IT_FIELDCAT5 WITH KEY FIELDNAME = 'BCD'.
IF SY-SUBRC EQ 0.
IT_FIELDCAT5-NO_OUT = 'X'.
MODIFY IT_FIELDCAT5 INDEX SY-TABIX TRANSPORTING NO_OUT.
ENDIF.
else.
READ TABLE IT_FIELDCAT5 WITH KEY FIELDNAME = 'BCD'.
IF SY-SUBRC EQ 0.
IT_FIELDCAT5-NO_OUT = ' '.
MODIFY IT_FIELDCAT5 INDEX SY-TABIX TRANSPORTING NO_OUT.
ENDIF.
ENDIf.
Cheers,
Syed Maheboob. -
Reg: Subtotal text in alv grid.
Hi All,
I need to display the subtotal text in ALV.
If:
data: i_layout type slis_layout_alv.
Then, we can used
i_layout-subtotal_text = my subtotal text.
But my declaration is :
Data: ls_layout type lvc_s_layo.
This dosnt have subtotaltext.
I have tried the method:
method subtotal_text.
perform event_subtotal_text using es_subtottxt_info
ep_subtot_line
e_event_data.
and also used the handle.
as per the coding in : BCALV_TEST_GRID_EVENTS
Still its not working.
Waiting for your valuable inputs.
Thanks & Regards,
AnjaliHi Anjali,
Try this sample code.
REPORT z_demo_alv_sort.
TABLES : vbak.
TYPE-POOLS: slis. " ALV Global types
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
DATA:
BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg, " Sales organization
kunnr LIKE vbak-kunnr, " Sold-to party
vbeln LIKE vbak-vbeln, " Sales document
netwr LIKE vbak-netwr, " Net Value of the Sales Order
waerk LIKE vbak-waerk, " Document currency
END OF gt_vbak.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
Form f_read_data
FORM f_read_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
FROM vbak
UP TO p_max ROWS
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
Form f_display_data
FORM f_display_data.
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA
Hope this helps,
Thanks,
Priya. -
Displaying the field symbol result in ALV GRID
hi.
I have a requirement to display the field symbol in ALV GRID. I am getting a error 'FIELD SYMBOL NOT YET BEEN ASSIGNED' when i am calling the 'REUSE ALV GRID DISPLAY'. Can any one help me out..I have a requirement that i have to display all the GL indicators as a field.
For that i have created a dynamic internal table so that based upon the GL indicators available in the database table i can create a dynamic internal table with GL indicators as the fieldnames.
Now i want to populate the corresponding amount with respect to the GL indicators in the dynamic internal table.
For ex.
I have a database table as follows:
Vendor Id GL indicators Amount
1000 A 2000
1000 S 3000
I have to created a field symbol as follows
Vendor Id A S
1000 2000 3000.
Now my requirement is that i want this values to be displayed in ALV GRID.
At the point of calling REUSE ALV GRID DISPLAY i am getting the error field symbol is not yet been assigned.. -
Display schedule qty - Month wise in ALV Grid
Hi Experts,
I have a requirement to display the schedule line quantities month wise in ALV Grid. The columns sholud be dynamic columns based on the input date range. I got some idea about how to create dynamic ALV but it is not clear to implement in my requirement.
Please Guide me in achiving the same.
Example:
Jan 2011 Feb 2011 March 2011
100 2000 300
Thanks&Regards,
KarthikHi.,
Create field catalog dynamically as like this.,
select-options s_date for sy-datum.
data: n type i,
count type i,
cnt type string,
field type string,
descr type string.
DATA: m TYPE t247-mnr,
month_name type char10,
m1 type i.
n = s_date-high+4(2) - s_date-low+4(2) . " getting number of months
m1 = s_date-low+4(2).
m = m1.
n = n + 1.
DO n TIMES. " building field catalog dynamically
m = m + 1.
count = count + 1.
cnt = count.
concatenate 'FIELD' cnt into field.
CALL FUNCTION 'ISP_GET_MONTH_NAME' " FM to get month name
EXPORTING
LANGUAGE = sy-langu
MONTH_NUMBER = m
IMPORTING
* LANGU_BACK =
LONGTEXT = month_name .
concatenate month_name s_date-low+0(4) into descr separated by ''.
wa_fieldcat-col_pos = count.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-fieldname = field.
wa_fieldcat-seltext_m = descr.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
ENDDO.
After this create dynamic table using,
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat
IMPORTING
ep_table = t_newtable.
then loop the internal table and assign the component to final internal table,.
like .,
CONCATENATE 'FIELD' index INTO fieldvalue. " do same like fieldcatalog
ASSIGN COMPONENT fieldvalue OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = wa-fieldvalue.
hope this helps u.,
Thanks & Regards,
Kiran -
Capture the text in ALV grid output
Hi Friends,
I have created a alv grid report, in that i have to edit one field by using EDIT, i am editign that field.
Since i am working on interactive alv ( if user keeps the cursor on that row and he presses the push button) i want to capture that entered text in interactive alv.
Can any one help me
Regards,
DVNSHi,
Please refer to SAP standard demo program BCALV_TEST_GRID_EDITABLE.
Thanks,
Sriram Ponna. -
How to display -ve sign before amount in ALV grid
Hi,
I want to display -ve numbers in an ALV grid. But the sign always appear at the end of the number. Is there any option with which I can display -ve sign before the number.
Regards,
DeeptiHi,
<b>You can refer to below threads:</b>
ALV - negative sign in the front
Prefix Negative sign in type P field in an ALV report
Or
USe Function Module <b>CLOI_PUT_SIGN_IN_FRONT</b>, may be this works in your case.
<b>Reward if helpful</b>
Rgds -
Display more than 255 charecters in alv grid
Hi,
I am trying to display the more than 255 harvesters in alv grid(Editable alv). But it is accepting 255 characters only. actually my string length is 2048 (file path).
How to display the more than 255 characters sting in alv grid. If any one know this please provide that logic.Hi,
Check this also
REUSE_ALV_GRID_DISPLAY maximum length
Re: how to display the data in the alv layout more than 255 characters -
Display 2 rows per entry with ALV Grid
Hi Experts,
I need to display the results of a report with ALV Grid. The Problem is: I need to display the resultdata (some numbers etc..) in one row and then add a second row with the longtext.
The ALV should look somthing like this:
resultdata1 resultdata2 resultdata3
longtext1
resultdata1 resultdata2 resultdata3
longtext1
resultdata1 resultdata2 resultdata3
longtext1
Can anyone of you give me hint on how to do that?
(The row_pos and col_pos ind the fieldcat do not do the trick )
Thanx
Felixhi ,
You can do this
resultdata1 resultdata2 resultdata3
longtext1
resultdata1 resultdata2 resultdata3
longtext1
resultdata1 resultdata2 resultdata3
longtext1
Create two internal table .
one for : resultdata1 resultdata2 resultdata3
second for longtext1
see that both tables have matching primary key .
then can match the data and append in another third table .
regards
Deepak.
Maybe you are looking for
-
Problem with Send using JMS Adapter with Websphere MQ
Hi, We have two scenarios using JMS Adapter with MQ: 1. File->PI->MQ This works fine and drop the file in MQ correctly. 2. MQ->PI->File This gives an error reading from the queue: (see highlighted in the log below). It correctly connects to the queue
-
Can i connect my apple magic mouse and my apple wireless keybord with my pc?
can i connect my apple magic mouse and my apple wireless keybord with my pc?
-
i have to export flat file into oracle 10g database table with same datatypes as created in MS Access but during load i am facing following errors i don't know why,how can i handle this situation where as i created flate file and control file in same
-
Can the color of the message app be changed on the new iOS 7 release.
Can the new message app colors be changed? The new format is white and quite stark.
-
Bonsoir, Lorsque je prends une photo en zoomant avec mon iphone 5, celle ci est décalée par rapport à la réalité. Quelqu'un a t'il le même problème? Merci.