Application Development 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:ย 

Default value in ALV

simantini_sh
Explorer
0 Kudos
270

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

Gourab_Dey
Contributor
154

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

Thanks,
Gourab

5 REPLIES 5

Gourab_Dey
Contributor
155

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

Thanks,
Gourab

0 Kudos
154

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

154

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

154

Thank you, it worked

former_member753791
Participant
0 Kudos
154

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