Skip to Content
author's profile photo Former Member
Former Member

ALV grid col total problem (f_cat-do_sum = 'x') error

Dear All

i m getting the runtime error ( MESSAGE_TYPE_X) in the following ALV grid report .Dump says

The termination occurred in the ABAP program "SAPLSLVC" in "LINE_OUT_NEW_2

The main program was "ZSD_REP_COB_SHEET ".

The termination occurred in line 924 of the source code of the (Include)

program "LSLVCF01"

of the source code of program "LSLVCF01" (when calling the editor 9240).

Help plzzzzz...........

Thanx

Moni

&----


*COB Control Sheet report *

----


REPORT ZSD_REP_COB_SHEET NO STANDARD PAGE HEADING LINE-SIZE 255

MESSAGE-ID ZMSG.

TABLES:

VBRK,

VBRP,

VBFA,

VBAK,

VBAP,

VBPA,

LIKP,

konv,

t001,

t001w,

t005T,

kna1,

adrc,

ZSERIAL_NUMBER,

STXL,

MAKT,

TVTRT,

TVZBT,

TVKBT,

SER01,

OBJK,

sscrfields. " Fields on selection screens

----


  • Type-Pools *

----


TYPE-POOLS : slis.

TYPES:BEGIN OF TYP_HEADER,

SLNO TYPE I,

NAME1 LIKE KNA1-NAME1,

SERNR LIKE OBJK-SERNR,

VBELN LIKE VBRK-VBELN,

FKDAT LIKE VBRK-FKDAT,

KUNAG LIKE VBRK-KUNAG,

KNUMV LIKE VBRK-KNUMV,

MATNR LIKE VBRP-MATNR,

MATKL LIKE VBRP-MATKL,

VKBUR LIKE VBRP-VKBUR,

VGBEL LIKE VBRP-VGBEL,

AUBEL LIKE VBRP-AUBEL,

NAME2 LIKE KNA1-NAME1,

KUNNR LIKE VBPA-KUNNR,

BEZEI LIKE tvkbt-BEZEI,

ZDI3 LIKE VBRK-NETWR,

ZZ01 LIKE VBRK-NETWR,

ZZ02 LIKE VBRK-NETWR,

ZZ03 LIKE VBRK-NETWR,

ZZ04 LIKE VBRK-NETWR,

ZZ05 LIKE VBRK-NETWR,

ZZ06 LIKE VBRK-NETWR,

ZZ07 LIKE VBRK-NETWR,

ZZ08 LIKE VBRK-NETWR,

ZZ09 LIKE VBRK-NETWR,

ZZ10 LIKE VBRK-NETWR,

ZZ11 LIKE VBRK-NETWR,

ZZ12 LIKE VBRK-NETWR,

ZZ13 LIKE VBRK-NETWR,

ZZ14 LIKE VBRK-NETWR,

ZZ15 LIKE VBRK-NETWR,

TOT1 LIKE VBRK-NETWR,

END OF TYP_HEADER.

DATA: T_FINAL TYPE TYP_HEADER OCCURS 0 WITH HEADER LINE ,

dat LIKE sy-datum,

SLNO TYPE I VALUE 1,

DBCNT like sy-dbcnt,

BEGIN OF T_XHDR OCCURS 0,

VBELN LIKE VBRK-VBELN,

FKDAT LIKE VBRK-FKDAT,

END OF T_XHDR,

*Declaration for ALV display.

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

v_alv_fieldcat TYPE slis_t_fieldcat_alv,

v_alv_layout TYPE slis_layout_alv,

v_layout TYPE slis_layout_alv,

v_prog TYPE sy-repid,

v_save TYPE c VALUE 'A',

v_fieldcat TYPE slis_fieldcat_alv,

v_pool TYPE c,

events TYPE slis_t_event,

f2code LIKE sy-ucomm VALUE '&ETA',

heading TYPE slis_t_listheader,

wa_header TYPE slis_listheader,

l_string TYPE slis_entry.

DATA : BEGIN OF t_ser OCCURS 0,

lief_nr LIKE ser01-lief_nr,

obknr LIKE ser01-obknr,

sernr like objk-sernr,

END OF t_ser.

DATA : BEGIN OF T_KUN OCCURS 0,

VBELN LIKE VBPA-VBELN,

KUNNR LIKE VBPA-KUNNR,

NAME1 LIKE KNA1-NAME1,

END OF T_KUN.

TYPES :BEGIN OF TYP_ZZXX ,

KNUMV LIKE KONV-KNUMV,

KSCHL LIKE KONV-KSCHL,

KBETR LIKE KONV-KBETR,

END OF TYP_ZZXX.

DATA: T_ZZXX TYPE TYP_ZZXX OCCURS 0 WITH HEADER LINE.

----


  • Constants *

*----


CONSTANTS c_x TYPE c VALUE 'X'.

CONSTANTS: formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

----


  • Parameter / Selection - screens *

----


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

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: "S_INVNO FOR VBRK-VBELN ,

S_INVDAT FOR VBRK-FKDAT OBLIGATORY.

SELECTION-SCREEN END OF BLOCK blk1.

*****SELECTION-SCREEN for Execution option

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-025.

PARAMETERS:p_backgd RADIOBUTTON GROUP bgrd DEFAULT 'X',

p_foregd RADIOBUTTON GROUP bgrd.

SELECTION-SCREEN END OF BLOCK b3.

*****Initialization.

INITIALIZATION.

CLEAR: T_FINAL.

v_prog = sy-repid.

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

AT SELECTION-SCREEN.

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

SELECT * FROM VBRK

INTO CORRESPONDING FIELDS OF TABLE T_XHDR

WHERE FKDAT IN S_INVDAT. " VBELN IN S_INVNO

IF SY-SUBRC NE 0.

MESSAGE E003(ZMSG).

ENDIF.

IF p_backgd = 'X'.

IF sscrfields-ucomm = 'ONLI' AND sy-batch <> 'X'.

sscrfields-ucomm = 'SJOB'. " SUBMIT IN BACKGROUND

ENDIF.

ENDIF.

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

*****start-of-selection.

START-OF-SELECTION.

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

PERFORM GET_DATA.

*END-OF-SELECTION.

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

END-OF-SELECTION.

*To display in Alv

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

PERFORM define_event.

PERFORM pop_fieldcat.

PERFORM display.

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

  • FORM GET_DATA.

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

FORM GET_DATA.

SELECT VK~VBELN VK~FKDAT VK~KUNAG VK~KNUMV VP~MATNR

VP~MATKL VP~VKBUR VP~VGBEL

VP~AUBEL K1~NAME1 TK~BEZEI "KV~KSCHL

INTO CORRESPONDING FIELDS OF TABLE T_FINAL

FROM VBRK AS VK

INNER JOIN VBRP AS VP

ON VK~VBELN = VP~VBELN

INNER JOIN KNA1 AS K1

ON K1~KUNNR = VK~KUNAG

INNER JOIN TVKBT AS TK

ON TK~VKBUR = VP~VKBUR

AND TK~SPRAS = 'E'

  • INNER JOIN KONV AS KV

  • ON KVKNUMV = VKKNUMV

WHERE VK~FKDAT IN S_INVDAT "VK~VBELN IN S_INVNO

AND VK~FKSTO NE 'X'

AND ( VK~FKART = 'ZFOR'

OR VK~FKART = 'ZDEP'

OR VK~FKART = 'JEX'

OR VK~FKART = 'F2' ) .

DELETE ADJACENT DUPLICATES FROM T_FINAL COMPARING ALL FIELDS.

DESCRIBE TABLE T_FINAL LINES DBCNT.

  • dbcnt = sy-dbcnt.

SELECT SNR~lief_nr

SNR~obknr

o~sernr

FROM ser01 as SNR inner join

objk as o on SNR~obknr = o~obknr

INTO CORRESPONDING FIELDS

OF TABLE t_ser FOR ALL ENTRIES IN T_FINAL

WHERE lief_nr EQ T_FINAL-vgbel.

LOOP AT T_FINAL.

READ TABLE T_ser WITH KEY lief_nr = t_FINAL-vgbel.

