‎2010 Apr 22 12:14 PM
Hello,
I need to create return sales order. I am trying to use BAPI_CUSTOMERRETURN_CREATE.
Can anybody please help.
Regards.
‎2010 Apr 22 12:22 PM
Hi,
Click on the Whereuse list for this FM
i.e SE37-->FM name
Regards,
Padmasri.
‎2010 Apr 22 12:23 PM
Hi,
Try the sample code
call function 'BAPI_CUSTOMERRETURN_CREATE'
exporting
salesdocumentin = salesdocumentin
return_header_in = wa_return_header_in
return_header_inx = wa_return_header_inx
importing
salesdocument = salesdocumentout
tables
return = it_return
return_items_in = it_return_items_in
return_items_inx = it_return_items_inx
return_partners = it_return_partners
return_schedules_in = it_schedules_in
return_schedules_inx = it_schedules_inxFill: order number in salesdocumentin
Fill following fields in "return_header_in"
DOC_TYPE, ORD_REASON, SD_DOC_CAT ='H',
REF_DOC = Reference document,
REFDOC_CAT = 'M' (If invoice is reference document)
SALES_ORG,DISTR_CHAN,DIVISION
Fill the value 'X' to corresponding fields of structure "return_header_inx"
Fill partner details in "return_partners"
While filling the structure "return_items_in" and "return_items_inx"
pass reference document number in the field "REF_DOC"
Fill Schedule line data in "return_schedules_in" and "return_schedules_inx"
Regards
Vinod
‎2010 Apr 22 12:49 PM
Thanks Vinod.
Kindly help me with RETURN_SCHEDULES_IN and RETURN_SCHEDULES_INX Values.
Regards,
Nikita Giradkar.
‎2010 Apr 22 12:55 PM
Hi, Try sample code as below
move <ls_return_item>-itm_number to wa_schedules_in-itm_number.
move '0001' to wa_schedules_in-sched_line.
move <ls_return_item>-target_qty to wa_schedules_in-req_qty.
move ' ' to wa_schedules_in-req_dlv_bl.
append wa_schedules_in to it_schedules_in.
move <ls_return_item>-itm_number to wa_schedules_inx-itm_number.
move '0001' to wa_schedules_inx-sched_line.
move 'X' to wa_schedules_inx-req_qty.
move 'U' to wa_schedules_inx-updateflag.
move 'X' to wa_schedules_inx-req_dlv_bl.
append wa_schedules_inx to it_schedules_inx.Regards
Vinod
‎2010 Apr 22 1:18 PM
Hi Nikita,
You have to fill given below fields.
so_header-doc_type
so_header-sales_org
so_header-distr_chan
so_header-division
so_header-pmnttrms
so_header-purch_no_c
so_header-incoterms1
so_header-incoterms2
so_header-ord_reason
w_items-itm_number
w_items-material
w_items-plant
w_items-orderid
w_items-profit_ctr
w_shedule-itm_number
w_shedule-sched_line
w_shedule-req_qty
w_partner-partn_role
w_partner-partn_numb
So you have to fill atleast these above parameters.
Ihope it will help you.
Regards,
Narendra
‎2010 Apr 23 8:10 AM
Hi,
I am getting error
331 Item 000003 does not exist
Kindly help.
Thanks & Regards.
‎2010 Apr 23 8:36 AM
You have to pass the line item number of Reference document (generally Billing document)
Regards
Vinod
‎2010 Apr 23 10:45 AM
My code is
clear : vbrp.
select * from vbrp where vbeln = zdefc_claim-vbeln and matnr = zdefc_claim-matnr.
RETURN_SCHEDULES_IN-ITM_NUMBER = vbrp-posnr.
RETURN_SCHEDULES_IN-REQ_QTY = zdefc_claim-zaccepted.
append RETURN_SCHEDULES_IN.
RETURN_SCHEDULES_INX-ITM_NUMBER = vbrp-posnr.
RETURN_SCHEDULES_INX-REQ_QTY = 'X'.
RETURN_SCHEDULES_INX-updateflag = 'U'.
APPEND RETURN_SCHEDULES_INX.
endselect.
‎2010 Apr 23 10:51 AM
Add following line of code while filling schedule line information.
move '0001' to RETURN_SCHEDULES_IN-sched_line.
move '0001' to RETURN_SCHEDULES_INX-sched_line.Hope you are mapping following values
"zdefc_claim-vbeln" into return_items_in-ref_doc,
"vbrp-posnr" into return_items_in-ref_doc_it,
"zdefc_claim-vbeln" into return_header_in-ref_doc.
Regards
Vinod
‎2010 Apr 23 10:58 AM
Hi Nikita,
As I mentioned mandatory fields in my above point.
Kindly use SCHEUD_LINE also
Atleast fill this field by 6 characters
i.e. padd with zeros in starting
eg. instead of 0001 you have to write '000001'
Regards,
Narendra
‎2010 Apr 23 11:54 AM
Thanks a lot.
While updating Sales documnet is getting created but Quantity is Blank.
Kindly Help.
Regards.
‎2010 Apr 23 12:02 PM
Check following lines of code where quantity is assigned.
move <ls_return_item>-target_qty to return_items_in-target_qty.
move 'X' to return_items_inx-target_qty.
move <ls_return_item>-target_qty to return_schedules_in-req_qty.
move 'X' to return_schedules_inx-req_qty.Regards
Vinod
‎2010 Apr 23 12:04 PM
Hi Nikita,
Plz check quantity field in your code.
i.e. just before calling BAPI, check ur internal table which contains quantity data.
Also check on this line of your code.
RETURN_SCHEDULES_IN-REQ_QTY = zdefc_claim-zaccepted.
or you can check by passing some constant value in quantity field. " to check the data is coming in variable or not.
Regards,
Narendra
‎2010 Apr 23 12:06 PM
Yes, I tried passing constant '10.000', but still quantity is not getting updated.
My code is:
CALL FUNCTION 'BAPI_CUSTOMERRETURN_CREATE'
EXPORTING
SALESDOCUMENTIN =
RETURN_HEADER_IN = RETURN_HEADER_IN
RETURN_HEADER_INX = RETURN_HEADER_INX
SENDER =
BINARY_RELATIONSHIPTYPE = 'VORA'
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = SALESDOCUMENT
TABLES
RETURN = RETURN
RETURN_ITEMS_IN = RETURN_ITEMS_IN
RETURN_ITEMS_INX = RETURN_ITEMS_INX
RETURN_PARTNERS = RETURN_PARTNERS
RETURN_SCHEDULES_IN = RETURN_SCHEDULES_IN
RETURN_SCHEDULES_INX = RETURN_SCHEDULES_INX
RETURN_CONDITIONS_IN =
RETURN_CFGS_REF =
RETURN_CFGS_INST =
RETURN_CFGS_PART_OF =
RETURN_CFGS_VALUE =
RETURN_CFGS_BLOB =
RETURN_CFGS_VK =
RETURN_CFGS_REFINST =
RETURN_TEXT =
RETURN_KEYS =
EXTENSIONIN =
PARTNERADDRESSES =
.
‎2010 Apr 23 12:18 PM
Hi Nikita,
Plz uncomment the given below lines
RETURN_SCHEDULES_IN = RETURN_SCHEDULES_IN
RETURN_SCHEDULES_INX = RETURN_SCHEDULES_INX
You are filling structures but commented these lines in your code.
Uncomment this.
I hope it will help you.
Regards,
Narendra
‎2010 Apr 23 12:24 PM
RETURN_SCHEDULES_IN & RETURN_SCHEDULES_INX is commented in BAPI. Data in this structures is used to determine quantity at item level.
Regards
Vinod
‎2010 Apr 24 5:28 AM
Thank you for above answers. Now at sales order quantity is getting updated but net value is blank.
Kindly help.
Thanks & Regards.
‎2010 Apr 24 7:34 PM
Moderator message - Please do not respond to questions like this. Correct answer is RTFM. post locked and points unassigned Rob