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: 

End of page in ALV Grid Report

Former Member
0 Kudos

Dear ABAPres,

I have developed ALV report using the Function module 'REUSE_ALV_GRID_DISPLAY'.

I want to display the End of Page.How can i achiev this.Please help me in this.

Thanks & Regards,

ashok.

1 ACCEPTED SOLUTION

I355602
Advisor
Advisor
0 Kudos

Hi Ashok,

Try using 'END_OF_LIST' event.

Use this code, its working:-


*TO CAPTURE EVENTS AND HANDLE
DATA : it_event TYPE slis_t_event,
       wa_event TYPE slis_alv_event.

*&---------------------------------------------------------------------*
*          POPULATE ALL EVENTS INTO INTERNAL TABLE
*&---------------------------------------------------------------------*
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type     = 0
    IMPORTING
      et_events       = it_event
    EXCEPTIONS
      list_type_wrong = 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.

  READ TABLE it_event INTO wa_event WITH KEY name = 'END_OF_LIST'.
  wa_event-form = 'END'. "sub-routine that will be used to write
  MODIFY it_event FROM wa_event INDEX sy-tabix. "modify it_events
  CLEAR wa_event.

*&---------------------------------------------------------------------*
*          POPULATE ALV GRID WITH DATA
*&---------------------------------------------------------------------*
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program                = sy-repid "report id
      it_fieldcat                       = it_field "field catalog internal table
      it_sort                           = it_sort "sort by field internal table
      it_events                         = it_event "internal table containing events
    TABLES
      t_outtab                          = itab "internal table containing data to be displayed
    EXCEPTIONS
      program_error                     = 1
      OTHERS                            = 2.

*&---------------------------------------------------------------------*
*&      Form  end
*&---------------------------------------------------------------------*
*       TO WRITE THE FOOTER
*----------------------------------------------------------------------*
FORM end.

  REFRESH it_end.
  wa_end-typ = 'S'.
  wa_end-key = text-001.
  wa_end-info = rep_id.
  APPEND wa_end TO it_end.
  CLEAR wa_end.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary       = it_end
*   I_LOGO                   =
*   I_END_OF_LIST_GRID       =
*   I_ALV_FORM               =
            .

ENDFORM.                    "end

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

13 REPLIES 13

Former Member
0 Kudos

Try with this

Fill event internal table with

i_event-name = 'end_of_page'

i_event-form = 'end_of_page'

append i_event.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

<all others are as usual >

IT_events = I_event

Create one subroutine with end_of_page and write your codings

Regards

Sasi

Former Member
0 Kudos

Hi,

Use in the FM 'RESUE_ALV_GRID_DISPLAY' in that we have end_of_page event . Declare it in in that FM.

otherwise u can define that event in "REUSE_ALV_GET_EVENTS".

cHEERS,

pRAVIN

Former Member
0 Kudos

Hi Ashok,

You can populate the EVENT table with END-OF-PAGE event.

And in the sub-routine for End-of-page, you can use REUSE_ALV_COMMENTARY_WRITE function module to display the detials,

Best Regards,

Ram.

Edited by: ram Kumar on Dec 30, 2008 7:33 PM

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Ashok,

In ALV Grid, you DO NOT have END_OF_PAGE event. Because the grid considers the entire display area as a screen container.

You can use the 'END_OF_LIST' event if it helps you or switch to ALV List.

BR,

Suhas

Former Member
0 Kudos

Hi,

How to use the End of list in the Funation module REUSE_ALV_GRID_DISPLAY.

Can you please guide me in this.

Thanks & Regards,

Ashok.

Former Member
0 Kudos

Whatever may be, end of page or end of list are considered as a events, so you can try with the same way

Regards

Sasi

former_member203501
Active Contributor
0 Kudos

hi do like this ...

data: it_events type slis_alv_event occurs 0 with header line.

it_events-form = 'END_OF_PAGE'.

it_events-name = 'END_OF_PAGE'.

append it_events.

former_member209914
Participant
0 Kudos

Hi ,

See below code....

REPORT zcssd_sales_hours_pend2.

TYPE-POOLS : slis.

*****Tables Used in the Report************************

TABLES : vbak,

tvak,

tvlk,

likp,

vbep,

t001w,

kna1.

*****Global Data Declarations*************************

DATA: i_fieldcat TYPE slis_t_fieldcat_alv ,

wa_fieldcat TYPE slis_fieldcat_alv.

DATA: tbl_fieldcat1 TYPE slis_t_fieldcat_alv ,

st_fieldcat1 TYPE slis_fieldcat_alv.

DATA: w_layout TYPE slis_layout_alv.

DATA: st_layout1 TYPE slis_layout_alv,

v_header TYPE slis_t_listheader,

v_header1 TYPE slis_t_listheader,

v_header2 TYPE slis_t_listheader,

v_events TYPE slis_t_event.

DATA: gt_sort TYPE slis_t_sortinfo_alv.

DATA: i_events TYPE slis_t_event,

i_event_exit TYPE slis_t_event_exit.

DATA: w_events LIKE LINE OF i_events,

w_event_exit LIKE LINE OF i_event_exit.

DATA: i_list_comments TYPE slis_t_listheader.

DATA: w_list_comments LIKE LINE OF i_list_comments.

DATA: w_print TYPE slis_print_alv.

DATA: gs_sort TYPE slis_sortinfo_alv.

*DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

*****Declaration of Internal Tables****************

TYPES : BEGIN OF ty_vbap_vbak,

vbeln TYPE vbap-vbeln,

posnr TYPE vbap-posnr,

matnr TYPE vbap-matnr,

matkl TYPE vbap-matkl,

zmeng TYPE vbap-zmeng,

meins TYPE vbap-meins,

spart TYPE vbap-spart,

netwr TYPE vbap-netwr,

kwmeng TYPE vbap-kwmeng,

werks TYPE vbap-werks,

route TYPE vbap-route,

netpr TYPE vbap-netpr,

kpein TYPE vbap-kpein,

kmein TYPE vbap-kmein,

auart TYPE vbak-auart,

lifsk TYPE vbak-lifsk,

netwr1 TYPE vbak-netwr,

vkorg TYPE vbak-vkorg,

vtweg TYPE vbak-vtweg,

spart1 TYPE vbak-spart,

vdatu TYPE vbak-vdatu,

kunnr TYPE vbak-kunnr,

END OF ty_vbap_vbak.

DATA : i_vbap_vbak1 TYPE STANDARD TABLE OF ty_vbap_vbak.

DATA : w_vbap_vbak1 LIKE LINE OF i_vbap_vbak1.

DATA : i_vbap_vbak2 TYPE STANDARD TABLE OF ty_vbap_vbak.

DATA : w_vbap_vbak2 LIKE LINE OF i_vbap_vbak2.

TYPES : BEGIN OF ty_knvv,

kunnr TYPE knvv-kunnr,

vkorg TYPE knvv-vkorg,

vtweg TYPE knvv-vtweg,

spart TYPE knvv-spart,

bzirk TYPE knvv-bzirk,

name1 TYPE kna1-name1,

END OF ty_knvv.

DATA : i_knvv1 TYPE STANDARD TABLE OF ty_knvv.

DATA : w_knvv1 LIKE LINE OF i_knvv1.

DATA : i_knvv2 TYPE STANDARD TABLE OF ty_knvv.

DATA : w_knvv2 LIKE LINE OF i_knvv2.

TYPES : BEGIN OF ty_likp,

vbeln TYPE likp-vbeln,

lfart TYPE likp-lfart,

lddat TYPE likp-lddat,

vbtyp TYPE likp-vbtyp,

kunnr TYPE likp-kunnr,

anzpk TYPE likp-anzpk,

netwr TYPE likp-netwr,

werks TYPE likp-werks.

TYPES : END OF ty_likp.

DATA : i_likp TYPE STANDARD TABLE OF ty_likp.

DATA : w_likp LIKE LINE OF i_likp.

DATA : i_t171t TYPE STANDARD TABLE OF t171t.

DATA : w_t171t LIKE LINE OF i_t171t.

TYPES : BEGIN OF ty_lips,

vbeln TYPE lips-vbeln,

posnr TYPE lips-posnr,

matnr TYPE lips-matnr,

matkl TYPE lips-matkl,

werks TYPE lips-werks,

lfimg TYPE lips-lfimg,

netwr TYPE lips-netwr.

TYPES : END OF ty_lips.

DATA : i_lips TYPE STANDARD TABLE OF ty_lips.

DATA : w_lips LIKE LINE OF i_lips.

TYPES : BEGIN OF ty_likp_lips,

vbeln TYPE likp-vbeln,

vkorg TYPE likp-vkorg,

lfart TYPE likp-lfart,

lddat TYPE likp-lddat,

vbtyp TYPE likp-vbtyp,

kunnr TYPE likp-kunnr,

anzpk TYPE likp-anzpk,

netwr TYPE likp-netwr,

werks TYPE likp-werks,

posnr TYPE lips-posnr,

matnr TYPE lips-matnr,

matkl TYPE lips-matkl,

lipswerks TYPE lips-werks,

lfimg TYPE lips-lfimg,

vrkme TYPE lips-vrkme,

vgbel TYPE lips-vgbel,

vtweg TYPE lips-vtweg,

spart TYPE lips-spart,

lipsnetwr TYPE lips-netwr.

