2006 Aug 31 9:43 PM
Hi!
Can anybody tell me how to create credit memo request using BAPI_SALESORDER_CREATEFROMDAT2
points will be rewarded if helpful
Hi!
Can anybody tell me how to create credit memo request using BAPI_SALESORDER_CREATEFROMDAT2
points will be rewarded if helpful
2006 Aug 31 10:07 PM
I think you can pass the other information with sales order type as CR.
2006 Sep 01 12:06 AM
Credit memo request is also a Sales order so it is just a matter of passing the appropriate Sales order type and fill the structures with the required data for your application.
Hope it helps.
Leonardo De Araujo
2006 Sep 01 1:15 PM
Hi!
Here is my code to test Bapi
pls take a look at it
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,
SD_SOLD_TO_PARTY LIKE BAPISOLDTO,
SD_SHIP_TO_PARTY LIKE BAPISHIPTO.
*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
f10 type char40 value '0001000007', " sold to party
f11 type char40 value '0001000007', " ship to party
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.
move:
gs_datafile-f10 TO sd_sold_to_party-sold_to,
gs_datafile-f11 to SD_SHIP_TO_PARTY-ship_to.
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,
SD_SOLD_TO_PARTY,
SD_SHIP_TO_PARTY.
ENDFORM. "bapi_call
2006 Sep 01 1:31 PM
Looks fine...
Regards
Anurag
--Please assign points to useful answers ---
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |