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

BAPI_SALESORDER_CREATEFROMDAT1

Former Member
0 Likes
599

Hi!

i am trying to create credit memo using BAPI_SALESorder_CREATEFROMDAT1. SInce i am not using ship_to_party can any body pls tell me where i can pass ship_to_party = Sold_to_party...

promise points will be rewarded

4 REPLIES 4
Read only

Former Member
0 Likes
564

HI,

Look at the below thread, you will find your answer

Regards

Sudheer

you can see the below link also,

http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/how-to-bapi_salesorder_createfromdat...

Read only

0 Likes
564

Hi !

here is my sample code to test bapi

pls help me points will be rewarded

REPORT ZWTY_SALESBAPI_TEST .

tables : vbak.

DATA: it_bapi_return like bapireturn1,

it_bapi_header like bapisdhead,

it_bapi_sold_to_party like bapipartnr occurs 0 with header line ,

it_bapi_items like bapiitemin occurs 0 with header line,

so_no like bapivbeln-vbeln.

*DATA: gv_fname TYPE string,

  • gv_flen TYPE int4.

*-- Internal table for credit memo header----

DATA: BEGIN OF gs_datafile,

f1 TYPE char4 value 'YCR' , " doc type

f2 TYPE char20 value '9990', "sales org

f3 TYPE char20 value '10', "distribution

f4 TYPE char20 value '00', " division

f5 TYPE char20 value '0001000007', "partner

f6 TYPE char20 value 'AG', "role_par

f7 type char40 value 'FERT034013SD', " material number

f8 type char8 value '10.000', " quantity

  • f13 type char8 value '1.000' , " quantity

  • f14 type char18, "material

END OF gs_datafile.

  • gt_datafile LIKE STANDARD TABLE OF gs_datafile.

MOVE: gs_datafile-f1 TO it_bapi_header-doc_type,

gs_datafile-f2 TO it_bapi_header-sales_org,

gs_datafile-f3 TO it_bapi_header-distr_chan,

gs_datafile-f4 TO it_bapi_header-division.

MOVE:

gs_datafile-f5 TO it_bapi_sold_to_party-partn_numb,

gs_datafile-f6 TO it_bapi_sold_to_party-partn_role.

append it_bapi_sold_to_party.

MOve:

gs_datafile-f7 TO it_bapi_items-material,

gs_datafile-f8 TO it_bapi_items-req_qty.

append it_bapi_items.

PERFORM bapi_call.

FORM bapi_call.

  • IF gs_claim_hdr IS INITIAL.

  • EXIT.

  • ENDIF.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'

EXPORTING

ORDER_HEADER_IN = it_bapi_header

  • WITHOUT_COMMIT = ' '

CONVERT_PARVW_AUART = 'X'

IMPORTING

SALESDOCUMENT = SO_NO

  • SOLD_TO_PARTY =

  • SHIP_TO_PARTY =

  • BILLING_PARTY =

RETURN = it_bapi_return

TABLES

ORDER_ITEMS_IN = it_bapi_items

ORDER_PARTNERS = it_bapi_sold_to_party

  • ORDER_ITEMS_OUT =

  • ORDER_CFGS_REF =

  • ORDER_CFGS_INST =

  • ORDER_CFGS_PART_OF =

  • ORDER_CFGS_VALUE =

  • ORDER_CCARD =

  • ORDER_CFGS_BLOB =

  • ORDER_SCHEDULE_EX =

.

.

IF it_bapi_return IS INITIAL.

COMMIT WORK.

WRITE: / 'Claim', so_no, 'created...'.

ELSE.

WRITE: / 'Errors occurred, no COMMIT...'.

ENDIF.

CLEAR:it_bapi_header,

it_bapi_sold_to_party,

it_bapi_items,

it_bapi_return.

Read only

0 Likes
564

Hi Preet

If you are able to successfully create Credit Memo

using your code and if you just need to make Solt-to

Party and Ship-To Party same you can try the below method.

Add one more entry for <b>it_bapi_sold_to_party</b>

with partner role as 'WE' and partner number being the same.

Kind Regards

Eswar

Read only

0 Likes
564

Hi

i am getting some problem for SD document category .. There is mismatch i don't know from where program is getting this value ... from