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

how to change internal table structure dynamically

Former Member
0 Likes
2,328

Hi Experts,

i am getting all openitems using BAPI_AR_ACC_GETOPENITEMS into my final internal table final data i am uploading into AL11 (application server )

but they don't want all the field they want field according to layout setting they will maintain in T Code FBL5N field can be different every time.

How to change the structure of internal table based on layout setting?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,500

Hi

You can use the class CL_ABAP_ELEMDESCR, CL_ABAP_STRUCTDESCR and

CL_ABAP_TABLEDESCR.

The first two are to generate the structure, the last one to create the internal table.

I suppose it can find out many samples in SCN

Max

7 REPLIES 7
Read only

gouravkumar64
Active Contributor
0 Likes
1,500

Hi,

I think this will works

1)For custom field catalog use GET_FRONTEND_FIELDCATALOG,

2)loop with in it,check no_out field equal to 'X' or not,

3)Copy or create  to new field catalog ,

4)For generate dynamic table CL_ALV_TABLE_CREATE,

5)loop through output table and copy required fields to dynamic table appending to it,

6)Then gui_download like this

CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
     filename                        = lv_file
    FILETYPE                        = 'DAT'
   tables
     data_tab                        = it_mbew  " it is generic.

Thanks

Gourav.

Read only

Former Member
0 Likes
1,501

Hi

You can use the class CL_ABAP_ELEMDESCR, CL_ABAP_STRUCTDESCR and

CL_ABAP_TABLEDESCR.

The first two are to generate the structure, the last one to create the internal table.

I suppose it can find out many samples in SCN

Max

Read only

0 Likes
1,500

Hi Max,

thanks but its depend on the individual login they will set the layout in fbl5n ,according to layout setting my data will be upload into AL11 file. Example some time they will display only 3 field in fbl5n output some time they want 10 like this.

Read only

0 Likes
1,500

Yes

I've understood that, the first problem is to know how you manage the download (It's not clear if you want to download the data into application server or to upload the data from application server).

Because here you need to know the ALV layout to be used, and it's not clear the logic you want to use

Max

Read only

0 Likes
1,500

Max i don't want to download the data into application server i created one program that program will upload the data into AL11 automatically  every day i am using open, dataset they will run into background mode. they can change the layout in fbl5n according to the current layout my program should upload only those field what ever they set into fbl5n layout.

Read only

0 Likes
1,500

Hi

So who downloads the data?

Read only

0 Likes
1,500

Hi,

In standalon program you can not change the structure dynamically coz to upload the data into al11 you need to convert all field into char ask them to give field what they want.

Thanks

Rohan