IF sy-subrc = 0.

  • MOVE t_ser-obknr TO T_FINAL-obknr.

move t_ser-sernr to T_FINAL-sernr.

MODIFY T_FINAL.

ENDIF.

ENDLOOP.

SELECT V~VBELN

V~KUNNR

K~name1

FROM VBPA AS V INNER JOIN

KNA1 AS K ON V~KUNNR = K~KUNNR

INTO TABLE T_KUN

FOR ALL ENTRIES IN T_FINAL

WHERE VBELN = T_FINAL-AUBEL

AND PARVW = 'Y9'.

LOOP AT T_FINAL.

MOVE SLNO TO T_FINAL-SLNO.

SLNO = SLNO + 1.

MODIFY T_FINAL.

READ TABLE T_KUN WITH KEY VBELN = T_FINAL-AUBEL.

IF SY-SUBRC = 0.

MOVE T_KUN-NAME1 TO T_FINAL-NAME2.

MODIFY T_FINAL.

ENDIF.

ENDLOOP.

SELECT * INTO CORRESPONDING FIELDS OF

TABLE T_ZZXX "KNUMV KSCHL KBETR

FROM KONV

FOR ALL ENTRIES IN T_FINAL

WHERE KNUMV = T_FINAL-KNUMV.

  • AND KSCHL = T_FINAL-KSCHL.

LOOP AT T_FINAL.

LOOP AT T_ZZXX WHERE KNUMV = T_FINAL-KNUMV.

T_ZZXX-KBETR = T_ZZXX-KBETR / 100000.

IF T_ZZXX-KSCHL = 'ZDI3'.

MOVE T_ZZXX-KBETR TO T_FINAL-ZDI3.

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FINAL-ZZ05

+ T_FINAL-ZZ06 + T_FINAL-ZZ07 + T_FINAL-ZZ12.

MODIFY T_FINAL.

CLEAR T_ZZXX.

ENDLOOP.

ENDLOOP.

ENDFORM.

&----


*& Form define_event

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM define_event .

v_prog = sy-repid.

v_alv_layout-colwidth_optimize = c_x.

v_alv_layout-zebra = c_x.

v_alv_layout-f2code = f2code.

v_alv_layout-detail_popup = 'X'.

v_alv_layout-info_fieldname = 'COL'.

v_alv_layout-numc_sum = 'X'.

v_alv_layout-totals_text = 'TOTAL'.

PERFORM create_event USING events[].

ENDFORM. " define_event

  • To display TOP_OF_PAGE.

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

FORM top_of_page.

DATA : text(40),txtdt(40).

CLEAR l_string.

l_string = 'JCB India Limited'(hd2).

wa_header-typ = 'H'.

wa_header-info = l_string.

APPEND wa_header TO heading. " index 1.

CLEAR l_string.

WRITE :'Number of records:' TO text,dbcnt TO text+20 LEFT-JUSTIFIED.

wa_header-typ = 'S'.

wa_header-info = text.

APPEND wa_header TO heading.

CLEAR l_string.

wa_header-typ = 'S'.

WRITE : 'Report Run Date :' TO txtdt,sy-datum TO txtdt+20 DD/MM/YY.

WRITE sy-datum TO dat DD/MM/YY.

wa_header-info = txtdt.

APPEND wa_header TO heading.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

i_logo = 'ENJOYSAP_LOGO'

it_list_commentary = heading.

CLEAR heading.

ENDFORM. "top_of_page

&----


*& Form pop_fieldcat

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM pop_fieldcat .

PERFORM fieldcat_append USING : text-002 'T_FINAL' 'SLNO' '4' ' ',

text-003 'T_FINAL' 'NAME1' '35' ' ',

text-004 'T_FINAL' 'SERNR' '18' ' ',

text-032 'T_FINAL' 'MATNR' '18' ' ',

text-029 'T_FINAL' 'VBELN' '10' ' ',

text-005 'T_FINAL' 'FKDAT' '8' ' ',

text-006 'T_FINAL' 'MONTH' '6' ' ',

text-007 'T_FINAL' 'MATKL' '3' ' ',

