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: 

ALV report

Former Member
0 Kudos

Moderator message: please use a meaningful informative subject in future

Hi all,

i need to convert a normal report into an ALV report. the report output has the header details most of which has constant texts. and item details. the item details are for every Advance Payment Number( AVSID). the header could have been possible with commentry write but since i ave to get the item details

for evert AVSID, i could not use ALV list. I had to use Block or Heirarchial ALV. the problem with heirarchial is the incorporate the header details. while in block, since i have to clear my inernal table before every new AVSID, the list containd no data. Can somebody guide with the apporach to be adopted here.

thanks,

Hari

Edited by: Matt on Nov 24, 2008 8:05 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try to move those records into some other internal table and then clear the old internal table.

Dispaly new internal table in the list.

Please let me know if u have any issues.

Regards,

Kusuma.

6 REPLIES 6

Former Member
0 Kudos

Hi,

Try to move those records into some other internal table and then clear the old internal table.

Dispaly new internal table in the list.

Please let me know if u have any issues.

Regards,

Kusuma.

0 Kudos

Hi Kusuma,

This works only when u give few AVSID in the selection screen. However when we execute the report withour specifying anything in the selection screen... the report give a blank screen.

Regards,

Hari

0 Kudos

Hi,

I am not getting what you are saying.

getting records from your DB table will depend on your select querry.

Regards,

Kusuma.

Former Member
0 Kudos

Hi ,

Please find the below code..

          • sort the table by check no. and AP clearing DOC********************

SORT it_disb_output BY chect fi_augbl.

report_id = sy-repid.

PERFORM layout_init CHANGING i_layout. " for ALV layout

PERFORM fieldcat_init CHANGING w_fieldcat. " For fields in ALV list

PERFORM sub_total.

PERFORM alv_display.

&----


*& Form Layout_init

&----


  • Layout initialization

----


FORM layout_init CHANGING i_layout.

CLEAR w_layout.

w_layout-colwidth_optimize = 'x'.

w_layout-window_titlebar = text-150.

ENDFORM. " Layout_init

&----


*& Form fieldcat_init

&----


  • Field catelogue initialization routine

----


      • FI fields will be in one color and Aries data will be in another

      • color

                • Perform Field_cat1 for aries data and Field_cat2 for FI data

FORM fieldcat_init CHANGING i_fieldcat.

PERFORM field_cat1 USING 'GPART' 'it_disb_output' text-119 .

PERFORM field_cat1 USING 'NAME_FIRST' 'it_disb_output' text-120.

PERFORM field_cat1 USING 'VTREF' 'it_disb_output' text-121 .

PERFORM field_cat1 USING 'OPBEL' 'it_disb_output' text-122 .

PERFORM field_cat3 USING

'BETRW' 'IT_DISB_OUTPUT' text-123 'X' 'CURR' ' ' 'C300' .

PERFORM field_cat1 USING 'MD_OPBEL' 'it_disb_output' text-124.

PERFORM field_cat2 USING 'BELNR' 'it_disb_output' text-125 .

PERFORM field_cat3 USING

'AUGDT' 'IT_DISB_OUTPUT' text-126 'X' 'DATS' ' ' 'C400' .

PERFORM field_cat3 USING

'WRBTR' 'IT_DISB_OUTPUT' text-127 'X' 'NUMC' ' ' 'C400' .

PERFORM field_cat2 USING 'CHECT' 'it_disb_output' text-128.

PERFORM field_cat2 USING 'FI_AUGBL' 'it_disb_output' text-129 .

PERFORM field_cat2 USING 'FI_LIFNR' 'it_disb_output' text-130 .

PERFORM field_cat2 USING 'NAME1' 'it_disb_output' text-131.

PERFORM field_cat1 USING 'PYMET' 'it_disb_output' text-132 .

PERFORM field_cat1 USING 'FI_SGTXT' 'it_disb_output' text-133 .

PERFORM field_cat1 USING 'FI_CHUSER' 'it_disb_output' text-134 .

PERFORM field_cat1 USING 'USERID_RMW1' 'it_disb_output' text-135.

PERFORM field_cat1 USING 'USERID_RMW2' 'it_disb_output' text-136.

PERFORM field_cat1 USING 'USERID_RMW3' 'it_disb_output' text-137 .

PERFORM field_cat3 USING

'BANCD' 'IT_DISB_OUTPUT' text-138 'X' 'DATS' ' ' 'C400' .

PERFORM field_cat3 USING

'VOIDD' 'IT_DISB_OUTPUT' text-139 'X' 'DATS' ' ' 'C400' .

ENDFORM. " fieldcat_init

&----


*& Form field_cat1

&----


  • Field catelogue for FI fields