TYPES : END OF ty_likp_lips.

DATA : i_likp_lips TYPE STANDARD TABLE OF ty_likp_lips.

DATA : w_likp_lips LIKE LINE OF i_likp_lips.

DATA : i_likp_lips1 TYPE STANDARD TABLE OF ty_likp_lips.

DATA : w_likp_lips1 LIKE LINE OF i_likp_lips1.

TYPES : BEGIN OF ty_vbup,

vbeln TYPE vbup-vbeln,

posnr TYPE vbup-posnr,

lfsta TYPE vbup-lfsta,

wbsta TYPE vbup-wbsta,

END OF ty_vbup.

TYPES : BEGIN OF ty_vbup1,

vbeln TYPE vbup-vbeln,

posnr TYPE vbup-posnr,

lfgsa TYPE vbup-lfgsa,

wbsta TYPE vbup-wbsta,

END OF ty_vbup1.

DATA : i_vbup TYPE STANDARD TABLE OF ty_vbup.

DATA : w_vbup LIKE LINE OF i_vbup.

DATA : i_vbup1 TYPE STANDARD TABLE OF ty_vbup1.

DATA : w_vbup1 LIKE LINE OF i_vbup1.

TYPES : BEGIN OF ty_output,

vbeln TYPE likp-vbeln,

vkorg TYPE likp-vkorg,

lfart TYPE likp-lfart,

lddat TYPE likp-lddat,

vbtyp TYPE likp-vbtyp,

kunnr TYPE likp-kunnr,

anzpk TYPE likp-anzpk,

netwr TYPE likp-netwr,

werks TYPE likp-werks,

posnr TYPE lips-posnr,

matnr TYPE lips-matnr,

matkl TYPE lips-matkl,

lipswerks TYPE lips-werks,

lfimg TYPE lips-lfimg,

vrkme TYPE lips-vrkme,

vgbel TYPE lips-vgbel,

vtweg TYPE lips-vtweg,

spart TYPE lips-spart,

lipsnetwr TYPE lips-netwr,

lfsta TYPE vbup-lfsta,

wbsta TYPE vbup-wbsta,

END OF ty_output.

DATA : i_output TYPE STANDARD TABLE OF ty_output.

DATA : w_output LIKE LINE OF i_output.

DATA : i_output1 TYPE STANDARD TABLE OF ty_output.

DATA : w_output1 LIKE LINE OF i_output1.

TYPES : BEGIN OF ty_vbfa,

vbelv TYPE vbfa-vbelv,

posnv TYPE vbfa-posnv,

vbeln TYPE vbfa-vbeln,

posnn TYPE vbfa-posnn,

vbtyp_n TYPE vbfa-vbtyp_n,

rfmng TYPE vbfa-rfmng,

  • RFWRT TYPE VBFA-RFWRT,

vbtyp_v TYPE vbfa-vbtyp_v,

END OF ty_vbfa.

DATA : i_vbfa TYPE STANDARD TABLE OF ty_vbfa.

DATA : w_vbfa LIKE LINE OF i_vbfa.

TYPES : BEGIN OF ty_vbfa1,

vbelv TYPE vbfa-vbelv,

posnv TYPE vbfa-posnv,

vbeln TYPE vbfa-vbeln,

posnn TYPE vbfa-posnn,

rfmng TYPE vbfa-rfmng,

rfwrt TYPE vbfa-rfwrt,

END OF ty_vbfa1.

DATA : i_vbfa1 TYPE STANDARD TABLE OF ty_vbfa1.

DATA : w_vbfa1 LIKE LINE OF i_vbfa1.

TYPES: BEGIN OF ty_vbrk_vbrp,

vbeln TYPE vbrk-vbeln,

fkart TYPE vbrk-fkart,

fktyp TYPE vbrk-fktyp,

vbtyp TYPE vbrk-vbtyp,

waerk TYPE vbrk-waerk,

netwr TYPE vbrk-netwr,

posnr TYPE vbrp-posnr,

fkimg TYPE vbrp-fkimg,

vrkme TYPE vbrp-vrkme,

umvkz TYPE vbrp-umvkz,

umvkn TYPE vbrp-umvkn,

netwr1 TYPE vbrp-netwr,

END OF ty_vbrk_vbrp.

DATA : i_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.

DATA : w_vbrk_vbrp LIKE LINE OF i_vbrk_vbrp.

TYPES : BEGIN OF ty_vbep,

vbeln TYPE vbep-vbeln,

posnr TYPE vbep-posnr,

wmeng TYPE vbep-wmeng,

lddat TYPE vbep-lddat,

END OF ty_vbep.

DATA : i_vbep TYPE STANDARD TABLE OF ty_vbep.

DATA : w_vbep LIKE LINE OF i_vbep.

TYPES : BEGIN OF ty_vbep_vbup,

vbeln TYPE vbep-vbeln,

posnr TYPE vbep-posnr,

wmeng TYPE vbep-wmeng,

lddat TYPE vbep-lddat,

lfgsa TYPE vbup-lfgsa,

wbsta TYPE vbup-wbsta,

END OF ty_vbep_vbup.

DATA : i_vbep_vbup TYPE STANDARD TABLE OF ty_vbep_vbup.

DATA : w_vbep_vbup LIKE LINE OF i_vbep_vbup.

TYPES : BEGIN OF ty_makt,

matnr TYPE mara-matnr,

maktx TYPE makt-maktx,

END OF ty_makt.

DATA : i_makt TYPE STANDARD TABLE OF ty_makt.

DATA : w_makt LIKE LINE OF i_makt.

TYPES : BEGIN OF ty_final,

lddat TYPE likp-lddat,

werks TYPE vbap-werks,

bzirk TYPE knvv-bzirk,

bztxt TYPE t171t-bztxt,

kunnr TYPE vbak-kunnr,

name1 TYPE kna1-name1,

vbeln TYPE likp-vbeln,

wbsta TYPE vbup-wbsta,

text(25) TYPE c,

lfgsa TYPE vbup-lfgsa,

kwmeng TYPE vbap-kwmeng,

netwr TYPE likp-netwr,

order TYPE vbak-vbeln,

posnr TYPE vbap-posnr,

matnr TYPE mara-matnr,

netwr1 TYPE vbak-netwr,

kwmeng1 TYPE vbap-kwmeng,

kwmeng2 TYPE vbap-kwmeng,

route TYPE vbap-route,

lifsk TYPE vbak-lifsk,

vdatu TYPE vbak-vdatu,

END OF ty_final.

DATA : i_final TYPE STANDARD TABLE OF ty_final.

DATA : w_final LIKE LINE OF i_final.

DATA : i_final1 TYPE STANDARD TABLE OF ty_final.

DATA : w_final1 LIKE LINE OF i_final1.

TYPES : BEGIN OF ty_final2,

lddat TYPE likp-lddat,

werks TYPE vbap-werks,

bzirk TYPE knvv-bzirk,

bztxt TYPE t171t-bztxt,

kunnr TYPE vbak-kunnr,

name1 TYPE kna1-name1,

vbeln TYPE likp-vbeln,

wbsta TYPE vbup-wbsta,

text(25) TYPE c,

lfgsa TYPE vbup-lfgsa,

kwmeng TYPE vbap-kwmeng,

netwr TYPE likp-netwr,

order TYPE vbak-vbeln,

posnr TYPE vbap-posnr,

matnr TYPE mara-matnr,

netwr1 TYPE vbak-netwr,

kwmeng1 TYPE vbap-kwmeng,

kwmeng2 TYPE vbap-kwmeng,

vdatu TYPE vbak-vdatu,

maktx TYPE makt-maktx,

END OF ty_final2.

DATA : i_final2 TYPE STANDARD TABLE OF ty_final2.

DATA : w_final2 LIKE LINE OF i_final2.

DATA : i_conwa TYPE STANDARD TABLE OF vbco6 WITH HEADER LINE.

DATA : i_vbfa_tab TYPE STANDARD TABLE OF vbfa WITH HEADER LINE.

DATA : opt TYPE ctu_params.

DATA : v_vbeln TYPE vbak-vbeln.

DATA : w_vbeln TYPE vbak-vbeln.

DATA : v_repid TYPE sy-repid.

DATA : v_netwr TYPE vbak-netwr.

DATA : v_kwmeng TYPE vbap-kwmeng.

DATA : v_netwr1 TYPE vbak-netwr.

DATA : v_kwmeng1 TYPE vbap-kwmeng.

DATA : v_time(60) TYPE c.

DATA : v_plant(60) TYPE c.

DATA : v_date(60) TYPE c.

DATA : v_lfart(60) TYPE c.

DATA : v_auart(60) TYPE c.

DATA : v_mod(2) TYPE c.

DATA : name(10).

DATA : v_indexes TYPE sy-index.

DATA : v_text(40) TYPE c.

DATA : v_total TYPE p DECIMALS 2.

DATA : v_total1(60) TYPE c.

DATA : v_totqt TYPE p DECIMALS 2.

****Constants Declaration********************************

CONSTANTS : c_wbstaa TYPE vbup-wbsta VALUE 'A',

c_wbstab TYPE vbup-wbsta VALUE 'B',

c_wbstac TYPE vbup-wbsta VALUE 'C',

c_lfartlf TYPE likp-lfart VALUE 'LF',

