Reg : ALV HIER_SEQ_LIST
HI ,
I am using the HIER_SEQ_LIST_DISPLAY for the output of my report .
I have passed the subroutine into the TOP_OF_PAGE event and i am getting the top of page details in the output..
Same thing i am doing for END_OF_PAGE , but i am not able to see the end of page details. In the Subroutine for END_OF_PAGE i have two write messages.
...Help me to get the end of page ..
Regards,
Krishnamoorthy
Hi,
I am not sure about your code, but please check following programs. You will get idea and can make error fix (if any) in your program.
end of page in alv report
end_of_page in alv
Hope this helps.
ashish
Similar Messages
-
Reg: ALV report - output download
Hi Friends,
I am having one issue reg download of ALV (Grid display) report output. we are having vendor number at 1st colomn. It's displaying correctly in output.
(eg:0000100069). But, when I download the output into a excel file, last digit of the vendor number getting truncated. (eg: 100069 becomes 10006).
Kindly help me regarding this ..
Thanks in advance.
Regards,
Bharat.Hi,
The problem is in formatting in Excel. U download the data. Then select the column u want to format, right click and select format cells. In that, choose Number and assign decimal places to 0. U will get according to the format u needed.
I worked in this, and got as per the specified format.
Reward if found useful. -
Reg alv grid display exporting to excel sheet
hi experts,
I have done an ALV report using reuse_alv_grid _display , out put is fine , but when i click on excel view icon i could only see an excel sheet without any data ., but when i use export to local file and choose spread sheet its giving the data in excel, but the user wants to click only the excel view icon., please help me out.
Note : i have already tried changing the macro security in excel to Low .see it will give you the Status message as ...
<b>View cannot be switched: Product is not installed or integration is not active.</b>
it means the Excel Integration was not done in you sap system . ask basis there will be a Patch for it ... once it was applied automatically in all the ALV the excel view will work
in my system it was working
Girish -
Reg: ALV report download to excel currency columns
Hi All,
While downloading the alv report to excel, currency fields with negative sign(less than 0) is downloading without negative sign.
And field catalog wad declared as 'CURR' field for that particular column, if I declared as 'CHAR', i am getting shortdump.
Can any one tell me how to get the negative sign.
Thanks in advance.Hi,
Do you use ALV to excel standard functionality or your own code to excel?
Please provide more information.
Thanks, -
Hi Expert,
I am facing simple problem regarding alv display.
While retrieving data, records are shown in internal table (It_final), but it doesn't goes to alv display in output.
The code is:
FORM merge_data .
SORT it_qasr BY probenr prueflos vorglfnr.
LOOP AT it_qasr INTO wa_qasr.
w_mittelwert = wa_qasr-mittelwert.
READ TABLE it_qapp INTO wa_qapp WITH KEY prueflos = wa_qasr-prueflos
vorglfnr = wa_qasr-vorglfnr
probenr = wa_qasr-probenr.
wa_final-userd1 = wa_qapp-userd1.
wa_final-usert1 = wa_qapp-usert1.
wa_final-userc1 = wa_qapp-userc1.
SHIFT wa_final-userc1 LEFT DELETING LEADING '0'.
wa_final-userc2 = wa_qapp-userc2.
READ TABLE it_plmk INTO wa_plmk WITH KEY merknr = wa_qasr-merknr
plnnr = wa_mapl-plnnr.
plnkn = wa_qasr-vorglfnr " changed by DEVK909452
READ TABLE it_qpmt INTO wa_qpmt WITH KEY mkmnr = wa_plmk-verwmerkm.
READ TABLE it_qpct INTO wa_qpct WITH KEY codegruppe = wa_qasr-gruppe1
code = wa_qasr-code1.
TRANSLATE wa_qpmt-mkmnr TO UPPER CASE.
IF wa_qpmt-mkmnr CS 'RQZMOI'.
wa_qpmt-mkmnr = 'MOIS_Q'.
ENDIF.
IF wa_qpmt-mkmnr CS 'RIOSI+AL'.
wa_qpmt-mkmnr = 'SIAL_IR'.
ENDIF.
CASE wa_qpmt-mkmnr.
WHEN 'MOIS_Q'.
wa_final-MOIS_Q = w_mittelwert.
WHEN 'SIAL_IR'.
wa_final-SiAl_IR = w_mittelwert.
WHEN 'SHIFT'.
wa_final-shift = wa_qpct-kurztext.
WHEN 'MATERIAL'.
wa_final-material = wa_qpct-kurztext.
ENDCASE.
APPEND wa_final TO it_final.
CLEAR wa_final.
FORM alv_display .
*fieldcatalog template with 105 fields
PERFORM sub_make_field_cat1 USING :
'1' 'USERD1' 'DATE',
'2' 'MATERIAL' 'MATERIAL',
'3' 'USERC2' 'SOURCE',
'4' 'USERC1' 'LOCATION',
'5' 'USERT1' 'TIME',
'6' 'SHIFT' 'SHIFT',
'7' 'MATERIAL' 'MATERIAL',
'8' 'SHIFT' 'SHIFT',
'9' 'MOIS_Q' 'MOISTURE-Q',
'10' 'SI_Q' 'SILICA-Q',
'11' 'AL_Q' 'ALUMINA-Q',
'12' 'FO_Q' 'FERRIC OXIDE-Q',
'13' 'SIZE_Q' 'SIZE-Q',
'14' 'MOIS_IR' 'MOISTURE-IR',
'15' 'TIRON_IR' 'TOTAL IRON-IR',
'16' 'SI_IR' 'SILICA-IR',
'17' 'AL_IR' 'ALUMINA-IR',
'18' 'SIAL_IR' 'SILICA + ALUMINA-IR',
'19' 'P_IR' 'PHOSPHOROUS-IR',
'20' 'L_O_I_IR' 'LOSS ON IGNITION-IR',
'21' 'MN_IR' 'MANGANESS-IR',
'22' 'TITOX_IR' 'TITANIUM OXIDE-IR',
'23' 'ALK_IR' 'ALKALIES-IR',
'24' 'SUL_IR' 'SULPHUR-IR',
'25' 'TIND_IR' 'TUMBLER INDEX-IR',
'26' 'ABBIND_IR' 'ABBRATION INDEX-IR',
'27' 'BDEN_IR' 'BULK DENSITY-IR',
'28' 'SIZE_IR' 'SIZE-IR',
'29' 'MOIS_IRF' 'MOISTURE-IRF',
'30' 'TIRON_IRF' 'TOTAL IRON-IRF',
'31' 'SI_IRF' 'SILICA-IRF',
'32' 'AL_IRF' 'ALUMINA-IRF',
'33' 'P_IRF' 'PHOSPHOROUS-IRF',
'34' 'L_O_I_IRF' 'LOSS ON IGNITION-IRF',
'35' 'MOIS_COKE' 'MOISTURE-COKE',
'36' 'VOL_MAT_COKE' 'VOLATILE MATTER-COKE',
'37' 'ASH_COKE' 'ASH-COKE',
'38' 'FIX_CA_COKE' 'FIXED CARBON-COKE',
'39' 'SUL_COKE' 'SULPHUR-COKE',
'40' 'P_COKE' 'PHOSPHOROUS-COKE',
'41' 'ALK_COKE' 'ALKALIES-COKE',
'42' 'SI_COKE' 'SILICA-COKE',
'43' 'AL_COKE' 'ALUMINA-COKE',
'44' 'FEO_COKE' 'FERRIC OXIDE-COKE',
'45' 'CAO_COKE' 'CALCIUM OXIDE-COKE',
'46' 'MGO_COKE' 'MAGNESIUM OXIDE-COKE',
'47' 'PPOX_COKE' 'PHOSPHOROUS PENTAOXIDE-COKE',
'48' 'SIZE_COKE' 'SIZE-COKE',
'49' 'MOIS_LS' 'MOISTURE-LS',
'50' 'SI_LS' 'SILICA-LS',
'51' 'AL_LS' 'ALUMINA-LS',
'52' 'FEO_LS' 'FERRIC OXIDE-LS',
'53' 'CAO_LS' 'CALCIUM OXIDE-LS',
'54' 'MGO_LS' 'MAGNESIUM OXIDE-LS',
'55' 'ALK_LS' 'ALKALIES-LS',
'56' 'SIZE_LS' 'SIZE-LS',
'57' 'MOIS_LSF' 'MOISTURE-LSF',
'58' 'SI_LSF' 'SILICA-LSF',
'59' 'AL_LSF' 'ALUMINA-LSF',
'60' 'FEO_LSF' 'FERRIC OXIDE-LSF',
'61' 'CAO_LSF' 'CALCIUM OXIDE-LSF',
'62' 'MGO_LSF' 'MAGNESIUM OXIDE-LSF',
'63' 'SIZE_LSF' 'SIZE-LSF',
'64' 'MOIS_D' 'MOISTURE-D',
'65' 'SI_D' 'SILICA-D',
'66' 'AL_D' 'ALUMINA-D',
'67' 'FEO_D' 'FERRIC OXIDE-D',
'68' 'CAO_D' 'CALCIUM OXIDE-D',
'69' 'MGO_D' 'MAGNESIUM OXIDE-D',
'70' 'ALK_D' 'ALKALIES-D',
'71' 'SIZE_D' 'SIZE-D',
'72' 'MOIS_DF' 'MOISTURE-DF',
'73' 'SI_DF' 'SILICA-DF',
'74' 'AL_DF' 'ALUMINA-DF',
'75' 'FEO_DF' 'FERRIC OXIDE-DF',
'76' 'CAO_DF' 'CALCIUM OXIDE-DF',
'77' 'MGO_DF' 'MAGNESIUM OXIDE-DF',
'78' 'SIZE_DF' 'SIZE-DF',
'79' 'MOIS_MO' 'MOISTURE-MO',
'80' 'SI_MO' 'SILICA-MO',
'81' 'AL_MO' 'ALUMINA-MO',
'82' 'TIRON_MO' 'TOTAL IRON-MO',
'83' 'MN_MO' 'MANGENESE-MO',
'84' 'P_MO' 'PHOSPHAROUS-MO',
'85' 'ALK_MO' 'ALKALIES-MO',
'86' 'SIZE_MO' 'SIZE-MO',
'87' 'MOIS_STR' 'MOISTURE-STR',
'88' 'SI_STR' 'SILICA-STR',
'89' 'AL_STR' 'ALUMINA-STR',
'90' 'TIRON_STR' 'TOTAL IRON-STR',
'91' 'FO_STR' 'FERROUS OXOIDE-STR',
'92' 'P_STR' 'PHOSPHAROUS-STR',
'93' 'CAO_STR' 'CALCIUM OXIDE-STR',
'94' 'MGO_STR' 'MAGNESIUM OXIDE-STR',
'95' 'TIND_STR' 'TUMBLER INDEX-STR',
'96' 'ABBIND_STR' 'ABBRATION INDEX-STR',
'97' 'CAOSIO2_STR' 'CAO / SIO2-STR',
'98' 'SI_SLG' 'SILICA-SLG',
'99' 'AL_SLG' 'ALUMINA-SLG',
'100' 'FEO_SLG' 'FERRIC OXIDE-SLG',
'101' 'CAO_SLG' 'CALCIUM OXIDE-SLG',
'102' 'MGO_SLG' 'MAGNESIUM OXIDE-SLG',
'103' 'MNO_SLG' 'MANGANESE OXIDE-SLG',
'104' 'FO_SLG' 'FERROUS OXIDE-SLG',
'105' 'BAS_SLG' 'BASICITY-SLG'.
is_layout-zebra = 'X'.
is_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = is_layout
it_fieldcat = it_fieldcat
i_save = 'X'
is_variant = gs_variant
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.
ENDFORM. " ALV_DISPLAY
form SUB_MAKE_FIELD_CAT1 using p_col TYPE char3
p_fnam TYPE char30
p_text TYPE char30.
is_fieldcat-col_pos = p_col.
is_fieldcat-fieldname = p_fnam.
is_fieldcat-seltext_m = p_text.
APPEND is_fieldcat TO it_fieldcat.
endform. " SUB_MAKE_FIELD_CAT1
This is the code i have.
In debugging, i found data in internal table (it_final). But, it doesn't display in output.
Please help me in this regard?
Thanks in advance....
Sai..
Edited by: Sai Babu on Sep 16, 2008 3:07 PMSai Babu wrote:
> Any experts.........
no,No,NO....
There is no expert(active since last 3months or so) beyond him
Specially in ALV moreover in OOPS ALV
Edited by: Ámit Güjärgoüd on Sep 16, 2008 3:19 PM -
Reg: ALV output download using excel option
Hi Team,
I created a report using ALV Function modules, I want to download in Excel sheet the output list. i am trying to download but i am not getting proper values. I am populating around 50 fileds.
is there any settings for these download.
<<removed by moderator>>
Thanks & Regards,
Mahendar patha.hi mahendra;
use this step-by-step procedure it will help u a lot:
Firstly export the data to memory using the FM LIST_FROM_MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE e000(su) WITH text-001.
ENDIF.
then i converted it into ASCII using LIST_TO_ASCI,
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_xlstab
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE e003(yuksdbfzs).
ENDIF.
This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
cl_abap_char_utilities=>horizontal_tab.
Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
This will create an excel attachment.
Sample code for formatting the data for the attachment in excel format.
u2022 Format the data for excel file download
LOOP AT t_xlstab INTO wa_xlstab .
DESCRIBE TABLE t_xlstab LINES lw_cnt.
CLEAR lw_sytabix.
lw_sytabix = sy-tabix.
u2022 If not new line then replace '|' by tabs
IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
WITH cl_abap_char_utilities=>horizontal_tab.
MODIFY t_xlstab FROM wa_xlstab .
CLEAR wa_xlstab.
wa_xlstab = cl_abap_char_utilities=>newline.
IF lw_cnt NE 0 .
lw_sytabix = lw_sytabix + 1.
u2022 Insert new line for the excel data
INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
lw_cnt = lw_cnt - 1.
ENDIF.
CLEAR wa_xlstab.
ENDIF.
ENDLOOP.
Sample code for creating attachment and sending mail:
FORM send_mail .
u2022 Define the attachment format
lw_doc_type = 'XLS'.
u2022 Create the document which is to be sent
lwa_doc_chng-obj_name = 'List'.
lwa_doc_chng-obj_descr = w_subject. "Subject
lwa_doc_chng-obj_langu = sy-langu.
u2022 Fill the document data and get size of message
LOOP AT t_message.
lt_objtxt = t_message-line.
APPEND lt_objtxt.
ENDLOOP.
DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
IF lw_tab_lines GT 0.
READ TABLE lt_objtxt INDEX lw_tab_lines.
lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
lwa_doc_chng-obj_langu = sy-langu.
lwa_doc_chng-sensitivty = 'F'.
ELSE.
lwa_doc_chng-doc_size = 0.
ENDIF.
u2022 Fill Packing List For the body of e-mail
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
u2022 Create the attachment (the list itself)
DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
u2022 Fill the fields of the packing_list for creating the attachment:
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = lw_doc_type.
lt_packing_list-obj_name = 'Attach'.
lt_packing_list-obj_descr = w_docdesc.
lt_packing_list-doc_size = lw_tab_lines * 255.
APPEND lt_packing_list.
u2022 Fill the mail recipient list
lt_reclist-rec_type = 'U'.
LOOP AT t_recipient_list.
lt_reclist-receiver = t_recipient_list-address.
APPEND lt_reclist.
ENDLOOP.
u2022 Finally send E-Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = lw_sent_to_all
TABLES
packing_list = lt_packing_list
object_header = lt_objhead
contents_bin = t_xlstab
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Hope it will help you
Regards
Rahul sharma
Edited by: RAHUL SHARMA on Nov 4, 2008 1:22 PM -
Reg: ALV (REUSE_ALV_GRID_DISPLAY)
Hi Experts,
I need to know how to give drop down list in one of the field in my ALV.
I found some posting in sdn, but that are related to OOPS concepts.
But i am using REUSE function module.
Can you please provide me the solution how to achecive drop down list in ALV using REUSE_ALV_GRID_DISPLAY.
Thanks
Vijay.RHi Vijayendran,
There is only oops method available to create drop down list in ALV.
Go through the program below and modify your program accordingly.
Only thing that you have to do is to create container for your alv and use this container for displaying drop down list.
This program displays a dropdown list in one of the fields of the ALV.
*& Report Z_LISTBOX_ALV
*& Program to display a dropdown list in ALV.
REPORT z_listbox_alv.
TYPE-POOLS: slis.
TYPES: BEGIN OF ty_rating,
task(20) TYPE c,
rating TYPE i,
weightage(2) TYPE c,
comments(40) TYPE c,
END OF ty_rating.
DATA: g_alvgrid TYPE REF TO cl_gui_alv_grid,
g_alv_container TYPE REF TO cl_gui_custom_container,
int_fieldcat TYPE lvc_t_fcat,
ok_code TYPE sy-ucomm.
DATA: int_outputdata TYPE TABLE OF ty_rating.
INITIALIZATION.
START-OF-SELECTION.
* call new screen for displaying the oop alv
CALL SCREEN 1100.
* Double click on the screen, it takes you the screen painter (SE51). Create
* Custom Container on the screen and name is as u2018CONTAINERu2019. Set the Ok-Code
* the screen as u2018OK_CODEu2019. Also create a GUI status named 'STANDARD' and
* in set Ok-code '&F03' for the back button.
* The screen 1100 thus gets created to hold the grid ALV.
* In the PBO of the screen, call the modules to set pf-status, title and
* to display the ALV list.
* In case we have an interactive ALV or for additional functionalities we can
* create OK-CODES and based on the user command we do the coding in the PAI.
*& Module STATUS_0600 OUTPUT
* set the PF status of the screen. Called in PBO of screen.
MODULE status_0600 OUTPUT.
SET PF-STATUS 'STANDARD'.
ENDMODULE. " STATUS_0600 OUTPUT
*& Module DISPLAY_ALV OUTPUT
* Displays the alv list. Called in PBO of screen.
MODULE display_alv OUTPUT.
* get the data.
PERFORM retrieve_data.
* prepare fieldcatalog for displaying the alv
PERFORM prepare_fieldcatalog.
* create a container to display the list
CREATE OBJECT g_alv_container
EXPORTING
container_name = 'CONTAINER'.
* create a reference for the alv
CREATE OBJECT g_alvgrid
EXPORTING
i_parent = g_alv_container.
* prepare a listbox for the rating column
PERFORM fill_dropdown.
* call the method to display the list
CALL METHOD g_alvgrid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
i_save = 'X'
CHANGING
it_outtab = int_outputdata
it_fieldcatalog = int_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. "DISPLAY_ALV OUTPUT
*& Form PREPARE_FIELDCATALOG
* prepares fieldcatalog
FORM prepare_fieldcatalog .
DATA: lws_fieldcat TYPE lvc_s_fcat.
CLEAR int_fieldcat.
CLEAR lws_fieldcat.
lws_fieldcat-col_pos = 1.
lws_fieldcat-fieldname = 'TASK'.
lws_fieldcat-scrtext_m = 'TASK'.
APPEND lws_fieldcat TO int_fieldcat.
CLEAR lws_fieldcat.
lws_fieldcat-col_pos = 2.
lws_fieldcat-fieldname = 'RATING'.
lws_fieldcat-edit = 'X'.
lws_fieldcat-scrtext_m = 'RATING'.
lws_fieldcat-just = 'L'.
lws_fieldcat-outputlen = '6'.
lws_fieldcat-drdn_hndl = '1'. "handle for listbox
APPEND lws_fieldcat TO int_fieldcat.
CLEAR lws_fieldcat.
lws_fieldcat-col_pos = 3.
lws_fieldcat-fieldname = 'WEIGHTAGE'.
lws_fieldcat-scrtext_m = 'WEIGHTAGE'.
lws_fieldcat-outputlen = '9'.
APPEND lws_fieldcat TO int_fieldcat.
CLEAR lws_fieldcat.
lws_fieldcat-col_pos = 4.
lws_fieldcat-fieldname = 'COMMENTS'.
lws_fieldcat-scrtext_m = 'COMMENTS'.
lws_fieldcat-edit = 'X'.
APPEND lws_fieldcat TO int_fieldcat.
ENDFORM. " PREPARE_FIELDCATALOG
*& Form RETRIEVE_DATA
* retreives the data to be displayed
FORM retrieve_data .
DATA: lws_outputdata TYPE ty_rating.
CLEAR int_outputdata.
CLEAR lws_outputdata.
lws_outputdata-task = 'proj. related'.
lws_outputdata-weightage = '20'.
APPEND lws_outputdata TO int_outputdata.
CLEAR lws_outputdata.
lws_outputdata-task = 'process. related'.
lws_outputdata-weightage = '10'.
APPEND lws_outputdata TO int_outputdata.
CLEAR lws_outputdata.
lws_outputdata-task = 'knowledge mgnt.'.
lws_outputdata-weightage = '30'.
APPEND lws_outputdata TO int_outputdata.
ENDFORM. " RETRIEVE_DATA
*& Form FILL_DROPDOWN
* prepares the listbox to be displayed and assigns it to the alv
FORM fill_dropdown .
DATA: lint_dropdown TYPE lvc_t_drop,
lws_dropdown TYPE lvc_s_drop.
CLEAR lint_dropdown.
CLEAR lws_dropdown.
lws_dropdown-handle = '1'.
lws_dropdown-value = '5'.
APPEND lws_dropdown TO lint_dropdown.
CLEAR lws_dropdown.
lws_dropdown-handle = '1'.
lws_dropdown-value = '4'.
APPEND lws_dropdown TO lint_dropdown.
CLEAR lws_dropdown.
lws_dropdown-handle = '1'.
lws_dropdown-value = '3'.
APPEND lws_dropdown TO lint_dropdown.
CLEAR lws_dropdown.
lws_dropdown-handle = '1'.
lws_dropdown-value = '2'.
APPEND lws_dropdown TO lint_dropdown.
CLEAR lws_dropdown.
lws_dropdown-handle = '1'.
lws_dropdown-value = '1'.
APPEND lws_dropdown TO lint_dropdown.
CALL METHOD g_alvgrid->set_drop_down_table
EXPORTING
it_drop_down = lint_dropdown.
ENDFORM. " FILL_DROPDOWN
*& Module HANDLE_GOBACK INPUT
* handles 'back' button. Called in PAI of the screen.
MODULE handle_goback INPUT.
IF ok_code EQ '&F03'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE.
Get back to me for any clarification.
Regards,
Bhavesh -
Reg: ALV Output to EXCEL
Hi
i am working in a alv report and i got the output and when i download in to excel some of the columns getting mismatched..
I got some solution from theSDN have to do some modification in Excel sheet,But now i am using EXCEL 2007 version can any one gimme some logice how to come out of this issue??
Thanks and Regards,
Arun JosephArun,
some time when you download output to excel than may be some of the field or sorting critieria may be not reflect in excel so you need to do some adjustment even you are using excel2007.
Amit. -
i have an existing report which displays the output in blocks.
for this they have used ALV .
they have used macros to build fieldcatalog for each block.
the following is the macro for the field catalog.
DEFINE m_alv_fieldcat.
clear e_alv_fieldcat.
add c_1 to w_col_pos.
move: w_col_pos to e_alv_fieldcat-col_pos,
&1 to e_alv_fieldcat-fieldname,
&2 to e_alv_fieldcat-tabname,
&3 to e_alv_fieldcat-ref_tabname,
&4 to e_alv_fieldcat-key,
&5 to e_alv_fieldcat-do_sum,
&6 to e_alv_fieldcat-outputlen,
&7 to e_alv_fieldcat-reptext_ddic,
&8 to e_alv_fieldcat-cfieldname,
&9 to e_alv_fieldcat-datatype.
append e_alv_fieldcat to i_alv_fieldcat.
END-OF-DEFINITION.
and they have populated the macro as follows
m_alv_fieldcat:
c_usnam param_tab_hdr c_bkpf space space 0 space space space,
c_belnr param_tab_hdr c_bkpf space space 0 space space space,
c_cpudt param_tab_hdr c_bkpf space space 0 space space space,
c_budat param_tab_hdr c_bkpf space space 0 space space space,
c_blart param_tab_hdr c_bkpf space space 0 space space space,
c_xblnr param_tab_hdr c_bkpf space space 0 space space space.
now my requirement is i have to add one more column in the block display.
they have used place holders for macros.as place holders are only for 9 values.plz tell me how to add one more column to this fieldcatalog which is using Macros.
thanks ®ardsAs you need to add one more column, you will not face any problem with Place holders. Just add the last line of the below code to the existing code:
m_alv_fieldcat:
c_usnam param_tab_hdr c_bkpf space space 0 space space space,
c_belnr param_tab_hdr c_bkpf space space 0 space space space,
c_cpudt param_tab_hdr c_bkpf space space 0 space space space,
c_budat param_tab_hdr c_bkpf space space 0 space space space,
c_blart param_tab_hdr c_bkpf space space 0 space space space,
c_xblnr param_tab_hdr c_bkpf space space 0 space space space.
C_EXTRACOL param_tab_hdr c_bkpf space space 0 space space space.
This will add one more column to the existing ALV list.
Regards,
Kiran Bobbala -
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. -
Hi Experts,
My requirement is i need a button along with the tool bar of ALV list display . when i check the button it should display the Selection criteria values which user entered as a pop up .
Is there any default tool which displays user selection values for ALV list display ?
Regards,
Vikram.S> Is there any default tool which displays user selection values for ALV list display ?
No such program.
But you have to write a code for it. Activate Button using the pf-status. then Handle that button in User command , and show a popup with the selection values.
Function used to get the selection details is
RS_REFRESH_FROM_SELECTOPTIONS
get the data and show it using a Popup. May be a ALV popup select function will help you. -
Reg : ALV Grid Refresh - Output not appearing
Hi All ,
Am calling a screen 100 at 3 different places.
Though i use refresh_table_display , The value in the output table, say i_final changes, but while displaying the output , the whole screen is blank , even the container is not appearing in the output .
Can you please help me with your inputs .
Regards,
Chitrayes it is good ...see the example...for your requirement..
REPORT yztest .
TYPE-POOLS: slis.
Tables
TABLES: mara.
TYPES: BEGIN OF ty_name,
name TYPE char10,
age TYPE i,
END OF ty_name.
TYPES: BEGIN OF ty_marks,
sub1 TYPE i,
sub2 TYPE i,
total TYPE i,
END OF ty_marks.
TYPES: BEGIN OF ty_phone,
phnum TYPE char10,
END OF ty_phone.
TYPES: BEGIN OF ty_addr,
address TYPE char20,
END OF ty_addr .
Output internal table
DATA: itab TYPE TABLE OF ty_name,
wa TYPE ty_name,
itab1 TYPE TABLE OF ty_marks,
wa1 TYPE ty_marks,
itab2 TYPE TABLE OF ty_phone,
wa2 TYPE ty_phone,
itab3 TYPE TABLE OF ty_addr,
wa3 TYPE ty_addr.
ALV Grid
DATA: r_grid TYPE REF TO cl_gui_alv_grid,
r_grid1 TYPE REF TO cl_gui_alv_grid,
r_grid2 TYPE REF TO cl_gui_alv_grid,
r_grid3 TYPE REF TO cl_gui_alv_grid,
g_dock TYPE REF TO cl_gui_docking_container,
g_dock1 TYPE REF TO cl_gui_docking_container,
g_dock2 TYPE REF TO cl_gui_docking_container,
g_dock3 TYPE REF TO cl_gui_docking_container,
g_dock4 TYPE REF TO cl_gui_docking_container,
it_fieldcat TYPE lvc_t_fcat,
it_fieldcat1 TYPE lvc_t_fcat,
it_fieldcat2 TYPE lvc_t_fcat,
it_fieldcat3 TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat.
DATA picture TYPE REF TO cl_gui_picture.
DATA url(255).
CLEAR url.
DATA init.
START-OF-SELECTION.
wa-name = 'test01'.
wa-age = '1'.
APPEND wa TO itab.
wa-name = 'test02'.
wa-age = '2'.
APPEND wa TO itab.
wa-name = 'test03'.
wa-age = '3'.
APPEND wa TO itab.
wa1-sub1 = '11'.
wa1-sub2 = '22'.
wa1-total = wa1-sub1 + wa1-sub2.
APPEND wa1 TO itab1.
wa1-sub1 = '22'.
wa1-sub2 = '33'.
wa1-total = wa1-sub1 + wa1-sub2.
APPEND wa1 TO itab1.
wa2-phnum = '99999999999'.
APPEND wa2 TO itab2.
wa2-phnum = '888888888888'.
APPEND wa2 TO itab2.
wa2-phnum = '777777777777'.
APPEND wa2 TO itab2.
wa3-address = 'HItech City'.
APPEND wa3 TO itab3.
wa3-address = 'Secunderabad'.
APPEND wa3 TO itab3.
wa3-address = 'Hyderabad'.
APPEND wa3 TO itab3.
PERFORM display_image.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'LISTOUT1'.
SET TITLEBAR 'LIST1'.
wa_fieldcat-fieldname = 'NAME'.
wa_fieldcat-seltext = 'NAME OF THE STUDENT'.
wa_fieldcat-coltext = 'NAME OF THE STUDENT'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'AGE'.
wa_fieldcat-seltext = 'AGE OF THE STUDENT'.
wa_fieldcat-coltext = 'AGE OF THE STUDENT'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'SUB1'.
wa_fieldcat-seltext = 'SUBJECT1'.
wa_fieldcat-coltext = 'SUBJECT1'.
APPEND wa_fieldcat TO it_fieldcat1.
wa_fieldcat-fieldname = 'SUB2'.
wa_fieldcat-seltext = 'SUBJECT2'.
wa_fieldcat-coltext = 'SUBJECT2'.
APPEND wa_fieldcat TO it_fieldcat1.
wa_fieldcat-fieldname = 'TOTAL'.
wa_fieldcat-seltext = 'TOTAL'.
wa_fieldcat-coltext = 'TOTAL'.
APPEND wa_fieldcat TO it_fieldcat1.
wa_fieldcat-fieldname = 'PHNUM'.
wa_fieldcat-seltext = 'PHONE NO'.
wa_fieldcat-coltext = 'PHONE NO'.
APPEND wa_fieldcat TO it_fieldcat2.
wa_fieldcat-fieldname = 'ADDRESS'.
wa_fieldcat-seltext = 'ADDRESS'.
wa_fieldcat-coltext = 'ADDRESS'.
APPEND wa_fieldcat TO it_fieldcat3.
IF g_dock IS INITIAL.
CREATE OBJECT g_dock
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock->dock_at_left
extension = 300.
CREATE OBJECT r_grid
EXPORTING
i_parent = g_dock.
ENDIF.
IF g_dock1 IS INITIAL.
CREATE OBJECT g_dock1
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock1->dock_at_right
extension = 300.
CREATE OBJECT r_grid1
EXPORTING
i_parent = g_dock1.
ENDIF.
IF g_dock2 IS INITIAL.
CREATE OBJECT g_dock2
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock2->dock_at_top
extension = 100.
CREATE OBJECT r_grid2
EXPORTING
i_parent = g_dock2.
IF g_dock3 IS INITIAL.
CREATE OBJECT g_dock3
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock3->dock_at_top
extension = 100.
CREATE OBJECT r_grid3
EXPORTING
i_parent = g_dock3.
ENDIF.
IF NOT itab[] IS INITIAL.
CALL METHOD r_grid->set_table_for_first_display
CHANGING
it_outtab = itab
it_fieldcatalog = it_fieldcat.
ENDIF.
IF NOT itab1[] IS INITIAL.
CALL METHOD r_grid1->set_table_for_first_display
CHANGING
it_outtab = itab1
it_fieldcatalog = it_fieldcat1.
ENDIF.
IF NOT itab2[] IS INITIAL.
CALL METHOD r_grid2->set_table_for_first_display
CHANGING
it_outtab = itab2
it_fieldcatalog = it_fieldcat2.
ENDIF.
IF NOT itab3[] IS INITIAL.
CALL METHOD r_grid3->set_table_for_first_display
CHANGING
it_outtab = itab3
it_fieldcatalog = it_fieldcat3.
ENDIF.
if g_dock4 is initial.
CREATE OBJECT g_dock4
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock4->dock_at_bottom
extension = 100.
CREATE OBJECT picture
EXPORTING parent = g_dock4.
CALL METHOD picture->load_picture_from_url
EXPORTING
url = url.
init = 'X'.
endif.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form display_image
FORM display_image .
DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
DATA html_table LIKE w3html OCCURS 1.
DATA return_code LIKE w3param-ret_code.
DATA content_type LIKE w3param-cont_type.
DATA content_length LIKE w3param-cont_len.
DATA pic_data LIKE w3mime OCCURS 0.
DATA pic_size TYPE i.
REFRESH query_table.
query_table-name = '_OBJECT_ID'.
query_table-value = 'ENJOYSAP_LOGO'.
APPEND query_table.
CALL FUNCTION 'WWW_GET_MIME_OBJECT'
TABLES
query_string = query_table
html = html_table
mime = pic_data
CHANGING
return_code = return_code
content_type = content_type
content_length = content_length
EXCEPTIONS
object_not_found = 1
parameter_not_found = 2
OTHERS = 3.
IF sy-subrc = 0.
pic_size = content_length.
ENDIF.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = cndp_sap_tab_unknown
size = pic_size
lifetime = cndp_lifetime_transaction
TABLES
data = pic_data
CHANGING
url = url
EXCEPTIONS
OTHERS = 1.
ENDFORM. " display_image
*& Module EXIT INPUT
text
MODULE exit INPUT.
CALL METHOD g_dock->free.
CALL METHOD g_dock1->free.
CALL METHOD g_dock2->free.
CALL METHOD g_dock3->free.
ENDMODULE. " EXIT INPUT -
Reg: ALV subtotals calculation
Hi SDN's,
I have 4 fields(coloumns) In ALV Grid display output,
first 2 coloumn fields having the subtotal.
I need to calculate 3rd, 4th columns based on first 2 columns subtotals.
Can u help me in this regard..
My problem some thing like the below example..
Col1 Col2 Col3 Col4
25.00 0.00
45.00 30.00
<b> 70.00 30.00 X Y</b>
Now, i need to find out the values of X and Y based on the subtotals of first and second column,
like X = (subtotal of column1 - subtotal of column2) / subtotal of column2 *100
Thanks in advance...
Rahulhi,
follow these links to solve u r query.
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.erpgenie.com/sapgenie/docs/Using%20ALV.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CAGTFLV/CAGTFLV.pdf
regards,
Ashokreddy. -
hi all,
How to Supress leading zeros in ALV Grid Output?
Requirement is : in ouput for materials columns some materials are like P0001, P0002, 000001 , 00004. i want to display like P0001,P0002,1,4.
i tried with fldcaat-lzero = space. but no use. here by default it is zero.
Message was edited by: Ashok ParupalliTry to set some flags in the field catalog.
fieldcat-LZERO = space.
or
fieldcat-no_zero = 'X'.
Regards,
Rich Heilman -
Hi All,
I have developed a report using ALV Grid but I want save the layout with some variant name but by default the option setting->Layout->save is disabled how to enable this?.
Thanks&Regards
MaheshHi Mahesh,
set I_SAVE with 'A'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = PROGNAME
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT
<b> I_SAVE = 'A'</b>
IT_EVENTS = GT_EVENTS
IT_EVENT_EXIT = EVENT
IS_PRINT = PRINT
TABLES
T_OUTTAB = IT_MARA
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
regards, Dieter
Maybe you are looking for
-
Is there an easy way to make a long chapter into a book with many chapters?
I have a long, book length text file (50 chapters). It's one file in one ID chapter. I would like to make it 50 files in 50 ID chapters in one book (indb). Can that be easily done? Thanks
-
How should I back up? - Ethernet HD vs Time Machine
The rundown: -I think it would be pointless to back up my whole computer since I just want certain files / folders to remain secured. -I want to have access to these files remotely (do not want .mac account) -Want the functionality of NAS drive to sh
-
Writing file with windows 7 and vista os..
hi, since i am using Windows XP operating system with Labview, i made a executable file and i trying to install with Windows 7 or Vista OS installed PC. when my device is detect it will gives the hardware information , that have to save in to the ha
-
How the java.library.path is set?
Hi, Can anyone please tell me know how System class (or JVM) sets the default value of the property java.library.path? I tried searching the answer on net but I was not able to find any thing. Regards, Kev.
-
How can I process raw files in Aperture from a Sony RX1?
How can I process raw files in Aperture from my Sony RX1?