Creation of Credit memo Request using FM SD_SALESDOCUMENT_CREATE
Hi Guys,
I am using FM SD_SALESDOCUMENT_CREATE to create credit memo request from flat file.
we are using variant configuration and characteristic values for material are not being populated. Rest of the sales document is created but characteristic values are missing.
can any one help me if u have some information or some piece of code.
here is the code i am using.
LOCAL DATA DECLARATION
DATA: L_WA_ORDER_CFGS_VALUE TYPE BAPICUVAL,
L_WA_ORDER_CFGS_REF TYPE BAPICUCFG,
L_WA_ORDER_CFGS_INST TYPE BAPICUINS,
L_WA_ORDER_CFGS_PART_OF TYPE BAPICUPRT.
CONSTANTS: C_MARA TYPE CHAR10 VALUE 'MARA',
C_300 TYPE CHAR03 VALUE '300'.
IF FP_L_WA_CHAR-ITM_NUMBER <> FP_V_ITEM_OLD.
Build internal tables for material configuration
Configuration: Reference Data
L_WA_ORDER_CFGS_REF-POSEX = FP_L_WA_CHAR-ITM_NUMBER.
L_WA_ORDER_CFGS_REF-CONFIG_ID = FP_L_WA_CHAR-ITM_NUMBER.
L_WA_ORDER_CFGS_REF-ROOT_ID = FP_L_WA_CHAR-ITM_NUMBER.
APPEND L_WA_ORDER_CFGS_REF TO FP_I_ORDER_CFGS_REF.
Build internal table BAPICUINS
Configuration: Instances
L_WA_ORDER_CFGS_INST-CONFIG_ID = FP_L_WA_CHAR-ITM_NUMBER.
L_WA_ORDER_CFGS_INST-INST_ID = FP_L_WA_CHAR-ITM_NUMBER.
L_WA_ORDER_CFGS_INST-CLASS_TYPE = C_300.
L_WA_ORDER_CFGS_INST-OBJ_TYPE = C_MARA.
L_WA_ORDER_CFGS_INST-OBJ_KEY = FP_L_WA_CHAR-MATERIAL.
APPEND L_WA_ORDER_CFGS_INST TO FP_I_ORDER_CFGS_INST.
Configuration: Part-of Specifications
L_WA_ORDER_CFGS_PART_OF-OBJ_TYPE = C_MARA.
L_WA_ORDER_CFGS_PART_OF-CLASS_TYPE = C_300.
L_WA_ORDER_CFGS_PART_OF-OBJ_KEY = FP_L_WA_CHAR-MATERIAL.
APPEND L_WA_ORDER_CFGS_PART_OF TO FP_I_ORDER_CFGS_PART_OF.
FP_V_ITEM_OLD = FP_L_WA_CHAR-ITM_NUMBER.
ENDIF.
Configuration: Characteristic Values
Sales Document Item
L_WA_ORDER_CFGS_VALUE-CONFIG_ID = FP_L_WA_CHAR-ITM_NUMBER .
L_WA_ORDER_CFGS_VALUE-INST_ID = FP_L_WA_CHAR-ITM_NUMBER.
Characteristic Name
L_WA_ORDER_CFGS_VALUE-CHARC = FP_L_WA_CHAR-CHARC .
Characteristic Value
L_WA_ORDER_CFGS_VALUE-VALUE = FP_L_WA_CHAR-VALUE .
APPEND L_WA_ORDER_CFGS_VALUE TO FP_I_ORDER_CFGS_VALUE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
SALES_HEADER_IN = FP_WA_ORDER_HEADER_IN
SALES_HEADER_INX = FP_WA_ORDER_HEADER_INX
BEHAVE_WHEN_ERROR = C_R
BUSINESS_OBJECT = 'BUS2094'
IMPORTING
SALESDOCUMENT_EX = L_SALESDOCUMENT
TABLES
RETURN = L_I_RETURN
SALES_ITEMS_IN = FP_I_ORDER_ITEMS_IN
SALES_ITEMS_INX = FP_I_ORDER_ITEMS_INX
SALES_PARTNERS = FP_I_ORDER_PARTNERS
SALES_SCHEDULES_IN = FP_I_ORDER_SCHEDULES
SALES_SCHEDULES_INX = FP_I_ORDER_SCHEDULESX
SALES_CONDITIONS_IN = FP_I_ORDER_CONDITIONS_IN
SALES_CONDITIONS_INX = FP_I_ORDER_CONDITIONS_INX
SALES_CFGS_REF = FP_I_ORDER_CFGS_REF
SALES_CFGS_INST = FP_I_ORDER_CFGS_INST
SALES_CFGS_PART_OF = FP_I_ORDER_CFGS_PART_OF
SALES_CFGS_VALUE = FP_I_ORDER_CFGS_VALUE
SALES_TEXT = FP_I_ORDER_TEXT.
Hi, has your question be answered? What was the outcome / result?
Similar Messages
-
Problem while creating credit memo request using BAPI
HI,
I am trying to create credit memo request using the BAPI_SALESDOCU_CREATEFROMDATA1..
I am getting the error as " No customer master data is available for the customer". But the customer exists in the KNA1 table. What is the mistake i hv done.. this s my code..
REPORT ZSV_CREDITMEMO_TEST1.
Data declarations.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
DATA: lt_schedules_ink TYPE STANDARD TABLE OF bapisdhead1
WITH HEADER LINE.
START-OF-SELECTION.
Header data
Sales document type
header-doc_type = 'G2'.
headerx-doc_type = 'X'.
Sales organization
header-sales_org = '0001'.
headerx-sales_org = 'X'.
Distribution channel
header-distr_chan = ''.
headerx-distr_chan = 'X'.
Division
header-division = ''.
headerx-division = 'X'.
headerx-updateflag = 'I'.
*Complete delivery
header-COMPL_DLV = ''.
header-COMPL_DLV = 'X'.
Partner data
Sold to
partner-partn_role = 'AG'.
partner-partn_numb = '0000C10130'.
APPEND partner.
Ship to
partner-partn_role = 'WE'.
partner-partn_numb = ''.
APPEND partner.
ITEM DATA
itemx-updateflag = 'I'.
Line item number.
item-itm_number = '000010'.
itemx-itm_number = 'X'.
Material
item-material = 'C20011'.
itemx-material = 'X'.
Plant
item-plant = ''.
itemx-plant = 'X'.
Quantity
item-target_qty = '10000'.
itemx-target_qty = 'X'.
item category
itemx-ITEM_CATEG = 'X'.
APPEND item.
APPEND itemx.
Fill schedule lines
lt_schedules_in-itm_number = '000010'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = '10000'.
APPEND lt_schedules_in.
Fill schedule line flags
lt_schedules_inx-itm_number = '000010'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
Call the BAPI to create the sales order.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
Check the return table.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error in creating document'.
ELSE.
Commit the work.
COMMIT WORK AND WAIT.
WRITE: / 'Document ', v_vbeln, ' created'.
ENDIF.
can anyone tell what the error is.?Hi
please look at code below code this succefully creating credit memo may some help to you
header-doc_type = 'ZS4'.
PERFORM get_plant.
headerx-doc_type = 'X'.
header-sales_org = wa_temp1-vkorg.
headerx-sales_org = 'X'.
header-purch_no = wa_temp1-bstnk.
header-distr_chan = wa_temp1-vtweg.
headerx-distr_chan = 'X'.
header-division = wa_temp1-spart.
header-purch_no_s = wa_temp1-bstnk.
headerx-division = 'X'.
wa_partner-partn_role = 'AG'.
wa_partner-partn_numb = wa_temp1-kunnr.
APPEND wa_partner TO it_partner.
wa_partner-partn_role = 'WE'.
wa_partner-partn_numb = wa_temp1-kunnr.
APPEND wa_partner TO it_partner.
CLEAR: wa_partner.
LOOP AT lt_temp2 INTO wa_temp2 WHERE kunnr = wa_temp1-kunnr.
"AND matnr = wa_temp1-matnr.
*wa_item-itm_number = wa_temp2-posnr .
wa_item-material = wa_temp2-matnr.
wa_item-plant = wa_temp2-werks.
wa_item-req_qty = wa_temp2-fkimg * 1000.
wa_item-target_qty = wa_temp2-fkimg * 1000.
APPEND wa_item TO it_item.
ENDLOOP.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
EXPORTING
order_header_in = header
* WITHOUT_COMMIT = ' '
* CONVERT_PARVW_AUART = ' '
IMPORTING
salesdocument = v_vbeln
* SOLD_TO_PARTY =
* SHIP_TO_PARTY =
* BILLING_PARTY =
return = return
TABLES
order_items_in = it_item
order_partners = it_partner.
IF v_vbeln <> space.
wa_vbeln-vbeln = v_vbeln.
APPEND wa_vbeln TO lt_vbeln.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
HIDE wa_vbeln-vbeln.
CLEAR: wa_partner,header,v_vbeln, wa_temp2.
REFRESH: it_partner,it_item.
ELSE.
* LOOP AT return .
it_error-srno = idx.
it_error-err_msg = return-message.
APPEND it_error.
* ENDLOOP.
ENDIF.
idx = idx + 1.
ENDLOOP.
Regards -
Create credit memo request using inbound IDOC
Hi Experts,
I want to create credit memo request using inbound IDOC, currently I am using GSVERF03 basic type and process code GSVE, I am getting below error:
No records exist in T661W for vendor XXXXX, plant, unloading point
Anyone suggest me is this correct message type to create credit memo request or suggest me the correct one. because we are working with customer sales order and invoice not with vendor purchase order.
Thanks for your help.ah, apologies i read outbound! I think you are using the correct message type i.e. GSVERF.
Can you not simply create the missing entry in T661W? i.e. for the missing records? -
Creation of Credit Memo request from Invoice.
Dear All,
We have requirement for creation of CRM Credit Memo request from CRM Invoice.
Please guide any one if you have clue on this requirement.
Regards,
Mallik KosuruThis can be achieved by creating complaints . You create a complaint -credit memo request-credit memo with reference to billing document, refer to C28 CRM complaints for more info.
-
Creation of credit memo requests through SD_SALESORDER_CREATE
Dear All,
We are using SD_SALESORDER_CREATE to create credit memo requests. However this FM only generates a document number and even gives a message that this document has been saved.
However there is no document saved to the database with that number. In effect this FM only advances the number range but doesn't commit.
Is there any other FM to save the document with the generated number.
Regards,
KCHi Guys - bang up to date I am, but just came across this old one by chance.
OSS Note 168124:
"To test BAPI BAPI_SALESORDER_CREATEFROMDAT2 and at the same time update the
created document, create a test sequence which calls BAPIs
BAPI_SALESORDER_CREATEFROMDAT2 and BAPI_TRANSACTION_COMMIT."
I believe BAPI_SALESORDER_CREATEFROMDAT2 calls SD_SALESORDER_CREATE so same issue and solution.
Stephan -
Creation of Credit Memo request from the contract invoice
Hi all,
I would like to know the relationship between the contract invoice (billing document type, ZULG) and the associated credit memo requests. I have the billing document no, and need to know all the associated credit memo requests.
It is possible to find the reference billing document from the credit memo request, as it is created with respect to a billing document, but is it possible to find the credit memo requests from the billing document?
Any info on this relationship would be really appreciated.
Many thanks,
SruthyHi!
If the credit memo is created as a follow on order with respect to the contract, it is possibel to find the credit memo request through the doc flow.
Thanks & Regards
Birlabose -
Credit memo request problem using
Dear All,
I am creating credit memo request using SD_SALESDOCUMENT_CREATE, I am facing problems in this
1> Quatity field is empty in the SO(TARGET_QTY)
2> The credit memo is always being created with negative value, which should not be the case
Note: I am passing manual condition type in condition type where calculation type is B(fixed value).
Can anyone suggest me why is it creating Credit memo request with (-)ve value always.
Thanks and regards,
Kapil Shiavaji SonavaneNaren,
1> I have already used that, see the following code.
for SALES_ITEMS_INX
LOOP AT T_BAPISDITM1.
T_BAPISDITMX-ITM_NUMBER = T_BAPISDITM1-ITM_NUMBER.
T_BAPISDITMX-UPDATEFLAG = 'X'.
T_BAPISDITMX-TARGET_QTY = 'X'.
T_BAPISDITMX-TARGET_QU = 'X'.
APPEND T_BAPISDITMX.
ENDLOOP.
But still Quantity is blank.
2> Created Credit memo request is coming in (-)ve value this is major problem for me. -
Creating credit memo request - V1 498 / missing order quantity
Hi Experts,
could any of You pls help me with a credit memo creation issue?
I credit memo needed to be created based on invoice, so configuration and copy control is done as usual, but I have a failure during CR order creation referring to an invoice F2.
I got an error message: V1 498 - Credit already exist for item... - and no qty is transferred to new document
I have gone thought the threads on Forum, but none of the suggested solution was appropriate to solve the issue:
- the document flow is updated in copy control ,
- I can no remove the schedule line flag at VOV7 - the order qty will be missed but target qty is used, and end up incompletition (VU 019 error messge), so billing is faile
- completition control set as B at VOV7,
Still have the problem
Could any of You pls help me - answers will be appreciated.V1 498 - Credit already exist for item...
What the above message means is that lines items have already been used as reference for the creation of credit memo request(s).
Create a new sales order, delivery and billing document. Then create credit memo request with reference to this new billing document and test.
In VTAF copy control, at item level, field "Pos./neg. quantity" dictates how the quantity in the source document is affected by copy control.
PS - I tried to create credit memo with reference to billing document (F2), there were no issues there. Therefore I am taking that the issue is with credit memo request (copied with ref to billing document F2) -
Credit Memo Request creation in VA01 transaction Code
Hi All,
Thank You very much in advance for reading this Query.
My Requirement is we have to create Credit memo Request in VA01 Transaction Code.But I tried to use the standard FM BAPI_SALESORDER_CREATEFROMDAT2 and It is throwing the Error "Unpermitted combination of Business Object BUS2032 and Sales doc.category K".
So can any one advise me the correct FM to satisfy this requirement.
Thanks and Regards,
K.Krishna Chaitanya.Hi
Try this....
Pass the below data to the fm: SD_SALESDOCUMENT_CREATE.
SALES_HEADER_IN:
DOC_TYPE
SALES_ORG
DISTR_CHAN
DIVISION
STATUS_BUFFER_REFRESH = 'X'
SALES_ITEMS_IN:
ITM_NUMBER
MATERIAL
TARGET_QTY
TARGET_QU
PURCH_NO_C
SALES_PARTNERS:
PARTN_ROLE
PARTN_NUMB
SALES_CONDITIONS:
ITM_NUMBER
COND_TYPE
COND_VALUE
CURRENCY
COND_UNIT
Hope this helps.... -
Creation of sales order(Credit memo request) w.r.t invoice
Hi want to create a Credit memo request (sales order) with respect to a invoice.
Can any body suggest me a bapi or Fm which will directly create a sales order with input as invoice number?
Also all mandatory import export parameters to be filled?
Thanks in Advance,
Rohan.You should be able to use one of these BAPIs (depending on your release - the ...2 one is the lates and greatest, it seems):
BAPI_SALESORDER_CREATEFROMDAT1
BAPI_SALESORDER_CREATEFROMDAT2
BAPI_SALESORDER_CREATEFROMDATA
You'll find a lot of information on them anywhere, please use search. There is also a decent documentation available for each one of them.
The invoice reference will have to be entered as follows (note that it's always at line level):
order_items_in-ref_doc = <invoice number = VBRK-VBELN>.
order_items_in-ref_doc_it = <<invoice line number = VBRP-POSNR.>.
order_items_in-ref_doc_ca = 'M'. " or whatever category is applicable
Keep in mind though that BAPIs do NOT always work the same way as VA01. If, for example, you have the requirements and copy routines (VOFM), they might get bypassed when creating an order with BAPI.
Any follow-up questions I'd suggest to post in ABAP forum. Good luck! -
Credit memo request creation problem
Hello Guys,
I try creating credit memo request passing all related parameters in FM 'SD_SALESDOCUMENT_CREATE'.
I get the error 'Document 9992222 doesn't have document category but '.
Message is V2 068 . It space before and after but.
I have passed the document category as 'M', in the header data.
Please reply, if you know the problem or want more details from me.
Thanks and Best Regards!
SandipHi Guys,
The Ref_doc_cat was not filled correctly in the BAPI. Hence the error.
Its working now.
Thanks!
Sandip -
Regd creation of New Sales Order Type - Credit Memo Request
Hello Gurus,
I have created a New Sales Order Type as per the given requirements. This is a Credit Memo Request. I have done all that are needed from SD perspective.
Can you please let me know what needs to be done from FI-CO perspective when a New Sales Order Type is created and this is a Credit Memo Request. If some one can let me know the customizations that needs to be done it will be very helpful for me.
Thanks,
SNK.Hi,
As per my understanding, there is nothing to be required from FI-CO perspective, in case when you defined a document type in SD.
During the sales order processing the SD-FI interface happenes for following activities
1) Credit check (In case you use Credt management)
2) Tax determination
For more knowledge
go through the link given below.
http://www.sap-img.com/sap-sd/link-between-sap-sd-mm-and-fi.htm
Hope it helps,
Regards,
MT -
TO CREATE A CREDIT MEMO USING CREDIT MEMO REQUEST
Hi,
I have a credit memo request 60000150 and I need to create a credit memo using the above credit memo request.Can anyone suggest a BAPI or some other method to do this and also the parameters to be passedHi,
I have a credit memo request 60000150 and I need to create a credit memo using the above credit memo request.Can anyone suggest a BAPI or some other method to do this and also the parameters to be passed -
Automatic billing document creation upon saving credit memo request.
Hi,
I have a requirment where in :
When a Credit Memo Request is created(va01) and upon saving the credit memo request an automatic billing document needs to be genereated i.e Credit Memo.
How can this be achieved.
ThanksHi Keni
If a Credit Memo Request is created and after saving the Credit Memo Request , automatic billing should happen means you should maintain a new sub-routine and assign in the copy control VTFA . In that sub-routine maintain a logic that once the Credit Memo Request is saved automatic billing should happen
Regards
Srinath -
Multiple credit memo creation for single credit memo request
Hello,
The problem is that I am able to repeatedly create multiple credit memos for the same credit memo request. The system is not stopping me by saying "This order is fully invoiced".
I observed the following in the customizing:
1. If the sales document category of the billing document (in VOFA transaction) is 6 (Intercompany credit memo), then I am able to create mulitiple credit memos against the same credit memo request.
2. When I change the sales document category of the billing document to O (credit memo), then the system stops me from creating multiple credit memos against the same credit memo request.
If I want to maintain 6 (intercompany credit memo) in VOFA and still want the system to stop me from creating multiple credit memos for the same credit memo request, then is there is any other customizing to achieve this?
Thanks,
ShankarShankar, most likely the billing status of your sales document is not updated. We have experienced the same (or similar?) issue with the intercompany documents and SAP refused to correct it. Here is a fragment of my message exchange with the SAP support:
We have already read the notes 63459 and 308989. They both do not apply
to our business process. The document flow mentioned in the notes is as
follows:
Sales order - customer billing document - intercompany billing document
Our document flow is different:
Contract - customer billing document - Intercompany sales order (could
be more than one order per customer billing document) - intercompany
billing document
The order-related billing status is not being updated on the
Intercompany sales order.
The process described in the notes implies one-to-one relationship
between the customer and inter-company billing documents and the sale
from a Plant that is assigned to another company. We are in the service
industry and sometimes the sale revenue has to be shared by 2-4
companies within our enterprise.
Good day. It is a standard system behaviour that if the billing document type has SD document cateogry '5' (field TVFK-VBTYP in transaction
VOFA). So it is an intercompany billing.
The order-related billing status VBUP-FKSAA is not affected by the
intercompany billing.
So its billing status remains opened, and can be billed more times.
This doesn't seem right to me. Maybe if more customers complain, they will do something about it.
To some extent this may be managed with copy requirements (VOFM), where you can prevent copying the credit memo line items that have been invoiced. However, this might still lead to the blank documents with 0 value, statuses won't be correct and in VF04 you would see the documents as not invoiced.
I had to do a core modification to resolve this issue in our system. In LV45P011 include I did the following:
* Faktura
*{ REPLACE DC6K903001 1
*\ IF vbfa-vbtyp_n CA vbtyp_fakt AND vbfa-vbtyp_n NA vbtyp_fkiv.
IF vbfa-vbtyp_n CA vbtyp_fakt.
*} REPLACE
Hope this helps.
Edited by: Jelena Perfiljeva on Nov 14, 2008 11:09 PM
Maybe you are looking for
-
I have been trying to use my Zagg Folio with my ipad 2 and it works great with all my programs except the Splashtop Remote desk top which allows me to access my mac desktop from anywhere with wireless access. The Zagg Keyboard however will not type o
-
Compiler error for single line if
Hi all, I found an interesting quirk, recently. I've condensed the problem into the following simple test class. public class Main { public static void main(String[] args) { final boolean myBoolean = args.length > 1; if (myBoolean
-
Dear All, In my client side, In periodic processing activity CJ88, getting error that "Sender: WBS OP.SACE.05003114 REFRACTORY MATERIAL" and "Acquisition value negative in area 01". Because of this error we are unable to run for this particular WBS e
-
Omg what kind of pdf file is this?
HI, I have this pdf I downloaded but it seems like none of the text is selectable or editable. this is the file http://adobe.ly/1DPyJXp, it seems like every letter is an separate object or that there are no objects at all in the file?? please someone
-
Please help! I can not back up my iPhone 5S,
When I connect to iTune, my iPhone has sync to step 2 then the message "iTunes could not back up the phone "NAME" because the backup could not be saved on the computer." how can I solve this problem. PS. My iTune run on OSX 10.9 PS2. I have try to d