c_lfartlr TYPE likp-lfart VALUE 'LR',

c_lfartlo TYPE likp-lfart VALUE 'LO',

c_lfartzlo TYPE likp-lfart VALUE 'ZLO',

c_lfgsaa TYPE vbup-lfgsa VALUE 'A',

c_lfgsab TYPE vbup-lfgsa VALUE 'B',

c_vbtyp_nj TYPE vbfa-vbtyp_n VALUE 'J',

c_vbtyp_nt TYPE vbfa-vbtyp_n VALUE 'T',

c_vbtyp_nm TYPE vbfa-vbtyp_n VALUE 'M',

c_vbtyp_vh TYPE vbfa-vbtyp_v VALUE 'H',

c_1100 TYPE t001w-werks VALUE '1100',

c_1101 TYPE t001w-werks VALUE '1101'.

****Selection Screen Declaration*************************

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE title.

SELECT-OPTIONS : s_werks FOR t001w-werks OBLIGATORY.

SELECT-OPTIONS : s_lddat FOR likp-lddat.

SELECT-OPTIONS : s_auat FOR vbak-auart DEFAULT 'OR'.

SELECT-OPTIONS : s_lfat FOR likp-lfart DEFAULT 'LF'.

SELECT-OPTIONS : s_vbeln FOR vbep-vbeln NO-DISPLAY.

SELECT-OPTIONS : s_posnr FOR vbep-posnr NO-DISPLAY.

SELECTION-SCREEN : END OF BLOCK b1.

****Initialization***************************************

INITIALIZATION.

v_repid = sy-repid.

title = 'Selection Screen Options'.

s_werks-sign = 'I'.

s_werks-option = 'EQ'.

s_werks-low = c_1100.

s_werks-high = c_1101.

APPEND s_werks.

CALL FUNCTION 'OIUREP_MONTH_FIRST_LAST'

EXPORTING

i_date = sy-datum

IMPORTING

e_first_day = s_lddat-low

e_last_day = s_lddat-high.

s_lddat-sign = 'I'.

s_lddat-option = 'EQ'.

APPEND s_lddat TO s_lddat.

****At selection screen on field*************************

AT SELECTION-SCREEN ON s_werks.

SELECT SINGLE * FROM t001w WHERE werks IN s_werks.

IF sy-subrc <> 0.

MESSAGE 'Please enter correct Plant' TYPE 'E'.

ENDIF.

AT SELECTION-SCREEN ON s_lddat.

AT SELECTION-SCREEN ON s_auat.

SELECT SINGLE * FROM tvak WHERE auart IN s_auat.

IF sy-subrc <> 0.

MESSAGE 'Please enter correct Sales Doc Type' TYPE 'E'.

ENDIF.

AT SELECTION-SCREEN ON s_lfat.

SELECT SINGLE * FROM tvlk WHERE lfart IN s_lfat.

IF sy-subrc <> 0.

MESSAGE 'Please enter correct Delv Doc Type' TYPE 'E'.

ENDIF.

****Start selection of data from tables based on cond****

  • PERFORM SALESORDER_HEADER_ITEM.

  • PERFORM CUSTOMER_SALESDATA.

START-OF-SELECTION.

PERFORM delivery_header_item.

PERFORM salesdocument_itemstatus.

PERFORM salesdocument_schedulelinedata.

PERFORM salesdocument_itemstatus_lfgsa.

PERFORM sales_district.

PERFORM delivery_salesdocument_wbsta.

PERFORM salesdocumentflow.

PERFORM billingdoc_header_item.

PERFORM salesorder_header_item2.

PERFORM customer_salesdata1.

PERFORM delivery_output.

PERFORM salesdoc_shdlnitem_itemstatus.

PERFORM salesorder_header_item1.

PERFORM customer_salesdata2.

PERFORM salesorder_output.

PERFORM material_descriptions.

PERFORM final_output.

END-OF-SELECTION.

****Fieldcatalog Routine for ALVGRID******************

PERFORM fieldcatalog.

****Event Routine for ALVGRID*************************

PERFORM build_header CHANGING v_header v_header1.

PERFORM build_events CHANGING v_events.

PERFORM print_build.

****Layout Routine for ALVGRID************************

PERFORM layout_build.

****Grid_display Routine for ALVGRID******************

PERFORM grid_display.

&----


*& Form fieldcatalog

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fieldcatalog .

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'LDDAT'.

wa_fieldcat-seltext_m = 'Loading Dt'.

wa_fieldcat-key = ' '. "SUBTOTAL KEY

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'WERKS'.

wa_fieldcat-seltext_m = 'Plant'.

wa_fieldcat-key = ' '. "SUBTOTAL KEY

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'BZIRK'.

wa_fieldcat-seltext_m = 'Sales Dist'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'BZTXT'.

wa_fieldcat-seltext_m = 'Name of Dist'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'KUNNR'.

wa_fieldcat-seltext_m = 'Customer No.'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'NAME1'.

wa_fieldcat-seltext_m = 'Customer Name'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'VBELN'.

wa_fieldcat-seltext_m = 'Delivery No.'.

wa_fieldcat-key = ' '. "SUBTOTAL KEY

wa_fieldcat-hotspot = 'X'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'WBSTA'.

wa_fieldcat-seltext_m = 'Delv Status'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'TEXT'.

wa_fieldcat-seltext_m = 'Status Desc'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'KWMENG'.

wa_fieldcat-seltext_m = 'Delivery Qty'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'NETWR'.

wa_fieldcat-seltext_m = 'Delv Net Value'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'ORDER'.

wa_fieldcat-seltext_m = 'Sales Order'.

wa_fieldcat-hotspot = 'X'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'KWMENG1'.

wa_fieldcat-seltext_m = 'Order Qty'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'NETWR1'.

wa_fieldcat-seltext_m = 'Sales Net Value'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'LIFSK'.

wa_fieldcat-seltext_m = 'Delv Block'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'ROUTE'.

wa_fieldcat-seltext_m = 'Route'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'I_FINAL1'.

wa_fieldcat-fieldname = 'VDATU'.

wa_fieldcat-seltext_m = 'Req Delivery Dt'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

CLEAR gs_sort.

gs_sort-fieldname = 'LDDAT'.

gs_sort-spos = 1.

gs_sort-up = 'X'.

gs_sort-subtot = 'X'.

APPEND gs_sort TO gt_sort.

ENDFORM. " fieldcatalog

&----


*& Form print_build

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM print_build .

w_print-no_print_listinfos = 'X'.

ENDFORM. " print_build

&----


*& Form layout_build

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM layout_build .

w_layout-zebra = 'X'.

w_layout-no_vline = ''.

w_layout-colwidth_optimize = 'X'.

w_layout-detail_popup = 'X'.

w_layout-detail_initial_lines = 'X'.

w_layout-detail_titlebar = 'Detail Title Bar'.

ENDFORM. " layout_build

&----


*& Form GRID_DISPLAY

&----


  • text

----


FORM grid_display.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

i_callback_user_command = 'PROCESS_USER_COMMANDS'

is_layout = w_layout

it_fieldcat = i_fieldcat[]

it_sort = gt_sort[]

i_default = 'X'

i_save = 'A'

it_events = v_events

is_print = w_print

TABLES

t_outtab = i_final1

EXCEPTIONS

program_error = 1

OTHERS = 2.

ENDFORM. "GRID_DISPLAY

&----


*& Form END_OF_LIST

&----


FORM top_of_list.

ENDFORM. "TOP_OF_LIST

&----


*& Form PROCESS_USER_COMMANDS

&----


  • text

----


  • -->SYST-UCOMM text

  • -->SELFIELD text

----


FORM process_user_commands USING syst-ucomm LIKE syst-ucomm

selfield TYPE slis_selfield.

CASE syst-ucomm.

WHEN '&IC1'.

IF selfield-sel_tab_field = 'I_FINAL1-VBELN'.

w_vbeln = selfield-value.

SET PARAMETER ID: 'VL' FIELD w_vbeln.

CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.

ELSEIF selfield-sel_tab_field = 'I_FINAL1-ORDER'.

v_vbeln = selfield-value.

SET PARAMETER ID: 'AUN' FIELD v_vbeln.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

ELSE.

READ TABLE i_final1 INTO w_final1 INDEX selfield-tabindex.

IF w_final1-vbeln <> ' '.

LOOP AT i_final INTO w_final WHERE vbeln = w_final1-vbeln.

READ TABLE i_makt INTO w_makt WITH KEY matnr = w_final-matnr .

IF sy-subrc = 0.

MOVE : w_final TO w_final2.

MOVE : w_makt-maktx TO w_final2-maktx.

APPEND w_final2 TO i_final2.

ELSE.

MOVE : w_final TO w_final2.

MOVE : ' ' TO w_final2-maktx.

APPEND w_final2 TO i_final2.

ENDIF.

ENDLOOP.

CLEAR w_makt.

ELSE.

LOOP AT i_final INTO w_final WHERE order = w_final1-order.

READ TABLE i_makt INTO w_makt WITH KEY matnr = w_final-matnr .

IF sy-subrc = 0.

MOVE : w_final TO w_final2.

MOVE : w_makt-maktx TO w_final2-maktx.

APPEND w_final2 TO i_final2.

ELSE.

MOVE : w_final TO w_final2.

MOVE : ' ' TO w_final2-maktx.

APPEND w_final2 TO i_final2.

ENDIF.

ENDLOOP.

CLEAR w_makt.

ENDIF.

PERFORM fieldcatalog1 USING selfield .

PERFORM event_build.

PERFORM layout_build1.

PERFORM grid_display1.

ENDIF.

ENDCASE.

ENDFORM. " PROCESS_USER_COMMANDS

&----


*& Form fieldcatalog1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fieldcatalog1 USING r_selfield TYPE slis_selfield.

REFRESH tbl_fieldcat1.

READ TABLE i_final1 INTO w_final1 INDEX r_selfield-tabindex.

IF w_final1-vbeln <> ' '.

PERFORM write_fieldcat1 USING 'POSNR' 'I_FINAL2' 'Item Number' ' ' 2 ' ' ' '

' '.

PERFORM write_fieldcat1 USING 'MATNR' 'I_FINAL2' 'Material Number' ' ' 3 ' ' ' '

' '.

PERFORM write_fieldcat1 USING 'MAKTX' 'I_FINAL2' 'Material Description' ' ' 4 ' ' ' '

' '.

PERFORM write_fieldcat1 USING 'KWMENG' 'I_FINAL2' 'Delivery Qty' ' ' 7 ' ' ' '

' '.

PERFORM write_fieldcat1 USING 'NETWR' 'I_FINAL2' 'Delv Net Value' ' ' 8 ' ' ' '

' '.

ELSE.

PERFORM write_fieldcat1 USING 'POSNR' 'I_FINAL2' 'Item Number' ' ' 2 ' ' ' '

' '.

PERFORM write_fieldcat1 USING 'MATNR' 'I_FINAL2' 'Material Number' ' ' 3 ' ' ' '

' '.

PERFORM write_fieldcat1 USING 'MAKTX' 'I_FINAL2' 'Material Description' ' ' 4 ' ' ' '

' '.

PERFORM write_fieldcat1 USING 'KWMENG2' 'I_FINAL2' 'Sales Order Qty' ' ' 9 ' ' ' '

' '.

PERFORM write_fieldcat1 USING 'NETWR1' 'I_FINAL2' 'Net Value' ' ' 10 ' ' ' '

' '.

ENDIF.

ENDFORM. " fieldcatalog1

&----


*& Form write_fieldcat1

&----


  • text

----


  • -->NAME text

  • -->TAB text

  • -->ST text

  • -->KEY text

  • -->POS text

  • -->LENGTH text

  • -->ICON text

  • -->HOT text

----


FORM write_fieldcat1 USING name tab st key pos length icon hot.

st_fieldcat1-fieldname = name.

st_fieldcat1-tabname = tab.

st_fieldcat1-seltext_m = st.

st_fieldcat1-key = key.

st_fieldcat1-col_pos = pos.

st_fieldcat1-outputlen = length.

st_fieldcat1-icon = icon.

st_fieldcat1-do_sum = hot.

APPEND st_fieldcat1 TO tbl_fieldcat1.

CLEAR st_fieldcat1.

ENDFORM. " WRITE_FIELDCAT

&----


*& Form GRID_DISPLAY1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM grid_display1 .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

it_fieldcat = tbl_fieldcat1

is_layout = st_layout1

it_events = i_events[]

TABLES

t_outtab = i_final2

EXCEPTIONS

program_error = 1

OTHERS = 2.

REFRESH i_final2.

ENDFORM. " GRID_DISPLAY1

&----


*& Form LAYOUT_BUILD1

&----


  • text

----


FORM layout_build1 .

st_layout1-zebra = 'X'.

st_layout1-no_vline = ''.

st_layout1-colwidth_optimize = 'X'.

st_layout1-detail_popup = 'X'.

st_layout1-detail_initial_lines = 'X'.

st_layout1-detail_titlebar = 'Detail Title Bar'.

ENDFORM. " layout_build

&----


*& Form salesdocument_itemstatus

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM salesdocument_itemstatus .

CLEAR i_vbup.

REFRESH i_vbup.

v_indexes = 10.

v_text = 'Processing... Sales Doc Item'.

PERFORM progress_ind.

IF NOT i_likp_lips[] IS INITIAL.

SELECT vbeln

posnr

lfsta

wbsta

FROM vbup INTO TABLE i_vbup

FOR ALL ENTRIES IN i_likp_lips

WHERE vbeln = i_likp_lips-vbeln

AND posnr = i_likp_lips-posnr

AND wbsta IN (c_wbstaa, c_wbstab, c_wbstac).

ENDIF.

SORT i_vbup BY vbeln posnr.

ENDFORM. " salesdocument_itemstatus

&----


*& Form delivery_header_item

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM delivery_header_item .

CLEAR i_likp_lips.

REFRESH i_likp_lips.

v_indexes = 1.

v_text = 'Processing.. Delivery'.

PERFORM progress_ind.

  • selected data from delivery header and delivery iten based on loading date and plant

  • based on document types LF LR LO ZLO.

SELECT a~vbeln

a~vkorg

a~lfart

a~lddat

a~vbtyp

a~kunnr

a~anzpk

a~netwr

a~werks

b~posnr

b~matnr

b~matkl

b~werks

b~lfimg

b~vrkme

b~vgbel

b~vtweg

b~spart

b~netwr

INTO TABLE i_likp_lips

FROM likp AS a INNER JOIN lips AS b

ON avbeln = bvbeln

WHERE a~lfart IN s_lfat

AND a~lddat IN s_lddat

AND b~werks IN s_werks.

  • %_HINTS ORACLE 'index("Z05" "Z05LFART" "Z05LDDAT")'.

  • DELETE i_likp_lips WHERE lfart NOT IN s_lfat

  • OR lddat NOT IN s_lddat

  • OR lipswerks NOT IN s_werks.

SORT i_likp_lips BY vbeln posnr.

ENDFORM. " delivery_header_item

&----


*& Form SalesDocument_ScheduleLineData

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM salesdocument_schedulelinedata .

CLEAR i_vbep.

REFRESH i_vbep.

v_indexes = 15.

v_text = 'Processing.. Sales Doc Sch Line Data'.

PERFORM progress_ind.

*SELECTED from table vbep based on loading date, this selection will fetch all

*the open sales orders.

SELECT vbeln

posnr

wmeng

lddat

FROM vbep

INTO TABLE i_vbep

WHERE vbeln in s_vbeln

and posnr in s_posnr

and lddat IN s_lddat.

  • DELETE I_VBEP WHERE LDDAT NOT IN S_LDDAT.

SORT i_vbep BY vbeln posnr.

ENDFORM. " SalesDocument_ScheduleLineData

&----


*& Form salesdocument_itemstatus_lfgsa

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM salesdocument_itemstatus_lfgsa .

CLEAR i_vbup1.

REFRESH i_vbup1.

v_indexes = 20.

v_text = 'Processing... Sales Doc Item'.

PERFORM progress_ind.

  • selected from vbup for all entries of vbep based on respective salesorder and item number

  • and lfgsa status equals to A AND B.

IF NOT i_vbep[] IS INITIAL.

SELECT vbeln posnr lfgsa wbsta FROM vbup INTO TABLE i_vbup1 FOR ALL ENTRIES IN i_vbep

WHERE vbeln = i_vbep-vbeln

AND posnr = i_vbep-posnr

AND LFGSA IN (C_LFGSAA, C_LFGSAB).

  • %_HINTS ORACLE 'index("ZS1" "ZS1~LFGSA")'.

ENDIF.

  • DELETE i_vbup1 WHERE lfgsa <> c_lfgsaa AND lfgsa <> c_lfgsab.

SORT i_vbup1 BY vbeln posnr.

ENDFORM. " salesdocument_itemstatus_lfgsa

&----


*& Form billingdoc_header_item

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM billingdoc_header_item .

CLEAR i_vbrk_vbrp.

REFRESH i_vbrk_vbrp.

v_indexes = 40.

v_text = 'Processing... Billing'.

PERFORM progress_ind.

*SELECTED INVOICE DETAILS FROM VBRK AND VBRP .

  • IF NOT I_VBFA1[] IS INITIAL.

  • SELECT AVBELN AFKART AFKTYP AVBTYP AWAERK ANETWR

  • BPOSNR BFKIMG BVRKME BUMVKZ BUMVKN BNETWR

  • INTO TABLE I_VBRK_VBRP FROM VBRK AS A INNER

  • JOIN VBRP AS B ON AVBELN = BVBELN FOR ALL ENTRIES IN I_VBFA1

  • WHERE A~VBELN = I_VBFA1-VBELN AND

  • B~POSNR = I_VBFA1-POSNN.

*

  • ENDIF.

  • SORT I_VBRK_VBRP BY VBELN POSNR VRKME.

ENDFORM. " billingdoc_header_item

&----


*& Form sales_district

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM sales_district .

CLEAR i_t171t.

REFRESH i_t171t.

v_indexes = 22.

v_text = 'Processing... Sales District'.

PERFORM progress_ind.

*TO SELECT THE SALES DISTRICT FROM I171T.

SELECT * FROM t171t INTO TABLE i_t171t WHERE spras = 'EN'.

ENDFORM. " sales_district

&----


*& Form Material_Descriptions

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM material_descriptions .

DATA : i_fin TYPE STANDARD TABLE OF ty_final WITH HEADER LINE.

CLEAR i_makt.