----


  • -->field_name field name

  • -->tab_name table name

  • -->col_head column heading

----


FORM field_cat1 USING field_name

tab_name

col_head.

DATA: l_line_fieldcat TYPE slis_fieldcat_alv.

CLEAR l_line_fieldcat.

l_line_fieldcat-fieldname = field_name.

l_line_fieldcat-ref_tabname = tab_name.

l_line_fieldcat-seltext_m = col_head.

l_line_fieldcat-emphasize = 'C300'.

APPEND l_line_fieldcat TO w_fieldcat.

ENDFORM. " field_cat1

&----


*& Form field_cat2

&----


  • field catelogue for aries data

----


  • -->field_name field name

  • -->tab_name table name

  • -->col_head column header

----


FORM field_cat2 USING field_name

tab_name

col_head.

DATA: l_line_fieldcat TYPE slis_fieldcat_alv.

CLEAR l_line_fieldcat.

l_line_fieldcat-fieldname = field_name.

l_line_fieldcat-ref_tabname = tab_name.

l_line_fieldcat-seltext_m = col_head.

l_line_fieldcat-emphasize = 'C400'.

APPEND l_line_fieldcat TO w_fieldcat.

ENDFORM. " field_cat2

&----


*& Form field_cat3

----


  • -->FIELD_NAME field name

  • -->TAB_NAME table name

  • -->COL_HEAD column header

  • -->DO_SUM column sum

  • -->DTYPE data type

  • -->FIELD_KEY key

  • -->EMP_SIZE color

----


FORM field_cat3 USING field_name

tab_name

col_head

do_sum

dtype

field_key

emp_size.

DATA: l_line_fieldcat TYPE slis_fieldcat_alv.

CLEAR l_line_fieldcat.

l_line_fieldcat-fieldname = field_name.

l_line_fieldcat-ref_tabname = tab_name.

l_line_fieldcat-seltext_m = col_head.

l_line_fieldcat-do_sum = do_sum.

l_line_fieldcat-datatype = dtype.

l_line_fieldcat-key = field_key.

l_line_fieldcat-emphasize = emp_size.

l_line_fieldcat-just = 'L'.

APPEND l_line_fieldcat TO w_fieldcat.

ENDFORM. "field_cat3

&----


*& Form alv_display

&----


  • Report output display routine

----


FORM alv_display .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_top_of_page = slis_ev_top_of_page

is_layout = w_layout

it_fieldcat = w_fieldcat[]

it_sort = t_subtotal[]

i_save = x_save

is_variant = gs_layout

TABLES

t_outtab = it_disb_output

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " alv_display

&----


*& Form TOP_OF_PAGE

&----


FORM top_of_page.

DATA: it_listheader TYPE slis_t_listheader.

PERFORM build_listheader USING it_listheader.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_listheader.

ENDFORM. "TOP_OF_PAGE

&----


*& Form BUILD_LISTHEADER

&----


  • List heading

----


FORM build_listheader USING i_listheader TYPE slis_t_listheader.

DATA v_date(50) TYPE c.

SELECT SINGLE name_textc FROM user_addr INTO username

WHERE bname EQ sy-uname.

CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'

EXPORTING

input = sy-datum

IMPORTING

output = v_date.

DATA hline TYPE slis_listheader.

CONCATENATE text-142 username '(' sy-uname')' INTO hline-info

SEPARATED BY space.

hline-typ = 'S'.

APPEND hline TO i_listheader.

CLEAR hline.

CONCATENATE text-143 v_date INTO hline-info.

hline-typ = 'S'.

APPEND hline TO i_listheader.

CLEAR hline.

CONCATENATE text-144 sy-uzeit0(2) ':' sy-uzeit2(2) ':' sy-uzeit+4(2)

INTO hline-info.

hline-typ = 'S'.

APPEND hline TO i_listheader.

CLEAR hline.

ENDFORM. "build_listheader

&----


*& Form sub_total

&----


  • Sub total criterion

----


FORM sub_total .

CLEAR t_subtotal.

t_subtotal-fieldname = 'CHECT'.

t_subtotal-spos = 1. "Sort Sequence

t_subtotal-up = 'X'. "Sort in ascending

t_subtotal-subtot = 'X'.

APPEND t_subtotal TO t_subtotal.

ENDFORM. " sub_total

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

You can use the same FM to pass the dynamic values .....

Revert in case you need any clarifications

BR

Jaga

0 Kudos

Hi Jaga,

I will have to call the ALV FM withing the loop. and So i caanot use the normal List/Grid ALV. How do i pass dynamic values??

regards, Hari

matt
Active Contributor
0 Kudos

Please use a meaningful informative subject in future