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

alv layout

Former Member
0 Likes
539

hi

when i changed my layout and saved some other columns/fields were also getting added which i have not selected and also some blank columns is also getting added upon and when i try to delete all those column by the option of selecting that particular field/column it s not getting deleted

how do i delete all those unwanted columns/fields

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
505

HI,

I believe u r giving the declared internal table to ALV to display. Internal table has extra columns which u dont want to display...

then u have to fill the field catalog manually with respected columns..

**************************

<b>DATA: BEGIN OF gt_final_outtab OCCURS 0,

matnr LIKE mara-matnr,

mtart like mara-mtart,

maktx LIKE makt-maktx,

menge LIKE mseg-menge,

meins LIKE mseg-meins,

per_val TYPE p DECIMALS 4,

werks like mseg-werks,

END OF gt_final_outtab.</b>

<b>FORM get_fieldcat.

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

DATA: pos TYPE i VALUE 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'MATNR'.

ls_fieldcat-datatype = 'CHAR'.

ls_fieldcat-outputlen = 18.

ls_fieldcat-seltext_l = 'Material Number'.

ls_fieldcat-checkbox = 'X'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'MAKTX'.

ls_fieldcat-datatype = 'CHAR'.

ls_fieldcat-outputlen = 20.

ls_fieldcat-seltext_l = 'Product Description'.

ls_fieldcat-checkbox = 'X'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'MENGE'.

ls_fieldcat-outputlen = 15.

ls_fieldcat-seltext_l = 'Lbs Shipped'.

ls_fieldcat-checkbox = 'X'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'MEINS'.

ls_fieldcat-outputlen = 4.

ls_fieldcat-seltext_l = 'QTY'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ENDFORM. " get_fieldcat

----


FORM show_report.

PERFORM get_fieldcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_repid

it_fieldcat = gt_fieldcat[]

i_save = 'A'

TABLES

t_outtab = gt_final_outtab.

ENDFORM. " Show_report</b>

Regards

SAB

hi

when i changed my layout and saved some other columns/fields were also getting added which i have not selected and also some blank columns is also getting added upon and when i try to delete all those column by the option of selecting that particular field/column it s not getting deleted

how do i delete all those unwanted columns/fields

3 REPLIES 3
Read only

Former Member
0 Likes
506

HI,

I believe u r giving the declared internal table to ALV to display. Internal table has extra columns which u dont want to display...

then u have to fill the field catalog manually with respected columns..

**************************

<b>DATA: BEGIN OF gt_final_outtab OCCURS 0,

matnr LIKE mara-matnr,

mtart like mara-mtart,

maktx LIKE makt-maktx,

menge LIKE mseg-menge,

meins LIKE mseg-meins,

per_val TYPE p DECIMALS 4,

werks like mseg-werks,

END OF gt_final_outtab.</b>

<b>FORM get_fieldcat.

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

DATA: pos TYPE i VALUE 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'MATNR'.

ls_fieldcat-datatype = 'CHAR'.

ls_fieldcat-outputlen = 18.

ls_fieldcat-seltext_l = 'Material Number'.

ls_fieldcat-checkbox = 'X'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'MAKTX'.

ls_fieldcat-datatype = 'CHAR'.

ls_fieldcat-outputlen = 20.

ls_fieldcat-seltext_l = 'Product Description'.

ls_fieldcat-checkbox = 'X'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'MENGE'.

ls_fieldcat-outputlen = 15.

ls_fieldcat-seltext_l = 'Lbs Shipped'.

ls_fieldcat-checkbox = 'X'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

pos = pos + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = pos.

ls_fieldcat-fieldname = 'MEINS'.

ls_fieldcat-outputlen = 4.

ls_fieldcat-seltext_l = 'QTY'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ENDFORM. " get_fieldcat

----


FORM show_report.

PERFORM get_fieldcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_repid

it_fieldcat = gt_fieldcat[]

i_save = 'A'

TABLES

t_outtab = gt_final_outtab.

ENDFORM. " Show_report</b>

Regards

SAB

Read only

Former Member
0 Likes
505

Hi Vara,

Can you post the code of the field catalog.

Thanks

Vikranth Khimavath

Read only

Former Member
0 Likes
505

hey guys thanks for the response i got it resolved