2006 Aug 27 11:10 PM
Hi
Can anybody help me in creating Credit Memo from SD using BAPI. I am new to BAPI so pls send me some code reagrding how to call bapi in custom function module.
Thank you
Hi
Can anybody help me in creating Credit Memo from SD using BAPI. I am new to BAPI so pls send me some code reagrding how to call bapi in custom function module.
Thank you
2006 Aug 27 11:36 PM
Hi,
Please find the sample code for Billing document BAPI.
t_billing-salesorg = vbak-vkorg.
t_billing-DISTR_CHAN = vbak-vtweg.
t_billing-DIVISION = vbak-spart.
t_billing-DOC_TYPE = vbak-auart.
t_billing-ref_doc = vbak-vbeln.
t_billing-ref_item = vbap-posnr.
t_billing-doc_number = vbak-vbeln.
t_billing-ITM_NUMBER = vbap-posnr.
t_billing-ordbilltyp = 'BILLING TYPE'.
t_billing-price_date = sy-datum.
t_billing-ref_doc_ca = vbak-vbtyp.
t_billing-sold_to = vbak-kunnr.
t_billing-material = vbap-matnr.
t_billing-plant = vbap-werks.
APPEND t_billing.
CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
TABLES
billingdatain = t_billing
return = t_return
success = t_success.
commit work.
Please award the points if it is working for you.
Thanks,
Naren
2006 Aug 29 3:44 AM
can u provide me a little bit more details... since i have to post credit memo using fileds in table qwtyh
2006 Aug 29 4:42 AM
Create Credit Memo: I guess the BAPI only allows to create Sales Orders for credit memo we have to pass another Business object (like BUS2094). For this we need to call this FM which is internally called by the Sales Order create BAPI(same one can be used to create credit memo).
CALL FM To create SD Doc / Credit memo
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
SALESDOCUMENT =
sales_header_in = hdr_exp
SALES_HEADER_INX =
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 = doc_num
sales_header_out = hdr_imp
SALES_HEADER_STATUS =
TABLES
return = t_return
sales_items_in = t_item
SALES_ITEMS_INX =
sales_partners = t_partner
SALES_SCHEDULES_IN =
SALES_SCHEDULES_INX =
sales_conditions_in = t_cond
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 =
.
LOOP AT t_return.
IF t_return-type = 'E'.
return-zreturn = t_return-message.
return-status = 'E'.
APPEND return.
EXIT.
ENDIF.
ENDLOOP.
Regards,
Vishal
Reward if helpful **
Message was edited by: Vishal Tyagi
2006 Aug 29 4:53 AM
I think u did'nt get me i need to create credit memo from SD not Sales Document
2006 Aug 29 4:56 AM
What Transaction do you use for manually creating Credit Memo?
Regards,
Vishal
2006 Aug 29 5:14 AM
2006 Aug 29 5:22 AM
Oh...then..I guess we have quite different processes. Sorry for confusion.
- Vishal
2006 Aug 31 10:25 AM
hi vishal actually u r right. I have to create credit memo request same way as we create sales order . I think i have to use BAPI_create_salerorder_dat2.. Can u provide me comlete source code
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |