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

Default value in ALV

simantini_sh
Explorer
0 Likes
2,456

Hi, can someone please tell him how do I set a field in ALV output list with a default value? Like here,

File Indicator will be a field with a default value i.e.., ERP

Thanks in advance 🙂

1 ACCEPTED SOLUTION
Read only

Gourab_Dey
Product and Topic Expert
Product and Topic Expert
2,340

In the internal table, you have set the value to ERP.

Thanks,
Gourab

5 REPLIES 5
Read only

Gourab_Dey
Product and Topic Expert
Product and Topic Expert
2,341

In the internal table, you have set the value to ERP.

Thanks,
Gourab

Read only

0 Likes
2,340

It's not related to any fields from any table, just a column with a default value. Can you pls share the syntax

Read only

Gourab_Dey
Product and Topic Expert
Product and Topic Expert
2,340

So, my understanding is, there is a column required in ALV output and the value should be always "ERP".

If my understanding is correct, then proceed with the below code. So, you have to add a field to you internal table if it's not already available.

FIELD-SYMBOLS: <fs_output> type <place_your_work_area_type_here>.

LOOP AT <place_your_work_area_type_here>ASSIGNING <fs_output>.
  <fs_output>-file_ind = 'ERP'.
ENDLOOP.

Note:

  • replace <place_your_work_area_type_here> with your ALV line item type
  • Replace <place_your_work_area_type_here> with the intenrnal table which is used in the ALV output

Please revert back if you are looking for something else.

Thanks,
Gourab

Read only

2,340

Thank you, it worked

Read only

former_member753791
Participant
0 Likes
2,340

Hi Simantini Hazra,

I suppose that column(FILE_IND) is a part of ALV you're displaying.Let's say your table is gt_alv.

So the code will be -

After fetching all relevant data and preparing your internal table. Loop your internal table using a field symbol.

LOOP AT gt_alv ASSIGNING <lfs_alv>.

<lfs_alv>-file_ind = 'ERP'.

ENDLOOP.

UNASSIGN <lfs_alv>.

Regards,

Rohit