Alv output problem
I have alv output with some values, now I need to put a push button on application tool bar if I change any values in the out put and then press that push button then the new values should be updated with out re execution of the alv program . how to do it.
Hi Kiran,
<li> The below code is more than enough. It works for your requirement.
<li>Define events
DATA: it_events TYPE slis_t_event,
wa_event like line of it_events.
<li>Fill events like below.
wa_events-name = 'PF_STATUS_SET'.
wa_events-form = 'PF_STATUS_SET'.
append wa_events to it_events.
clear wa_events.
wa_events-name = 'USER_COMMAND'.
wa_events-form = 'USER_COMMAND'.
append wa_events to it_events.
clear wa_events.
<li>Set pf status like below.
FORM PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS' EXCLUDING rt_extab.
"When you set pf-status using above statement, you dont see ALV toolbar. To get back all the tools copy status of the any "program status which is using ALV in SE41 transaction code to your program with status you mentioned here.
"Program :SAPLKKBL
"status :STANDARD_FULLSCREEN
ENDFORM.
<li>Use USER_COMMAND event like below
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
IF R_UCOMM = 'REFRESH'."Create one button on ALV toolbar with function code REFRESH
RS_SELFIELD-REFRESH = 'X'. "Set this one. It refreshes internal table data with new values
ENDIF.
ENDFORM. "USER_COMMAND
<li>Call function module like below
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = program
it_fieldcat = it_fieldcat
it_events = it_events
TABLES
t_outtab = i_mard.
Let me know if you have any problem.
Thanks
Venkat.O
Similar Messages
-
ALV output problem in displaying the field lengths.( LONG_DES1 & LONG DES)
I have declared itab of ALV output like below...
Internal table for ALV report generation***********
DATA : Begin of pdet_otab_alv occurs 0,
bukrs LIKE bsid-bukrs, "Company code
postm(4), "Posting month (YYMM format)
xblnr LIKE bsid-xblnr, "Reference document number
kunnr LIKE bsid-kunnr, "Customer (Supplier Billing Customer)
name1 LIKE kna1-name1, "Name 1
buzei like bsid-buzei,
gjahr like bsid-gjahr,
filkd like bsid-filkd, "Rep Number
rname like kna1-name1, "Rep Name
belnr LIKE bsid-belnr, "Document number (invoice number)
blart LIKE bsid-blart, "Document type
zfbdt LIKE bsid-zfbdt, "Baseline date
zterm LIKE knb1-zterm, "Terms
netdt LIKE bsega-netdt,"Due date
sgtxt LIKE bsid-sgtxt, "Text
agerg TYPE t_agerg, "Age range of invoice
wrbtr LIKE bsid-wrbtr, "Original invoice amount
due LIKE bsid-wrbtr, "Amount outstanding on invoice
long_des(250) type c, " Long description
<b> long_des TYPE string,
long_des1 TYPE string,</b>
date_s(10) type c, " Date
short_des(20) type c, " Short Description
counter type i,
End of pdet_otab_alv.
And after filling the internal table fields ( fields 'LONG_DES1' & 'LONG_DES' from FM READ_TEXT 's longtext, which are of 265 chars each )
<b>'LONG_DES1' & 'LONG_DES' are trimmed in ALV out put WHY ?</b>
w_fieldcat-fieldname = 'LONG_DES1'.
w_fieldcat-tabname = 'PDEL_OTAB_ALV'.
w_fieldcat-ref_fieldname = 'SCRTEXT_L'.
w_fieldcat-ref_tabname = 'DD03P'.
w_fieldcat-seltext_l = 'Original Note'.
w_fieldcat-col_pos = 17.
APPEND w_fieldcat TO fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'LONG_DES'.
w_fieldcat-tabname = 'PDEL_OTAB_ALV'.
w_fieldcat-ref_fieldname = 'SCRTEXT_L'.
w_fieldcat-ref_tabname = 'DD03P'.
w_fieldcat-seltext_l = 'Latest Note'.
w_fieldcat-col_pos = 18.
APPEND w_fieldcat TO fieldcat.
CLEAR w_fieldcat.
<b>next part i.e., before passing fieldcat.... I have filled s_layout like below.</b>
<b> s_layout-max_linesize = 1000.
s_layout-colwidth_optimize = 'X'.</b>
Call the following function to display output in ALV form
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZFRSBOI0'
is_layout = s_layout
it_fieldcat = fieldcat
it_events = p_events[]
it_sort = p_it_sort[]
i_save = 'A'
TABLES
t_outtab = pdet_otab_alv1
EXCEPTIONS
program_error = 1
OTHERS = 2.
If the function call is not successful, raise error message
and come out from the program
IF sy-subrc <> 0.
message e000(00) with
'Unable to display report'(e01).
exit.
ENDIF.some body suggested me....we can display full length of text by below coding ?
Is that not correct - just asking....
s_layout-max_linesize = 1000.
s_layout-colwidth_optimize = 'X'.
Call the following function to display output in ALV form
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZFRSBOI0'
is_layout = s_layout
it_fieldcat = fieldcat
it_events = p_events[]
it_sort = p_it_sort[]
i_save = 'A'
TABLES
t_outtab = pdet_otab_alv1
EXCEPTIONS
program_error = 1
OTHERS = 2.
If the function call is not successful, raise error message
and come out from the program
IF sy-subrc <> 0.
message e000(00) with
'Unable to display report'(e01).
exit.
ENDIF. -
Problem in alv output download
HI All,
My problem is
My alv output table contains long text with value as 1000 characters.
when i am downloading my alv output into excel, it is downloading only 255 characters length.
is there any ways to download the entire long text into excel.
Please help me on this...
Thanks in advance.
Maruthi Konijetisee the following example.
REPORT z_down_xml LINE-SIZE 132 NO STANDARD PAGE HEADING.
Databases
TABLES:
makt, "Mat description
marc, "Material / plant
t001w, "plant name
bhdgd. "Batch heading
Internal tables
DATA:
BEGIN OF gt_marc OCCURS 0,
werks LIKE marc-werks,
matnr LIKE marc-matnr,
END OF gt_marc,
Table to be downloaded as xml. Each line stores start and end tags
and the value
BEGIN OF gt_xml OCCURS 0,
line(120),
END OF gt_xml,
g_maktx(120).
User-input
SELECT-OPTIONS:
s_werks FOR marc-werks,
s_matnr FOR marc-matnr.
START-OF-SELECTION.
Extract all required data
PERFORM main_processing.
END-OF-SELECTION.
SORT gt_marc BY werks matnr.
LOOP AT gt_marc.
AT FIRST. "First tag must be root
CLEAR gt_xml.
gt_xml-line = ''.
APPEND gt_xml.
CLEAR gt_xml.
display data
FORMAT COLOR 2 ON.
WRITE :/ gt_marc-matnr, makt-maktx.
FORMAT COLOR 2 OFF.
ENDLOOP.
The last tag must be the root closing tag --*
gt_xml-line = '</LOCATIONS>'.
APPEND gt_xml.
CLEAR gt_xml.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
filename = 'C:PLANT1.XML'
filetype = 'ASC'
TABLES
data_tab = gt_xml.
TOP-OF-PAGE.
MOVE sy-title TO bhdgd-line1.
MOVE sy-repid TO bhdgd-repid.
MOVE sy-uname TO bhdgd-uname.
MOVE sy-datum TO bhdgd-datum.
MOVE '0' TO bhdgd-inifl.
MOVE '132' TO bhdgd-lines.
FORMAT INTENSIFIED ON COLOR COL_HEADING.
PERFORM batch-heading(rsbtchh0). "report header
Form READ_PLANT
FORM read_plant.
Get plant name
CLEAR t001w.
SELECT SINGLE name1
INTO t001w-name1
FROM t001w
WHERE werks EQ gt_marc-werks.
ENDFORM. " READ_PLANT
Form MAIN_PROCESSING
FORM main_processing.
Material and plant basic data
SELECT werks matnr
INTO TABLE gt_marc
FROM marc
WHERE werks IN s_werks
AND matnr IN s_matnr.
ENDFORM. " MAIN_PROCESSING
Form READ_DESCRIPTION
FORM read_description.
Material name
CLEAR g_maktx.
SELECT SINGLE maktx
INTO g_maktx
FROM makt
WHERE matnr EQ gt_marc-matnr
AND spras EQ 'E'.
Replace special character
DO.
REPLACE '&' WITH '*ù%;' INTO g_maktx.
IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
ENDDO.
DO.
REPLACE '*ù%;' WITH '&' INTO g_maktx.
IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
ENDDO.
DO.
REPLACE '/' WITH '/' INTO g_maktx.
IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
ENDDO.
ENDFORM. " READ_DESCRIPTION -
Problem while downloading the alv output to excel file.
Hii,
While downloading the alv output to an excel file i am facing a problem. Either the output comes as 1.23456E+11 or the values get cut .
Cant put in txt file as the users require to calculate directy and i have even tried to increase the output length .But both doesnt help.
So what are the other ways to do so.
Edited by: mansi_v27 on Mar 24, 2010 12:35 PMHi,
Welcome to SCN!!!.
Please go through the forum rules. This has been discussed many times. You can search in the forum for this.
Infact there is no problem. Just expand that excel cell. You can see the full value. This is standard excel property.
Thanks,
Vinod. -
Problem in downloading ALV output in excel
Dear Abapers,
I am facing a problem while downloading alv output in spreadsheet. Report headers and data headings are coming in excle but contents are missing instead of that No Data is displaying on excel sheet. I have debug that and observed the deep structure name T_OUTTAB using by the FM ALV_DATA_EXPORT is empty, It should contain the contents of my output data.
Below I am giving my code.
***********************************************declaration****************
BEGIN OF d_file_out,
index TYPE i, "Index no
msg TYPE string, "Message
msgtyp(1) TYPE c, "Message type
END OF d_file_out,
DATA:t_file_out TYPE TABLE OF d_file_out.
DATA:wa_file_out TYPE d_file_out.
Display Error Logs
PERFORM display_logs USING text-006.
FORM display_logs USING p_text TYPE string.
CONSTANTS: c_count TYPE char5 VALUE 'INDEX',
c_mestyp TYPE char6 VALUE 'MSG',
c_message TYPE char7 VALUE 'MSGTYP'.
*Field catalog
PERFORM: z_field_catalog USING c_count text-010, "Record number
z_field_catalog USING c_mestyp text-011, "Message type
z_field_catalog USING c_message text-012. "Message
*Top of page event
PERFORM z_event USING t_events.
wa_layout-colwidth_optimize = c_x.
ALV grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
is_layout = wa_layout
I_STRUCTURE_NAME = wa_file_out
it_fieldcat = t_field
it_events = t_events
TABLES
t_outtab = t_file_out
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.
***********************************Fieldcatalog**********************************************
FORM z_field_catalog USING p_field TYPE any
p_name TYPE any.
wa_field-fieldname = p_field.
wa_field-seltext_l = p_name.
IF p_field = 'INDEX'.
wa_field-outputlen = '14'.
wa_field-col_pos = 1.
ELSEIF p_field = 'MSG'.
wa_field-outputlen = '120'.
wa_field-col_pos = 2.
ELSEIF p_field = 'MSGTYP'.
wa_field-outputlen = '08'.
wa_field-col_pos = 3.
ENDIF.
APPEND wa_field TO t_field.
CLEAR wa_field.
ENDFORM.
Here I have given my code, which contain the building of field catalog and Calling ALV Grid. I have already checked the excel micros settings. Other programs are working fine on my system and downloading in excel is also working.
Hope to get reply soon.
Regards,
HimanshuHi ,
use this to down load to xcel
v_file = lv_file.
DATA: BEGIN OF s_head OCCURS 0,
head(40) TYPE c ,
END OF s_head.
s_head-head = text-015."'Sales price'. * for header
APPEND s_head.
s_head-head = text-016."'Purchase price'. * for header
APPEND s_head.
s_head-head = text-017."'Listing Procedure'. * for header
APPEND s_head.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
write_field_separator = '#'
TABLES
data_tab = it_output1[]
fieldnames = s_head[]
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. -
Problem in download ALV output
Hi experts,
When I try to download my ALV report output, its giving dump 'Field symbol has not yet been assigned.
In my ALV output, I have 46 fields/columns. When I have 18 fields/columns or less, I able to download, but if it is more than 18. Its giving the above dump.
*Error details:*
Runtime Errors GETWA_NOT_ASSIGNED
Date and Time 05.09.2009 17:56:13
Short text
Field symbol has not yet been assigned.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLKKBL" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
You attempted to access an unassigned field symbol
(data segment 110).
This error may occur if
- You address a typed field symbol before it has been set with
ASSIGN
- You address a field symbol that pointed to the line of an
internal table that was deleted
- You address a field symbol that was previously reset using
UNASSIGN or that pointed to a local field that no
longer exists
- You address a global function interface, although the
respective function module is not active - that is, is
not in the list of active calls. The list of active calls
can be taken from this short dump.
Please provid the solution for this.
Thanks and regards,
SubbuHi Sandra,
As you told, There is a problem in populating field catalog.
Actually, I had passed the same field name 2 times while populating field catalog table. Thats why, the issue has been raised. Now I changed it accordingly.
Thanks and regards
Subbu
Edited by: subbu_1983 on Sep 6, 2009 11:10 AM -
Subtotal problem in Export Excel from ALV Output
Subtotal displays correct in alv output, but if i do the export excel , that subtotal value is changed in excel sheet.
is it possible to solve this problem.DATA: lo_grid TYPE REF TO cl_gui_alv_grid.
** get the global reference
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lo_grid.
** get the subtotal
DATA: it_01 TYPE REF TO data.
* CALL METHOD lo_grid->get_subtotals
IMPORTING
ep_collect01 = it_01.
** change the data
FIELD-SYMBOLS: <ft_tab> TYPE ANY TABLE,
<fs_tab> TYPE ANY,
<ff_field> TYPE ANY.
ASSIGN it_01->* TO <ft_tab>.
LOOP AT <ft_tab> ASSIGNING <fs_tab>.
ASSIGN COMPONENT 'PER' OF STRUCTURE <fs_tab> TO <ff_field>.
<ff_field> = '100'.
ENDLOOP.
** Refresh the table display
CALL METHOD lo_grid->refresh_table_display
EXPORTING
i_soft_refresh = 'X'. -
HI ,
I developed ALV report, the output is coming properly. But if i download that output into local file or spreadsheet from ALV output screen am unable to get the data only header and field headers are coming but data is not coming. But for other ALV with same importing parameters it is downloading properly. I donu2019t know whatu2019s problem only for this ALV, any one can please help me out from this situation pls.
ThxHi Lavanya
There can be two possibilities
1.) check the authorization, if it's missing, then this might happen...u hav said that the other report, it's downloading fine...r u trying to download the other report also with the same user id? is it a standard program or a customized report?
2.) just try reducing the security level in excel --> Tools -> Macros -> Security
regards
Sathish -
Problem with alv output export to text file
hi experts,
when iam exporting alv output to text file,
some data is missing in text file.say for example sold-to-party value is 1155027 in alv out put,but in text file it is showeing only 115502 ,
the last digit is missing,
can anyone help urgent!!!!!and when you export it to excel?
from here you could save it as text file too...
A. -
Problem in Download ALV Output to Excel
Hi All,
When iam going to Download the ALV ( Grid ) Output to Excel, all columns are not coming in Output.
But the ALV Output Contains 140 Columns.
How to solve this issue.
Points Rewarded.
Thanks & Regards,
Kiran . IHi,
You can download the report by going to menu option
List->export->local file.. in this select spreadsheet and give the name for this to download.
You can view all the columns here in xls sheet.
Regards,
Ram Mohan
Pls reward poins if useful... -
Search help problem in ALV output for field TD24A-DISMM
Hi Abap-Experts,
I have one issue regarding simple ALV report.
I need to display search-help for field DISMM. I have used below code in ALV fieldcatalog.
ts_fieldcat - tabname = 'TD24A'.
ts_fieldcat - tabname = 'DISMM'.
I have attached search-help for fields such as MATNR and WERKS too.
The search-helps are getting displayed for MATNR as well as WERKS.
But, the search-help is not gettting displayed for field DISMM(RP-TYPE) .
The output displayed is done using Simple ALV.
Could anyone please help me and correct my code or logic i have used.Hi,
I have changed code a bit...and used T438A table.
CLEAR ts_fieldcat.
ts_fieldcat-col_pos = '5'.
ts_fieldcat-fieldname = 'DISMM'.
ts_fieldcat-seltext_l = text-014.
ts_fieldcat-outputlen = 2.
ts_fieldcat-reptext_ddic = ''.
ts_fieldcat-ref_tabname = 'T438A'.
ts_fieldcat-ref_fieldname = 'DISMM'.
ts_fieldcat-ddic_outputlen = '2'.
ts_fieldcat-input = 'X'.
APPEND ts_fieldcat TO gt_fieldcat.
still it is not showing me the F4 help in simplae ALV output..
kindly help me -
ALV Problem :: Output Problem
Hi Experts,
I have one query. In my ALV output display, I am getting save button as disable mode.
Actually my user wants to save the layout once he hide the particular fields & all.
I have seen the code but there is as such no PF status is maintained for that report.
Can anybody suggest me what I supposed to do so that I can save the layout?
Thanks,
NehaCALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_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 =
IT_FIELDCAT = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A' -- Add this in ur code
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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final
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. -
Negative sign for DMBTR field in ALV output
Hi Experts,
Before posting I have searched for more than 3 hours in the forums to get a solution for this.
I did not get any solution so I am posting this problem which I need to resolve.
I have to display the DMBTR field in ALV output for which a grand total will have to be displayed.
Here for all the values in DMBTR which are negative are getting displayed as '- 6673.56','- 289956.23' as I am using the edit mask 'V_____________.__'.
I have to get the value shown as '-6673.56', '-289956.23'.
I tried to use convert this DMBTR to String and have successfully displayed the negative sign correctly in front of the value but I am not getting the totals which I need to have
PLease check and suggest for a solution.
Regards
KishoreHi,
If this is the case, then you can use character field to display the sign on the left. Sum up the total and use the event end of list to display the same. Remember to set the TECH and NO_OUT in the field catalog.
Hope this helps.
Regards,
Siva -
Strange behaviour in alv output display for a date column!
hi friends,
my alv output list display contains a column for budat (posting date), if this field has no value, then it displays a blank cell (space) in the output in my user login...but when the same report is run in another user login, even though the value of the column is null, it displays 00000000 (8 zeroes) rather than displaying a blank cell...i have set the field catalog property NO_ZERO = 'X'; is this property has anything to do with authorization to achieve its funcionality? am not sure...this is strange, as it is the same report, same field catalog that is being used..need some inputs on this
thanks in advance
SathishThere are 2 solutions for an adhoc solution you can change the field to a char10 field, this will solve your immediate problem of the 0 display. For a permanent solution you can check the user profile setting for the date for you as well as the concerned user.
Hope That Helps
Anirban M. -
Page-break in alv background job for alv output variant not coming correctl
Hi,
I have created an ALV grid report. When i run the report in background i get the output with correct page-break on FIELD1. Now when i run the report in background with an "ALV output variant" (its the ALV variant that controls the fields display in the output; this is not the program variant), i do not get the page-break on FIELD1. I have already build the sort criteria and using:
gs_sort-group = '* '. "New-Page
Please let me know what could be reason for not getting the page-break in background when i am using the alv output variant and how do i correct this problem.
Regards,
RakeshHello Everyone,
I have solved the problem. While running the program in background, we get the page-breaks when we use the below part of code in the sort catalogue with the condition that the program variant should not use any ALV layout variant.
gs_sort-group = '* '. "New-Page
If you are using the ALV layout variant in the program variant then we can check the ROWPOS, COLPOS, and NO_OUT for that ALV layout variant and pass them along in the fieldcatalog table. You should be careful with not to pass the layout variant in the DISVARIANT. You can notice that i have cleared it and simply passing the program name into that.
*C-- Process separately for jobs running in Background. Actually
*C-- sortcat-group solves the problem only in Foreground. In background
*C-- when ALV layout variant is not selected then it works otherwise it
*C-- fails. So for background jobs we are reading the fieldcat and then
*C-- passing the same in the display FM.
IF sy-batch = 'X'.
CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
EXPORTING
i_dialog = ' '
i_user_specific = ' '
i_default = ' '
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
it_default_fieldcat = gt_fieldcat
i_layout = gs_layout
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
IMPORTING
* E_EXIT =
et_fieldcat = lt_fieldcat
* et_sort = gt_sort[]
* ET_FILTER =
* es_layout = gs_layout
CHANGING
cs_variant = gs_disvariant
EXCEPTIONS
wrong_input = 1
fc_not_complete = 2
not_found = 3
program_error = 4
OTHERS = 5
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR gs_fieldcat.
LOOP AT gt_fieldcat INTO gs_fieldcat.
*C-- Transfer all position changes to gt_fieldcat from lt_fieldcat
CLEAR ls_fieldcat.
READ TABLE lt_fieldcat
INTO ls_fieldcat
WITH KEY fieldname = gs_fieldcat-fieldname.
IF sy-subrc = 0.
gs_fieldcat-row_pos = ls_fieldcat-row_pos.
gs_fieldcat-col_pos = ls_fieldcat-col_pos.
gs_fieldcat-no_out = ls_fieldcat-no_out.
MODIFY gt_fieldcat FROM gs_fieldcat INDEX sy-tabix.
CLEAR gs_fieldcat.
ENDIF.
ENDLOOP.
*C-- Clear the disvariant for the background job as it contains the ALV
*C-- layout varinat
CLEAR gs_disvariant.
gs_disvariant-report = 'ZGPPMP0001'.
Then pass gt_fieldcat to 'REUSE_ALV_GRID_DISPLAY'.
The reason i'm doing it this way is that when we pass the layout variant name, the contents in gt_fieldcat were getting modified.
One more thing i'd like to point out is that that, i tried to delete the fields with no_out = 'x'. Now when i ran the program in background with all the fields in sort catalog (suppose there are 2 fields field1 and field2) also in fieldcatalog it ran fine. In the next run in background i removed one of the fields in sort catalog from the fieldcatalog (delete the fields with no_out = 'x') and i got dump. Basically i had hidden field1 and so the code which was deleting fields with no_out = 'x' deleted this field from gt_fieldcat. So basically we should not delete fields with no_out = 'x'.
I was getting ABAP runtime errors MESSAGE_TYPE_X in the following part of the standard code.
000310 LOOP AT CT_SORT INTO LS_SORT.
000320
000330 READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
000340 WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
000350 IF SY-SUBRC NE 0.
> MESSAGE X000(0K).
000370 ENDIF.
000380
000390 LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
i have just mentioned this part because when i checked the forum many people were getting such errors "MESSAGE_TYPE_X". This could also be one of the reasons.
Maybe you are looking for
-
Specify xml string in .java file?
I have a class A in a .java file where I would like to specify a string which is a xml snippet: public class A { public String getXmlString() { String myXmlString = "<?xml version="1.0"?> <catalog> <book id="bk101"> <author>Gambardella, Mat
-
Adding objectClass to existing context...
I'm a newbie so bare w/ me =). How do I add an objectClass in JNDI to an existing entry/context in a directory? e.g. I wasnt to add: objectClass=psAddress to a current entry that has: cn=Brian Van,o=Home objectClass=top objectClass=person objectClass
-
Iphone won't start after crash
My iPhone 4S crashed and restarted but fails to wake up. It restarts but then stops and restarts again. It won't stop until the battery is dead but does the same as soon as I plug it in. Can I wipe and reset to factory without connecting it?
-
Hi, I am trying to render a file from Cinema 4D within AE to a series of PNG files as I don't want my animation having a black background (I don't believe there is an easier way?). Problem is any tutorial I follow on YouTube shows an option under 'Re
-
HOW TO CREATE DATA SOURCE FOR MAXDB
hi, i am using hibernate in NetWeaver with maxdb. i have to give datasource name in hibernate.cfg.xml but i do't know how to create datasource for maxdb. please help me. Thanqqqqqqqq Guru