REFRESH i_makt.

PERFORM progress_ind.

i_fin[] = i_final[].

SORT i_fin BY matnr.

DELETE ADJACENT DUPLICATES FROM i_fin COMPARING matnr.

  • THIS STATEMENT IS USED TO SELECT MATERIAL DESCRIPTIONS BASED ON THE MATERIAL NUMBERS

  • PRESENT IN THE FINAL INTERNAL TABLE.

IF NOT i_fin[] IS INITIAL.

SELECT matnr maktx FROM makt INTO TABLE i_makt FOR ALL ENTRIES IN i_fin WHERE spras = 'EN'

AND matnr = i_fin-matnr.

ENDIF.

SORT i_makt BY matnr.

ENDFORM. " Material_Descriptions

&----


*& Form delivery_salesdocument_wbsta

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


  • This routine will helps us to combine delivery data and sales document item status

FORM delivery_salesdocument_wbsta .

CLEAR i_output.

REFRESH i_output.

v_indexes = 30.

v_text = 'Processing... Open Delivery'.

PERFORM progress_ind.

LOOP AT i_likp_lips INTO w_likp_lips.

READ TABLE i_vbup INTO w_vbup WITH KEY vbeln = w_likp_lips-vbeln

posnr = w_likp_lips-posnr BINARY SEARCH.

IF sy-subrc = 0.

MOVE-CORRESPONDING w_likp_lips TO w_output.

MOVE : w_vbup-lfsta TO w_output-lfsta.

MOVE : w_vbup-wbsta TO w_output-wbsta.

APPEND w_output TO i_output.

ENDIF.

ENDLOOP.

SORT i_output BY vbeln posnr.

ENDFORM. " delivery_salesdocument_wbsta

&----


*& Form salesdocumentflow

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM salesdocumentflow .

CLEAR i_vbfa.

REFRESH i_vbfa.

CLEAR i_vbfa1.

REFRESH i_vbfa1.

v_indexes = 35.

v_text = 'Processing... Sales Doc Flow'.

PERFORM progress_ind.

  • THIS STATEMENT IS USED TO SELECT THE ORDER NUMBERS BASED ON DELIVERY NUMBERS

  • FROM SALES DOCUMENT FLOW TABLE.

  • IF NOT I_OUTPUT[] IS INITIAL.

  • SELECT VBELV POSNV VBELN POSNN VBTYP_N RFMNG VBTYP_V INTO TABLE I_VBFA FROM VBFA

  • FOR ALL ENTRIES IN I_OUTPUT WHERE VBELN = I_OUTPUT-VBELN

  • AND POSNN = I_OUTPUT-POSNR

  • AND VBTYP_N IN (C_VBTYP_NJ, C_VBTYP_NT).

*

  • SELECT VBELV POSNV VBELN POSNN RFMNG RFWRT FROM VBFA INTO TABLE I_VBFA1 FOR ALL ENTRIES IN

  • I_OUTPUT WHERE VBELV = I_OUTPUT-VBELN

  • AND POSNV = I_OUTPUT-POSNR

  • AND VBTYP_N = C_VBTYP_NM.

  • ENDIF.

*

  • SORT I_VBFA BY VBELN POSNN.

  • SORT I_VBFA1 BY VBELN POSNN.

ENDFORM. " salesdocumentflow

&----


*& Form salesdoc_shdlnitem_itemstatus

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM salesdoc_shdlnitem_itemstatus .

CLEAR i_vbep_vbup.

REFRESH i_vbep_vbup.

v_indexes = 70.

v_text = 'Processing... Order'.

PERFORM progress_ind.

*TO COMBINE THE VBUP DATA WITH STATUS OF LFGSA EQ TO A AND B WITH

*DATA OF VBEP , WHERE WE GET DATA OF VBEP BASED ON LOADING DATE

IF NOT i_vbup1 IS INITIAL.

LOOP AT i_vbup1 INTO w_vbup1.

READ TABLE i_vbep INTO w_vbep WITH KEY vbeln = w_vbup1-vbeln

posnr = w_vbup1-posnr BINARY SEARCH.

IF sy-subrc = 0.

MOVE : w_vbep-vbeln TO w_vbep_vbup-vbeln,

w_vbep-posnr TO w_vbep_vbup-posnr,

w_vbep-wmeng TO w_vbep_vbup-wmeng,

w_vbep-lddat TO w_vbep_vbup-lddat,

w_vbup1-lfgsa TO w_vbep_vbup-lfgsa,

w_vbup1-wbsta TO w_vbep_vbup-wbsta.

APPEND w_vbep_vbup TO i_vbep_vbup.

ENDIF.

ENDLOOP.

ENDIF.

SORT i_vbep_vbup BY vbeln posnr.

DELETE ADJACENT DUPLICATES FROM i_vbep_vbup COMPARING vbeln posnr.

ENDFORM. " salesdoc_shdlnitem_itemstatus

&----


*& Form delivery_output

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


*This routine will give us all the deliveries which are open or closed with

*there respective delivered quantity and amount etc.

FORM delivery_output .

CLEAR i_final.

REFRESH i_final.

v_indexes = 65.

v_text = 'Processing... Deliver'.

PERFORM progress_ind.

IF NOT i_output[] IS INITIAL.

LOOP AT i_output INTO w_output.

REFRESH i_vbfa_tab.

  • IF W_OUTPUT-LFART = C_LFARTLF OR W_OUTPUT-LFART = C_LFARTLO OR W_OUTPUT-LFART = C_LFARTZLO.

  • READ TABLE I_VBFA INTO W_VBFA WITH KEY VBELN = W_OUTPUT-VBELN

  • POSNN = W_OUTPUT-POSNR BINARY SEARCH .

  • ELSEIF W_OUTPUT-LFART = C_LFARTLR.

  • IF W_OUTPUT-VBTYP = 'J'.

  • READ TABLE I_VBFA INTO W_VBFA WITH KEY VBELN = W_OUTPUT-VBELN

  • POSNN = W_OUTPUT-POSNR BINARY SEARCH.

  • ELSE.

  • READ TABLE I_VBFA INTO W_VBFA WITH KEY VBELN = W_OUTPUT-VBELN

  • POSNN = W_OUTPUT-POSNR

  • VBTYP_N = C_VBTYP_NT

  • VBTYP_V = C_VBTYP_VH .

    • if sy-subrc <> 0.

    • continue.

    • endif.

  • ENDIF.

  • ENDIF.

i_conwa-vbeln = w_output-vbeln.

i_conwa-posnr = w_output-posnr.

CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'

EXPORTING

aufbereitung = '2'

belegtyp = ' '

comwa = i_conwa

nachfolger = 'X'

n_stufen = '50'

vorgaenger = 'X'

v_stufen = '50'

  • IMPORTING

  • BELEGTYP_BACK =

TABLES

vbfa_tab = i_vbfa_tab

.

CLEAR i_conwa.

IF w_output-lfart = c_lfartlf OR w_output-lfart = c_lfartlo OR w_output-lfart = c_lfartzlo OR w_output-lfart = 'ZLF'.

READ TABLE i_vbfa_tab WITH KEY vbeln = w_output-vbeln

posnn = w_output-posnr.

IF i_vbfa_tab-vbelv IS INITIAL.

sy-subrc = 4.

ENDIF.

ELSEIF w_output-lfart = c_lfartlr.

IF w_output-vbtyp = 'J'.

READ TABLE i_vbfa_tab WITH KEY vbeln = w_output-vbeln

posnn = w_output-posnr.

IF i_vbfa_tab-vbelv IS INITIAL.

sy-subrc = 4.

ENDIF.

ELSE.

READ TABLE i_vbfa_tab WITH KEY vbeln = w_output-vbeln

posnn = w_output-posnr

vbtyp_n = c_vbtyp_nt

vbtyp_v = c_vbtyp_vh .

IF i_vbfa_tab-vbelv IS INITIAL.

sy-subrc = 4.

ENDIF.

ENDIF.

ENDIF.

IF sy-subrc = 0.

  • READ TABLE I_VBAP_VBAK2 INTO W_VBAP_VBAK2 WITH KEY VBELN = W_VBFA-VBELV

  • POSNR = W_VBFA-POSNV BINARY SEARCH .

READ TABLE i_vbap_vbak2 INTO w_vbap_vbak2 WITH KEY vbeln = i_vbfa_tab-vbelv

posnr = i_vbfa_tab-posnv BINARY SEARCH .

IF sy-subrc = 0.

READ TABLE i_knvv1 INTO w_knvv1 WITH KEY kunnr = w_vbap_vbak2-kunnr

vkorg = w_vbap_vbak2-vkorg

vtweg = w_vbap_vbak2-vtweg

spart = w_vbap_vbak2-spart BINARY SEARCH .

IF sy-subrc = 0.

READ TABLE i_t171t INTO w_t171t WITH KEY bzirk = w_knvv1-bzirk BINARY SEARCH .

IF sy-subrc = 0.

w_final-bztxt = w_t171t-bztxt.

ELSE.

w_final-bztxt = ' '.

ENDIF.

IF w_output-wbsta = c_wbstaa.

w_final-text = 'Not Yet Processed'.

ELSEIF w_output-wbsta = c_wbstab.

w_final-text = 'Partially Completed'.

ELSEIF w_output-wbsta = c_wbstac.

