Skip to Content
0
Former Member
Sep 29, 2005 at 02:15 PM

runtime error in abap report

482 Views

error analysis as in ST22 TRANSACTION:

AN EXCEPTION OCCURED THE EXCEPTION ASSIGNED TO CLASS CX_SY_CONVERSION_NO_NUMBER WAS NOT CAUGHT WHICH LED TO AN ERROR. THE REASON FOR THIS EXCEPTION IS :

THE PROGRAM TRIED TO INTERPRET VALUE ':4' AS NUMBER SINCE THE VALUE CONTRAVENES THE CORRECT NUMBER FORMAT THIS WAS NOT POSSIBLE.

ATTACHED IS MY PROGRAM

REPORT ZVXR0303

LINE-COUNT 60(3)

LINE-SIZE 132

MESSAGE-ID VN.

Tables: VBEP, VBAP, NAST.

DATA: BEGIN OF HEADER,

ORDER(15) VALUE 'ORDER',

LINE(5) VALUE 'LINE',

MATERIAL(14) VALUE 'MATERIAL',

DUE(15) VALUE 'DUE (MAD)',

CREATED(10) VALUE 'CREATED',

QTY(10) VALUE 'QUANTITY',

KEY(5) VALUE 'KEY',

TYPE(5) VALUE 'TYPE',

END OF HEADER.

DATA: Begin of IDAT OCCURS 0,

VBELN LIKE VBAP-VBELN,

POSNR LIKE VBAP-POSNR,

werks LIKE VBAP-WERKS,

cuobj LIKE vbap-CUOBJ,

MBDAT LIKE vbep-mbdat,

ERDAT LIKE VBAP-ERDAT,

MATNR LIKE VBAP-MATNR,

KWMENG LIKE VBAP-KWMENG,

QTY TYPE I,

END of IDAT.

class cl_abap_char_utilities definition load.

constants: tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.

DATA: t_record(1000) TYPE C.

DATA: C_KWMENG(20) TYPE C.

data: OUTFILE(50) value '/usr/users/ftpsapfi/locks_540318'.

DATA: BEGIN OF TKOMCON OCCURS 50.

INCLUDE STRUCTURE CONF_OUT.

DATA: END OF TKOMCON.

DATA: iKEY TYPE I,

offset TYPE I,

KeyTypeLOC TYPE I,

KeyNumberLOC TYPE I,

type(15) TYPE C.

select-options: sVBELN FOR VBEP-VBELN obligatory,

sMAD FOR VBEP-MBDAT obligatory,

sERDAT FOR VBAP-ERDAT,

sMATNR FOR VBAP-MATNR,

sWERKS FOR VBAP-WERKS,

sKWMENG FOR VBAP-KWMENG.

SELECT

vbap~vbeln

vbap~POSNR

vbap~werks

vbap~cuobj

VBEP~MBDAT

VBAP~ERDAT

VBAP~MATNR

VBAP~KWMENG

INTO CORRESPONDING FIELDS of IDAT

FROM ( VBEP INNER JOIN VBAP ON vbepvbeln = vbapvbeln

AND vbepposnr = vbapposnr )

WHERE BMENG > 0

AND vbep~MBDAT IN sMAD

AND VBEP~VBELN in sVBELN

AND VBAP~werks IN sWERKS

AND VBAP~ERDAT IN sERDAT

AND VBAP~MATNR IN sMATNR

AND VBAP~KWMENG IN sKWMENG

AND VBAP~ABGRU = SPACE.

APPEND IDAT.

ENDSELECT.

PERFORM TOP-OF-PAGE.

if sy-batch = 'x'.

OPEN DATASET OUTFILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

TRANSFER t_record TO OUTFILE.

endif.

IF SY-SUBRC = 0.

LOOP at IDAT.

write IDAT-KWMENG DECIMALS 0 TO C_KWMENG.

REFRESH TKOMCON.

CALL FUNCTION 'VC_I_GET_CONFIGURATION'

EXPORTING

INSTANCE = idat-cuobj

LANGUAGE = NAST-SPRAS

TABLES

CONFIGURATION = TKOMCON

EXCEPTIONS

OTHERS = 4.

LOOP AT TKOMCON

WHERE ATNAM = 'S_SK_SPEC_KEY' OR ATNAM = 'S_MK_SPEC_KEY'

OR ATNAM = 'S_SK_CONSC_KEY' OR ATNAM = 'S_MK_CONSC_KEY'.

IF TKOMCON-ATNAM = 'S_SK_CONSC_KEY'