text-026 'T_FINAL' 'NAME2' '35' ' ',

text-027 'T_FINAL' 'BEZEI' '20' ' ',

text-028 'T_FINAL' 'ZINST' '10' ' ',

text-030 'T_FINAL' 'ZDI3' '21' 'X',

text-008 'T_FINAL' 'ZZ01' '21' 'X',

text-009 'T_FINAL' 'ZZ02' '21' 'X',

text-010 'T_FINAL' 'ZZ03' '21' 'X',

text-011 'T_FINAL' 'ZZ04' '21' 'X',

text-012 'T_FINAL' 'ZZ05' '21' 'X',

text-013 'T_FINAL' 'ZZ06' '21' 'X',

text-014 'T_FINAL' 'ZZ07' '21' 'X',

text-015 'T_FINAL' 'ZZ08' '21' 'X',

text-016 'T_FINAL' 'ZZ09' '21' 'X',

text-017 'T_FINAL' 'ZZ10' '21' 'X',

text-018 'T_FINAL' 'ZZ11' '21' 'X',

text-019 'T_FINAL' 'ZZ12' '21' 'X',

text-020 'T_FINAL' 'ZZ13' '21' 'X',

text-021 'T_FINAL' 'ZZ14' '21' 'X',

text-022 'T_FINAL' 'ZZ15' '21' 'X',

text-031 'T_FINAL' 'TOT1' '21' 'X'.

ENDFORM. " pop_fieldcat

&----


*& Form fieldcat_append

&----


  • text

----


  • -->P_TEXT_005 text

  • -->P_0657 text

  • -->P_0658 text

  • -->P_0659 text

----


FORM fieldcat_append USING m_text m_tabname m_flname m_len m_sum.

CLEAR v_fieldcat.

v_fieldcat-seltext_l = m_text.

v_fieldcat-tabname = m_tabname.

v_fieldcat-fieldname = m_flname.

v_fieldcat-outputlen = m_len.

v_fieldcat-do_sum = m_sum.

APPEND v_fieldcat TO v_alv_fieldcat.

ENDFORM. " fieldcat_append

&----


*& Form display

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM display .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_prog

I_GRID_TITLE = 'COB Control Sheet Report'

is_layout = v_alv_layout

it_fieldcat = v_alv_fieldcat

it_events = events[]

TABLES

T_outtab = T_FINAL.

ENDFORM. " display

&----


*& Form create_event

&----


  • text

----


  • -->P_EVENTS[] text

----


FORM create_event USING p_events TYPE slis_t_event.

DATA: ls_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = p_events.

READ TABLE p_events WITH KEY name = slis_ev_top_of_page

INTO ls_event.

IF sy-subrc = 0.

MOVE formname_top_of_page TO ls_event-form.

APPEND ls_event TO p_events.

ENDIF.

ENDFORM. " create_event

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on May 02, 2005 at 05:47 AM

    Check out these oss notes.

    0000805510

    0000186847

    0000353165

    0000432278

    0000640218

    0000702444

    0000717669

    0000211099

    0000324167

    Raja

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2008 at 02:36 PM

    I have the answer for you. A few days ago I had the same problem. Solution is: You should have precisely the same names of fields in your table with data T_FINAL and in your structure for field catalog v_alv_fieldcat. I am talking about these names in apostrophes.

    Example:

    You have variable's name:

    T_FINAL-NAME1
    ...
    T_FINAL-ZZ15

    and field catalog name should be exactly the same, so:

    v_alv_fieldcat-fieldname = 'NAME1'.
    v_alv_fieldcat-fieldname = 'ZZ15'

    and so on...

    If you do not have correct names (all of them), you will not be able to make a TOTAL.

    In my case it helped me, you can check it in debugger in this include LSLVCF01. Set a breakpoint in line 905 near by LOOP starting and see whether you have correct all the names in table rt_fieldcat field fieldname.

    I hope it helps you as well.

    Best regards

    Krzysztof

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 23, 2020 at 07:42 PM

    Iam also getting same problem . not able to perform" do_sum" on amount field.could you please help me out any one.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.