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

regarding ALV format

Former Member
0 Likes
545

Dear All:

i want to generate a withholding tax report with following format. i populated two internal tables for vendor information and withholding tax information. but cannot bring the format like this:

Vendor 10000012 Vendor Name ABC Traders

Document No Document Date Posting Date Withholding Tax Code Withholding Tax Base Amount Withholding Tax Amount

50000010 12.06.2010 12.06.2010 A2 10000 100

50000011 17.06.2010 17.06.2010 A5 42500 425

50000012 28.06.2010 28.06.2010 A5 81569 815.69

can anyone help me how i can generate this format? can anyone provide me any sample code for that?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
494

Hi

Generally the order of fields in the alv report is same as that of the internal table.If you want to have your specific order then you need to make your own field catalog.

Sample code:

FORM BUILD_FIELDCATALOG.

WA_FIELDCATALOG-TABNAME = 'Y78EMP'.

WA_FIELDCATALOG-FIELDNAME = 'EMP_ID'.

WA_FIELDCATALOG-COL_POS = '1'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

  • CLEAR FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'LAST_NAME'.

WA_FIELDCATALOG-COL_POS = '2'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

  • CLEAR FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'FIRST_NAME'.

WA_FIELDCATALOG-COL_POS = '3'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

  • CLEAR WA_FIELDCATALOG.

ENDFORM.

Col_pos parameter of the fiield catalog gives the column position.

And you need to pass the this field catalog name in the IT_FIELDCAT parameter of REUSE_ALV_GRID_DISPLAY

Thanks!!

Edited by: Rahuljn on Jul 21, 2010 3:23 PM

2 REPLIES 2
Read only

Former Member
0 Likes
495

Hi

Generally the order of fields in the alv report is same as that of the internal table.If you want to have your specific order then you need to make your own field catalog.

Sample code:

FORM BUILD_FIELDCATALOG.

WA_FIELDCATALOG-TABNAME = 'Y78EMP'.

WA_FIELDCATALOG-FIELDNAME = 'EMP_ID'.

WA_FIELDCATALOG-COL_POS = '1'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

  • CLEAR FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'LAST_NAME'.

WA_FIELDCATALOG-COL_POS = '2'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

  • CLEAR FIELDCATALOG.

WA_FIELDCATALOG-FIELDNAME = 'FIRST_NAME'.

WA_FIELDCATALOG-COL_POS = '3'.

APPEND WA_FIELDCATALOG TO FIELDCATALOG.

  • CLEAR WA_FIELDCATALOG.

ENDFORM.

Col_pos parameter of the fiield catalog gives the column position.

And you need to pass the this field catalog name in the IT_FIELDCAT parameter of REUSE_ALV_GRID_DISPLAY

Thanks!!

Edited by: Rahuljn on Jul 21, 2010 3:23 PM

Read only

Former Member
0 Likes
494

Hi,

Check the examples provided in SAP itself.

Tcode - SE38 ---> BCALV_TEST_HIERSEQ_LIST

And also check other programs with BCALV*