OR TKOMCON-ATNAM = 'S_MK_CONSC_KEY'.

KeyTYPELOC = 0.

keynumberloc = 2.

TRANSLATE TKOMCON-ATWRT+KeyNumberLOC(4) USING ': '.

IF TKOMCON-ATWRT+KeyNumberLOC(4) CO '0123456789 '.

iKey = TKOMCON-ATWRT+KeyNumberLOC(4).

IF ( TKOMCON-ATWRT+KeyTypeLOC(2) = 'FR' AND iKey >= 454 )

OR ( TKOMCON-ATWRT+KeyTypeLOC(2) = 'XF' AND iKey >= 1150 ).

PERFORM OUT-OF-RANGE-FOUND.

ENDIF.

ENDIF.

Else.

Offset = 0.

DO.

IF offset <= 9.

offset = offset + 1.

If TKOMCON-ATWRT+Offset(1) = ':'.

KeyTypeLOC = Offset + 1.

KeyNumberLOC = Offset + 3.

EXIT.

ENDIF.

ELSE.

EXIT.

ENDIF.

ENDDO.

TRANSLATE TKOMCON-ATWRT+KeyNumberLOC(4) USING ': '.

IF TKOMCON-ATWRT+KeyNumberLOC(4) CO '0123456789 '.

iKey = TKOMCON-ATWRT+KeyNumberLOC(4).

IF ( TKOMCON-ATWRT+KeyTypeLOC(2) = 'FR' AND iKey >= 454 )

OR ( TKOMCON-ATWRT+KeyTypeLOC(2) = 'XF' AND iKey >= 1150 ).

IDAT-KWMENG = TKOMCON-ATWRT(3).

PERFORM OUT-OF-RANGE-FOUND.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDLOOP.

ENDIF.

CLOSE DATASET OUTFILE.

----


  • FORM OUT-OF-RANGE-FOUND *

----


  • ........ *

----


FORM OUT-OF-RANGE-FOUND.

WRITE: / IDAT-VBELN.

WRITE: 10 IDAT-POSNR.

WRITE: 20 IDAT-MATNR.

WRITE: 35 IDAT-MBDAT.

WRITE: 50 IDAT-ERDAT.

WRITE: 65(3) IDAT-KWMENG DECIMALS 0.

WRITE: 75 TKOMCON-ATWRT+KeyTypeLOC(6).

IF TKOMCON-ATNAM = 'S_SK_CONSC_KEY'

OR TKOMCON-ATNAM = 'S_MK_CONSC_KEY'.

WRITE: 85 'Consecutive'.

ELSE.

WRITE: 85 'Specific'.

ENDIF.

IF TKOMCON-ATNAM = 'S_SK_CONSC_KEY'

OR TKOMCON-ATNAM = 'S_MK_CONSC_KEY'.

TYPE = 'Consecutive'.

ELSE.

TYPE = 'Specific'.

ENDIF.

  • * PREPARING A RECORD TO BE SENT TO FILE

CONCATENATE

IDAT-VBELN

IDAT-POSNR

IDAT-MATNR

IDAT-MBDAT

IDAT-ERDAT

C_KWMENG

TKOMCON-ATWRT+KeyTypeLOC(6)

TYPE

INTO t_record SEPARATED BY tab.

if sy-batch = 'x'.

TRANSFER t_record TO OUTFILE.

endif.

ENDFORM.

----


  • FORM TOP-OF-PAGE *

----


  • ........ *

----


FORM TOP-OF-PAGE.

WRITE: / 'ORDER'.

WRITE: 10 'LINE'.

WRITE: 20 'MATERIAL'.

WRITE: 35 'DUE (MAD)'.

WRITE: 50 'CREATED'.

WRITE: 65 'QTY'.

WRITE: 75 'KEY'.

WRITE: 85 'TYPE'.

  • PREPARING A RECORD TO BE SENT TO FILE

CONCATENATE

header-ORDER

header-LINE

header-MATERIAL

header-DUE

header-CREATED

header-QTY

header-KEY

header-TYPE

INTO t_record SEPARATED BY tab.

ENDFORM.

THIS IS WORKING FINE WITH DIFFERENT RANGES BUT WHEN I USE RANGE

Sales Order 1250000 TO 2250000

MAD 01/18/2005 TO 03/02/2005

Material LOCK9250FR TO LOCK9250XF

PLANT 4500

IT GIVES THE RUNTIME ERROR I MENTIONED ABOVE

ANY HELP WOULD BE GREATLY APPRECIATED

THANKS.