Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Download

Former Member
0 Likes
598

Hello Gurus,

I have an ALV report .In that report i have a button called download.I change my ALV Layout and pressed download.

Let us say my alv has 10 fields.I have my own layout with 5 fields.when i got my alv display with the layout(5 fields) and pressed download i want to get only 5 fields 2 be downloaded rather than all fields.

How can i acheive this functionality?

4 REPLIES 4
Read only

Former Member
0 Likes
571

Hi Madan,

Give same nternal table name for all the fields in u r ALV report.

Otherwise i can't take all the fields for concideration.

Move all the fields in to one internal table and give that table name in all places in field catlog and ALV FM.

reward if useful.

Regards,

Narasimha

Read only

Former Member
0 Likes
571

hi,

use edit parameter in fieldcat, and BOX_FIELDNAME in layout so that when you display alv report you obtain some pushbuttons beside the records.

now write the code such that the fields you select in the alv report by clicking the pushbutton are stored in another internal table . Now pass this internal table to download function module.

reward if useful.

thanks and regards

Read only

Former Member
0 Likes
571

you have to get current frontend field caltog using the method. and then create a dynamic table to achieve this.

method GET_FRONTEND_FIELDCATALOG

and then something like this:

LOOP AT G_T_FIELDCAT INTO G_R_FIELDCAT WHERE NO_OUT NE 'X'

AND TECH IS INITIAL

AND FIELDNAME NE 'ICON'.

MOVE-CORRESPONDING G_R_FIELDCAT TO IS_FIELDCAT.

IS_FIELDCAT-FIELDNAME = G_R_FIELDCAT-FIELDNAME.

IS_FIELDCAT-INTTYPE = G_R_FIELDCAT-INTTYPE.

IS_FIELDCAT-OUTPUTLEN = G_R_FIELDCAT-OUTPUTLEN.

IS_FIELDCAT-REF_FIELD = G_R_FIELDCAT-FIELDNAME.

IS_FIELDCAT-REF_TABLE = G_R_FIELDCAT-REF_TABNAME.

APPEND IS_FIELDCAT TO IT_FIELDCAT.

ENDLOOP.

DATA: WA_LISTE LIKE P_T_LISTE.

CLEAR:IT_OUTTAB.

REFRESH: IT_OUTTAB.

LOOP AT P_T_LISTE INTO WA_LISTE.

WA_OUTTAB-PSPID = WA_LISTE-PSPID .

WA_OUTTAB-POSID = WA_LISTE-POSID.

WA_OUTTAB-POST1 = WA_LISTE-POST1.

WA_OUTTAB-STTXT_INT = WA_LISTE-STTXT_INT.

WA_OUTTAB-STTXT_EXT = WA_LISTE-STTXT_EXT.

APPEND WA_OUTTAB TO IT_OUTTAB.

ENDLOOP.

**dynamic table creation for data

ASSIGN LT_DATA TO <FS_DATA>.

Create a new Table

CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE

EXPORTING

IT_FIELDCATALOG = IT_FIELDCAT

IMPORTING

EP_TABLE = <FS_DATA>

EXCEPTIONS

GENERATE_SUBPOOL_DIR_FULL = 1

OTHERS = 2.

IF SY-SUBRC = 0.

ASSIGN <FS_DATA>->* TO <FS_1>.

CREATE DATA NEW_LINE LIKE LINE OF <FS_1>.

A field-symbol to access that work area

ASSIGN NEW_LINE->* TO <FS_2>.

**MOVE DATA

LOOP AT IT_OUTTAB INTO WA_OUTTAB.

CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'

EXPORTING

INPUT = WA_OUTTAB-PSPID

IMPORTING

OUTPUT = WA_OUTTAB-PSPID.

CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'

EXPORTING

INPUT = WA_OUTTAB-POSID

IMPORTING

OUTPUT = WA_OUTTAB-POSID.

LOOP AT G_T_FIELDCAT INTO G_R_FIELDCAT

WHERE NO_OUT IS INITIAL

AND TECH IS INITIAL.

ASSIGN COMPONENT G_R_FIELDCAT-FIELDNAME OF STRUCTURE

WA_OUTTAB TO <FS_5>.

ASSIGN COMPONENT G_R_FIELDCAT-FIELDNAME OF STRUCTURE

<FS_2> TO <FS_3>.

<FS_3> = <FS_5>.

ENDLOOP.

INSERT <FS_2> INTO TABLE <FS_1>.

ENDLOOP.

ELSE.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Read only

0 Likes
571

Thanks for ur reply.But i dont want 2 use ABAP Objects.Is there any other solution 2 do this without using Objects......