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

alv header list

Former Member
0 Likes
574

in the alv report for displaying the header data i have written my coding as

FORM E04_COMMENT_BUILD USING E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.

DATA: LS_LINE TYPE SLIS_LISTHEADER.

CLEAR LS_LINE.

LS_LINE-TYP = 'S'.

LS_LINE-KEY = 'Payer'.

LS_LINE-INFO = gt_header_table-kunnr.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'Compamy Code'.

LS_LINE-INFO = gt_header_table-bukrs.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'Name'.

LS_LINE-INFO = it_h_kna1-name1.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'City'.

LS_LINE-INFO = it_h_kna1-ort01.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'State'.

LS_LINE-INFO = it_h_kna1-regio.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'Telephone Number'.

LS_LINE-INFO = it_h_kna1-telf1.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'Fax Number'.

LS_LINE-INFO = it_h_kna1-telfx.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'Sales Group'.

LS_LINE-INFO = it_vbrp-vkgrp.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

ENDFORM.

and for sorting by company code and for customer number i have written as

FORM IT_SORT.

clear wa_sort.

wa_sort-spos = 1.

wa_sort-fieldname = 'BUKRS'.

wa_sort-up = 'X'.

wa_sort-group = '* '.

  • wa_sort-group = 'UL'.

append wa_sort to it_u_sort.

clear wa_sort.

wa_sort-spos = 2.

wa_sort-fieldname = 'KUNNR'.

wa_sort-up = 'X'.

wa_sort-subtot = 'X'.

wa_sort-group = '* '.

  • wa_sort-group = 'UL'.

append wa_sort to it_u_sort.

clear wa_sort.

ENDFORM. " IT_SORT

my problem is in my header data the data s not getting refreshed for example if am giving customer in the input as 1 and in the company code input as 1000 and 1200 in my report the company code is getting populated only by 1200,plant 1000 is not getting displayed where am i going wrong

in the alv report for displaying the header data i have written my coding as

FORM E04_COMMENT_BUILD USING E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.

DATA: LS_LINE TYPE SLIS_LISTHEADER.

CLEAR LS_LINE.

LS_LINE-TYP = 'S'.

LS_LINE-KEY = 'Payer'.

LS_LINE-INFO = gt_header_table-kunnr.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'Compamy Code'.

LS_LINE-INFO = gt_header_table-bukrs.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'Name'.

LS_LINE-INFO = it_h_kna1-name1.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'City'.

LS_LINE-INFO = it_h_kna1-ort01.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'State'.

LS_LINE-INFO = it_h_kna1-regio.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'Telephone Number'.

LS_LINE-INFO = it_h_kna1-telf1.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'Fax Number'.

LS_LINE-INFO = it_h_kna1-telfx.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

LS_LINE-KEY = 'Sales Group'.

LS_LINE-INFO = it_vbrp-vkgrp.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

ENDFORM.

and for sorting by company code and for customer number i have written as

FORM IT_SORT.

clear wa_sort.

wa_sort-spos = 1.

wa_sort-fieldname = 'BUKRS'.

wa_sort-up = 'X'.

wa_sort-group = '* '.

  • wa_sort-group = 'UL'.

append wa_sort to it_u_sort.

clear wa_sort.

wa_sort-spos = 2.

wa_sort-fieldname = 'KUNNR'.

wa_sort-up = 'X'.

wa_sort-subtot = 'X'.

wa_sort-group = '* '.

  • wa_sort-group = 'UL'.

append wa_sort to it_u_sort.

clear wa_sort.

ENDFORM. " IT_SORT

my problem is in my header data the data s not getting refreshed for example if am giving customer in the input as 1 and in the company code input as 1000 and 1200 in my report the company code is getting populated only by 1200,plant 1000 is not getting displayed where am i going wrong

5 REPLIES 5
Read only

Former Member
0 Likes
545

Refer this for Sorting

Hi,

Dont clear sales order, keep it and in ALV if u use sort by sales order then item u will get as u expect.

  DATA:   wa_sortinfo TYPE slis_sortinfo_alv.
       i_sortcat TYPE slis_t_sortinfo_alv.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program     = report_id
            i_grid_title           = ws_title
*            i_callback_top_of_page = 'TOP-OF-PAGE'
            is_layout              = wa_layout
            it_fieldcat            = i_fieldcat[]
            it_sort                = i_sortcat
            i_save                 = 'A'
            it_events              = i_events
       TABLES
            t_outtab               = i_reportdata1
       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.

  PERFORM sortcat_init CHANGING i_sortcat.

FORM sortcat_init CHANGING i_sortcat TYPE slis_t_sortinfo_alv.

  CLEAR wa_sortinfo.
  wa_sortinfo-fieldname = 'EBELN'. (sales order)
  wa_sortinfo-tabname = 'I_REPORTDATA1'. (specify the output table name)
  wa_sortinfo-spos = 1.            " First sort by this field.
  wa_sortinfo-up = 'X'.            "   Ascending
  wa_sortinfo-subtot = 'X'.        " Subtotal at Name1
  APPEND wa_sortinfo TO i_sortcat.

  CLEAR wa_sortinfo.
  wa_sortinfo-fieldname = 'EBELP'.
  wa_sortinfo-tabname = 'I_REPORTDATA1'.
  wa_sortinfo-spos = 2.            " Sec sort by this field.
  wa_sortinfo-up = 'X'.            "   Ascending
  wa_sortinfo-subtot = 'X'.        " Subtotal at Name1
  APPEND wa_sortinfo TO i_sortcat.

ENDFORM.                    " sortcat_init

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_rephead.htm

Read only

Former Member
0 Likes
545

if u have to 2 entries or 2 values ,in that case u have to concatenate these 2 values.

<b> fheader-typ = 'S'.

fheader-key = 'Date'.

write s_budat-low to w_low.

write s_budat-high to w_high.

concatenate w_low ' - ' w_high into fheader-info.

append fheader.</b>

regards

Prabhu

Read only

0 Likes
545

if suppose i give multiple entries in low range itself

Read only

0 Likes
545

Hi Lakshmi,,

data:begin of it_bukrs occurs 0,

bukrs(4),

end of it_bukrs.

data: v_bukrs(40).

select bukrs from t001 into it_bukrs where bukrs in so_bukrs.

loop at it_bukrs.

concatenate v_bukrs it_bukrs-bukrs into v_bukrs.

endloop.

finally in the header u display the v_bukrs...Please keep in mind that u have limitation on the length which u can display....

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
545

Hi

if u have to 2 entries or 2 values ,in that case u have to concatenate these 2 values.

fheader-typ = 'S'.

fheader-key = 'Date'.

write s_budat-low to w_low.

write s_budat-high to w_high.

concatenate w_low ' - ' w_high into fheader-info.

append fheader.

Once you was used the data please make sure that you have to clear that data.

For example here you have to

clear fheader.

Regards,

kumar