w_final-text = 'Completed'.

ENDIF.

IF w_output-matnr = w_vbap_vbak2-matnr.

IF w_output-lfimg = w_vbap_vbak2-kwmeng.

w_vbap_vbak2-netwr = w_vbap_vbak2-netwr.

ELSE.

w_vbap_vbak2-netwr = ( w_output-lfimg * w_vbap_vbak2-netwr ) / w_vbap_vbak2-kwmeng.

ENDIF.

ENDIF.

MOVE : w_output-lddat TO w_final-lddat,

w_vbap_vbak2-vdatu TO w_final-vdatu,

w_vbap_vbak2-werks TO w_final-werks,

w_knvv1-bzirk TO w_final-bzirk,

w_knvv1-kunnr TO w_final-kunnr,

w_knvv1-name1 TO w_final-name1,

w_output-vbeln TO w_final-vbeln,

w_output-wbsta TO w_final-wbsta,

' ' TO w_final-lfgsa.

IF w_output-lfimg EQ 0.

MOVE : ' ' TO w_final-kwmeng.

ELSE.

MOVE : w_output-lfimg TO w_final-kwmeng.

ENDIF.

MOVE :w_output-posnr TO w_final-posnr,

w_vbap_vbak2-matnr TO w_final-matnr.

IF w_vbap_vbak2-netwr EQ 0.

MOVE : ' ' TO w_final-netwr.

ELSE.

MOVE :w_vbap_vbak2-netwr TO w_final-netwr.

ENDIF.

IF w_vbap_vbak2-kwmeng EQ 0.

MOVE: ' ' TO w_final-kwmeng2.

ELSE.

MOVE: w_vbap_vbak2-kwmeng TO w_final-kwmeng2.

ENDIF.

LOOP AT i_vbap_vbak2 INTO w_vbap_vbak2 WHERE vbeln = w_output-vgbel.

v_kwmeng = w_vbap_vbak2-kwmeng + v_kwmeng.

ENDLOOP.

w_final-order = ' '.

w_final-netwr1 = 0.

APPEND w_final TO i_final.

CLEAR w_vbap_vbak2.

CLEAR w_knvv1.

CLEAR w_final.

CLEAR w_vbfa.

CLEAR w_vbfa1.

CLEAR w_vbrk_vbrp.

ENDIF.

CLEAR v_kwmeng.

ENDIF.

ELSE.

IF w_output-lfart = 'LF'.

IF w_output-posnr > 10.

SKIP.

ENDIF.

ELSE.

IF w_output-wbsta = c_wbstaa.

w_final-text = 'Not Yet Processed'.

ELSEIF w_output-wbsta = c_wbstab.

w_final-text = 'Partially Completed'.

ELSEIF w_output-wbsta = c_wbstac.

w_final-text = 'Completed'.

ENDIF.

IF w_output-wbsta = c_wbstac.

  • READ TABLE I_VBFA1 INTO W_VBFA1 WITH KEY VBELV = W_OUTPUT-VBELN

  • POSNV = W_OUTPUT-POSNR BINARY SEARCH .

READ TABLE i_vbfa_tab WITH KEY vbelv = w_output-vbeln

posnv = w_output-posnr

vbtyp_n = 'M'.

IF sy-subrc = 0.

  • READ TABLE I_VBRK_VBRP INTO W_VBRK_VBRP WITH KEY VBELN = W_VBFA1-VBELN

  • POSNR = W_VBFA1-POSNN

  • VRKME = W_OUTPUT-VRKME .

*

  • IF SY-SUBRC = 0.

  • IF W_VBRK_VBRP-NETWR1 > W_VBRK_VBRP-NETWR.

  • W_VBFA1-RFWRT = W_VBRK_VBRP-NETWR.

  • ELSE.

  • W_VBFA1-RFWRT = W_VBRK_VBRP-NETWR1.

  • ENDIF.

  • ENDIF.

w_vbfa1-rfwrt = i_vbfa_tab-rfwrt.

ENDIF.

ENDIF.

READ TABLE i_knvv1 INTO w_knvv1 WITH KEY kunnr = w_output-kunnr

vkorg = w_output-vkorg

vtweg = w_output-vtweg

spart = w_output-spart BINARY SEARCH.

IF sy-subrc = 0.

READ TABLE i_t171t INTO w_t171t WITH KEY bzirk = w_knvv1-bzirk BINARY SEARCH.

IF sy-subrc = 0.

w_final-bztxt = w_t171t-bztxt.

ELSE.

w_final-bztxt = ' '.

ENDIF.

MOVE : w_output-lddat TO w_final-lddat,

w_output-lipswerks TO w_final-werks,

w_knvv1-bzirk TO w_final-bzirk,

w_knvv1-kunnr TO w_final-kunnr,

w_knvv1-name1 TO w_final-name1,

w_output-vbeln TO w_final-vbeln,

w_output-wbsta TO w_final-wbsta,

' ' TO w_final-lfgsa.

IF w_output-lfimg EQ 0.

MOVE : ' ' TO w_final-kwmeng.

ELSE.

MOVE : w_output-lfimg TO w_final-kwmeng.

ENDIF.

  • MOVE: W_SALESORDER-VBELN TO W_FINAL-ORDER,

MOVE: w_output-posnr TO w_final-posnr,

w_output-matnr TO w_final-matnr.

IF w_vbfa1-rfwrt EQ 0.

MOVE : ' ' TO w_final-netwr.

ELSE.

MOVE: w_vbfa1-rfwrt TO w_final-netwr.

ENDIF.

APPEND w_final TO i_final.

CLEAR w_final.

CLEAR w_knvv1.

CLEAR w_vbfa1.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

ENDFORM. " delivery_output

&----


*& Form salesorder_output

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


*This routine will give us all the sales order which are open.

FORM salesorder_output .

v_indexes = 90.

v_text = 'Processing... Order'.

PERFORM progress_ind.

LOOP AT i_vbep_vbup INTO w_vbep_vbup.

READ TABLE i_vbap_vbak1 INTO w_vbap_vbak1 WITH KEY vbeln = w_vbep_vbup-vbeln

posnr = w_vbep_vbup-posnr BINARY SEARCH.

IF sy-subrc = 0.

READ TABLE i_knvv2 INTO w_knvv2 WITH KEY kunnr = w_vbap_vbak1-kunnr

vkorg = w_vbap_vbak1-vkorg

vtweg = w_vbap_vbak1-vtweg

spart = w_vbap_vbak1-spart BINARY SEARCH.

IF sy-subrc = 0.

READ TABLE i_t171t INTO w_t171t WITH KEY bzirk = w_knvv2-bzirk BINARY SEARCH .

IF sy-subrc = 0.

w_final-bztxt = w_t171t-bztxt.

ELSE.

w_final-bztxt = ' '.

ENDIF.

MOVE : w_vbep_vbup-lddat TO w_final-lddat,

w_vbap_vbak1-vdatu TO w_final-vdatu,

w_vbap_vbak1-werks TO w_final-werks,

w_knvv2-bzirk TO w_final-bzirk,

w_knvv2-kunnr TO w_final-kunnr,

w_knvv2-name1 TO w_final-name1,

' ' TO w_final-vbeln,

' ' TO w_final-wbsta,

w_vbep_vbup-lfgsa TO w_final-lfgsa,

' ' TO w_final-kwmeng,

w_vbap_vbak1-vbeln TO w_final-order,

w_vbap_vbak1-posnr TO w_final-posnr,

w_vbap_vbak1-matnr TO w_final-matnr,

' ' TO w_final-netwr,

w_vbap_vbak1-kwmeng TO w_final-kwmeng2.

IF v_kwmeng EQ 0.

MOVE ' ' TO w_final-kwmeng1.

ELSE.

MOVE : w_vbap_vbak1-kwmeng TO w_final-kwmeng1.

ENDIF.

IF w_vbap_vbak1-netwr1 EQ 0.

MOVE : ' ' TO w_final-netwr1.

ELSE.

MOVE : w_vbap_vbak1-netwr TO w_final-netwr1.

ENDIF.

MOVE w_vbap_vbak1-lifsk TO w_final-lifsk.

MOVE w_vbap_vbak1-route TO w_final-route.

APPEND w_final TO i_final.

CLEAR w_final.

CLEAR w_knvv2.

CLEAR w_vbap_vbak1.

CLEAR w_vbep_vbup.

ENDIF.

CLEAR v_kwmeng.

ENDIF.

ENDLOOP.

ENDFORM. " salesorder_output

&----


*& Form final_output

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM final_output .

CLEAR v_total.

CLEAR v_totqt.

CLEAR i_final1.

REFRESH i_final1.

v_indexes = 95.

v_text = 'Processing... Output'.

PERFORM progress_ind.

LOOP AT i_final INTO w_final.

IF w_final-vbeln IS NOT INITIAL.

MOVE : w_final-lddat TO w_final1-lddat,

w_final-vdatu TO w_final1-vdatu,

w_final-werks TO w_final1-werks,

w_final-bzirk TO w_final1-bzirk,

w_final-bztxt TO w_final1-bztxt,

w_final-kunnr TO w_final1-kunnr,

w_final-name1 TO w_final1-name1,

w_final-wbsta TO w_final1-wbsta,

w_final-lfgsa TO w_final1-lfgsa,

w_final-text TO w_final1-text,

