Problem in ALV layout ...urgent
Hi,
I am using transction VL06C which displays the ALV list. The strucute used by standard program for ALV is LIPOV. There is one include available for customer fields LIPOVZ.
I have inculded my Z structure to it and new field i added is shipmet number. Now i can see the shipment number in the layout of ALV list as hidden field. So I automatically got this field in my ALV list.
Now today I added one more filed quantity to my Z structure. But I cant see that field in my Layout of ALV.
When I debugg I can see the field is getting populated correctly in user exit. Also in Field catalog.
But can not see in Layout when I am trying to change the ALV layout. I can see only Ship. Number
Please suggest.
Hi Vinit,
I think you may have copied the fieldcatalog structure from your previous fields.
Check whether this line has been added for the field.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'MTART'(060).
wa_fieldcat-seltext_l = 'Mat. Type '(024).
wa_fieldcat-ddictxt = c_long.
* Hide the column
*wa_fieldcat-no_out = c_x.*
append wa_fieldcat to i_fieldcat.
. Sorry if iam wrong.
Similar Messages
-
Problem with alv layout?
Hi everyone,
I generating 2 alv reports within a program.In the selection screen there are 2 radio buttons for different alv reports. I selected the 1st radio button and executed the prog to get a alv report.Then i went to change layout and selected the required columns from the columns set saved the layout as the default layout.
Then I came back to the selection screen again and selected the 2nd radio button and executed the program.Here the program is taking the default layout which i saved earlier as the layout and generating the alv report according to that.But i don't want to use the default layout when i select the 2nd radio button.How can i do that?
Any suggestions please?First define a variable as below
data: gs_variant like disvariant.
Also have two selection screen parameters for each alv report as shown below
parameters: p_alvr1 like disvariant-variant,
p_alvr2 like disvariant-variant.
before calling the ALV function module to display, do the following.
gs_variant-report = sy-report.
if you are calling report1, then
gs_variant-variant = p_alvar1.
gs_variant-handle = 'ALV1'. " The is what separates two variants.
if you are calling report 2 then
gs_variant-variant = p_alvar1.
gs_variant-handle = 'ALV2'. " The is what separates two variants.
simply pass the gs_variant to the ALV function module as shown below
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_user_command = g_user_command
i_structure_name = 'I_RPT'
is_layout = gs_layout
i_save = g_save
is_variant = gs_variant
it_fieldcat = gt_fieldcat[]
TABLES
t_outtab = i_rpt
EXCEPTIONS
program_error = 1
others = 2. -
Problem in saving layout in ALV's
Hi all!
I am getting a strange problem in ALV's .For an ALV report some users are able to save the layouts where as some are not able to save .Why is it happening so? I have mentioned IS_SAVE = 'X' in my func.module REUSE_ALV_GRID_DISPLAY.Please help.Hi,
You Have to call the Fm Reuse_alv_variant_f4
SELECTION-SCREEN : BEGIN OF BLOCK blk3 WITH FRAME TITLE text-003.
PARAMETER:p_var TYPE disvariant-variant MODIF ID p2. "Variant Part
SELECTION-SCREEN:END OF BLOCK blk3.
Data: wa_variant TYPE disvariant,
wa_variant1 TYPE disvariant.
CONSTANTS:c_x(1) TYPE c VALUE'X',
lc_a(1) TYPE c VALUE 'A',
FORM alv_variant .
wa_variant-username = sy-uname.
wa_variant-report = sy-repid.
*For variant Part
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = wa_variant
i_save = lc_a
IMPORTING
es_variant = wa_variant1
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
p_var = wa_variant-variant.
ELSE.
p_var = wa_variant1-variant.
ENDIF.
ENDFORM. " alv_variant
After That
*display variant
wa_variant-report = sy-repid.
IF NOT p_var IS INITIAL.
wa_variant-variant = p_var.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = lwa_layout
it_fieldcat = gi_fieldcat
is_variant = wa_variant
i_default = c_x
i_save = lc_a
TABLES
t_outtab = gi_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
Regards
Sandipan -
Problem in exporting ALV Layout to excelsheet!!!
Hi,
I am facing a problem while trying to export an ALV layout to Excel sheet. While the values appear correctly, the order of the columns gets distorted. So the table in Excel appears with correct values but with columns in disarray. I have checked the settings of Excel (SECURITY LEVEL is Medium and TRUSTED SOURCES "Trust All Installed Add-Ins and Templates" and "Trust Access to Visual Basic Project" is checked.) and its doesnt seem to be change anything.
Any suggestions?Hi,
Follow the below procedures to export data to excel.
Normal ALV :
Click on the local file option and select spreadsheet option from the radio button list and click on ok , file save window will open , select the correct directory path and give the file name , then ALV contents will be downloaded into Excel sheet.
In OO ALV :
click on the Export button in the ALV toolbar ->click on the spreadsheet , then information message window will open , select ok button , then you will get three options , click on the table option and press ok , data will be exported to Excel sheet , then save the excel data in specified directory.
Regards
Appana -
Hi everyone,
I generating 2 alv reports within a program.In the selection screen there are 2 radio buttons for different alv reports. First i selected the 1st radio button and executed the prog to get a alv report.Then i went to change layout and selected the required columns from the columns set and then saved the layout as the default layout.
Then I came back to the selection screen again.In the selection screen, in the parameter p_var there is default variant,so i cleared the parameter with no layout variant selected.then i selected the 2nd radio button and executed the program.Here the program is again taking the default layout (even though i cleared it in the selection screen )and generating the alv report according to that.But i don't want to use the default layout when i select the 2nd radio button,unless i select it from the variant list.How can i do that?
Any suggestions please?Hi Hymavathi,
Thanks for the reply.Below is my code for the layout.If u can see any problem in the code please tell me the changes.Thank you.
PARAMETERS: P_VAR LIKE DISVARIANT-VARIANT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VAR.
PERFORM GET_VARIANT CHANGING P_VAR. " ALV Layout
FORM GET_VARIANT CHANGING X_VAR.
PERFORM F4_ALV_LAYOUT(PPIO_ENTRY) USING I_GRID-PROGRAM
CHANGING X_VAR.
ENDFORM.
perform alv_display.
FORM ALV_DISPLAY.
DATA: I_GRID-LAYOUT TYPE SLIS_LAYOUT_ALV.
SORT I_HEADER BY PLNBEZ AUFNR.
Define layout.
CLEAR I_GRID-LAYOUT.
I_GRID-LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
Set up Variant
I_GRID-VARIANT-VARIANT = P_VAR. " Variant
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = I_GRID-PROGRAM
IS_LAYOUT = I_GRID-LAYOUT
IT_FIELDCAT = I_GRID-FIELDCAT
I_SAVE = 'A'
IS_VARIANT = I_GRID-VARIANT
TABLES
T_OUTTAB = I_HEADER
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ALV Failed.
IF SY-SUBRC <> 0.
WRITE: / 'Failed with',SY-SUBRC.
ENDIF.
ENDFORM.
PERFORM ALV_DISPLAY_2.
FORM ALV_DISPLAY_2.
DATA: I_GRID-LAYOUT TYPE SLIS_LAYOUT_ALV.
SORT I_HEADER BY PLNBEZ AUFNR.
Define layout.
CLEAR I_GRID-LAYOUT.
I_GRID-LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
Set up Variant
I_GRID-VARIANT-VARIANT = P_VAR. " Variant
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = I_GRID-PROGRAM
I_CALLBACK_PF_STATUS_SET = I_GRID-PF_STATUS_SET
I_CALLBACK_USER_COMMAND = I_GRID-USER_COMMAND
IS_LAYOUT = i_grid-layout
IT_FIELDCAT = I_GRID-FIELDCAT
I_SAVE = 'A'
IS_VARIANT = I_GRID-VARIANT
TABLES
T_OUTTAB = I_HEADER
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ALV Failed.
IF SY-SUBRC <> 0.
WRITE: / 'Failed with',SY-SUBRC.
ENDIF.
ENDFORM. " ALV_DISPLAY_2 -
Hi Friends,
I have the following 2 problems in ALV report
1) Logo is not getting displayed in the report.
2) When i click on the Purchase order number in the report the interactive report is not working,i am not able to see report of First interactive level.
can you help it out friends.
Thanks and regards
Dinesh
REPORT YSDBALV1
tables: ekko , ekpo .
type-pools: slis .
Table for Display Header
data:i_header type slis_t_listheader with header line.
*Fieldcat Declaration
data:fieldcatalog type slis_T_fieldcat_alv WITH HEADER LINE.
*Table of Events
data:i_event type slis_t_event with header line .
For Layout
data:i_layout type slis_layout_alv .
data: text(30) .
*Internal Table Declaration
data: begin of it_final occurs 0 ,
ebeln like ekko-ebeln , "Purchasing Document No.
bedat like ekko-bedat , "Purchasing Document Date
matnr like ekpo-matnr , "Material No.
netwr like ekpo-netwr , "Net Order Value in PO Currancy
meins like ekpo-meins , "UOM
chk(1) ,
light(1) ,
change like ekpo-menge ,
end of it_final .
**select option Declaration
selection-screen begin of block block.
select-options: s_ebeln for ekko-ebeln .
selection-screen end of block block .
selection-screen begin of block block1 .
parameters:grid radiobutton group r .
parameters:list radiobutton group r .
selection-screen end of block block1 .
at selection screen
at selection-screen .
select single * from ekko where ebeln in s_ebeln .
if sy-subrc <> 0 .
message e000(8I) WITH 'No Data Exists' .
endif .
start-of-selection .
if grid = 'X' .
perform get_data .
perform event using i_event[] .
perform field using fieldcatalog[] .
perform layout using i_layout .
perform grid_display .
endif .
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
*DATA Retrieval from tables
SELECT EKKO~EBELN
EKKO~BEDAT
EKPO~EBELP
EKPO~MATNR
EKPO~NETWR
EKPO~MEINS
EKPO~MENGE
EKPO~BPRME
INTO CORRESPONDING FIELDS OF table IT_FINAL
FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
WHERE EKKO~EBELN IN S_EBELN.
APPEND IT_FINAL.
endform. " get_data
*Getting the Event for Top of Page display.
*& Form event
text
-->P_I_event[] text
form event using p_i_event type slis_t_event.
clear p_i_event .
refresh p_i_event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = p_i_event
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
read table p_i_event with key name = slis_ev_top_of_page into i_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE_PO' to i_event-form.
modify p_i_event from i_event index sy-tabix transporting form.
endif.
clear i_event.
endform. " event
*Display Top-of Page Details and Logo
form top_of_page_po .
clear i_header .
refresh i_header .
write sy-datum to text.
i_header-typ = 'H'.
i_header-info = 'PURCHASE OREDER DETAILS'.
append i_header.
*Logo Display
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header[]
I_LOGO = 'ENJOYSAPLOGO'.
endform .
*Field Catalog Append
*& Form field
text
-->P_fieldCATALOG[] text
form field using p_fieldcatalog type slis_t_fieldcat_alv.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order No'.
fieldcatalog-col_pos = 1.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'BEDAT'.
fieldcatalog-seltext_m = 'PO Date'.
fieldcatalog-col_pos = 2.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material No'.
fieldcatalog-col_pos = 4.
fieldcatalog-outputlen = 20.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'NETWR'.
fieldcatalog-seltext_m = 'Net Value '.
fieldcatalog-col_pos = 5.
fieldcatalog-outputlen = 20.
fieldcatalog-do_sum = 'X'.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Units'.
fieldcatalog-col_pos = 6.
fieldcatalog-outputlen = 4.
append fieldcatalog .
clear fieldcatalog.
endform. " field
*& Form layout
text
form layout using p_i_layout TYPE SLIS_LAYOUT_ALV .
i_layout-zebra = 'X'.
i_layout-lights_fieldname = 'LIGHT'.
i_layout-lights_tabname = 'IT_FINAL'.
i_layout-box_fieldname = 'CHK'.
i_layout-box_tabname = 'IT_FINAL'.
i_layout-edit = ' '.
endform.
*To display Buttons in the MENU BAR if needed
FORM SET_PO_PF_STATUS USING P_I_EXTAB TYPE
SLIS_T_EXTAB.
SET PF-STATUS 'MENUPO'.
ENDFORM.
*Event for Interactive display of ALV report
form USER_COMMAND using r_ucomm like sy-ucomm
rs_selfield type slis_selfield .
if r_ucomm = '&IC1'.
READ TABLE IT_FINAL index rs_selfield-tabindex.
write:/ IT_FINAL-ebeln.
endif.
endform .
*Parameters of FM REUSE_ALV_GRID_DISPLAY
*& Form grid_display
text
--> p1 text
<-- p2 text
form grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
IT_EVENTS = I_EVENT[]
TABLES
t_outtab = IT_FINAL.
endform. " grid_display*& Report YSDBALV1
REPORT YSDBALV1.
tables: ekko , ekpo .
type-pools: slis .
Table for Display Header
data:i_header type slis_t_listheader with header line.
*Fieldcat Declaration
data:fieldcatalog type slis_T_fieldcat_alv WITH HEADER LINE.
*Table of Events
data:i_event type slis_t_event with header line ,
wa_event type line of slis_t_event.
For Layout
data:i_layout type slis_layout_alv .
data: text(30) .
*Internal Table Declaration
data: begin of it_final occurs 0 ,
ebeln like ekko-ebeln , "Purchasing Document No.
bedat like ekko-bedat , "Purchasing Document Date
matnr like ekpo-matnr , "Material No.
netwr like ekpo-netwr , "Net Order Value in PO Currancy
meins like ekpo-meins , "UOM
chk(1) ,
light(1) ,
change like ekpo-menge ,
end of it_final .
**select option Declaration
selection-screen begin of block block.
select-options: s_ebeln for ekko-ebeln .
selection-screen end of block block .
selection-screen begin of block block1 .
parameters:grid radiobutton group r .
parameters:list radiobutton group r .
selection-screen end of block block1 .
at selection screen
at selection-screen .
select single * from ekko where ebeln in s_ebeln .
if sy-subrc <> 0 .
message e000(8I) WITH 'No Data Exists' .
endif .
start-of-selection .
if grid = 'X' .
perform get_data .
perform event using i_event[] .
perform field using fieldcatalog[] .
perform layout using i_layout .
perform grid_display .
endif .
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
*DATA Retrieval from tables
SELECT EKKO~EBELN
EKKO~BEDAT
EKPO~EBELP
EKPO~MATNR
EKPO~NETWR
EKPO~MEINS
EKPO~MENGE
EKPO~BPRME
INTO CORRESPONDING FIELDS OF table IT_FINAL
FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
WHERE EKKO~EBELN IN S_EBELN.
APPEND IT_FINAL.
endform. " get_data
*Getting the Event for Top of Page display.
*& Form event
text
-->P_I_event[] text
form event using p_i_event type slis_t_event.
clear p_i_event .
refresh p_i_event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = p_i_event.
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
read table p_i_event with key name = slis_ev_top_of_page into wa_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE_PO' to i_event-form.
modify p_i_event from i_event index sy-tabix transporting form.
endif.
clear i_event.
endform. " event
*Display Top-of Page Details and Logo
form top_of_page_po .
clear i_header .
refresh i_header .
write sy-datum to text.
i_header-typ = 'H'.
i_header-info = 'PURCHASE OREDER DETAILS'.
append i_header.
*Logo Display
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header[]
I_LOGO = 'ENJOYSAP_LOGO'.
endform .
*Field Catalog Append
*& Form field
text
-->P_fieldCATALOG[] text
form field using p_fieldcatalog type slis_t_fieldcat_alv.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order No'.
fieldcatalog-col_pos = 1.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'BEDAT'.
fieldcatalog-seltext_m = 'PO Date'.
fieldcatalog-col_pos = 2.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material No'.
fieldcatalog-col_pos = 4.
fieldcatalog-outputlen = 20.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'NETWR'.
fieldcatalog-seltext_m = 'Net Value '.
fieldcatalog-col_pos = 5.
fieldcatalog-outputlen = 20.
fieldcatalog-do_sum = 'X'.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Units'.
fieldcatalog-col_pos = 6.
fieldcatalog-outputlen = 4.
append fieldcatalog .
clear fieldcatalog.
endform. " field
*& Form layout
text
form layout using p_i_layout TYPE SLIS_LAYOUT_ALV .
i_layout-zebra = 'X'.
i_layout-lights_fieldname = 'LIGHT'.
i_layout-lights_tabname = 'IT_FINAL'.
i_layout-box_fieldname = 'CHK'.
i_layout-box_tabname = 'IT_FINAL'.
i_layout-edit = ' '.
endform.
*To display Buttons in the MENU BAR if needed
FORM SET_PO_PF_STATUS USING P_I_EXTAB TYPE
SLIS_T_EXTAB.
SET PF-STATUS 'MENUPO'.
ENDFORM.
*Event for Interactive display of ALV report
form USER_COMMAND using r_ucomm like sy-ucomm
rs_selfield type slis_selfield .
if r_ucomm = '&IC1'.
READ TABLE IT_FINAL index rs_selfield-tabindex.
set parameter id 'VL1' field it_final-ebeln.
call transaction 'ME23N'.
endif.
endform .
*Parameters of FM REUSE_ALV_GRID_DISPLAY
*& Form grid_display
text
--> p1 text
<-- p2 text
form grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
IT_EVENTS = I_EVENT[]
TABLES
t_outtab = IT_FINAL.
endform. " grid_display
Regards,
Rusidar S. -
ALV layout variant missing in background job.
hi guys,
Having problem on getting the default ALV layout variant when run the job in backgorund. Please advise any correction needed in the following code.
Thanks.
*& Include Z_MM_KBR_AGSUBCONINV_MOD2 *
MODULE status_0100 OUTPUT.
SET PF-STATUS '100'.
SET TITLEBAR '100'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module display_data OUTPUT
text
MODULE display_data OUTPUT.
IF sy-batch IS INITIAL. "Foreground
IF w_container IS INITIAL.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
*Creating the container
CREATE OBJECT w_container
EXPORTING
container_name = c_container
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
*Creating the ALV GRID
CREATE OBJECT w_grid
EXPORTING
i_parent = w_container
i_appl_events = c_check
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 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.
else.
exit.
ENDIF.
ELSE.
*Creating the ALV GRID
CREATE OBJECT w_grid
EXPORTING
i_parent = go_dock_container
i_appl_events = c_check
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
WRITE:/ 'Error in grid'.
ENDIF.
CREATE OBJECT w_grid
EXPORTING i_parent = go_dock_container.
ENDIF.
*getting the variant option
wa_variant-report = sy-repid.
wa_variant-username = sy-uname.
wa_layout-grid_title = sy-title.
wa_layout-cwidth_opt = c_check.
wa_layout-zebra = c_check.
wa_layout-no_f4 = c_check.
wa_layout-sel_mode = 'D'.
*Excluding the unwanted buttons
PERFORM exclude_toolbar_buttons.
build field catalog.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_buffer_active = c_check
i_structure_name = c_fcat_str
i_bypassing_buffer = c_check
CHANGING
ct_fieldcat = t_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.
loop at t_fieldcat into w_fieldcat.
if w_fieldcat-FIELDNAME = 'AGING1'.
W_FIELDCAT-NO_ZERO = 'X'.
MODIFY t_fieldcat FROM W_FIELDCAT INDEX SY-TABIX.
ENDIF.
endloop.
Generate sort critria
PERFORM generate_sort.
Create object of class lcl_event_receiver.
CREATE OBJECT w_event.
Handler for events.
SET HANDLER w_event->handle_top_of_page FOR w_grid.
SET HANDLER w_event->handle_print_top_of_page FOR w_grid.
SET HANDLER w_event->handle_print_end_of_list FOR w_grid.
SET HANDLER w_event->handle_hotspot_click FOR w_grid.
*Displaying the alv
IF NOT sy-batch IS INITIAL.
PERFORM create_snp.
ENDIF.
t_data = i_final.
CALL METHOD w_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = wa_layout
is_variant = wa_variant
CHANGING
it_outtab = t_data
it_fieldcatalog = t_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDIF.
ENDMODULE. " display_data OUTPUT
*& Module user_command_0100 INPUT
text
MODULE user_command_0100 INPUT.
DATA: lt_rows TYPE lvc_t_row,
w_rows TYPE lvc_s_row.
CASE sy-ucomm.
WHEN c_back.
LEAVE TO SCREEN 0.
WHEN c_exit.
LEAVE TO SCREEN 0.
WHEN c_cancel.
LEAVE TO SCREEN 0.
WHEN 'BILDET'.
CALL METHOD w_grid->get_selected_rows
IMPORTING
et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc EQ 0.
READ TABLE lt_rows INTO w_rows INDEX 1.
READ TABLE i_vbfa INTO w_vbfa INDEX w_rows-index.
IF sy-subrc EQ 0.
CLEAR i_zbw_br_nf4.
LOOP AT i_zbw_br_nf3 INTO w_zbw_br_nf3 WHERE
refkey = w_vbfa-v_vbeln.
APPEND w_zbw_br_nf3 TO i_zbw_br_nf4.
ENDLOOP.
call dialog screen and display new alv control
CALL SCREEN 101 STARTING AT 10 5.
ENDIF.
ENDIF.
WHEN 'NOTAF'.
CALL METHOD w_grid->get_selected_rows
IMPORTING
et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc EQ 0.
READ TABLE lt_rows INTO w_rows INDEX 1.
READ TABLE i_zbw_br_nf3 INTO w_zbw_br_nf3 INDEX w_rows-index.
DATA docnum LIKE j_1bdydoc-docnum.
docnum = w_zbw_br_nf3-docnum.
SET PARAMETER ID 'JEF' FIELD docnum.
CALL TRANSACTION 'J1B3N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDMODULE. " user_command_0100 INPUT
*& Form modify_col_name
text
-->P_<FCAT> text
-->P_TEXT_H01 text
FORM modify_col_name USING pwa_fcat TYPE lvc_s_fcat
value(pw_text) TYPE any.
pwa_fcat-coltext = pw_text.
pwa_fcat-scrtext_l = pw_text.
pwa_fcat-scrtext_m = pw_text.
pwa_fcat-scrtext_s = pw_text.
ENDFORM. " modify_col_name
FORM display_hotspot *
FORM display_hotspot USING pw_row_id TYPE lvc_s_row
pw_column_id TYPE lvc_s_col.
FIELD-SYMBOLS <l_data> TYPE zbrforecast.
READ TABLE t_br_nf_acum ASSIGNING <l_data> INDEX pw_row_id-index.
CHECK sy-subrc = 0.
IF pw_column_id = ' '.
ENDIF.
ENDFORM. "display_hotspot
*& Form generate_sort
Genereate Sort criteria
FORM generate_sort.
Local variables
DATA: wal_sort TYPE lvc_s_sort,
wl_pos TYPE numc2.
wl_pos = 01.
sort ORDER
wal_sort-spos = wl_pos.
wal_sort-fieldname = c_aufnr.
wal_sort-up = c_check.
APPEND wal_sort TO t_sort.
ENDFORM. "generate_sort
*& Form f4_variant
text
<--PW_VARI text
FORM f4_variant CHANGING pw_vari TYPE disvariant-variant.
wa_variant-report = sy-cprog.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = wa_variant
i_save = c_u
IMPORTING
es_variant = wa_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc IS INITIAL.
pw_vari = wa_variant-variant.
ELSE.
MESSAGE s208(00) WITH text-t04.
ENDIF.
ENDFORM. " f4_variant
*& Form validate_layout
*This subroutine is to validate the layout
No parameters are passed to this subroutine
FORM validate_layout.
IF NOT p_layout IS INITIAL.
Check Layout
wa_variant-report = sy-repid.
wa_variant-username = sy-uname.
wa_variant-variant = p_layout.
CALL FUNCTION 'LVC_VARIANT_EXISTENCE_CHECK'
EXPORTING
i_save = c_u
CHANGING
cs_variant = wa_variant
EXCEPTIONS
OTHERS = 01.
IF NOT sy-subrc IS INITIAL.
SET CURSOR FIELD 'P_LAYOUT'.
MESSAGE s001(00) WITH text-t06 p_layout.
STOP.
ENDIF.
ELSE.
clear wa_variant.
ENDIF.
ENDFORM. " validate_layout
*& Form validate_data
text
FORM validate_data .
PERFORM validate_layout.
ENDFORM. " validate_dataHi,
Before the call to method set_table_for_first_display, populate
wa_variant-report = sy-repid.
Best regards,
Prashant -
Hi All,
I have an issue with ALV report.I have basic list and secondary list.The problem is the layout selection of one list is effecting the other list display.Could you please let me know some body what parameters I have to pass for IS_LAYOUT parameter in the ALV_Griddisplay ?what is the purpose of IS_Variant--handle parameter?
Regards
MaheshHi,
Check the sample Interactive ALV Grid Report.
REPORT z_demo_3_alv_list.
This program is an example with 3 ALV Grid lists *
The customers are displayed in the first list *
When a line is selected, the customer's orders are displayed in *
the second list *
When a line is selected in the second list, the items orders are *
displayed in the second list *
Macro definition
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
TYPE-POOLS: slis. " ALV Global types
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
TYPES:
Data displayed in the first list
BEGIN OF ty_kna1,
kunnr TYPE kna1-kunnr, " Customer number
name1 TYPE kna1-name1, " Customer name
ort01 TYPE kna1-ort01, " Customer city
END OF ty_kna1,
Data displayed in the second list
BEGIN OF ty_vbak,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
netwr TYPE vbak-netwr, " Net Value of the Sales Order
END OF ty_vbak,
Data displayed in the third list
BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln, " Sales document
posnr TYPE vbap-posnr, " Sales document item
matnr TYPE vbap-matnr, " Material number
arktx TYPE vbap-arktx, " Short text for sales order item
kwmeng TYPE vbap-kwmeng, " Order quantity
netwr TYPE vbap-netwr, " Net value of the order item
END OF ty_vbap.
DATA:
gs_kna1 TYPE ty_kna1,
gt_kna1 TYPE TABLE OF ty_kna1,
gs_vbak TYPE ty_vbak,
gt_vbak TYPE TABLE OF ty_vbak,
gt_vbap TYPE TABLE OF ty_vbap.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data_kna1.
END-OF-SELECTION.
PERFORM f_display_data_kna1.
Form f_read_data_kna1
FORM f_read_data_kna1.
Read customer data with a least one order
SELECT kunnr name1 ort01 INTO TABLE gt_kna1
FROM kna1 AS k
UP TO p_max ROWS
WHERE EXISTS
( SELECT kunnr FROM vbak WHERE kunnr = k~kunnr ).
ENDFORM. " F_READ_DATA_KNA1
Form f_display_data_kna1
FORM f_display_data_kna1.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
Build the field catalog
m_fieldcat 'KUNNR' 'KNA1'.
m_fieldcat 'NAME1' 'KNA1'.
m_fieldcat 'ORT01' 'KNA1'.
Display the first list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND_KNA1'
it_fieldcat = lt_fieldcat
TABLES
t_outtab = gt_kna1.
ENDFORM. " F_DISPLAY_DATA_KNA1
FORM USER_COMMAND_KNA1 *
FORM user_command_kna1 USING u_ucomm TYPE sy-ucomm
us_selfield TYPE slis_selfield."#EC CALLED
CASE u_ucomm.
WHEN '&IC1'.
READ TABLE gt_kna1 INDEX us_selfield-tabindex INTO gs_kna1.
CHECK sy-subrc EQ 0.
PERFORM f_read_data_vbak. " Read data from VBAK
PERFORM f_display_data_vbak. " Display orders
ENDCASE.
ENDFORM. " USER_COMMAND_KNA1
Form f_read_data_vbak
FORM f_read_data_vbak.
SELECT vkorg kunnr vbeln netwr
INTO TABLE gt_vbak
FROM vbak
UP TO p_max ROWS
WHERE kunnr = gs_kna1-kunnr.
ENDFORM. " F_READ_DATA_VBAK
Form f_display_data_vbak
FORM f_display_data_vbak.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
Build the field catalog
m_fieldcat 'VKORG' 'VBAK'.
m_fieldcat 'KUNNR' 'VBAK'.
m_fieldcat 'VBELN' 'VBAK'.
m_fieldcat 'NETWR' 'VBAK'.
Display the second list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND_VBAK'
it_fieldcat = lt_fieldcat
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA_VBAK
FORM USER_COMMAND_VBAK *
FORM user_command_vbak USING u_ucomm TYPE sy-ucomm
us_selfield TYPE slis_selfield."#EC CALLED
CASE u_ucomm.
WHEN '&IC1'.
READ TABLE gt_vbak INDEX us_selfield-tabindex INTO gs_vbak.
CHECK sy-subrc EQ 0.
PERFORM f_read_data_vbap. " Read data from VBAP
PERFORM f_display_data_vbap. " Display items
ENDCASE.
ENDFORM. " USER_COMMAND_VBAK
Form f_read_data_vbap
FORM f_read_data_vbap.
SELECT vbeln posnr matnr arktx kwmeng netwr
INTO TABLE gt_vbap
FROM vbap
WHERE vbeln = gs_vbak-vbeln.
ENDFORM. " F_READ_DATA_VBAP
Form f_display_data_vbap
FORM f_display_data_vbap.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
Build the field catalog
m_fieldcat 'VBELN' 'VBAP'.
m_fieldcat 'POSNR' 'VBAP'.
m_fieldcat 'MATNR' 'VBAP'.
m_fieldcat 'ARKTX' 'VBAP'.
m_fieldcat 'KWMENG' 'VBAP'.
m_fieldcat 'NETWR' 'VBAP'.
Display the third list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
TABLES
t_outtab = gt_vbap.
ENDFORM. " F_DISPLAY_DATA_VBAP
END OF PROGRAM Z_DEMO_3_ALV_LIST ******************
Regards,
Raj. -
How to send pdf or excel attachment as saved alv layout in email
Hi Guru,
I am developing a report in which, i am sending report as excel attachment after clicking a button on top of alv grid, and pdf attachment after clicking another button on top of alv grid. I am sending mail by two ways they are:
1) I am populating my internal table value in separate internal table and converting that to string and sending email as excel attachment.
2) And am converting report as spooljob, and using abapspool 2 pdf function module i am converting spool to pdf, after that am send that pdf as mail attachment.
Now my requirement is i need to send email attachment as layout which is displayed in the alv screen, even i hide a column and change the layout it is going with all the columns. What should i do for this problem.
Regards,
RithikaHi,
Check if the below steps will solve the problem.
* Get the run time ALV layout (field catalog) using the below method.
data: r_grid TYPE REF TO cl_gui_alv_grid.
CALL METHOD r_grid->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = t_fcat.
* Adjust the download table according to t_fcat. -
Doubt in alv layout variant.
hi experts,
I have a requirement that my selection screen should have 'ALV LAYOUT' as one of my parameter. I am using PNPCE LDB , now my issue is I can get the layout option when f4 is press on the alv layout parameter but the respective layout is not displaying in my output.
ex: I have layout A and B .
A have only pernr and name
b have only pernr and address
my normal alv layout is pernr name and address. if i choose A in my ALV LAYOUT parameter also its displaying in default layout alv same is happening for while am choosing B. I not getting the alv output for respective layout I chosen.
{code}
FORM GET_VARIANT .
DATA: lw_variant TYPE disvariant,
l_exit TYPE char1.
lw_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = lw_variant
i_save = 'A'
IMPORTING
e_exit = l_exit
es_variant = lw_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF l_exit EQ space.
p_layout = lw_variant-variant.
IF NOT p_layout IS INITIAL.
PERFORM get_w_variant.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " GET_VARIANT
*& Form GET_W_VARIANT
* text
* --> p1 text
* <-- p2 text
FORM GET_W_VARIANT .
DATA: lw_variant TYPE disvariant.
lw_variant-report = sy-repid.
lw_variant-handle = space.
lw_variant-log_group = space.
lw_variant-username = space.
lw_variant-variant = p_layout.
lw_variant-text = space.
lw_variant-dependvars = space.
ENDFORM. " GET_W_VARIANT
*& Form ALV_DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM ALV_DISPLAY .
* DATA: l_table TYPE REF TO cl_salv_table.
* TRY.
* CALL METHOD CL_SALV_TABLE=>FACTORY
** EXPORTING
** LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE
** R_CONTAINER =
** CONTAINER_NAME =
* IMPORTING
* R_SALV_TABLE = L_TABLE
* CHANGING
* T_TABLE = GT_ALV
* CATCH CX_SALV_MSG .
* ENDTRY.
* l_table->display( ).
DATA: lw_variant TYPE disvariant.
DATA:I_FIELD TYPE SLIS_T_FIELDCAT_ALV,
iWA TYPE SLIS_FIELDCAT_ALV.
IWA-FIELDNAME = 'PERNR'.
IWA-SELTEXT_L = 'EMPLOYEE ID'.
APPEND IWA TO i_FIELD.
IWA-FIELDNAME = 'NAME'.
IWA-SELTEXT_L = 'NAME'.
APPEND IWA TO I_FIELD.
IWA-FIELDNAME = 'DEPT'.
IWA-SELTEXT_L = 'DEPT'.
APPEND IWA TO I_FIELD.
IWA-FIELDNAME = 'UNION'.
IWA-SELTEXT_L = 'UNION'.
APPEND IWA TO I_FIELD.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZTESTPRGFOR20' "Program name
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = i_field
* it_sort = i_sort
i_save = 'X'
is_variant = Lw_variant
TABLES
t_outtab = GT_ALV
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. " ALV_DISPLAY
{code}hi Mohammed Quddus,
thanks for your reply . but if you look at my code the concept are same as same as that link code.
am getting all the things right.
i Can able to change the layout by the button on alv and
able to save that new layout
the saved layout are displaying in the my parameter if I press f4. the problem is if I choose the saved layout that layout is not coming in my alv output always its showing default layout.
if anything you find wrong in my code please let me know. -
ME57 transaction with possibility to show in ALV layout
Hi experts,
I need change the alv grid in the transaction ME57. To this, I copied the program RM06BZ00 (scree, includes... )
When I try execute the program with ALV layout the message ''Scope of list ALV not defined (please correct)" shows.
To resolve this problem I change the parameter im_service in the ME_REP_GET_TABLE_MANAGER function (Way to function: program ZSAPFM06B / include ZFM06BF04 / Include ZFM06BF04_PRUEFEN_LSTUB)
When I change this parameter on Debug (manual change) the ALV shows correctly, but when I change in program code the message remains.
How the way to copy the Me57 transaction with possibility to show in ALV layout?
Follows the code change:
CALL FUNCTION 'ME_REP_GET_TABLE_MANAGER'
EXPORTING
im_service = 'RM06BZ00'
im_scope = l_scope
IMPORTING
ex_manager = gf_factory.
Thank you!
Edited by: Andréa Molina on Aug 4, 2011 5:12 PM
Edited by: Rob Burbank on Aug 5, 2011 9:22 AMI solved my own problem...
The change in im_service was right.
The problem is that:
The gf_factory back empty in some places and in standrad transaction back with values. The memory clean the gf_factory result.
So... the only way to show ALV is fill the gf_factory in anywhere the gf_factory is check.
The places are:
1. sapfm06b - fm06bf04 - fm06bf04_pruefen_lstub
Call in RM06BZ00 - perform pruefen_lstub(sapfm06b) using p_lstub.
2. sapfm06b - fm06bfsl - fm06bfsl_ban_aufbauen
Call in RM06BZ00 - ban_aufbauen(sapfm06b).
3. sapfm06b - fm06bf01- fm06bf01_submit
Call in RM06BZ00 - perform perform submit(zgb_sapfm06b) using sucomm.
If the gf_factory is filled in this places... The ALV will show! -
Problem in ALV!!!! Please help
The Following program terminates with short dump when i try to execute.
Please tell me whats the problem.
<<program removed>>
Moderator Message: Did you happen to read the Short Dump error message?
Edited by: kishan P on May 20, 2011 11:59 AMHi Gopal,
There is a a column width optimize function of SLIS ALV layout.
colwidth_optimize(1) type c
but, i am not sure if it works.
Also, when the report is generated, there is an option in the menu.
Go to "Setting --> Columns --> Optimize Width"
With this, it optimizes the column width based on data width but when you download, it reverts to the dictionary field length.
Regards,
Vivek -
Max_linesize - ALV LAYOUT
What is the limit for the field max_linesize for the ALV layout?
I need to print 300 fields, but its doing a short dump for memory on the Quality ambient.. in the development Ambient, it is showing normally.
Someone knows what is this problem?That depends on printer. If you execute your report in background this will give you only 256 char.
Well, if you want to print the 300 lines, you need to run the report in foreground and you have to choose the printer format X_65_512/2 or X_65_256/2. This will print in 2 pages.
Press properties on printer to choose the format. -
Dynamic ALV Layout - Immediate help required
I have a Summary and a Detailed ALV layout screen. Now when i get to detailed screen from summary screen; I choose a layout say L1 here. Then I press F3(back) this would get me back to the summary screen.Now my requirement is when i click on detailed view from here now; the previously chosen layout L1 needs to be used for the report output. Can this be done?
Note : This needs to be done without choosing layout from selection screen.
Require help urgently on this.
Regards
SwamyYes you can do that.
When you are backing out of detailed screen, store the name of the layout in a variable. When you are coming in the detailed screen again, pass this layout name in the IS_VARIANT-LAYOUT variable along with other values.
Before backing out of the detailed screen you can get the layout chosen using the function REUSE_ALV_GRID_LAYOUT_INFO_GET or calling the method GET_FRONTEND_LAYOUT of the class CL_GUI_ALV_GRID, depending on how you are displaying the report.
Regards,
Ravi
Note - Please mark all the helpful answers -
How to display long text in SAP Query ALV layout? It only show 129 char now
I have a SAP Query which show a remark field(Max length more than 500 char), but it only show max length 129 char now. In fact, the lenght of remark field text is more than 300, and i had debug the source code, the field text value do is correct, its length do is 376.
Do anybody can help me solve the issue, let the query ALV layout can show the long text field value?
thanks very much in addvance.Hi,
ALV can show only a restrict value length around 128 characters, many experts said that we can not extend. many suggestions is split text into some column.
Regards,
Maybe you are looking for
-
Print presentasion without Print button on printout
We want print presentation and eliminate Pint button from printout. We tried many ways: 1) We put in presentation initialization method a statement setVisible: false and print.this. Unfortunately a button still visible on printout. 2) We wrote a new
-
Is there a way to move mp3s back from the iPod?
I can transfer to my ipod fine, however I had removed a good deal of my music from my PC hard drive as I had it on my ipod. Is there an easy way to move select music back from my ipod to my PC hard drive?
-
IS-OIL: Exchange Third-party feedstock material for on-spec material
Dear All, We are using SAP ERP ECC 6.0 + IS-Oil Downstream and we are trying to figure out how to record the following business flow in the system: 1. A third-party partner send us feedstock/off-spec material to our oil depot for an exchange with on-
-
I try to create a pdf of a webpage, Quickbooks page, or anything...but when selecting the Adobe Printer to print it brings up the screen to name the pdf and then would typically save the file (create a pdf) on your pc. However, it disappears but nev
-
Hi guys, when is was posting a stock using MB1A using movement type 201P. i get the following error.please do help me to come across these errors error : No stock posting possible for this material Regards Jino