Skip to Content
0
Former Member
Jul 10, 2007 at 01:31 AM

SD_SALESDOCUMENT_CREATE error

384 Views

hi all,

i am using SD_SALESDOCUMENT_CREATE to create Credit Memo request with reference to Billing no, i encountered error:

Enter a document number between 0065000000 and 0069999999

Sales document 60000635 was not changed

the number range error : 0065000000 to 0069999999 is external number range setting, in our spro, we use internal range starts from 0060000000 to 0064999999,

why system cannot read the internal no 60000635 that i have passed in the coding, pls help

  • Header data

CLEAR: vbrk, vbpa, tvak, nriv.

REFRESH: ivbrp.

SELECT SINGLE * FROM vbrk

WHERE vbeln = '0090009938'.

SELECT SINGLE * FROM vbpa

WHERE vbeln = '0090009938'

AND parvw = 'WE'.

SELECT * FROM vbrp

INTO TABLE ivbrp

WHERE vbeln = '0090009938'.

SELECT SINGLE * FROM tvak

WHERE auart = 'G2'.

IF sy-subrc = 0.

SELECT SINGLE * FROM nriv

WHERE nrrangenr = tvak-numki

AND object = 'RV_BELEG'.

ENDIF.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = nriv-nrlevel

IMPORTING

OUTPUT = wvbeln_in

.

*wvbeln_in = nriv-nrlevel.

  • Sales document type

header-doc_type = wauart.

headerx-doc_type = 'X'.

  • Sales organization

header-sales_org = vbrk-vkorg.

headerx-sales_org = 'X'.

  • Distribution channel

header-distr_chan = vbrk-vtweg.

headerx-distr_chan = 'X'.

  • Division

header-division = vbrk-spart.

headerx-division = 'X'.

header-ref_doc = vbrk-vbeln.

headerx-ref_doc = 'X'.

*header-REFDOCTYPE = 'F2'.

*headerx-REFDOCTYPE = 'X'.

headerx-updateflag = 'I'.

  • append header. append headerx.

  • Partner data

  • Sold to

partner-partn_role = 'AG'.

partner-partn_numb = vbpa-kunnr.

APPEND partner.

LOOP AT ivbrp.

CLEAR: item, itemx.

  • ITEM DATA

itemx-updateflag = 'I'.

  • Line item number.

item-itm_number = ivbrp-posnr.

itemx-itm_number = 'X'.

  • Material

item-material = ivbrp-matnr.

itemx-material = 'X'.

  • Plant

item-plant = ivbrp-werks.

itemx-plant = 'X'.

  • Quantity

item-target_qty = ivbrp-fkimg.

itemx-target_qty = 'X'.

APPEND item.

APPEND itemx.

ENDLOOP.

CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'

EXPORTING

salesdocument = wvbeln_in

sales_header_in = header

sales_header_inx = headerx

  • SENDER =

  • BINARY_RELATIONSHIPTYPE = ' '

  • INT_NUMBER_ASSIGNMENT = ' '

  • BEHAVE_WHEN_ERROR = ' '

  • LOGIC_SWITCH = ' '

business_object = 'BUS2094'

  • TESTRUN =

  • CONVERT_PARVW_AUART = ' '

  • STATUS_BUFFER_REFRESH = 'X'

  • IMPORTING

  • SALESDOCUMENT_EX =

  • SALES_HEADER_OUT =

  • SALES_HEADER_STATUS =

TABLES

return = return

sales_items_in = item

sales_items_inx = itemx

sales_partners = partner

  • SALES_SCHEDULES_IN =

  • SALES_SCHEDULES_INX =

  • SALES_CONDITIONS_IN =

  • SALES_CONDITIONS_INX =

  • SALES_CFGS_REF =

  • SALES_CFGS_INST =

  • SALES_CFGS_PART_OF =

  • SALES_CFGS_VALUE =

  • SALES_CFGS_BLOB =

  • SALES_CFGS_VK =

  • SALES_CFGS_REFINST =

  • SALES_CCARD =

  • SALES_TEXT =

  • SALES_KEYS =

  • SALES_CONTRACT_IN =

  • SALES_CONTRACT_INX =

  • EXTENSIONIN =

  • PARTNERADDRESSES =

  • SALES_SCHED_CONF_IN =

  • ITEMS_EX =

  • SCHEDULE_EX =

  • BUSINESS_EX =

  • INCOMPLETE_LOG =

  • EXTENSIONEX =

  • CONDITIONS_EX =

  • PARTNERS_EX =

  • TEXTHEADERS_EX =

  • TEXTLINES_EX =

  • BATCH_CHARC =

.