w_final-lifsk TO w_final1-lifsk,

w_final-route TO w_final1-route.

  • W_FINAL-ORDER TO W_FINAL1-ORDER.

w_final1-kwmeng = w_final-kwmeng + w_final1-kwmeng.

w_final1-netwr = w_final-netwr + w_final1-netwr.

w_final1-kwmeng1 = w_final-kwmeng1.

w_final1-netwr1 = w_final-netwr1.

IF w_final1-kwmeng EQ 0.

w_final1-kwmeng = ' '.

ENDIF.

IF w_final1-netwr EQ 0.

w_final1-netwr = ' '.

ENDIF.

IF w_final1-kwmeng1 EQ 0.

w_final1-kwmeng1 = ' '.

ENDIF.

IF w_final1-netwr1 EQ 0.

w_final1-netwr1 = ' ' .

ENDIF.

AT END OF vbeln.

v_totqt = v_totqt + w_final1-kwmeng.

v_total = v_total + w_final1-netwr.

MOVE : w_final-vbeln TO w_final1-vbeln.

APPEND w_final1 TO i_final1.

CLEAR w_final1.

ENDAT.

ELSE.

MOVE : w_final-lddat TO w_final1-lddat,

w_final-vdatu TO w_final1-vdatu,

w_final-vbeln TO w_final1-vbeln.

MOVE : w_final-werks TO w_final1-werks,

w_final-bzirk TO w_final1-bzirk,

w_final-bztxt TO w_final1-bztxt,

w_final-kunnr TO w_final1-kunnr,

w_final-name1 TO w_final1-name1,

w_final-wbsta TO w_final1-wbsta,

w_final-lfgsa TO w_final1-lfgsa,

w_final-text TO w_final1-text,

w_final-lifsk TO w_final1-lifsk,

w_final-route TO w_final1-route,

w_final-order TO w_final1-order.

w_final1-kwmeng = w_final-kwmeng + w_final1-kwmeng.

w_final1-netwr = w_final-netwr + w_final1-netwr.

v_kwmeng = v_kwmeng + w_final-kwmeng2.

w_final1-kwmeng1 = v_kwmeng . "W_FINAL-KWMENG1.

v_kwmeng1 = v_kwmeng1 + w_final-netwr1.

w_final1-netwr1 = v_kwmeng1. "W_FINAL-NETWR1.

IF w_final1-kwmeng EQ 0.

w_final1-kwmeng = ' '.

ENDIF.

IF w_final1-netwr EQ 0.

w_final1-netwr = ' '.

ENDIF.

IF w_final1-kwmeng1 EQ 0.

w_final1-kwmeng1 = ' '.

ENDIF.

IF w_final1-netwr1 EQ 0.

w_final1-netwr1 = ' ' .

ENDIF.

AT END OF order.

v_totqt = v_totqt + w_final1-kwmeng1.

v_total = v_total + w_final1-netwr1.

APPEND w_final1 TO i_final1.

CLEAR w_final1.

CLEAR v_kwmeng.

CLEAR v_kwmeng1.

ENDAT.

ENDIF.

ENDLOOP.

SORT i_final1 BY lddat.

ENDFORM. " final_output

&----


*& Form SALESORDER_HEADER_ITEM1

&----


  • text

----


FORM salesorder_header_item1.

CLEAR i_vbap_vbak1.

REFRESH i_vbap_vbak1.

v_indexes = 75.

v_text = 'Processing... Order'.

PERFORM progress_ind.

*This statement is used to fetch the salesorder numbers based on vbep_vbup data.

IF NOT i_vbep_vbup[] IS INITIAL.

SELECT avbeln aposnr amatnr amatkl azmeng ameins aspart anetwr akwmeng awerks aroute anetpr akpein akmein

bauart blifsk bnetwr bvkorg bvtweg bspart bvdatu bkunnr INTO TABLE i_vbap_vbak1 FROM vbap AS a INNER JOIN vbak AS b

ON avbeln = bvbeln FOR ALL ENTRIES IN i_vbep_vbup WHERE

a~vbeln = i_vbep_vbup-vbeln AND

a~posnr = i_vbep_vbup-posnr.

  • AND

  • A~WERKS IN S_WERKS AND

  • B~AUART IN S_AUAT

  • %_HINTS ORACLE 'index("ZVB" "ZVB~WERKS")'.

ENDIF.

DELETE i_vbap_vbak1 WHERE werks NOT IN s_werks

OR auart NOT IN s_auat.

SORT i_vbap_vbak1 BY vbeln posnr.

ENDFORM. " salesorder_header_item

&----


*& Form SALESORDER_HEADER_ITEM2

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM salesorder_header_item2 .

CLEAR i_vbap_vbak2.

REFRESH i_vbap_vbak2.

v_indexes = 45.

v_text = 'Processing... Salesorder'.

PERFORM progress_ind.

*This statement is used to fetch the salesorder numbers based on i_output data.

IF NOT i_output[] IS INITIAL.

SELECT avbeln aposnr amatnr amatkl azmeng ameins aspart anetwr akwmeng awerks aroute anetpr akpein akmein

bauart blifsk bnetwr bvkorg bvtweg bspart bvdatu bkunnr INTO TABLE i_vbap_vbak2 FROM vbap AS a INNER JOIN vbak AS b

ON avbeln = bvbeln FOR ALL ENTRIES IN i_output WHERE

a~vbeln = i_output-vgbel .

  • AND

  • A~WERKS IN S_WERKS AND

  • B~AUART IN S_AUAT

  • %_HINTS ORACLE 'index("ZVB" "ZVB~WERKS")'.

ENDIF.

DELETE i_vbap_vbak2 WHERE werks NOT IN s_werks

OR auart NOT IN s_auat.

SORT i_vbap_vbak2 BY vbeln posnr.

ENDFORM. " SALESORDER_HEADER_ITEM2

&----


*& Form customer_salesdata1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM customer_salesdata1 .

DATA : i_output2 TYPE STANDARD TABLE OF ty_output WITH HEADER LINE.

CLEAR i_knvv1.

REFRESH i_knvv1.

v_indexes = 50.

v_text = 'Processing... Customer'.

PERFORM progress_ind.

i_output2[] = i_output[].

DELETE ADJACENT DUPLICATES FROM i_output2 COMPARING kunnr.

*This statement is used to select all the customers based on i_output data

IF NOT i_output2[] IS INITIAL.

SELECT akunnr avkorg avtweg aspart abzirk bname1 INTO TABLE i_knvv1

FROM knvv AS a INNER JOIN kna1 AS b

ON akunnr = bkunnr FOR ALL ENTRIES IN i_output2

WHERE a~kunnr = i_output2-kunnr.

ENDIF.

SORT i_knvv1 BY kunnr vkorg vtweg spart.

ENDFORM. " customer_salesdata1

&----


*& Form customer_salesdata2

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM customer_salesdata2 .

DATA : i_vbap_vbak2 TYPE STANDARD TABLE OF ty_vbap_vbak WITH HEADER LINE.

CLEAR i_knvv2.

REFRESH i_knvv2.

v_indexes = 80.

v_text = 'Processing... Order'.

PERFORM progress_ind.

i_vbap_vbak2[] = i_vbap_vbak1[].

DELETE ADJACENT DUPLICATES FROM i_vbap_vbak2 COMPARING kunnr.

*This statement is used to select all the customers based on i_output data

IF NOT i_vbap_vbak2[] IS INITIAL.

SELECT akunnr avkorg avtweg aspart abzirk bname1 INTO TABLE i_knvv2

FROM knvv AS a INNER JOIN kna1 AS b

ON akunnr = bkunnr FOR ALL ENTRIES IN i_vbap_vbak2

WHERE a~kunnr = i_vbap_vbak2-kunnr.

ENDIF.

SORT i_knvv2 BY kunnr vkorg vtweg spart.

ENDFORM. " customer_salesdata2

&----


*& Form progress_ind

&----


  • text

----


FORM progress_ind.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

percentage = v_indexes

text = v_text.

ENDFORM. "progress_ind

&----


*& Form build_header

&----


  • text

----


  • -->LT_TOP_OF_PAGE text

  • -->LT_END_OF_PAGE text

----


FORM build_header CHANGING lt_top_of_page TYPE slis_t_listheader

lt_end_of_page TYPE slis_t_listheader.

DATA: ls_line TYPE slis_listheader.

CLEAR ls_line.

ls_line-typ = 'H'.

ls_line-info = sy-title.

APPEND ls_line TO lt_top_of_page.

CONCATENATE sy-datum4(2) '-' sy-datum6(2) '-' sy-datum0(4) ' / ' sy-uzeit0(2) ':' sy-uzeit2(2) ':' sy-uzeit4(2) INTO v_time.

ls_line-typ = 'S'.

ls_line-key = 'Report Date/Time'.

ls_line-info = v_time.

APPEND ls_line TO lt_top_of_page.

IF s_werks-high IS INITIAL.

CONCATENATE '-' s_werks-low INTO v_plant.

REPLACE '-' WITH ' ' INTO v_plant.

ELSE.

CONCATENATE s_werks-low ' to;' s_werks-high INTO v_plant.

REPLACE ';' WITH ' ' INTO v_plant.

ENDIF.

ls_line-typ = 'S'.

ls_line-key = 'Plant' .

ls_line-info = v_plant.

