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

To Create Credit memo from SD using BAPI

Former Member
0 Likes
1,511

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

8 REPLIES 8
Read only

Former Member
0 Likes
1,222

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

Read only

0 Likes
1,222

can u provide me a little bit more details... since i have to post credit memo using fileds in table qwtyh

Read only

0 Likes
1,222

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

Read only

0 Likes
1,222

I think u did'nt get me i need to create credit memo from SD not Sales Document

Read only

0 Likes
1,222

What Transaction do you use for manually creating Credit Memo?

Regards,

Vishal

Read only

0 Likes
1,222

normally user FB75

Read only

0 Likes
1,222

Oh...then..I guess we have quite different processes. Sorry for confusion.

- Vishal

Read only

0 Likes
1,222

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