‎2015 Aug 27 3:31 PM
Dear Expert,
I have used the submit program asset Balance report.
I have created the zprogram and called the program rabest_alv01.
I am getting the output in the text format as i am not able to read the data exactly according to field.
Any way can i input directly output table from the program rabest_alv01 so that
i need to modify final internal table before display.
SUBMIT rabest_alv01
WITH BUKRS IN gr_bukrs
WITH P_GRID EQ 'X'
EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
DATA : it_text LIKE solisti1 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = it_text
listobject = t_listobject.
Thanks and regards,
Zubera
‎2015 Aug 27 4:11 PM
Hi
It seems you're lucky abaper, the program RABEST_ALV01 has an hidden parameter can be used in order to export the ALV table. P_TABLE:
SUBMIT RABEST_ALV01
WITH BUKRS IN GR_BUKRS
WITH P_GRID EQ 'X'
WITH P_TABLE EQ 'X'
AND RETURN.
If you use it the output table is exported to memory instead of printed by ALV, so you don't need to export the abap list, but only to get the ALV table form memory:
If you see the fm FIAA_ALV_DISPLAY used to generate the ALV:
FUNCTION fiaa_alv_display.
*"----------------------------------------------------------------------
*"*"Globale Schnittstelle:
*" IMPORTING
*" VALUE(I_FIELDCAT) TYPE SLIS_T_FIELDCAT_ALV OPTIONAL
*" VALUE(VARIANTE) TYPE DISVARIANT-VARIANT
*" VALUE(ITAB_SORT) TYPE SLIS_T_SORTINFO_ALV OPTIONAL
*" VALUE(ITAB_LAYOUT) TYPE SLIS_LAYOUT_ALV OPTIONAL
*" VALUE(ITAB_EVENTS) TYPE SLIS_T_EVENT OPTIONAL
*" VALUE(TABNAME_HEADER) TYPE SLIS_TABNAME
*" VALUE(TABNAME_ITEM) TYPE SLIS_TABNAME DEFAULT SPACE
*" VALUE(HIERARCHICAL) TYPE XFELD DEFAULT SPACE
*" VALUE(SUMMEN_BERICHT)
*" VALUE(GITTERBERICHT) DEFAULT SPACE
*" VALUE(X_T086) TYPE T086
*" REFERENCE(EXPAND) TYPE XFELD DEFAULT SPACE
*" REFERENCE(USE_ALV_GRID) TYPE XFELD DEFAULT SPACE
*" REFERENCE(TCOLLECT) TYPE FIAA_SALVCOLLECT OPTIONAL
...........................................................................................................................................................
* only output to table?
IF NOT tcollect-x_table_out IS INITIAL.
IF hierarchical IS INITIAL. "> 875231
* standard lists are exported in one table
EXPORT table FROM itab_header TO MEMORY ID sy-cprog.
ELSE.
* hierarchichal lists are exported in two tables
CONCATENATE sy-cprog '_HEADER' INTO ld_mem_id.
EXPORT table FROM itab_header TO MEMORY ID ld_mem_id.
CONCATENATE sy-cprog '_ITEM' INTO ld_mem_id.
EXPORT table FROM itab_item TO MEMORY ID ld_mem_id.
ENDIF. "> 875231
RETURN.
ENDIF.
The output table is exported to a memory ID called like the calling program, so RABEST_ALV01
So you should try to import that table in your program after the submit:
INCLUDE RASORT_ALV_DATA_FIELDCAT. "Here the internal table to be imported is defined
SUBMIT RABEST_ALV01
WITH BUKRS IN GR_BUKRS
WITH P_GRID EQ 'X'
WITH P_TABLE EQ 'X'
AND RETURN.
IMPORT TABLE TO SUMTAB_DATA_S FROM MEMORY ID 'RABEST_ALV01'.
Max
‎2015 Aug 27 4:18 PM
Hi Max,
Thanks for your reply. i tried with p_table EQ 'X', but
it is giving the error No list generated.
Program RABEST_ALV01 using the File symbol in the ALV Display.
How we can declare the internal table to import ALV in our report.
Thanks and regards,
Zubera
‎2015 Aug 27 4:30 PM
Sorry
If you run the program with parameter SUMMB equal to space, the data stored in a internal table defined as the dictionary structure FIAA_SALVTAB_RABEST:
see programm RABEST_ALV01:
DATA: itab_data LIKE fiaa_salvtab_rabest OCCURS 10 WITH HEADER LINE.
Where have you the error?
Max
‎2015 Aug 27 4:32 PM
I have coded below it is going to dump. Please tell me what i need to correct
DATA: sumtab_data LIKE HASHED TABLE OF fiaa_salvtab_sum
WITH UNIQUE KEY s1 s2 s3 s4 s5
s1_text s2_text s3_text s4_text
s5_text add1 waers.
DATA: BEGIN OF sumtab_data_s OCCURS 10.
INCLUDE STRUCTURE fiaa_salvtab_sum.
* Infotext
DATA: text(30),
flg_pick_up(1),
hlp_level(1),
* Sortiertexte
* s1_text(10), s2_text(10), s3_text(10), s4_text(10), s5_text(10),
" 781218
* Platzhalter (Sonst dumpt ALV Grid!)
dspace01(1),dspace02(1),dspace03(1),dspace04(1),dspace05(1),
dspace06(1),dspace07(1),dspace08(1),dspace09(1),dspace10(1),
END OF sumtab_data_s,
sumline TYPE fiaa_salvtab_sum.
DATA: tcollect TYPE fiaa_salvcollect.
gr_bukrs-sign = 'I'.
gr_bukrs-option = 'BT'.
gr_bukrs-low = 'TEOC'.
APPEND gr_bukrs.
SUBMIT rabest_alv01
WITH BUKRS IN gr_bukrs
*WITH P_GRID EQ 'X'
WITH P_TABLE EQ 'X'
EXPORTING LIST TO MEMORY
AND RETURN.
IMPORT TABLE TO SUMTAB_DATA_S FROM MEMORY ID 'RABEST_ALV01'.
‎2015 Aug 27 4:50 PM
I have below code also still it is going for dump:
Error when attempting to IMPORT object "TABLE".
SUBMIT rabest_alv01
WITH BUKRS IN gr_bukrs
*WITH P_GRID EQ 'X'
WITH P_TABLE EQ 'X'
EXPORTING LIST TO MEMORY
AND RETURN.
IMPORT TABLE TO itab_data FROM MEMORY ID 'RABEST_ALV01'.
‎2015 Aug 27 4:54 PM
Hi
No it's not ok, no output is printed so you don't need to use the option EXPORTING LIST..........
so:
SUBMIT rabest_alv01
WITH BUKRS IN gr_bukrs
*WITH P_GRID EQ 'X'
WITH P_TABLE EQ 'X'
EXPORTING LIST TO MEMORY
AND RETURN.
IMPORT TABLE TO SUMTAB_DATA_S FROM MEMORY ID 'RABEST_ALV01'.
But try to check the program RABEST_ALV01 where the fm FIAA_ALV_DISPLAY is called:
IF summb eq space.
* *******************
* ** EINZELBERICHT **
* *******************
PERFORM init_fieldcat.
CALL FUNCTION 'FIAA_ALV_DISPLAY'
EXPORTING
use_alv_grid = p_grid
variante = p_vari
tabname_header = 'ITAB_DATA'
summen_bericht = summb
x_t086 = t086
tcollect = tcollect
TABLES
itab_header = itab_data[]
bukrs = bukrs[]
sortfeld = feld[]
itab_errors = gt_anfm[]. "> 1002552
ELSE.
* *******************
* ** SUMMENBERICHT **
* *******************
PERFORM summentabelle_aufbauen.
PERFORM init_fieldcat_sum.
CALL FUNCTION 'FIAA_ALV_DISPLAY'
EXPORTING
use_alv_grid = p_grid
variante = p_vari
tabname_header = 'SUMTAB_DATA_S'
summen_bericht = summb
x_t086 = t086
tcollect = tcollect
TABLES
itab_header = sumtab_data_s[]
bukrs = bukrs[]
sortfeld = feld[]
itab_errors = gt_anfm[]. "> 1002552
ENDIF.
The parameter SUMMB is space by default (it's a radiobutton) so the table used for alv is ITAB_DATA instead of SUMTAB_DATA_S, you don't set that radiobutton in your submit so your code should be:
DATA: ITAB_DATA LIKE FIAA_SALVTAB_RABEST OCCURS 10 WITH HEADER LINE.
GR_BUKRS-SIGN = 'I'.
GR_BUKRS-OPTION = 'BT'.
GR_BUKRS-LOW = 'TEOC'.
APPEND GR_BUKRS.
SUBMIT RABEST_ALV01
WITH BUKRS IN GR_BUKRS
WITH P_TABLE EQ 'X'
AND RETURN.
IMPORT TABLE TO TAB_DATA FROM MEMORY ID 'RABEST_ALV01'.
I think the ranges GR_BUKRS is not filled correctly, if you use the option BT (so between) you need to indicate the HIGH value, if you want to select the data of a single company code you need to use the option EQ
Max
‎2015 Aug 27 5:02 PM
Hi Max,
Thanks for your reply. i have used the both table sumtab_data_s and itab_data, it is
going for dump. I think some problem in the structure of imprt table.
Thanks and regards,
Zubera
‎2015 Aug 27 5:25 PM
I've tried to run this code and it works:
DATA: ITAB_DATA LIKE FIAA_SALVTAB_RABEST OCCURS 10 WITH HEADER LINE.
RANGES: GR_BUKRS FOR T001-BUKRS.
GR_BUKRS-SIGN = 'I'.
GR_BUKRS-OPTION = 'EQ'.
GR_BUKRS-LOW = 'MAAB'.
APPEND GR_BUKRS.
SUBMIT RABEST_ALV01
WITH BUKRS IN GR_BUKRS
WITH P_TABLE EQ 'X'
AND RETURN.
IMPORT TABLE TO ITAB_DATA FROM MEMORY ID 'RABEST_ALV01'.
‎2015 Aug 27 5:33 PM
Same code i copied and run it is giving below dump
Error when attempting to IMPORT object "TABLE"
No idea what is the problem.
‎2015 Aug 27 5:47 PM
‎2015 Aug 27 5:52 PM
REPORT ZTEST_ASSET1.
DATA: ITAB_DATA LIKE FIAA_SALVTAB_RABEST OCCURS 10 WITH HEADER LINE.
RANGES: GR_BUKRS FOR T001-BUKRS.
GR_BUKRS-SIGN = 'I'.
GR_BUKRS-OPTION = 'EQ'.
GR_BUKRS-LOW = 'TYGB'.
APPEND GR_BUKRS.
SUBMIT RABEST_ALV01
WITH BUKRS IN GR_BUKRS
WITH P_TABLE EQ 'X'
AND RETURN.
BREAK-POINT.
IMPORT TABLE TO ITAB_DATA FROM MEMORY ID 'RABEST_ALV01'.
IF SY-SUBRC EQ 0.
ENDIF.
Dump
Error when attempting to IMPORT object "TABLE".
The reason for the exception is:
When importing the object "TABLE", the component 1 in the dataset
had a different length from the corresponding component of the
target object in the program "ZTEST_ASSET1".
The length is 4 in the dataset, but 40 in the program.
‎2015 Aug 27 6:09 PM
Uhm
can you post the part of code of RABEST_ALV01 placed in the event END-OF-SELECTION
Max
‎2015 Aug 27 6:37 PM
No problem
Probably you've another version of report RABEST_ALV01 where the ALV table is created dynamically,
so try this code:
RANGES: GR_BUKRS FOR T001-BUKRS.
DATA: LT_COMPTAB TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE.
DATA: LR_OUTTAB_STRUCT TYPE REF TO CL_ABAP_STRUCTDESCR.
DATA: LR_DATA_LINE TYPE REF TO DATA.
DATA: LR_DATA_TABLE TYPE REF TO DATA.
FIELD-SYMBOLS: <ITAB_LINE> TYPE ANY.
FIELD-SYMBOLS: <ITAB_DATA> TYPE STANDARD TABLE.
* Create internal table dynamically
CALL FUNCTION 'FIAA_CREATE_OUTFILE_ALV'
EXPORTING
I_STRUCTUR = 'FIAA_SALVTAB_RABEST'
I_SRTVR = '0001'
I_NO_VAR_STRUC = 'X' "1751706
TABLES
T_OUTTAB = LT_COMPTAB.
LR_OUTTAB_STRUCT = CL_ABAP_STRUCTDESCR=>CREATE( LT_COMPTAB ).
CREATE DATA LR_DATA_LINE TYPE HANDLE LR_OUTTAB_STRUCT.
ASSIGN LR_DATA_LINE->* TO <ITAB_LINE>.
CREATE DATA LR_DATA_TABLE LIKE STANDARD TABLE OF <ITAB_LINE>.
ASSIGN LR_DATA_TABLE->* TO <ITAB_DATA>.
* Do submit
GR_BUKRS-SIGN = 'I'.
GR_BUKRS-OPTION = 'EQ'.
GR_BUKRS-LOW = 'TYGB'.
APPEND GR_BUKRS.
SUBMIT RABEST_ALV01
WITH BUKRS IN GR_BUKRS
WITH P_TABLE EQ 'X'
AND RETURN.
IMPORT TABLE TO <ITAB_DATA> FROM MEMORY ID 'RABEST_ALV01'.
FREE MEMORY ID 'RABEST_ALV01'.
Max
‎2015 Aug 27 7:20 PM
Hi Max,
Thanks for your support.
It is giving the dump Length error occurred in IMPORT statement in the import
statement. Some problem in import statement internal table.
‎2015 Aug 27 7:23 PM
Code in End of selection
* Start of note 1496486
IF summb eq space.
gd_tabname_header = gc_tabname_header.
ELSE.
gd_tabname_header = gc_tabname_sum.
ENDIF.
CALL FUNCTION 'FIAA_ALV_DISPLAY'
EXPORTING
use_alv_grid = p_grid
variante = p_vari
tabname_header = gd_tabname_header
summen_bericht = summb
x_t086 = t086
tcollect = tcollect
TABLES
itab_header = <itab_data>[]
bukrs = bukrs[]
sortfeld = feld[]
itab_errors = gt_anfm[]. "> 1002552
* End of noter 1496486
‎2015 Aug 27 7:26 PM
Below is the dump description
The dataset can only be imported into a target area that has the
same structure as the data in the dataset. If the target area
is longer or shorter than the data set, refer to the documentation
for the additions ACCEPTING PADDING or ACCEPTING TRUNCATION.
‎2015 Aug 28 9:50 AM
Hi
Ok that means the program the version of RABEST_ALV01 is higher than mine, anyway I've tried to check it in another system
You need to check the form FORM CREATE_OUTFILE_ALV in RABEST_ALV01
FORM CREATE_OUTFILE_ALV USING value(i_linetyp)
p_table "1751706
i_srtvr
i_fiaa_salvtab.
CLEAR lr_outtab_struct.
CLEAR lt_comptab.
CALL FUNCTION 'FIAA_CREATE_OUTFILE_ALV'
EXPORTING
i_structur = i_fiaa_salvtab
i_srtvr = i_srtvr
i_no_var_struc = p_table "1751706
TABLES
t_outtab = lt_comptab.
lr_outtab_struct = cl_abap_structdescr=>create( lt_comptab ).
* Create data type for alv data
CLEAR lr_data_line.
* (header line)
CASE i_linetyp.
WHEN gc_header.
CREATE DATA lr_data_line TYPE HANDLE lr_outtab_struct.
ASSIGN lr_data_line->* TO <itab_line>.
CREATE DATA lr_data_table LIKE STANDARD TABLE OF <itab_line>.
ASSIGN lr_data_table->* TO <itab_data>.
* (Position-Line)
WHEN gc_line.
CREATE DATA lr_data_line TYPE HANDLE lr_outtab_struct.
ASSIGN lr_data_line->* TO <itab_line2>.
CREATE DATA lr_data_table LIKE STANDARD TABLE OF <itab_line2>.
ASSIGN lr_data_table->* TO <itab_data2>.
ENDCASE.
ENDFORM.
As you can see, now the table for the ALV is created dynamically, so you need to do the same in your Z-report
As I've explained in the previous answers, you need to replace the code above in order to generate the ALV table in the same way of RABEST_ALV01
I've tried this code and it works:
RANGES: GR_BUKRS FOR T001-BUKRS.
DATA: LT_COMPTAB TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE.
DATA: LR_OUTTAB_STRUCT TYPE REF TO CL_ABAP_STRUCTDESCR.
DATA: LR_DATA_LINE TYPE REF TO DATA.
DATA: LR_DATA_TABLE TYPE REF TO DATA.
FIELD-SYMBOLS: <ITAB_LINE> TYPE ANY.
FIELD-SYMBOLS: <ITAB_DATA> TYPE STANDARD TABLE.
* Create internal table dynamically
CALL FUNCTION 'FIAA_CREATE_OUTFILE_ALV'
EXPORTING
I_STRUCTUR = 'FIAA_SALVTAB_RABEST'
I_SRTVR = '0001'
I_NO_VAR_STRUC = 'X' "1751706
TABLES
T_OUTTAB = LT_COMPTAB.
LR_OUTTAB_STRUCT = CL_ABAP_STRUCTDESCR=>CREATE( LT_COMPTAB ).
CREATE DATA LR_DATA_LINE TYPE HANDLE LR_OUTTAB_STRUCT.
ASSIGN LR_DATA_LINE->* TO <ITAB_LINE>.
CREATE DATA LR_DATA_TABLE LIKE STANDARD TABLE OF <ITAB_LINE>.
ASSIGN LR_DATA_TABLE->* TO <ITAB_DATA>.
* Do submit
GR_BUKRS-SIGN = 'I'.
GR_BUKRS-OPTION = 'EQ'.
GR_BUKRS-LOW = 'VA10'.
APPEND GR_BUKRS.
SUBMIT RABEST_ALV01
WITH BUKRS IN GR_BUKRS
WITH P_TABLE EQ 'X'
AND RETURN.
IMPORT TABLE TO <ITAB_DATA> FROM MEMORY ID 'RABEST_ALV01'.
FREE MEMORY ID 'RABEST_ALV01'.
‎2015 Aug 28 11:13 AM
Hi Max,
Thanks for your reply.
I found the problem, but not sure why it is happening.
Problem is in below code:
CALL FUNCTION 'FIAA_CREATE_OUTFILE_ALV'
EXPORTING
i_structur = i_fiaa_salvtab
i_srtvr = i_srtvr
TABLES
t_outtab = lt_comptab.
Standard program is returning 28 field in the table lt_comptab,
but in same code my custom program returning 25 fields.
So because of that program is going dump.
Thanks and regards,
Zubera
‎2015 Aug 28 11:51 AM
Hi
Yes that's the problem
So check how the program calls fm FIAA_CREATE_OUTFILE_ALV and call it in the same way in your report
I mean you need to check all values transfered to fm FIAA_CREATE_OUTFILE_ALV, so:
- i_fiaa_salvtab
- i_srtvr
- p_table
CALL FUNCTION 'FIAA_CREATE_OUTFILE_ALV'
EXPORTING
i_structur = i_fiaa_salvtab
i_srtvr = i_srtvr
i_no_var_struc = p_table "1751706
TABLES
t_outtab = lt_comptab.
In the piece of code you've posted, it seems the note 1751706 is not applied, if it's so in your program u need to move SPACE in I_NO_VAR_STRUC:
RANGES: GR_BUKRS FOR T001-BUKRS.
DATA: LT_COMPTAB TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE.
DATA: LR_OUTTAB_STRUCT TYPE REF TO CL_ABAP_STRUCTDESCR.
DATA: LR_DATA_LINE TYPE REF TO DATA.
DATA: LR_DATA_TABLE TYPE REF TO DATA.
FIELD-SYMBOLS: <ITAB_LINE> TYPE ANY.
FIELD-SYMBOLS: <ITAB_DATA> TYPE STANDARD TABLE.
* Create internal table dynamically
CALL FUNCTION 'FIAA_CREATE_OUTFILE_ALV'
EXPORTING
I_STRUCTUR = 'FIAA_SALVTAB_RABEST'
I_SRTVR = '0001'
I_NO_VAR_STRUC = 'X' "1751706
TABLES
T_OUTTAB = LT_COMPTAB.
LR_OUTTAB_STRUCT = CL_ABAP_STRUCTDESCR=>CREATE( LT_COMPTAB ).
CREATE DATA LR_DATA_LINE TYPE HANDLE LR_OUTTAB_STRUCT.
ASSIGN LR_DATA_LINE->* TO <ITAB_LINE>.
CREATE DATA LR_DATA_TABLE LIKE STANDARD TABLE OF <ITAB_LINE>.
ASSIGN LR_DATA_TABLE->* TO <ITAB_DATA>.
* Do submit
GR_BUKRS-SIGN = 'I'.
GR_BUKRS-OPTION = 'EQ'.
GR_BUKRS-LOW = 'VA10'.
APPEND GR_BUKRS.
SUBMIT RABEST_ALV01
WITH BUKRS IN GR_BUKRS
WITH P_TABLE EQ 'X'
AND RETURN.
IMPORT TABLE TO <ITAB_DATA> FROM MEMORY ID 'RABEST_ALV01'.
FREE MEMORY ID 'RABEST_ALV01'.