APPEND ls_line TO lt_top_of_page.

IF s_lddat-high = '00000000'.

CONCATENATE s_lddat-low4(2) '-' s_lddat-low6(2) '-' s_lddat-low0(4) INTO v_date14(46).

ELSE.

CONCATENATE s_lddat-low4(2) '-' s_lddat-low6(2) '-' s_lddat-low0(4) ' to;' s_lddat-high4(2) '-' s_lddat-high6(2) '-' s_lddat-high0(4) INTO v_date+14(46).

REPLACE ';' WITH ' ' INTO v_date.

ENDIF.

ls_line-typ = 'S'.

ls_line-key = 'Loading Date' .

ls_line-info = v_date.

APPEND ls_line TO lt_top_of_page.

IF s_auat-high IS INITIAL.

CONCATENATE s_auat-low '-' INTO v_auart.

REPLACE '-' WITH ' ' INTO v_auart.

ELSE.

CONCATENATE s_auat-low ' to;' s_auat-high INTO v_auart.

REPLACE ';' WITH ' ' INTO v_auart.

ENDIF.

ls_line-typ = 'S'.

ls_line-key = 'Sales Doc Type' .

ls_line-info = v_auart.

APPEND ls_line TO lt_top_of_page.

IF s_lfat-high IS INITIAL.

CONCATENATE s_lfat-low '-' INTO v_lfart.

REPLACE '-' WITH ' ' INTO v_lfart.

ELSE.

CONCATENATE s_lfat-low ' to;' s_lfat-high INTO v_lfart.

REPLACE ';' WITH ' ' INTO v_lfart.

ENDIF.

ls_line-typ = 'S'.

ls_line-key = 'Delv Doc Type' .

ls_line-info = v_lfart.

APPEND ls_line TO lt_top_of_page.

ls_line-typ = 'S'.

ls_line-key = 'Total Cases' .

ls_line-info = v_totqt.

APPEND ls_line TO lt_end_of_page.

ls_line-typ = 'S'.

ls_line-key = 'Total Val in Dollars' .

ls_line-info = v_total.

APPEND ls_line TO lt_end_of_page.

ENDFORM. " BUILD_HEADER

&----


*& Form BUILD_EVENTS

&----


FORM build_events CHANGING p_v_events TYPE slis_t_event.

DATA: line_event TYPE slis_alv_event.

CLEAR line_event.

line_event-name = 'TOP_OF_PAGE'.

line_event-form = 'F_TOP_OF_PAGE'.

APPEND line_event TO p_v_events.

line_event-name = 'END_OF_LIST'.

line_event-form = 'F_END_OF_PAGE'.

APPEND line_event TO p_v_events.

ENDFORM. " BUILD_EVENTS

----


  • FORM F_TOP_OF_PAGE *

----


FORM f_top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = v_header.

ENDFORM. "f_top_of_page

&----


*& Form f_END_of_page

&----


  • text

----


FORM f_end_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = v_header1.

ENDFORM. "f_END_of_page

&----


*& Form event_build

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM event_build .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = i_events.

READ TABLE i_events

WITH KEY name = slis_ev_top_of_page

INTO w_events.

IF sy-subrc = 0.

MOVE 'ALV_TOP_OF_PAGE' TO w_events-form.

MODIFY i_events FROM w_events INDEX sy-tabix.

ENDIF.

READ TABLE i_events WITH KEY name = slis_ev_top_of_list

INTO w_events.

IF sy-subrc = 0.

MOVE 'TOP_OF_LIST' TO w_events-form.

APPEND w_events TO i_events.

ENDIF.

ENDFORM. " event_build

&----


*& Form alv_top_of_page

&----


  • text

----


FORM alv_top_of_page.

CLEAR: i_list_comments[].

w_list_comments-typ = 'H'. "H=Header, S=Selection, A=Action

w_list_comments-key = ' '.

w_list_comments-info = 'Hourly Ship and Pending Report'.

APPEND w_list_comments TO i_list_comments.

CONCATENATE sy-datum4(2) '-' sy-datum6(2) '-' sy-datum0(4) ' / ' sy-uzeit0(2) ':' sy-uzeit2(2) ':' sy-uzeit4(2) INTO v_time.

w_list_comments-typ = 'S'. "H=Header, S=Selection, A=Action

w_list_comments-key = 'Report Date/Time'.

w_list_comments-info = v_time.

APPEND w_list_comments TO i_list_comments.

IF s_werks-high IS INITIAL.

CONCATENATE '-' s_werks-low INTO v_plant.

REPLACE '-' WITH ' ' INTO v_plant.

ELSE.

CONCATENATE s_werks-low ' to;' s_werks-high INTO v_plant.

REPLACE ';' WITH ' ' INTO v_plant.

ENDIF.

w_list_comments-typ = 'S'. "H=Header, S=Selection, A=Action

w_list_comments-key = 'Plant'.

w_list_comments-info = v_plant.

APPEND w_list_comments TO i_list_comments.

IF s_lddat-high = '00000000'.

CONCATENATE s_lddat-low4(2) '-' s_lddat-low6(2) '-' s_lddat-low0(4) INTO v_date14(46).

ELSE.

CONCATENATE s_lddat-low4(2) '-' s_lddat-low6(2) '-' s_lddat-low0(4) ' to;' s_lddat-high4(2) '-' s_lddat-high6(2) '-' s_lddat-high0(4) INTO v_date+14(46).

REPLACE ';' WITH ' ' INTO v_date.

ENDIF.

w_list_comments-typ = 'S'. "H=Header, S=Selection, A=Action

w_list_comments-key = 'Loading Date'.

w_list_comments-info = v_date.

APPEND w_list_comments TO i_list_comments.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = i_list_comments.

ENDFORM. "alv_top_of_page

*----


Regards,

vinod

laxmanakumar_appana
Active Contributor
0 Kudos

I355602
Advisor
Advisor
0 Kudos

Hi Ashok,

Try using 'END_OF_LIST' event.

Use this code, its working:-


*TO CAPTURE EVENTS AND HANDLE
DATA : it_event TYPE slis_t_event,
       wa_event TYPE slis_alv_event.

*&---------------------------------------------------------------------*
*          POPULATE ALL EVENTS INTO INTERNAL TABLE
*&---------------------------------------------------------------------*
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type     = 0
    IMPORTING
      et_events       = it_event
    EXCEPTIONS
      list_type_wrong = 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.

  READ TABLE it_event INTO wa_event WITH KEY name = 'END_OF_LIST'.
  wa_event-form = 'END'. "sub-routine that will be used to write
  MODIFY it_event FROM wa_event INDEX sy-tabix. "modify it_events
  CLEAR wa_event.

*&---------------------------------------------------------------------*
*          POPULATE ALV GRID WITH DATA
*&---------------------------------------------------------------------*
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program                = sy-repid "report id
      it_fieldcat                       = it_field "field catalog internal table
      it_sort                           = it_sort "sort by field internal table
      it_events                         = it_event "internal table containing events
    TABLES
      t_outtab                          = itab "internal table containing data to be displayed
    EXCEPTIONS
      program_error                     = 1
      OTHERS                            = 2.

*&---------------------------------------------------------------------*
*&      Form  end
*&---------------------------------------------------------------------*
*       TO WRITE THE FOOTER
*----------------------------------------------------------------------*
FORM end.

  REFRESH it_end.
  wa_end-typ = 'S'.
  wa_end-key = text-001.
  wa_end-info = rep_id.
  APPEND wa_end TO it_end.
  CLEAR wa_end.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary       = it_end
*   I_LOGO                   =
*   I_END_OF_LIST_GRID       =
*   I_ALV_FORM               =
            .

ENDFORM.                    "end

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Former Member
0 Kudos

Dear Gambhir,

Using your code getting Dumping error in "CLEAR wa_event"

Can you provide the all code.

Thanks.

0 Kudos

Please provide the code for  'END_OF_PAGE'

Former Member
0 Kudos

Hi,

You create one subroutine for END-OF-LIST. Call this in the FM,

REUSE_ALV_EVENTS_GET.

Example:

Data: i_event TYPE slis_t_event.

&----


*& Form f_build_eventtab

&----


  • text

----


FORM f_build_eventtab USING ps_event TYPE slis_t_event.

DATA: wa_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = ps_event.

READ TABLE ps_event WITH KEY name = slis_ev_end_of_list INTO wa_event.

IF sy-subrc EQ c_0.

MOVE slis_ev_end_of_list TO wa_event-form.

APPEND wa_event TO ps_event.

ENDIF.

ENDFORM. " f_build_eventtab

&----


*& Form END OF LIST *

&----


*& To display the summary of the totals *

&----


FORM end_of_list . "#EC CALLED

DATA: l_amt LIKE bsid-dmbtr,

l_diff LIKE bsid-dmbtr,

l_lines TYPE sy-tabix.

DESCRIBE TABLE i_final_1 LINES l_lines.

IF l_lines GT c_0.

LOOP AT i_final_1.

l_diff = i_final_1-dmbtr - i_final_1-wrbtr.

l_amt = l_diff + l_amt.

ENDLOOP.

ENDIF.

FORMAT COLOR 3 .

WRITE: /50 text-021,

61 l_amt CURRENCY 'THB'.

ULINE.

ENDFORM. "END_OF_LIST

I hope this will be useful for you.

Regards,

Joan