3 internal tables in one ALV - Download to Excel
Hi guys..I need some help
I've tried searching around but no avail.
I have a requirement to display 3 itabs in 1 ALV. An example of the output would be like a report from ECC tcode - ME2L.
Basically it will be
Header
Item
Schedule Line
And of course finally, I have to make it being able to download it into an Excel file.
Thanks in advance!
Hi guys,
I'm trying the alv tree node and child method but still can't seem to get it to work...
The table i've created is
Table1
-Structure 1
-Structure 2
-Structure 3
Does it work that way?
DATA: l_item_key TYPE lvc_nkey,
l_schedule_key TYPE lvc_nkey,
ls_po_number TYPE bbp_item_no,
l_vendor_key TYPE lvc_nkey,
l_po_key TYPE lvc_nkey,
lw_vendor_last TYPE string,
l_last_key TYPE lvc_nkey.
SORT lt_final BY vendor_data.
LOOP AT lt_final INTO ls_final.
* TOP LEVEL NODES.
lw_vendor_last = ls_final-vendor_data-partner_id.
IF ls_final-vendor_data-partner_id <> lw_vendor_last.
lw_vendor_last = ls_final-vendor_data-partner_id.
PERFORM add_vendor USING ls_final-vendor_data
CHANGING l_vendor_key.
CLEAR lw_vendor_last.
ENDIF.
* Vendor Nodes?
IF ls_final-item_data-number_int <> ls_po_number.
ls_po_number = ls_final-item_data-number_int.
PERFORM add_po USING ls_final
l_vendor_key
CHANGING l_po_key.
ENDIF.
*& Form ADD_VENDOR
* text
* -->P_LS_FINAL_VENDOR_DATA text
* -->P_1863 text
* <--P_L_VENDOR_KEY text
FORM add_vendor USING p_vendor TYPE ZSC_MAIN_STRUC_HEADER
p_relat_key TYPE lvc_nkey
CHANGING p_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value.
l_node_text = p_vendor-partner_id.
* add node:
* ALV Tree firstly inserts this node as a leaf if you do not provide
* IS_NODE_LAYOUT with field ISFOLDER set. In form 'add_carrid_line'
* the leaf gets a child and thus ALV converts it to a folder
* automatically.
CALL METHOD g_alv_tree->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_final
IMPORTING
e_new_node_key = p_node_key.
ENDFORM. " ADD_VENDOR
*& Form ADD_PO
* text
* -->P_LS_FINAL_ITEM_DATA text
* -->P_L_VENDOR_KEY text
* <--P_L_PO_KEY text
FORM add_po USING p_item_data TYPE zsc_main_structure
p_relat_key TYPE lvc_nkey
CHANGING p_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value.
* add node
* ALV Tree firstly inserts this node as a leaf if you do not provide
* IS_NODE_LAYOUT with field ISFOLDER set. In form 'add_carrid_line'
* the leaf gets a child and thus ALV converts it to a folder
* automatically.
l_node_text = p_item_data-vendor_data-partner_id.
CALL METHOD g_alv_tree->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_final
IMPORTING
e_new_node_key = p_node_key.
ENDFORM. " ADD_PO
When i run the report, I'm getting a shortdump regarding GETWA_NOT_ASSIGNED at CL_ALV_TREE_BASE==============CP
but If I remove the Vendor nodes section, no error but the ALV grid is empty.
Hope you guys can help....appreciate it
Similar Messages
-
How can I disenable the EXCEL field format when use ALV download to excel ?
Dear friends,
I have a problem with the ALV download to EXCEL. One field Value in ALV is like u2018-abcdeu2026u2019.the character u201C-u201Cis the first position in field value.when I download the value to EXCEL,the field value u2018-abcdeu2026u2019 changed u2018=-abcdeu2026u2019 in EXCEL.how can I remove u2018=u2019 in EXCEL when I down to excel used ALV.
I add a space in u2018 -abcdeu2026u2019,So this value can be download to Excel .
Have you any solve method?
User does not use excel logo button to download.
User use Local fileu2026 button to download
Thanks
Sunadd a single quote to the beginning of the field.
like: '-abcde
in excel it will be shown as : -abcde -
Hi,
I have a problem with regards to the ALV download to excel. I have an ALV grid with 40 columns and i need to download the output to an excel file. But after downloading the ALV output, i noticed that some columns are already on the next line. i need to have all columns to be in the same line. Does anyone have an idea how to prevent columns to be printed in the next line?
Thanks in advance!
Kind regards,
MerriamLooks like Note 855314 has a workaround ... my be more.
Of course (yuk!), write you own download.
Best!
Jim -
Passing internal table from one program to other without using IMPORT
Hi Experts,
I need to pass an internal table from one program to other. However i cannot use IMPORT/EXPORT due to some reason. Any idea how this can be done?
Warm regards,
Harshad.hi,
for passing itab from one program to another u can use
IN FIRST PROGRAM WRITE ,
perform pass_data(SECOND_PROGRAM_NAME) using ITAB.
in both the program declare itab with same structure.
if u want to do some changes in that itab and if u want it back in first program then write as
perform pass_data(SECOND_PROGRAM_NAME) using ITAB changing itab. -
How to join THREE different tables into internal table using one select statement .
How to join THREE different tables into internal table using one select statement .
Hi experts,
I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
Scenario:
Database tables:
SPFLI
SFLIGHT
SBOOK.
Table Fields:
SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
SEATSOCC_C SEATSMAX_F SEATSOCC_F
SBOOK - CARRID CONNID CLASS
MY INTERNAL TABLE IS IT_XX.
Your help much appreciated.
Thanks in advance.
Pawan.Hi Pawan,
please check below codes. hope it can help you.
TYPES: BEGIN OF ty_xx,
carrid TYPE spfli-carrid ,
connid TYPE spfli-connid ,
countryfr TYPE spfli-countryfr,
cityfrom TYPE spfli-cityfrom ,
countryto TYPE spfli-countryto,
cityto TYPE spfli-cityto ,
fldate TYPE sflight-fldate ,
seatsmax TYPE sflight-seatsmax ,
seatsocc TYPE sflight-seatsocc ,
seatsmax_b TYPE sflight-seatsmax_b,
seatsocc_b TYPE sflight-seatsocc_b,
seatsmax_f TYPE sflight-seatsmax_f,
seatsocc_f TYPE sflight-seatsocc_f,
class TYPE sbook-class,
END OF ty_xx,
t_xx TYPE STANDARD TABLE OF ty_xx.
DATA: it_xx TYPE t_xx.
SELECT spfli~carrid
spfli~connid
spfli~countryfr
spfli~cityfrom
spfli~countryto
spfli~cityto
sflight~fldate
sflight~seatsmax
sflight~seatsocc
sflight~seatsmax_b
sflight~seatsocc_b
sflight~seatsmax_f
sflight~seatsocc_f
sbook~class
INTO TABLE it_xx
FROM spfli INNER JOIN sflight
ON spfli~carrid = sflight~carrid
AND spfli~connid = sflight~connid
INNER JOIN sbook
ON spfli~carrid = sbook~carrid
AND spfli~connid = sbook~connid.
Thanks,
Yawa -
Tow internal table to one commone internal table
hi
i have two internal table
itab1 having fields
f1
f2
f3
f4
and second internal table having fields
HERE F1 IS COMMON FIELD BETTWEEN TWO
f1
f5
f6
f7
f8
f9
f10
i want the data of both the internal table into one final table having data
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
IE COMBINED DATA OR BOTHE IE I AM ADDING THE COLUIMNS OF INTERNAL TABLE 1 AND INTERNAL TABLE 2 TO FINAL OUTPUT TABLE
PLEASE SUGGEST ?
REGARDS
ARORAhi RAAM
the situation is like this
her is the internal table with data and rows
IT_APC Table[58x64]
it_dep Table[14x48]
it_Dep_Apc Table[1x108]
now iand combining data of itapc and itdep to it_dep_apc
both have only one common firled bukrs
and as rows and columns as displayed above
now if i do below as suggeted by u
LOOP AT IT_APC INTO WA_APC.
READ TABLE IT_DEP INTO WA_DEP WITH KEY BUKRS = WA_APC-BUKRS
BINARY SEARCH.
then the all the data is not combined i suppose as i need to have the final table all the data from both the internal tables....
ie common rows plus extra rows for bukrs
regards
Arora -
How to consolidate 4 internal table into one
how can we consolidate data from
two or more internal tables into one
please help
its a bit uegent
thanks in advanceHi,
If you want to combine two internal table,you can follow 2 approaches.
Case1: If both the internal table are of same structure,
append lines of itab1 to itab2.
The above statement will append all the records in itab1 to itab2.
Case2:If both the internal table are of differnt structure,
you need one or more common fields in the two tables to connect.
loop at itab1.
move-corresponding itab1 to itab.
loop at itab2 where f1 = itab1-f1.
move-corresponding itab2 to itab.
append itab.
clear : itab2, itab.
endloop.
clear itab1.
endloop.
Now itab will hold the entries from itab1 and itab2. -
Transferring an Internal table from one Function Module to another
Hi,
I need to transfer an Internal Table from one FM to another. I've tried the statements IMPORT IT from Memory ID and EXPORT IT to Memory ID, but this is not working. I think the reason is different session or diff LUW, I can not use SET and GET Parametr syntax, as I will not be able to pass Internal Tables through it.
Can any1 please give a solution on this?
Cheers
AbhishekI'd agree with April that the easiest way to pass data directly from FM1 to FM2 is via "tables", but what is your overall code structure i.e. are you going:
Program
Call Function FM1
back to Program
Call Function FM1
or are you going:
Program
Call Function FM1
Call Function FM2 from FM1
In either case, I would expect the export / import to be working fine, at least it seem to when I tried it using:
export lt_data from lt_data to memory id 'Z:1234'.
import lt_data to lt_data from memory id 'Z:1234'.
Jonathan -
Mapping of various internal tables into one existing excel
Hi all,
i have a problem regarding conversion into existing excel sheet.
Actually i have multiple reports and i have to convert all them into an existing excel sheet.. How is it possible please guide.
Edited by: Ram Shanker on Oct 30, 2009 10:37 AMHi Ram,
You can merge different internal table data to a single worksheet in an excel ;
or you can keep each internal table data in separate worksheets in a single excel.
Both ways are possible using OLE technique.
Refer this link.
https://wiki.sdn.sap.com/wiki/display/Snippets/DownloadDataintoMultipleSheetExcelDocumentwithNonEditableColumns%28Passwordprotected%29UsingABAP+OLE
Thanks,
Nisha Vengal. -
Hi Experts,
Currently in my custom program I have an issue regarding downloading ALV to excel file where one of the fields in the report will output more than 400 characters which is in Chinese characters and this field already type to string. The problem is when i download it to excel only the 301 characters is only downloaded to the file.
Addtnl information:
The data in the output internal table is complete before going through the FM REUSE_ALV_GRID but when i tried to debug when downloading before it reaches to the GUI_DOWNLOAD it already has incomplete data so this means that this is not a problem for GUI_DOWNLOAD.
Question:
Is the problem a SAP ALV download limitation?
Is there an available solution for this?
Edited by: Ekitzv on Apr 8, 2011 6:21 AMFirst try to scroll down till the last page, then select all the column manually by putting curser and copy.
This will solve your issue. i usually do in ths way
Shayam -
Dynamic creation of internal table based on alv layout
Hi experts!!
I have the following request from my client:
I am displaying an alv report and i need to download it in txt format based on the columns showed in the current layout (i.e. if the user chooses to hide some columns, then they should not appear in the txt file ). In the alv i am using the Function Modules of the alv and not ABAP Objects.
I thought of dynamically creating the internal table, but i am not sure how to do it.
I also thaught of creating an internal table with only one field with the maximum length, but how can i check which fields are diplayed, and how can i get their values??
Please Help!!
Thank u in advance!!!
Please - no duplicate posts
Edited by: Rob Burbank on Feb 24, 2009 2:16 PMAfter call the above said function module you will get the exporting table for field catalog ie
call function 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
importing
es_layout = ls_slis_layo
et_fieldcat = lt_slis_fcat
if you check the lt_slis_fcat internal table if the field are hide in the layout by the user then in this internal table check for field NO_OUT will X.
Take the fields where NO_OUT ne X
then for creating dynamic internal table
field-symbols : <ptab> type standard table.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = lt_slis_fcat
importing
ep_table = i_content.
if sy-subrc = 0.
assign i_content->* to <ptab>.
else.
write: 'Error creating internal table'.
stop.
endif.
Here is the dynamic internal table
a® -
ALV download to Excel onto desktop using OLE concept.
Hi Experts,
I requriement is , through my se38 program i need to download report output to excel.
i did this using OLE concepts code and excel is being downloaded good.
But problem is all columns data is dumped into First column. But in my ALV i have 20 columns. So i except data in excel sheet to be in 20 columns.
Below is the OLE code i used
CREATE OBJECT wa_excel 'EXCEL.APPLICATION'. "Create object for Excel
SET PROPERTY OF wa_excel 'VISIBLE' = 1. "In background Mode
CALL METHOD OF wa_excel 'WORKBOOKS' = w_workbook.
CALL METHOD OF w_workbook 'ADD'. "Create a new Workbook
SET PROPERTY OF wa_excel 'SheetsInNewWorkbook' = 3. "No of sheets
* Downloading header details to first sheet
PERFORM download_sheet TABLES i_final USING 1 'Master Material Details'.
GET PROPERTY OF wa_excel 'ActiveSheet' = w_worksheet.
* Protect the first worksheet with a password
CALL METHOD OF w_worksheet 'PROTECT
EXPORTING #1 = 'infy@123'.
* Save the Excel file
GET PROPERTY OF wa_excel 'ActiveWorkbook' = w_workbook.
CALL METHOD OF w_workbook 'SAVEAS'
EXPORTING #1 = p_infile.
FREE OBJECT: w_worksheet, wa_excel.
FORM download_sheet TABLES p_tab USING p_sheet TYPE i p_name TYPE string.
CALL METHOD OF wa_excel 'WORKSHEETS' = w_worksheet
EXPORTING
#1 = p_sheet.
CALL METHOD OF w_worksheet 'ACTIVATE'.
SET PROPERTY OF w_worksheet 'NAME' = p_name.
CALL METHOD OF wa_excel 'Range' = w_range
EXPORTING
#1 = 'A1'
#2 = 'D1'.
CALL METHOD OF w_range 'INTERIOR' = w_int.
SET PROPERTY OF w_int 'ColorIndex' = 6.
SET PROPERTY OF w_int 'Pattern' = 1.
* Initially unlock all the columns( by default all the columns are locked )
CALL METHOD OF wa_excel 'Columns' = w_columns.
SET PROPERTY OF w_columns 'Locked' = 0.
* Locking and formatting first column
CALL METHOD OF wa_excel 'Columns' = w_columns
EXPORTING
#1 = 1.
* Locking and formatting second column
CALL METHOD OF wa_excel 'Columns' = w_columns
EXPORTING
#2 = 2.
SET PROPERTY OF w_columns 'Locked' = 2.
SET PROPERTY OF w_columns 'NumberFormat' = '@'.
* Export the contents in the internal table to the clipboard
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = p_tab[]
CHANGING
rc = w_rc
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
* Paste the contents in the clipboard to the worksheet
CALL METHOD OF w_worksheet 'Paste'.
* Autofit the columns according to the contents
CALL METHOD OF wa_excel 'Columns' = w_columns.
CALL METHOD OF w_columns 'AutoFit'.
FREE OBJECT: w_columns, w_range.
Please help me if there is any SET Property of WA_EXCEL with which i can handle ALV data into Diffrenet columns.
Regards,
jayant.hi nabheet,
we have implemnted this logic and it is workign fine. Bit it takes long time to download data in Excel sheet. Actually it is happening feild by field.
Please advice any perfomance tuning to this logic.
Rgs,
jayant -
ALV download to Excel--Problem with Column Headers
Hi,
I have created a dynamic internal table and displaying it as ALV using SALV classes. Problem is that when I download this ALV to Excel I'm not getting Column headings same as they are in ALV display.
I mean in Excel it is showing Column headings taken from domain or data element.
While creating dynamic table i'm passing short/ Medium & Long text too. Still it is not working.
Any kinda help is appreciated.
Thanks & Regards,
Vivek Gaur
Edited by: Vivek Gaur on Nov 4, 2009 2:04 PMLook I cant actually post the code as it is divided in some global classes and main program. But i can elaborate the steps little further:
1: I have created a field catalog for Dynamic internal table. In it i have passed every necessary field along with short/medium/Long texts.
2: I fill up this dynamic table with data.
3: I assign a field symbol to this dynamic internal table.
4: I pass this field symbol to the factory method of CL_SALV_TABLE Class.
Thats it buddy..Hope u have understood my problem. -
Dear Gurus a problem in alv report downloading to excel:
on executing the report works fine but when downloading to excel there last digit of bpvno is getting truncated.
ex: actual bpvno:'4000010' but excel o/p shows as '400001'
I have declared a field in final internal table as:
data: bpvno as bseg-belnr,
(in field catalog)
fieldcatalog-fieldname = 'BPVNO'.
fieldcatalog-seltext_m = 'BPV No.'.
fieldcatalog-seltext_L = 'BPV No.'.
fieldcatalog-col_pos = I1.
fieldcatalog-emphasize = 'X'.
append fieldcatalog .
clear fieldcatalog.
I1 = I1 + 1.
but after specifying the REF_TABLENAME & REF_FIELDNAME the downloaded excel o/p is correct.
My questions is:
1) i want to know what all are mandatory fields to be specified in fieldcatalog & is it compulsory to specify REF_TABLENAME & REF_FIELDNAME .
if not complusory why the downloaded excel value is being truncated ???
plz dont send materilas on alv and answer specific to the question....Hi,
I wrote a small program, and for me it worked. My assumption about the seltext was wrong. And I also didn't use output lenght.
Here is the code.
REPORT ZALVTOEXCEL .
type-pools slis.
data : gt_fcat type slis_t_fieldcat_alv.
data fieldcatalog like line of gt_fcat.
types : begin of t_belnr,
bpvno like bseg-belnr.
types end of t_belnr.
data gt_belnr type table of t_belnr.
data gwa_belnr type t_belnr.
gwa_belnr-bpvno = '4000010'.
append gwa_belnr to gt_belnr.
fieldcatalog-fieldname = 'BPVNO'.
fieldcatalog-seltext_m = 'BPV No.'.
fieldcatalog-seltext_L = 'BPV No.'.
fieldcatalog-col_pos = 1.
fieldcatalog-emphasize = 'X'.
append fieldcatalog to gt_fcat.
clear fieldcatalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = gt_fcat
I_SAVE = 'A'
TABLES
t_outtab = gt_belnr
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.
regards,
Advait. -
Select on MARA resulting into # values in internal table for one field
Hi Team,
I have written a SELECT statement on MARA table as below.
TRY.
SELECT matnr zzwftag FROM mara CLIENT SPECIFIED
INTO CORRESPONDING FIELDS OF TABLE gt_mara WHERE
mandt = sy-mandt AND
zzwftag NE space
AND zzwftag IS NOT NULL
AND zzwftag NE '#'
AND zzwftag NE '%#%'
AND zzwftag NE ' '
AND zzwftag NOT LIKE '%/%'(012).
CATCH cx_sy_dynamic_osql_error.
MESSAGE 'Error While Fetching Data from MARA'(044) TYPE 'S'(040) DISPLAY LIKE 'W'(041).
ENDTRY.
IF NOT gt_mara[] IS INITIAL.
DELETE gt_mara[] WHERE zzwftag EQ '#'
OR zzwftag IS INITIAL
OR zzwftag EQ space
OR zzwftag EQ ' '.
ENDIF.
Observations: 1. In
the resulting internal table I am seeing '#' values for fields zzwftag which are actually empty when I see the record in SE11 in MARA(ALV display). It shows '#' in it in SE16 display(We can choose User parameters and hence mode of display in SE11)
The requirement is to avoid those records where zzwftag is initial i.e. blank. I tried to delete invalid records but to no avail.
Please suggest any way where I can get the Select correct.
Regards,
AmitPlease do not use so many not conditions in one query....
Using so many negative conditions results in bad data.
Instead use delete statements later this would not confuse the system.
Also if you are using sy-mandt then i think you should not use client specified system will take care of it.
TRY.
SELECT matnr zzwftag FROM mara CLIENT SPECIFIED
INTO CORRESPONDING FIELDS OF TABLE gt_mara WHERE
mandt = sy-mandt AND
zzwftag NE space.
CATCH cx_sy_dynamic_osql_error.
MESSAGE 'Error While Fetching Data from MARA'(044) TYPE 'S'(040) DISPLAY LIKE 'W'(041).
ENDTRY.
IF NOT gt_mara[] IS INITIAL.
DELETE gt_mara[] WHERE zzwftag EQ '#'
OR zzwftag IS INITIAL
OR zzwftag EQ space
OR zzwftag EQ ' '.
delete gt_mara[] where zzwflag eq '%#%'.
ENDIF.
Maybe you are looking for
-
Error while installing SAP Widget Developer tool.zip on Eclipse Java EE IDE
Hello, I am new to SAP widget. I hav installed "Eclipse Java EE IDE for Web Developers" from eclipse.org and now when i was trying to install SAP Widget Developer tool.zip add-on as stated in the SAP Enterprise Widget Development Guide -->
-
Nokia 2520 with keyboard in consumption mode
I am a new owner of an AT&T Lumia 2520 with the power keyboard. I have noticed that when I am "consumption mode" and using Metro apps the on screen keyboard does not pop up. The only way to do this is to disconnect the power keyboard entirely and t
-
Intel GMA950 drivers/update help play spore!?
Hi, I am having trouble running spore on my macbook, i am able to play somewhat but i cant seem to view the creature creations part, at certain points the screen is black where it should show color. since this only happens in certain points of the ga
-
Cisco webview - create a template with new input parameter
Dear all, I know the Infomaker will help to create a template for webview. I have done with some custom template. My problem is that I can not change the input parameter for webview page. For example, if the template under the skill group, I can only
-
"Access denied. Login again" when creating New Configuration in Object Edit
Hi all, I am trying to complete ]<a href="http://help.sap.com/saphelp_nw70/helpdata/en/43/8d77556536267fe10000000a1553f7/content.htm">My First Composite Application</a> but got stuck at the step <a href="http://help.sap.com/saphelp_nw70/helpdata/en/4