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

Run time error during invoice creation using BAPI_INCOMINGINVOICE_CREATE

Former Member
0 Likes
814

Hello Experts,

While creating GR based Subsequent credit for self billing inovice for Portugal using BAPI_INCOMINGINVOICE_CREATE

i am getting a run time error "Unable to convert 'B' as a number".

Reason is while generating Number range,for ERS process, IVTYP is defaulted with value 'B'.But am not passing

any value to IV_CATEGORY.

I am passing below fields at header lever,

invoice_ind  = space.

comp_code    = gw_bukrs.

doc_date     = sy-datum.

pstng_date   = sy-datum.

ref_doc_no   = invoice number .

currency     = 'EUR'.

item_text    = descr.

and  below fields and item level,

po_number        = f_ekko-ebeln.

po_item          = f_ekbe-ebelp.

ref_doc          = f_ekbe-belnr .

ref_doc_year     = f_ekbe-gjahr.

ref_doc_it       = '0001'.

tax_code         = 'D4'.

quantity         = 1.

de_cre_ind       = gc_x.

item_amount      = 10.

po_unit          = 'PC'.

Does anyone have any idea about the reason for this error.?

Thanks in Advance,

Gowri.

3 REPLIES 3
Read only

Former Member
0 Likes
710

Hi,

I don't think that we can help you with the above informations. Please look in ST22 in which line the the runtime error occurs and post the line and the contents of the fields. You can find these values in the dump below the code snippet, where the runtime error occurs..

Regards,

Klaus

Read only

0 Likes
710

Hello Klaus,

Thanks for the reply and this is place where dump occurs.

No.      Ty.                                       Program                             Include                         Line
          Name

   22    FUNCTION                           SAPLFIN2                            LFIN2U27                      61
         OFF_NUMBER_ASSIGN_ERS

Runtime Errors         CONVT_NO_NUMBER
Date and Time          2014.04.16 06:47:29

    51   ENDIF.
    52
    53 * Note 1619154
    54   IF LV_LIFNR IS NOT INITIAL.
    55 * begin of note 1550481
    56     IF I_PARAM-COMP_COUNTRY = 'PT'.
    57       CALL FUNCTION 'SIPT_GET_PARAMETER_MM'        "Note 1600931
    58     IMPORTING
    59       GJAHR = LV_GJAHR
    60       IVTYP = LV_IVTYP.
>>>>>     IF lv_ivtyp = 1 OR lv_ivtyp = 5.                    "N1702606
    62         SELECT SINGLE * FROM SIPT_NUMBR_MM WHERE LIFNR = LV_LIFNR.
    63         IF SY-SUBRC = 0.
    64           CALL FUNCTION 'SIPT_BEFORE_NUMBERING_MM'
    65             EXPORTING
    66               LIFNR  = LV_LIFNR
    67               GJAHR  = LV_GJAHR
    68               BUKRS  = LV_BUKRS
    69             IMPORTING
    70               PAVAL  = LV_PAVAL

and here the values are,

No.      22 Ty.          FUNCTION
Name  OFF_NUMBER_ASSIGN_ERS

COMP_COUNTRY
    PT
    00
    00
    55
    04
I_PARAM
    R1C1940    RN  5200012496                          0617000000               PT0000000000000000
    0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    5343333222254223333333333222222222222222222222222223333333333222222222222222553333333333333333
    213194000002E005200012496000000000000000000000000000617000000000000000000000040000000000000000
O_XBLNR
    5200012496
    0000000000000000
    0000000000000000
    3333333333222222
    5200012496000000

N0 SY-REPID

L0 80

V0 SAPLFIN2

X0 00000000000000000000000000000

X0 00000000000000000000000000000

X0 54544443222222222222222222222

X0 310C69E2000000000000000000000

N0 SY-MSGID

L0 40

V0

X0 00000000000000000000

X0 00000000000000000000

X0 22222222222222222222

X0 00000000000000000000

N0 SWITCH_TO_UPDATE_MODE

L0 8

V0 AEND

X0 0000

X0 0000

X0 4444

X0 15E4

SWITCH_TO_UPDATE_MODE
8
AEND
0000
0000
4444
15E4
N0 LV_LIFNR
L0 20
V0 0617000000
X0 0000000000
X0 0000000000
X0 3333333333
X0 0617000000
N0 ADDR_COMP
L0 2
V0
X0 0
X0 0
X0 2
X0 0
N0 I_PARAM-COMP_COUNTRY
L0 4
V0 PT
X0 00
X0 00
X0 55
X0 04
N0 MIDDLE_TAB
L0 4
V0 128
X0 0008
X0 0000
N0 MOD
L0 4
V0 10
X0 00
X0 00
X0 33
X0 10
N0 LV_GJAHR
L0 8
V0 2014
X0 0000
X0 0000
X0 3333
X0 2014
N0 STATUS
L0 16
V0
X0 00000000
X0 00000000
X0 22222222
X0 00000000
N0 LV_IVTYP
L0 2
V0 B
X0 0
X0 0
X0 4
X0 2
N0 SY
L0 4612
V0 #################################################,#############################Á#######ฐXC#̀#####   E###   0100        ###__S                 010      00
X0 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
X0 000000000000000000000000000000000000000E00000000000000000000000000000000000000000000000E00030000C0000000000000000000000000000000000000000000000000000000000
X0 0000000000000000000000000000000000000000000000000200000000000000000000000000010C000100015400000002224000222333322222222000555222222222222222223332222223322
X0 0000010300000100000000000100010000000000000100000C0305000000000000000000000009010006000083000C0000005003000010000000000000FF3000000000000000000100000000000

Thanks

Gowri.

Read only

0 Likes
710

Hi,

it seems that IVTYP 'B' will be found automatically by a given document number. IVTYP 'B' means BAPI Invoice. But your code checks for numeric types 1 ERS or 5 Cancellation. Please check domain values for domain IVTYP for that.

It seems that you are performing with a wrong document number of IVTYP 'B'.

Regards,

Klaus