How to add new line item to SO using BAPI_SALESORDER_CREATEFROMDAT2
Hi,
I have sales order A with 1 line item, now i want to add new line item with material x and quantity y to the existing sales order A
using BAPI_SALESORDER_CREATEFROMDAT2.
Line item no for new line item should be generated by SAP internally.Please let me know the mandatory parameters to be passed to the BAPI to fulfill the requirement.
DATA: order_header TYPE bapisdhd1,
order_inx TYPE bapisdhd1x,
partners TYPE TABLE OF bapiparnr,
wa_partners TYPE bapiparnr.
CLEAR: salesdocument,order_header_inx,wa_in, wa_inx.
REFRESH: item_in, item_inx.
salesdocument = wa_vbup-vbeln.
order_header_inx-updateflag = 'X'.
wa_in-itm_number = ' '.
wa_in-material = p_nmatnr.
wa_in-target_qty = gv_menge - gv_wemng.
APPEND wa_in TO item_in.
wa_inx-itm_number = ' '.
wa_inx-updateflag = 'U'.
wa_inx-target_qty = 'X'.
APPEND wa_inx TO item_inx.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
salesdocumentin = salesdocument
order_header_in = order_header
order_header_inx = order_inx
IMPORTING
salesdocument = salesdocument
TABLES
return = return
order_items_in = item_in
order_items_inx = item_inx
order_partners = partners.
Thanks
Bhuvana
Hello,
You can use FM: BAPI_SALESORDER_CHANGE with update indicator I (insert)
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = l_vbeln
order_header_inx = l_wa_order_header_inx
simulation = l_simulation
tables
return = l_i_return
order_item_in = l_i_order_item
order_item_inx = l_i_order_item_inx
partners = l_i_partners
schedule_lines = l_i_schedule_lines
schedule_linesx = l_i_schedule_linesx
extensionin = l_i_extensionin.
Thanks
Subhankar
Similar Messages
-
How to add new line item to PO using BAPI_PO_CREATE1
Hi,
I have a purchase order with 2 line items, now i want to add new line item to the same PO using BAPI_PO_CREATE1.
Here new line item should be created with reference PR line item.But this PR line item is Dynamic it get generated once the Sales order line item get changed.
Please let me know how can i pass the PR doc no, PR line item no as reference to create the new PO line item.
Thanks
BhuvanaHi,
I think you need to use BAPI: BAPI_PO_GETDETAIL, then BAPI:BAPI_PO_CHANGE.
BAPI_PO_CREATE1 equals ME21N, but adding new line item needs to be done in ME22N.
Cheers, -
How to add new line item using BAPI BAPI_CONTRACT_CHANGE for contract-ME32K
HI Experts,
how to add new line item using BAPI: BAPI_CONTRACT_CHANGE for existing contract.
Requirement:
Already the contract having two line items using ME31K.
Custom program has to add new line items in existing contract.
Thanks,
SendilI got the solution:
We can do like this:
1. Get all details using details, BAPI_CONTRACT_GETDETAIL.
2. After getting results, append new line item. Then use your BAPI.
Check this posting program.. where this bapi is used, use the same coding technique.
IDOC_INPUT_PURCONTRACT_CHANGE -
How to add new line items to FI document
Hi,
When doing a Post Goods Issue From VL02N I need to add a new line item to the posted FI document. BADI AC_DOCUMENT allows you to change the FI document, but it doesn't appear to allow you to add any new lines. In fact the Exporting parameter EX_DOCUMENT-item doesn't even have all of the line item fields like the GL account(hkont). Can the item component be extended to add the other item fields?
Or is it best to use a Business Transaction Event such as Process 1120??
Thanks for any and all advice!
Doug CrabtreeHi Chris,
The $20 difference represents a variance between what is the Material Master standard price and and another price that is maintained because of the current rapidly escalating commodity prices. This amount and cost center to post it to has to be determined dynamically at posting time from VL02N. Finance wants to be able to post this variance to account 40100 to be able to track this. Our FI analyst has determined that this isn't possible using config.
A possible solution is to create a custom program to post an additional FI doc using a BAPI with the additional line item and run it as a periodic job, however a real-time solution would be preferred.
There are BADI's and substitutions to substitute values, but I haven't found any great way to add additional line items. Even several BTE's I have looked at such as PROCESS_00001120 say not to change bseg lines.
Any help or advice would be greatly appreciated. Thanks.
Doug -
How to add new line item based on main item using crm_order_maintain
Hi All,
can you please provide a way to create a new line item based on main line item and save in crm transaction( in house repair order) by using crm_order_maintain(from SAP GUI).
Thanks,
vinod.Hi Vinod,
The relationship with main item is stored with CRMD_ORDERADM_I- Parent.
You need to pass the guid of main item to orderadm_i-parent. This will keep the relationship with main item.
Thanks
Ajay -
Add new line item in existing outbound delivery
Hi,
I am trying to add new line item in existing outbound delivery with material number and quantity.
for this i tried BAPI_OUTB_DELIVERY_CHANGE and LE_MOB_DELIVERY_UPDATE.
but both fm doesn't work and this will not add new line in that delivery.
please help me how can i add new line item in delivery.
I hope someone will help me........plz
ThanksThis kind of question is about to become a FAQ, I think....search the forum for similar questions.
-
To add new Line Items in Accounting Document using BTE
Hi,
We have a requirement to add new GL line items while doing PGI through VL02N. The requirement is as below. Please confirm, if we can use BTE 1120 for this and if yes, how to use it to add new line items.
Orig line items:
Item PK Acct No USD
001 99 12200 565.00
002 81 40000 565.00
New DESIRED line items:
Item PK Acct No USD
001 99 12200 565.00
002 81 40000 565.00
003 91 40000 565.00
004 81 40001 565.00
Regards
SaiHi,
I need to add new line items previously to save the FI document too.
Could you explain how we can use BTE 1120 to change or add new lines, please?
I have done a test but it don't work:
(Function open_fi_perform_00001120_p)
L_BSEG[] = T_BSEG[].
Call to the function that handle the BTE, with L_BSEG[] parameter.
T_BSEG[] = L_BSEG[]. "Note 996552
Then our new values in T_BSEG table are replace for the original table, and our changes are be deleted.
Thanks in advance,
Susana -
Hi All,
My requirement is to add new line items automatically onto the shopping basket based on a main configurable line item addition.
Unfortunately this could not be configured for a variety of reasons.
This has to done after the user clicks on Accept on the config pop-up for this Part and before he returns to the shopping basket.(I believe the CRM_ISA_BASKET_CHANGE would be called at this point)
ISA would pass to the backend the extension values for the new Material to be added and the Main item(config item number) in the function call.
So technically what would be best approach to add new line items and tie it to a parent line item if ISA can send both the values(new Material/Parent Product) in extension table to the backend?
Did someone face this situation before. If yes can you please let me know which methods in the backend were used?
Thanks a lot.Hi,
May I know how did you resolve this problem.
Thanks in advance.
amar.s -
How to add new line in message on my S890
My stock keyboard in Lenovo S890 doesn't have enter key, is this normal ? How to add new line ?
However this happened only in messages, while using whatsapp the enter key present.Hi,
the fact that your question is posted in Order Management section, does the move order automatically generated by OM?
nevertheless, i don't think you should (or allowed, in this case) to add a new line in transact move order. Transact move order only queries (not create records) the move order lines eligible to allocate and transact.
So, I don't see why you need to add a new line in transact move order.
You can, however, add a new line in the allocation of the lines, where for instance, you need to have half of the line allocated to one locator, and the other half to another locator
Thanks -
Add new line item in VA02 by copying same Order line details
Hi All,
I've a requirement where i need to add new line items in the Sales Order (T Code VA02) with reference to the same Order lines . For e.g an Order 80000100 which has 2 line items and the requirement is to create a new line i.e. line item 0030 by copying the details from the existing line item 0010 of the same order .
I've checked the BAPI - BAPI_SALESDOCUMENT_COPY which is for Order Creation T Code VA01 . I'm looking out for Sales Order Change BAPI where i can give the reference as Order no and Order line item which will create a new line item in the same Order with the same details of the reference Order line item .
Do let me know your thoughts !!!!
Thanks,
BintuHi -
Please check these two FM's BAPI_SALESORDER_GETDETAILBOS & BAPI_SALESORDER_CHANGE.
Regards,
Atul Mohanty -
hai Friends , i've some problems, i really don't know how to add new line when typing
ThanksSorry you feel that way. It is still a new platform and is improving with every update. Hopefully the next update will make things better for you then.
If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
If your issue is resolved, don't forget to click the Solution button on the resolution! -
How to add new xml item(BAPI requset)?
Hello
i want to create bom to ERP from mii
how to add new xml item(BAPI requset)?
i use bapi CAD_CREATE_BOM_WITH_SUB_ITEMS
this bapi's format is
<table>
<item>
<col1>1111</col1>
<col2>bbbb</col2>
</item>
</table>
i want to add <item>
like this
<table>
<item>
<col1>1111</col1>
<col2>bbbb</col2>
</item>
<item>
<col1>22222</col1>
<col2>bbbb</col2>
</item>
</table>
how to set trx?
i tryed
SAP_JCo_Interface_0.Request{/CAD_CREATE_BOM_WITH_SUB_ITEMS/TABLES/BOM_ITEM/item[2]/SORTF}
when error occured
use MII12.0
Edited by: Atsushi Iwasaki on May 18, 2010 6:22 AMHi,
You can try this alternative
Step 1) Create XML Document with required structure which you want to pass it to BAPI request.
Step 2) Populate the XML Row with required contents and map it to above created XML document
Step 3) Map above created XML Document to BAPI request (use assign XML option dfrom link editor rather tha assign value)
This will help to map dynamic contents to your BAPI request.
Regards,
Shalaka -
How to insert multiple line items in fv60 using bdc.
Hi all,
How to insert multiple line items in fv60 using bdcshi
chk this
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA : IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_EBELP(30) , V_MENGE(30) , V_WERKS(30), V_EMATN(30) ,
V_PEINH(30).
DATA : FILE TYPE STRING, V_MSG(100) , V_IND(2) TYPE N , FLAG VALUE 'X'.
PARAMETERS: P_FILE(50) TYPE C DEFAULT 'C:\ME21_TEST'.
DATA : BEGIN OF ITAB OCCURS 0,
IND(02),
LIFNR_001(010),
data element: BSART
BSART_002(004),
data element: BEDAT
data element: EKORG
EKORG_004(004),
EKGRP_006(003),
data element: LPEIN
LPEIN_005(001),
data element: EMATNR
EMATN_01_007(018),
data element: EWERK
WERKS_01_008(004),
data element: EPEIN
PEINH_01_009(006),
data element: EWERK
MENGE_01_013(017),
data element: AUFEP
EBELP_014(005),
data element: AUFEP
END OF ITAB.
START-OF-SELECTION.
FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SORT ITAB BY IND.
START-OF-SELECTION.
LOOP AT ITAB.
REFRESH IT_MESSAGES.
<b>V_IND = V_IND + 1.</b>
<b>AT NEW IND.</b>
<b>READ TABLE ITAB INDEX SY-TABIX.</b>
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0100'.
PERFORM BDC_FIELD USING 'EKKO-LIFNR'
ITAB-LIFNR_001.
PERFORM BDC_FIELD USING 'RM06E-BSART'
ITAB-BSART_002.
*perform bdc_field using 'RM06E-BEDAT'
ITAB-BEDAT_003.
PERFORM BDC_FIELD USING 'EKKO-EKORG'
ITAB-EKORG_004.
PERFORM BDC_FIELD USING 'RM06E-LPEIN'
ITAB-LPEIN_005.
PERFORM BDC_FIELD USING 'EKKO-EKGRP'
ITAB-EKGRP_006.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
ENDAT.
<b>PERFORM BDC_DYNPRO USING 'SAPMM06E' '0120'.
CONCATENATE 'EKPO-EMATN(' V_IND ')' INTO V_EMATN.
PERFORM BDC_FIELD USING V_EMATN
ITAB-EMATN_01_007.
CONCATENATE 'EKPO-WERKS(' V_IND ')' INTO V_WERKS.
PERFORM BDC_FIELD USING V_WERKS
ITAB-WERKS_01_008.
CONCATENATE 'EKPO-PEINH(' V_IND ')' INTO V_PEINH.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0120'.
PERFORM BDC_FIELD USING V_PEINH
ITAB-PEINH_01_009.
*CONCATENATE 'EKPO-MENGE(' V_IND ')' INTO V_MENGE.
*perform bdc_dynpro using 'SAPMM06E' '0120'.
*perform bdc_field using V_MENGE
ITAB-MENGE_01_013.
*CONCATENATE 'EKPO-EBELP(' V_IND ')' INTO V_EBELP.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0120'.
PERFORM BDC_FIELD USING 'RM06E-EBELP'
ITAB-EBELP_014.</b>PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
AT END OF IND.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
ENDAT.
CALL TRANSACTION 'ME21' USING IT_BDCDATA MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_MESSAGES.
LOOP AT IT_MESSAGES WHERE MSGTYP = 'E' OR MSGTYP = 'A'.
IF FLAG = 'X'.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = 'GAMY_FAILURE'
HOLDDATE = FILLER8
KEEP = 'X'
USER = SY-UNAME
RECORD = FILLER1
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR FLAG.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'ME21'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
DYNPROTAB = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_MESSAGES-MSGID
LANG = 'EN'
NO = IT_MESSAGES-MSGNR
V1 = IT_MESSAGES-MSGV1
V2 = IT_MESSAGES-MSGV2
V3 = IT_MESSAGES-MSGV3
V4 = IT_MESSAGES-MSGV4
IMPORTING
MSG = V_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
WRITE : / V_MSG.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDLOOP.
IF FLAG NE 'X'.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA. -
How to modify or add new line items to existing BOM?
Hi All-
I have been trying to change Quantity, Valid From Date, Sort String and Item Category of existing BOM components, but only successful in changing Quantity and sort string. I dont know why Valid From date and Item Category are not getting changed. Further, I am not able to add new components (items) to the BOM. Can anyone help me with the coding for the same? I shall def reward the good and helpful answers. I am using the function module, CSAP_MAT_BOM_MAINTAIN. Send me some sample program for understanding.
Thanks
ShakirHi,
Please try to use Explicit Commit work to save the changes.
check if there in any BAPI FM related to this.
Please check the structure you have passed for these fields.
check the Item category for BOM items - POSTP in table T418. if the entry exists then try to add the values again.
Thanks & Regards,
Chandralekha. -
ME21N add new line item when creating a PO
Hi guys,
I am new to badi & oop.
I want to add a PO line item after clicking the save button in ME21n.
I found the BADI IF_PURCHASE_ORDER_MM.
I have coded in the method POST by using method create_item.
However, it still does not work? Any ideas how to use this method to create the new line item or any sample code?
Please help! points will be rewarded.
Many thanks...Hi Sen,
You mean by executing the BAPI call? Maybe you did understand my question wrongly.
What my requirement is that, user will be keying in details for PO and its line item in ME21N.
And upon saving, need to auto add in an additional line to the PO. Eg user key in 3 line items, the BADI/userexit suppose to add a new line item to it.
The bapi that you proposed, creates PO from d scratch right?
I guess it can't just create an PO item with that bapi unfortunately.
Any other help? I need a help in coding this create_item method in interface class IF_PURCHASE_ORDER_MM.
Please help.. I have an urgent requirements.
Many thanks in advance.
Maybe you are looking for
-
Update for RDP 8.1 Windows 7 SP1 changed explorer right click context menu
I have a 4 pcs and 3 nas drive on my network. previous to the update I could view my pcs and nas drives in explorers right pane left click one and access the folders on it. since the update I can no longer do this because "remotedesktopconnection"
-
How to change fonts and background in a finder window?
I have searched all over the system (10.5.4) and can't figure out how to change the font that displays the text in any finder window. I know you used to be able to change the background of any finder window too. I must be getting old! Any ideas?
-
HT4061 when I click on the itunes icon on my desk top it says that it is corrupt or installed wrong
how do i uninstall the itunes on my desk top computer and then reinstall it. when I click on the current itunes icon it says it's corrupt or install wrong but we've been using this icon for quite some time
-
Streaming purchased TV from a friend's account?
My house is well set up with Apple tech. My iTunes library sits on my MacBookPro and I stream media to my Apple TV (2nd Edition). Sometimes I make TV series purchases directly from my Apple TV and watch them as they are streamed from the iCloud. I ha
-
Generic Service error in HCM Processes and Forms
Hi , I have created generic services and they are working fine in the Development system .But when it is moved to testing system , all the services are active. But it still reports that the none of the generic services including the standard SAP deli