BAPI ME_PROCESS_REQ_CUST - invalidate item
Dear SAP,
We are using BADI BAPI ME_PROCESS_REQ_CUST and pretend to flag parameter re_valid as mmpur_rule_invalid, on the method PROCESS_ACCOUNT
or PROCESS_ITEM.
According to note Note 611175 - ME_PROCESS_REQ_CUST: Documentation, we must use method is_valid, but the parameter re_valid has type returning.
How can we invalidate the document item?
Thanks in advance,
Maria João rocha
Try setting BROKEN_RULES.
Sample code.
DATA: lv_object TYPE REF TO object,
lv_attrib TYPE string.
FIELD-SYMBOLS: <fs1> TYPE ANY.
lv_attrib = 'MY_STATE->BROKEN_RULES'.
ASSIGN lv_object->(lv_attrib) TO <fs1>.
SET BIT 2 OF <fs1>.
George Centino
Similar Messages
-
Sales order change BAPI not updating items Profit center
Dear ,
I am facing the problem in using the BAPI for Item 's profit centre in blank space.
I write down the below code <but it's not at all updating the profite centre .
please ccorrect the code if any required'
TYPES: BEGIN OF file_data ,
vbeln TYPE vbap-vbeln, " order numner
posnr TYPE vbap-posnr, " orderitem
profit_ctr TYPE vbap-prctr, " [profite centre
END OF file_data.
DATA: t_data TYPE STANDARD TABLE OF file_data .
DATA : wa_data LIKE LINE OF t_data.
DATA: t_data_item TYPE STANDARD TABLE OF file_data .
DATA : wa_data_item LIKE LINE OF t_data_item.
**DATA: t_data_item TYPE file_data OCCURS 0.
*DATA: return TYPE STANDARD TABLE OF bapiret2.
*DATA: wa_return LIKE LINE OF return.
DATA: wait LIKE bapita-wait VALUE 'X'.
DATA: s_order_header_in LIKE bapisdh1.
DATA: s_order_header_inx LIKE bapisdh1x.
DATA: BEGIN OF i_order_item_in OCCURS 0.
INCLUDE STRUCTURE bapisditm.
DATA: END OF i_order_item_in.
DATA: BEGIN OF i_order_item_inx OCCURS 0.
INCLUDE STRUCTURE bapisditmx.
DATA: END OF i_order_item_inx.
DATA: BEGIN OF it_return OCCURS 0.
INCLUDE STRUCTURE bapiret2.
DATA: END OF it_return.
***********************selection
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS : file LIKE rlgrap-filename OBLIGATORY.
"ctu_mode TYPE ctu_mode DEFAULT 'N'.
SELECTION-SCREEN END OF BLOCK b1.
*********assign file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CLEAR file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = file
EXCEPTIONS
OTHERS = 1.
DATA: it_text TYPE truxs_t_text_data .
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = it_text
i_filename = file
TABLES
i_tab_converted_data = t_data[] " Your internal table of structure of Excel sheet
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
t_data_item[] = t_data[].
DELETE ADJACENT DUPLICATES FROM t_data COMPARING vbeln.
Header update indicator
s_order_header_inx-updateflag = 'U'.
Line items
REFRESH: i_order_item_in, i_order_item_inx.
LOOP AT t_data INTO wa_data.
LOOP AT t_data_item INTO wa_data_item WHERE vbeln = wa_data-vbeln. .
i_order_item_in-itm_number = wa_data_item-posnr.
i_order_item_in-profit_ctr = wa_data_item-profit_ctr.
i_order_item_inx-itm_number = wa_data_item-posnr.
i_order_item_inx-updateflag = 'U'.
i_order_item_inx-profit_ctr = 'X'.
APPEND: i_order_item_in, i_order_item_inx.
ENDLOOP.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_data-vbeln
IMPORTING
output = wa_data-vbeln.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = wa_data-vbeln
order_header_in = s_order_header_in
order_header_inx = s_order_header_inx
behave_when_error = 'P'
TABLES
return = it_return
order_item_in = i_order_item_in
order_item_inx = i_order_item_inx.i already used same But it's not working
s_order_header_inx-updateflag = 'U'.
Line items
REFRESH: i_order_item_in, i_order_item_inx.
LOOP AT t_data INTO wa_data.
LOOP AT t_data_item INTO wa_data_item WHERE vbeln = wa_data-vbeln. .
BAPISDITM
i_order_item_in-itm_number = wa_data_item-posnr.
i_order_item_in-profit_ctr = wa_data_item-profit_ctr.
BAPISDITMX
i_order_item_inx-itm_number = wa_data_item-posnr.
i_order_item_inx-updateflag = 'U'.
i_order_item_inx-profit_ctr = 'X'.
APPEND: i_order_item_in, i_order_item_inx.
ENDLOOP.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_data-vbeln
IMPORTING
output = wa_data-vbeln.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = wa_data-vbeln
order_header_in = s_order_header_in
order_header_inx = s_order_header_inx
behave_when_error = 'P'
TABLES
return = it_return
order_item_in = i_order_item_in
order_item_inx = i_order_item_inx. -
How to pass the condition vallues in bapi BAPI_PO_CREATE1 for items as well
HI,
where to pass the condition value table in bapi BAPI_PO_CREATE1 item level as well as header level
Like Frieght charges,discounts, basic price ,VAT,CST etc.
Is there any BAPI for GR tcode MIGO.
Pl send along with simple examples .
Your answeres will be rewarded.Pass the condition value to the following parameters.
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
For GR u case use the following BAPI.
GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order
02 - MB31 - Goods Receipts for Prod Order
03 - MB1A - Goods Issue
04 - MB1B - Transfer Posting
05 - MB1C - Enter Other Goods Receipt
06 - MB11
Domain: KZBEW - Movement Indicator
Goods movement w/o reference
B - Goods movement for purchase order
F - Goods movement for production order
L - Goods movement for delivery note
K - Goods movement for kanban requirement (WM - internal only)
O - Subsequent adjustment of "material-provided" consumption
W - Subsequent adjustment of proportion/product unit material
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gmhead
goodsmvt_code = gmcode
* TESTRUN = ' '
IMPORTING
goodsmvt_headret = mthead
* MATERIALDOCUMENT =
MATDOCUMENTYEAR =
tables
goodsmvt_item = itab
GOODSMVT_SERIALNUMBER =
return = errmsg. -
BAPI to modify items and create new ones in Purchase Order
Hi, everybody!
We need to change purchase orders (PO's) using a BAPI.
We need not only to modify and delete the existing items in a PO, but also create new
items in the same PO. Is it possible to do that using the bapi called BAPI_PO_CHANGE?
If it isn't so, which BAPI should we use?
Could anybody help us?
Thanks in advanceHi
Use the Function module BAPI_PO_CHANGE. This BAPI changes the existing line and also will append new lines to the existing POs.
The other mandatory part is to populate the Change Parameter tables too.
Hope this answers your question.
Raj. -
BAPI to add items before document creation in FI
Hello!!
I need to add 2 items to a document that is being created in transactions FB01 or f-53 (but, hasn't been created yet). I need to know if there is a bapi that I can call in an User Exit before the document is created?....
Thanks.,
Marina MoraHi Mora ,
which Version of SAP u are using ?, based on that we can add value.
Regards
Peram -
BAPI to add item and its net price while creating opportunity
is there any BAPI/FM through which i can add item and its net value to opportunity in CRM.
Kindly help.
Regards
Sachin YadavYou can give a try with Customer Function like EXIT_SAPLMCB1_001
-
Hey, is there a BAPI that returns the line items of a given account and a time frame?
Hi,
BAPI_USER_EXIST may help u
Cheers,
Chaitanya. -
BAPI creating incorrect Item Texts
Hi all
I've got a problem where sales orders and credit notes get created via BAPIs but sometimes an item text from the previously created record appears on the following record.
Background
The process is as follows:
1. XI creates a bunch of IDocs containing a mixture of sales order and credit memo doc types
2. These are all processed in one go within a custom function module
3. For Credit notes the BAPI 'BAPI_SALESDOCU_CREATEFROMDATA' is used, if this is successful then the item texts are processed which basically involves adding an item text to the last item. This is done using the SAVE_TEXT function. If there is more than one item the first to penultimate items do not have texts.
4. For other doc types (standard orders, forward orders, paid), function 'SD_SALESDOCUMENT_CREATE' is run in test mode so that a credit check can be performed in advance of creating the document - the sales_text table is populated. If the credit check passes then the order is created using BAPI 'BAPI_SALESORDER_CREATEFROMDAT2'. The texts are created vai the BAPI by populating the order_text table.
5. The next Idoc is then processed.
Five times since this went live (about 18 months ago) a Credit Note has been created where the first item on it has the item text from the previous sales order
What I've done so far
1. I've reviewed the code to make sure variables are being cleared - they are
2. I've run data through the system and stepped through it in debug mode - it works fine
3. Our QAS box was restored from PRD recently so contains some of these incorrect documents. I've re-run the exact same batch that casued the incorrect documents - they are all created correctly
4. I've trawled through SAP Notes and this forum
The fact that the problem is not replicable suggests to me that both the data coming in and the bespoke function module are OK. I'm not sure why the different methods have been used for the different doc types but I wonder if this is what's causing the problem, maybe memory is not being cleared or something.
Any pointers, thoughts, solutions or other genreal musings would be greatly appreciated!
Thanks
AndyHi Andy
Although you have mentioned that, you have checked whether variables are cleared, but from the issue it looks like there must be some variable that does not gets cleared.....i would suggest you to debug once again and check this out.....it might help.
regards
Lokesh -
Is there any bapi for giving item details if we pass delivery order number
hi experts,
please provide me with any bapi or funcitonmodule which gives item details by passing it delivery order number.
raju.sYou can pass the Delivery Order Number to the table LIPS (SD document: Delivery: Item data) in SE11 or SE16. This will give the Delivery Item Details.
Regards
Gopi -
Importing SAP BAPI as Generated Item - String Object
Am new to BizTalk, working on BT 2013 using Visual Studio 2012. Am adding a "generated item" for Z_BAPI_SALESORDER_CHANGE (using the "Consume Adapter Service" dialog) and am receiving the message below. Our ABAP programmer tells me it's
type STRING which is causing the issue, but STRING is supposed to be an acceptable type (here: http://msdn.microsoft.com/en-us/library/dd787893%28v=bts.80%29.aspx). What am I missing?
Appreciate the help!
Microsoft.ServiceModel.Channels.Common.MetadataException: Retrieval of Type Metadata has failed while building WSDL at 'SAPTABLE/ZSSM_SO_HEADER_IN_CHANGE'
---> Microsoft.ServiceModel.Channels.Common.MetadataException: The SAP system returned error: Details: ErrorCode=RFC_EXCEPTION. ErrorGroup=RFC_ERROR_APPLICATION_EXCEPTION. SapErrorMessage=UNSUPPORTED_TYPE. AdapterErrorMessage=The RfcGetStructureInfoAsTable
API returned the error code 2 when obtaining metadata for the type ZSSM_SO_HEADER_IN_CHANGE. Check the RFC SDK trace files for details.. when trying to retrieve metadata for table: ZSSM_SO_HEADER_IN_CHANGE.Is it possible that your table is an ITAB II type table?
Because that is not supported by the SAP Adapter in BizTalk, see the limitations list
http://msdn.microsoft.com/library/dd787849(BTS.10).aspx
Glenn Colpaert - MCTS BizTalk Server - Blog : http://blog.codit.eu -
Characteristics for Item of a Order in BAPI
Hi,
My requirement is to create a return sales order using a BAPI from a inbound file for AFS Material.
I am using BAPI BAPI_CUSTOMERRETURN_CREATE which has interface almost same as any other Sales Order creation BAPI.
When a AFS material data is entered in the sales order creation Transaction (VA01) we have option for Matrix Entry.
In my current system,
certain materials are configured to have characteristics XS, S, M.
Some MAterials have charectricits XS, SM, MD, LG, XL.
eg :
WE craete a BAPI with 2 items one with the first material and second with the second material.
We enter first material XS = 1, and M = 1 and thus total quantity in the first item = 2.
We enter Second material XS = 1, SM = 1, LG = 1, XL = 1 and thus total quantity in the first item = 4.
Coming back to my requirement I need to pass the above characteristics values into teh BAPI when I create a sales order so that the sales order thus created has items with the characteristics as mentioend above.
CAN ANYONE PLEASE HELP ME IN ACHIEVING THIS. "CREATE SALES ORDER WITH CHARACTERISTICS VALUES FOR ITEMS (QUANTITY) USING BAPI".Hi,
My requirement is to create a return sales order using a BAPI from a inbound file for AFS Material.
I am using BAPI BAPI_CUSTOMERRETURN_CREATE which has interface almost same as any other Sales Order creation BAPI.
When a AFS material data is entered in the sales order creation Transaction (VA01) we have option for Matrix Entry.
In my current system,
certain materials are configured to have characteristics XS, S, M.
Some MAterials have charectricits XS, SM, MD, LG, XL.
eg :
WE craete a BAPI with 2 items one with the first material and second with the second material.
We enter first material XS = 1, and M = 1 and thus total quantity in the first item = 2.
We enter Second material XS = 1, SM = 1, LG = 1, XL = 1 and thus total quantity in the first item = 4.
Coming back to my requirement I need to pass the above characteristics values into teh BAPI when I create a sales order so that the sales order thus created has items with the characteristics as mentioend above.
CAN ANYONE PLEASE HELP ME IN ACHIEVING THIS. "CREATE SALES ORDER WITH CHARACTERISTICS VALUES FOR ITEMS (QUANTITY) USING BAPI". -
Function or bapi returning customers or vendors with open items per plant
Dear experts.
may you please tell me which function or bapi can i use that will return all customers or vendors with open items per given plant. i have tried to use BAPI_AR_ACC_GETOPENITEMS and BAPI_AP_ACC_GETOPENITEMS but they return open items for a given customer and vendor respectively per given company code.ok but those 2 BAPIs return open items after providing the customer or vendor. what i need is a BAPI which returns a list of customers or vendors with open items
-
Bapi for creating purchase order
hi, iam using BAPI_PO_CREATE1 to create PO's for service. after creating opne PO if i go and create another po within a short span of a minute or so then it does not create the second PO. it gives message that doc does not contain any items.
TABLES: ekpo,zcta_podates,ekko.
DATA iekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.
DATA iekko LIKE ekko OCCURS 0 WITH HEADER LINE.
DATA ipodates LIKE zcta_podates OCCURS 0 WITH HEADER LINE.
DATA : wabldat1 LIKE zcta_podates-podat.
DATA : wabldat2 LIKE zcta_podates-podat.
DATA : wabldat3 LIKE zcta_podates-podat.
DATA : wabldat4 LIKE zcta_podates-podat.
DATA : wabldat5 LIKE zcta_podates-podat.
DATA : wabldat6 LIKE zcta_podates-podat.
DATA : wabldat7 LIKE zcta_podates-podat.
DATA :fname1 TYPE string.
DATA :w_fname1 TYPE string.
DATA : BEGIN OF itab1 OCCURS 0 ,
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(15),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
val3(10),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzcity LIKE ekpo-zzcity,
zzlangu LIKE ekpo-zzlangu,
zzedition LIKE ekpo-zzedition,
zzcolorhue LIKE ekpo-zzcolorhue,
zztypeofad LIKE ekpo-zztypeofad,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab1.
DATA :BEGIN OF itab2 OCCURS 0, " radio
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzcity LIKE ekpo-zzcity,
zzprogramname LIKE ekpo-zzprogramname,
zzdealstructure LIKE ekpo-zzdealstructure,
zztimeband LIKE ekpo-zztimeband,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab2.
DATA :BEGIN OF itab3 OCCURS 0, "tv
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzgenre LIKE ekpo-zzgenre,
zzprogramname LIKE ekpo-zzprogramname,
zzdealstructure LIKE ekpo-zzdealstructure,
zztimeband LIKE ekpo-zztimeband,
zzlangu LIKE ekpo-zzlangu,
zzcity(20), " LIKE ekpo-zzcity,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab3.
DATA :BEGIN OF itab4 OCCURS 0, "OUTDOOR
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
cond(12),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzcity LIKE ekpo-zzcity,
zzlocationorroad LIKE ekpo-zzlocationorroad,
zztypeofad LIKE ekpo-zztypeofad,
zztrafficdirtn LIKE ekpo-zztrafficdirtn,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab4.
DATA :BEGIN OF itab5 OCCURS 0, "INTERNET
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
cond(12),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zztypeofad LIKE ekpo-zztypeofad,
zzsection LIKE ekpo-zzsection,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab5.
DATA :BEGIN OF itab6 OCCURS 0, "CINEMA
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
cond(12),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzcity LIKE ekpo-zzcity,
zzlocationorroad LIKE ekpo-zzlocationorroad,
zzcinemaname LIKE ekpo-zzcinemaname,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab6.
DATA :BEGIN OF itab7 OCCURS 0, "OTHER MEDIA
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
val3(10),
val4(10),
zzformat LIKE ekpo-zzformat,
zcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzcity LIKE ekpo-zzcity,
zzedition LIKE ekpo-zzedition,
zzcolorhue LIKE ekpo-zzcolorhue,
zztypeofad LIKE ekpo-zztypeofad,
zzlangu LIKE ekpo-zzlangu,
zzgenre LIKE ekpo-zzgenre,
zzprogramname LIKE ekpo-zzprogramname,
zzdealstructure LIKE ekpo-zzdealstructure,
zztimeband LIKE ekpo-zztimeband,
zzlocationorroad LIKE ekpo-zzlocationorroad,
zzsection LIKE ekpo-zzsection,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab7.
DATA :BEGIN OF itab8 OCCURS 0, "NO MEDIA
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
qty(12),
gross(12),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzcity LIKE ekpo-zzcity,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab8.
DATA : BEGIN OF str OCCURS 0,
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(15),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
val3(10),
val4(10),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzcity LIKE ekpo-zzcity,
zzlangu LIKE ekpo-zzlangu,
zzedition LIKE ekpo-zzedition,
zzcolorhue LIKE ekpo-zzcolorhue,
zztypeofad LIKE ekpo-zztypeofad,
zzillumination LIKE ekpo-zzillumination ,
zztrafficdirtn LIKE ekpo-zztrafficdirtn ,
zzstore LIKE ekpo-zzstore ,
zzcasting LIKE ekpo-zzcasting ,
zzgenre LIKE ekpo-zzgenre ,
zzsection LIKE ekpo-zzsection ,
zznumberofdays LIKE ekpo-zznumberofdays ,
zzprogramname LIKE ekpo-zzprogramname ,
zzdealstructure LIKE ekpo-zzdealstructure ,
zztimeband LIKE ekpo-zztimeband ,
zzdate LIKE ekpo-zzdate ,
zzdaysofwk LIKE ekpo-zzdaysofwk ,
zzasnum LIKE ekpo-zzasnum ,
zzlocationorroad LIKE ekpo-zzlocationorroad ,
zzcinemaname LIKE ekpo-zzcinemaname ,
zzcapacity LIKE ekpo-zzcapacity ,
zzfield2 LIKE ekpo-zzfield2 ,
zzfield3 LIKE ekpo-zzfield3 ,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF str.
DATA :package(10) TYPE n VALUE '4747'.
DATA :subpackage(10) TYPE n VALUE '4748'.
DATA : l_po_header LIKE bapimepoheader.
DATA : l_po_headerx LIKE bapimepoheaderx.
DATA : l_purchaseorder LIKE bapimepoheader-po_number.
DATA : t_po_account LIKE bapimepoaccount OCCURS 0 WITH HEADER LINE.
DATA : t_po_accountx LIKE bapimepoaccountx OCCURS 0 WITH HEADER LINE.
DATA : t_po_servalue LIKE bapiesklc OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF t_po_items OCCURS 0.
INCLUDE STRUCTURE bapimepoitem.
DATA : END OF t_po_items.
DATA : BEGIN OF t_po_itemsx OCCURS 0.
INCLUDE STRUCTURE bapimepoitemx.
DATA : END OF t_po_itemsx.
DATA : BEGIN OF t_return OCCURS 0.
INCLUDE STRUCTURE bapiret2.
DATA : END OF t_return.
DATA : BEGIN OF t_po_services OCCURS 0.
INCLUDE STRUCTURE bapiesllc.
DATA : END OF t_po_services.
DATA: l_item(5) TYPE n,l_last_po(10).
*TABLES : zerror.
DATA lcounter(3) TYPE n.
DATA : l_errflag.
SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME.
PARAMETER:x_lifnr LIKE ekko-lifnr .
PARAMETER:x_ekorg LIKE ekko-ekorg DEFAULT '9000' .
PARAMETER:x_ekgrp LIKE ekko-ekgrp .
PARAMETER:x_bukrs LIKE ekko-bukrs DEFAULT '0101' .
PARAMETER:x_bsart LIKE ekko-bsart DEFAULT 'ZNB1'.
PARAMETER:x_sdate LIKE ekko-bedat.
PARAMETER : x_edate LIKE ekko-bedat.
PARAMETER: pr_fn1 LIKE ibipparms-path OBLIGATORY.
PARAMETER: rad1 RADIOBUTTON GROUP gr1.
PARAMETER: rad2 RADIOBUTTON GROUP gr1.
PARAMETER: rad3 RADIOBUTTON GROUP gr1.
PARAMETER: rad4 RADIOBUTTON GROUP gr1.
PARAMETER: rad5 RADIOBUTTON GROUP gr1.
PARAMETER: rad6 RADIOBUTTON GROUP gr1.
PARAMETER: rad7 RADIOBUTTON GROUP gr1.
PARAMETER: rad8 RADIOBUTTON GROUP gr1.
SELECTION-SCREEN:END OF BLOCK b1 .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pr_fn1.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = pr_fn1.
MOVE pr_fn1 TO w_fname1.
START-OF-SELECTION.
IF rad1 = 'X'.
PERFORM table_upload TABLES itab1.
ELSEIF rad2 = 'X'.
PERFORM table_upload TABLES itab2.
ELSEIF rad3 = 'X'.
PERFORM table_upload TABLES itab3.
ELSEIF rad4 = 'X'.
PERFORM table_upload TABLES itab4.
ELSEIF rad5 = 'X'.
PERFORM table_upload TABLES itab5.
ELSEIF rad6 = 'X'.
PERFORM table_upload TABLES itab6.
ELSEIF rad7 = 'X'.
PERFORM table_upload TABLES itab7.
ELSEIF rad8 = 'X'.
PERFORM table_upload TABLES itab8.
ENDIF.
LOOP AT str.
SHIFT str-srvpos RIGHT DELETING TRAILING ' '.
OVERLAY str-srvpos WITH '00000000000000000'.
MODIFY str.
ENDLOOP.
CLEAR : l_po_header.
PERFORM create_po_header.
LOOP AT str FROM 2 .
PERFORM append_item.
ENDLOOP.
PERFORM create_po.
WAIT UP TO 5 SECONDS.
SELECT * FROM ekpo INTO CORRESPONDING FIELDS OF TABLE iekpo WHERE ebeln = l_purchaseorder.
COMMIT WORK.
WAIT UP TO 5 SECONDS.
LOOP AT iekpo.
l_item = sy-tabix + 1.
READ TABLE str INDEX l_item.
iekpo-zzfield2 = str-zzfield2 .
iekpo-zzfield3 = str-zzfield3 .
iekpo-zzformat = str-zzformat .
iekpo-zzmeansofad = str-zzmeansofad .
iekpo-zzedition = str-zzedition .
iekpo-zzcolorhue = str-zzcolorhue .
iekpo-zztypeofad = str-zztypeofad .
iekpo-zzcity = str-zzcity .
iekpo-zzlangu = str-zzlangu .
iekpo-zzdaysofwk = str-zzdaysofwk .
iekpo-zzasnum = str-zzasnum .
iekpo-zzlocationorroad = str-zzlocationorroad .
iekpo-zzcinemaname = str-zzcinemaname .
iekpo-zzcapacity = str-zzcapacity .
iekpo-zzcampaign = str-zzcampaign .
iekpo-zzillumination = str-zzillumination .
iekpo-zztrafficdirtn = str-zztrafficdirtn .
iekpo-zzstore = str-zzstore .
iekpo-zzcasting = str-zzcasting .
iekpo-zzgenre = str-zzgenre .
iekpo-zzsection = str-zzsection .
iekpo-zznumberofdays = str-zznumberofdays .
iekpo-zzprogramname = str-zzprogramname .
iekpo-zzdealstructure = str-zzdealstructure .
iekpo-zztimeband = str-zztimeband .
iekpo-zzdate = str-zzdate .
MODIFY iekpo.
ENDLOOP.
WAIT UP TO 2 SECONDS.
COMMIT WORK.
WAIT UP TO 15 SECONDS.
UPDATE ekpo FROM TABLE iekpo.
COMMIT WORK.
WAIT UP TO 2 SECONDS.
SELECT * FROM ekko INTO CORRESPONDING FIELDS OF TABLE iekko WHERE ebeln = l_purchaseorder.
LOOP AT iekko.
iekko-kdatb = x_sdate.
iekko-kdate = x_edate.
MODIFY iekko.
ENDLOOP.
UPDATE ekko FROM TABLE iekko.
COMMIT WORK.
WAIT UP TO 1 SECONDS.
CLEAR l_item.
l_item = 10.
LOOP AT str FROM 2 .
CONCATENATE str-date1+6(4) str-date1+3(2) str-date1(2) INTO wabldat1.
CONCATENATE str-date2+6(4) str-date2+3(2) str-date2(2) INTO wabldat2.
CONCATENATE str-date3+6(4) str-date3+3(2) str-date3(2) INTO wabldat3.
CONCATENATE str-date4+6(4) str-date4+3(2) str-date4(2) INTO wabldat4.
CONCATENATE str-date5+6(4) str-date5+3(2) str-date5(2) INTO wabldat5.
CONCATENATE str-date6+6(4) str-date6+3(2) str-date6(2) INTO wabldat6.
CONCATENATE str-date7+6(4) str-date7+3(2) str-date7(2) INTO wabldat7.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '001'.
ipodates-podat = wabldat1.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '002'.
ipodates-podat = wabldat2.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '003'.
ipodates-podat = wabldat3.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '004'.
ipodates-podat = wabldat4.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '005'.
ipodates-podat = wabldat5.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '006'.
ipodates-podat = wabldat6.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '007'.
ipodates-podat = wabldat7.
APPEND ipodates.
l_item = l_item + 10.
ENDLOOP.
WAIT UP TO 1 SECONDS.
MODIFY zcta_podates FROM TABLE ipodates.
COMMIT WORK.
WAIT UP TO 2 SECONDS.
ipodates-podat,ipodates-ebeln,ipodates-ebelp,ipodates-linno.
WAIT UP TO 5 SECONDS.
LOOP AT t_return.
WRITE :/ t_return-message.
ENDLOOP.
free : ipodates,iekpo,str,itab1,itab2,itab3,itab4,itab5,itab6,itab7,itab8.
*& Form create_po_header
FORM create_po_header .
l_po_header-comp_code = '0101'. " Company Code
l_po_header-doc_type = x_bsart. "'ZNB1'. " Order Typr BSART
l_po_header-creat_date = sy-datum. " P.O Dt - BEDAT
l_po_header-doc_date = sy-datum.
l_po_header-vendor = x_lifnr.
l_po_header-vper_start = x_sdate.
l_po_header-vper_end = x_edate.
l_po_header-purch_org = '9000'. " Purch. Org - EKKO-EKORG
l_po_header-pur_group = x_ekgrp. " Purch Group - EKKO-EKGRP
l_po_header-currency_iso = 'INR'.
CLEAR : l_po_headerx.
l_po_headerx-po_number = 'X'.
l_po_headerx-comp_code = 'X'." Company Code
l_po_headerx-doc_type = 'X'. " Order Typr BSART
l_po_headerx-vendor = 'X'. "Vendor - EKKO-LIFNR
l_po_headerx-purch_org = 'X'. " Purch. Org - EKKO-EKORG
l_po_headerx-pur_group = 'X'. " Purch Group - EKKO-EKGRP
l_po_headerx-currency_iso = 'X'. " Currency Default field for Enjoy
l_po_headerx-ref_1 = 'X'.
ENDFORM. " create_po_header
*& Form APPEND_ITEM
FORM append_item .
package = package + 2.
subpackage = package + 1.
l_item = l_item + 10.
t_po_items-po_item = l_item.
t_po_items-acctasscat = 'K'.
t_po_items-item_cat = 'D'.
t_po_items-short_text = str-txz01. .
t_po_items-plant = str-werks . " P
t_po_items-tax_code = 'S1'.
t_po_items-pckg_no = package. " 4748. "package.
APPEND t_po_items.
CLEAR t_po_items.
t_po_itemsx-po_item = l_item.
t_po_itemsx-po_itemx = 'X'.
t_po_itemsx-acctasscat = 'X'.
t_po_itemsx-item_cat = 'X'.
t_po_itemsx-short_text = 'X'.
t_po_itemsx-plant = 'X'.
t_po_itemsx-tax_code = 'X'.
t_po_itemsx-pckg_no = 'X'.
APPEND t_po_itemsx.
CLEAR t_po_itemsx.
t_po_account-po_item = l_item.
t_po_account-serial_no = 1.
t_po_account-quantity = 1.
t_po_account-distr_perc = '00'.
t_po_account-costcenter = '0006079000'. " 'BR034'.
t_po_account-gl_account = '0054014071'. "'0000135075'.
t_po_account-co_area = '1001'.
APPEND t_po_account.
CLEAR t_po_account.
t_po_accountx-po_item = l_item.
t_po_accountx-serial_no = 1.
t_po_accountx-quantity = 'X'.
t_po_accountx-distr_perc = 'X'.
t_po_accountx-costcenter = 'X'.
t_po_accountx-gl_account = 'X'.
t_po_accountx-co_area = 'X'.
APPEND t_po_accountx.
CLEAR t_po_accountx.
t_po_services-pckg_no = package. "'4748'.
t_po_services-line_no = '0000000001' .
t_po_services-ext_line = '0000000000' .
t_po_services-outl_level = '0'.
t_po_services-outl_no = ' '.
t_po_services-outl_ind = 'X'.
t_po_services-subpckg_no = subpackage . "'4749'.
APPEND t_po_services. CLEAR t_po_services .
t_po_services-pckg_no = subpackage . "'4749'.
t_po_services-line_no = '0000000002' .
t_po_services-ext_line = '10' .
t_po_services-outl_level = '0'.
t_po_services-service = str-srvpos. "'000000000003000045'.
t_po_services-gr_price = str-gross. "'2000.00'.
t_po_services-form_val1 = str-val1. "'10.000'.
t_po_services-form_val2 = str-val2. "'33.000'.
if rad1 = 'x'.
t_po_services-form_val3 = str-val3. " '3.000'.
endif.
t_po_services-tax_code = 'S1'.
APPEND t_po_services. CLEAR t_po_services .
t_po_servalue-pckg_no = subpackage . "'4749'.
t_po_servalue-line_no = '0000000002' .
t_po_servalue-serial_no = '01'.
APPEND t_po_servalue . CLEAR t_po_servalue.
ENDFORM. " APPEND_ITEM
*& Form create_po
FORM create_po .
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = l_po_header
poheaderx = l_po_headerx
IMPORTING
exppurchaseorder = l_purchaseorder
TABLES
return = t_return
poitem = t_po_items
poitemx = t_po_itemsx
poaccount = t_po_account
poaccountx = t_po_accountx
poservices = t_po_services
posrvaccessvalues = t_po_servalue
WAIT UP TO 15 SECONDS.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
ENDFORM. " create_po
*& Form TABLE_UPLOAD
FORM table_upload TABLES p_itab1. " structure < itab1 #local# >
"Insert correct name for <...>.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = w_fname1
filetype = 'ASC'
has_field_separator = 'X'
read_by_line = 'X'
replacement = '#'
TABLES
data_tab = p_itab1.
LOOP AT p_itab1.
MOVE-CORRESPONDING p_itab1 TO str.
APPEND str.
CLEAR p_itab1.
ENDLOOP.
* WAIT UP TO 5 SECONDS.
ENDFORM. " TABLE_UPLOADHi,
Check this sample code..how to use the BAPI_PO_CREATE1.
REPORT Z_TEST_PO .
*DATA DECLARATION
CONSTANTS : C_X VALUE 'X'.
*Structures to hold PO header data
DATA : HEADER LIKE BAPIMEPOHEADER ,
HEADERX LIKE BAPIMEPOHEADERX .
*Structures to hold PO account data
DATA : ACCOUNT LIKE BAPIMEPOACCOUNT OCCURS 0 WITH HEADER LINE ,
ACCOUNTX LIKE BAPIMEPOACCOUNTX OCCURS 0 WITH HEADER LINE .
*Internal Tables to hold PO ITEM DATA
DATA : ITEM LIKE BAPIMEPOITEM OCCURS 0 WITH HEADER LINE,
ITEMX LIKE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE,
*Internal table to hold messages from BAPI call
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
*Internal table to hold messages from BAPI call
POCONTRACTLIMITS LIKE BAPIESUCC OCCURS 0 WITH HEADER LINE.
DATA : W_HEADER(40) VALUE 'PO Header',
PURCHASEORDER LIKE BAPIMEPOHEADER-PO_NUMBER,
DELIVERY_DATE LIKE BAPIMEPOSCHEDULE-DELIVERY_DATE.
DATA : WS_LANGU LIKE SY-LANGU.
*text-001 = 'PO Header' - define as text element
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : COMPANY LIKE HEADER-COMP_CODE DEFAULT '122' ,
DOCTYP LIKE HEADER-DOC_TYPE DEFAULT 'NB' ,
CDATE LIKE HEADER-CREAT_DATE DEFAULT SY-DATUM ,
VENDOR LIKE HEADER-VENDOR DEFAULT '2000000012' ,
PUR_ORG LIKE HEADER-PURCH_ORG DEFAULT 'PU01' ,
PUR_GRP LIKE HEADER-PUR_GROUP DEFAULT '005' .
*sociedad like HEADER-COMP_CODE default '122' ,
*vendedor like HEADER-SALES_PERS default 'sale person'.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS : ITEM_NUM LIKE ITEM-PO_ITEM DEFAULT '00010',
MATERIAL LIKE ITEM-MATERIAL DEFAULT '12000000' ,
TIPO_IMP LIKE ITEM-ACCTASSCAT DEFAULT 'K' ,
*pos_doc like ITEM-ITEM_CAT default 'F' ,
SHORTTXT LIKE ITEM-SHORT_TEXT DEFAULT 'PRUEBA BAPI' ,
GRUP_ART LIKE ITEM-MATL_GROUP DEFAULT '817230000' ,
PLANT LIKE ITEM-PLANT DEFAULT '3001' ,
MPE LIKE ITEM-TRACKINGNO DEFAULT '9999' ,
*contrato like ITEM-AGREEMENT default '4904000003' ,
*quantity like ITEM-QUANTITY default 1 .
PO_UNIT LIKE ITEM-PO_UNIT DEFAULT 'EA'.
SELECTION-SCREEN END OF BLOCK B2.
* Par?mnetros de imputaci?n
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-004.
PARAMETERS : CENTRO LIKE ACCOUNT-COSTCENTER DEFAULT '1220813150',
CUENTA LIKE ACCOUNT-GL_ACCOUNT DEFAULT '6631400' ,
NUM_POS LIKE ACCOUNT-PO_ITEM DEFAULT '10' ,
SERIAL LIKE ACCOUNT-SERIAL_NO DEFAULT '01' ,
IND_IMP LIKE ACCOUNT-TAX_CODE DEFAULT 'I2' .
SELECTION-SCREEN END OF BLOCK B3.
START-OF-SELECTION.
*DATA POPULATION
WS_LANGU = SY-LANGU. "Language variable
*POPULATE HEADER DATA FOR PO
*HEADER-COMP_CODE = sociedad .
HEADER-DOC_TYPE = DOCTYP .
HEADER-VENDOR = VENDOR .
HEADER-CREAT_DATE = CDATE .
HEADER-CREATED_BY = 'TD17191' .
HEADER-PURCH_ORG = PUR_ORG .
HEADER-PUR_GROUP = PUR_GRP .
HEADER-COMP_CODE = COMPANY .
HEADER-LANGU = WS_LANGU .
*HEADER-SALES_PERS = vendedor .
*HEADER-CURRENCY = 'DOP' .
*HEADER-ITEM_INTVL = 10 .
*HEADER-PMNTTRMS = 'N30' .
*HEADER-EXCH_RATE = 1 .
*POPULATE HEADER FLAG.
HEADERX-COMP_CODE = C_X.
HEADERX-DOC_TYPE = C_X.
HEADERX-VENDOR = C_X.
HEADERX-CREAT_DATE = C_X.
HEADERX-CREATED_BY = C_X.
HEADERX-PURCH_ORG = C_X.
HEADERX-PUR_GROUP = C_X.
HEADERX-LANGU = C_X.
*HEADERX-sales_pers = c_x.
*HEADERX-CURRENCY = c_x.
*HEADER-ITEM_INTVL = c_x.
*HEADER-PMNTTRMS = c_x.
*HEADER-EXCH_RATE = c_x.
*HEADER-EXCH_RATE = c_x.
*POPULATE ITEM DATA.
ITEM-PO_ITEM = ITEM_NUM.
ITEM-QUANTITY = '1'.
*ITEM-MATERIAL = material .
ITEM-SHORT_TEXT = 'prueba bapi_po_create1'.
*ITEM-TAX_CODE = ''.
ITEM-ACCTASSCAT = 'K' .
*ITEM-ITEM_CAT = 'D' .
ITEM-MATL_GROUP = '817230000' .
ITEM-PLANT = '3001' .
ITEM-TRACKINGNO = '99999'.
ITEM-PREQ_NAME = 'test'.
*ITEM-AGREEMENT = '' .
*ITEM-AGMT_ITEM = ''.
ITEM-QUANTITY = '1' .
ITEM-PO_UNIT = 'EA'.
*ITEM-ORDERPR_UN = 'EA'.
ITEM-CONV_NUM1 = '1'.
ITEM-CONV_DEN1 = '1'.
ITEM-NET_PRICE = '1000000' .
ITEM-PRICE_UNIT = '1'.
ITEM-GR_PR_TIME = '0'.
ITEM-PRNT_PRICE = 'X'.
ITEM-UNLIMITED_DLV = 'X'.
ITEM-GR_IND = 'X' .
ITEM-IR_IND = 'X' .
ITEM-GR_BASEDIV = 'X'.
*ITEM-PCKG_NO = '' .
APPEND ITEM. CLEAR ITEM.
*POPULATE ITEM FLAG TABLE
ITEMX-PO_ITEM = ITEM_NUM.
ITEMX-PO_ITEMX = C_X.
*ITEMX-MATERIAL = C_X.
ITEMX-SHORT_TEXT = C_X.
ITEMX-QUANTITY = C_X.
*ITEMX-TAX_CODE = C_X.
ITEMX-ACCTASSCAT = C_X.
*ITEMX-ITEM_CAT = c_x.
ITEMX-MATL_GROUP = C_X.
ITEMX-PLANT = C_X.
ITEMX-TRACKINGNO = C_X.
ITEMX-PREQ_NAME = C_X.
*ITEMX-AGREEMENT = C_X.
*ITEMX-AGMT_ITEM = c_x.
ITEMX-STGE_LOC = C_X.
ITEMX-QUANTITY = C_X.
ITEMX-PO_UNIT = C_X.
*ITEMX-ORDERPR_UN = C_X.
ITEMX-CONV_NUM1 = C_X.
ITEMX-CONV_DEN1 = C_X.
ITEMX-NET_PRICE = C_X.
ITEMX-PRICE_UNIT = C_X.
ITEMX-GR_PR_TIME = C_X.
ITEMX-PRNT_PRICE = C_X.
ITEMX-UNLIMITED_DLV = C_X.
ITEMX-GR_IND = C_X .
ITEMX-IR_IND = C_X .
ITEMX-GR_BASEDIV = C_X .
APPEND ITEMX. CLEAR ITEMX.
*POPULATE ACCOUNT DATA.
ACCOUNT-PO_ITEM = ITEM_NUM.
ACCOUNT-SERIAL_NO = SERIAL .
ACCOUNT-CREAT_DATE = SY-DATUM .
ACCOUNT-COSTCENTER = CENTRO .
ACCOUNT-GL_ACCOUNT = CUENTA .
ACCOUNT-GR_RCPT = 'tester'.
APPEND ACCOUNT. CLEAR ACCOUNT.
*POPULATE ACCOUNT FLAG TABLE.
ACCOUNTX-PO_ITEM = ITEM_NUM .
ACCOUNTX-PO_ITEMX = C_X .
ACCOUNTX-SERIAL_NO = SERIAL .
ACCOUNTX-SERIAL_NOX = C_X .
ACCOUNTX-CREAT_DATE = C_X .
ACCOUNTX-COSTCENTER = C_X .
ACCOUNTX-GL_ACCOUNT = C_X .
ACCOUNT-GR_RCPT = C_X.
APPEND ACCOUNTX. CLEAR ACCOUNTX.
*BAPI CALL
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = HEADER
POHEADERX = HEADERX
IMPORTING
EXPPURCHASEORDER = PURCHASEORDER
TABLES
RETURN = RETURN
POITEM = ITEM
POITEMX = ITEMX
POACCOUNT = ACCOUNT
POACCOUNTX = ACCOUNTX.
*Confirm the document creation by calling database COMMIT
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN =
END-OF-SELECTION.
*Output the messages returned from BAPI call
LOOP AT RETURN.
WRITE / RETURN-MESSAGE.
ENDLOOP.
Regards
vijay -
How to INSERT items using BAPI_SALESORDER_CHANGE
Hello all,
i am trying to insert a items into SALESDOCUMENT, i am making the following process.
i have a SALESDOCUMENT from which a make a copy then i delete all the ITEMS and i try to insert the new one, i am trying to insert a new ITEMS which has relations with another material i am making this because i am expecting when i insert the ITEMS all the material will be recalculated.
for example
position material quantity.
10 6050 1 this is the main material
20 7228 30 This is child record of the main material
30 7143 1 this is child record of the main material.
when i run my function i need to modify the main material as this
position material quantity
10 6050 2.
so i am expecting
position material quantity.
10 6050 2 this is the main material
20 7228 60 This is child record of the main material
30 7143 2 this is child record of the main marial.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_copia "this is the copy
order_header_inx = are_headx " value U
TABLES
return = tab_retor
order_item_in = tab_items
order_item_inx = tab_itemx
schedule_lines = tab_sched
schedule_linesx = tab_schex.
but i really i don`t how to do it, i have been using the bapi BAPI_SALESORDER_CHANGE, this bapi delete the items this is ok , but not insert the items that i need , 'does anybody has make something like this, i will really apprecite if someone give a hand, please.continue..................................................
***GET LIST OF SALESORDER
CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'
EXPORTING
i_bapi_view = i_bapi_view
TABLES
sales_documents = sales_documents
order_headers_out = order_headers_out
order_items_out = order_items_out.
LOOP AT order_items_out .
MOVE-CORRESPONDING order_items_out TO order_item_in.
order_item_in-val_type = pval.
APPEND order_item_in.
ENDLOOP.
LOOP AT order_item_in .
MOVE-CORRESPONDING order_item_in TO itab_ch.
APPEND itab_ch.
ENDLOOP.
LOOP AT itab_ch .
* Header update indicator
s_order_header_inx-updateflag = 'U'.
i_order_item_in-itm_number = itab_ch-itm_number .
i_order_item_in-material = itab_ch-material.
i_order_item_in-target_qty = itab_ch-target_qty.
i_order_item_in-sales_unit = itab_ch-sales_unit.
i_order_item_in-val_type = itab_ch-val_type.
i_order_item_inx-updateflag = 'I'.
i_order_item_inx-itm_number = itab_ch-itm_number .
i_order_item_inx-material = itab_ch-material.
i_order_item_inx-target_qty = 'X'.
i_order_item_inx-sales_unit = itab_ch-sales_unit.
i_order_item_inx-val_type = 'X'.
APPEND: i_order_item_in, i_order_item_inx.
** Fill schedule lines
i_sched-itm_number = itab_ch-itm_number .
i_sched-sched_line = '0001'.
i_sched-req_qty = itab_ch-target_qty.
APPEND i_sched.
* Fill schedule line flags
i_schedx-itm_number = itab_ch-itm_number .
i_schedx-sched_line = '0001'.
i_schedx-updateflag = 'I'.
i_schedx-req_qty = 'X'.
APPEND i_schedx.
ENDLOOP.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_vbeln
order_header_in = s_order_header_in
order_header_inx = s_order_header_inx
behave_when_error = 'P'
TABLES
return = it_return
order_item_in = i_order_item_in
order_item_inx = i_order_item_inx
schedule_lines = i_sched
schedule_linesx = i_schedx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
LOOP AT it_return.
WRITE / it_return-message.
ENDLOOP. -
Sales Item's Qty is disabled in change mode (VA02) of Sales Order.
Hi,
1) We create Sales order (L2) from Service Order(DP90 tcode), system automatically selects 'LABOR HOURS' material, based on actual hours posted for a service order and adds this as 1st line item in Sales Order. When order is saved and we go back to VA02, we find that LABOR HOURS item is disabled, meaning we cannot change Qty but can only change Amount. The item is not billed yet.
2) If we add 2nd line item with same 'LABOR HOURS' material in change mode(VA02), Ssave and get back to VA02 again, this item is enabled. We want to make the 1st Line item's qty enabled so users can change the qty before creating billing document.
Since the 1st line item is created from DP90 tcode, system does not allow us to change the Qty ? Any help is appreciated.
NiranjanHi Jelena,
Thanks once again for your time and responding back.
If you remember, I had mentioned that we are creating Sales order from DP90 tcode. We had created a custom screen(and tcode) called ZWIN where we had provided a button to create Sales order from Service Order using DP90 tcode. In this custom screen, we were calling BDC for DP90 and creating Sales order. On the same custom screen, we had given option where users could enter other materials. For these extra materials added, we were using BAPI 'BAPI_SALESORDER_CHANGE', to add these new materials. Here is how I fixed it.
1) DP90 would have created sales order with Item 10 for LABOR HOURS.
2) Then 'BAPI_SALESORDER_CHANGE' would have added any extra materials selected on Custom screen.
3) While calling this BAPI, I deleted Item 10 with LABOR HOURS and added new Line Item 11 with same LABOR HOURS.
Now when I get into VA02, I see that LABOR HOURS line is enabled, which means we can change Qty.
This avoided deleting line item and adding same item in VA02 when there was a change in qty later.
Thanks again.
Niranjan
Maybe you are looking for
-
Problem with RMI in ADB T75 receiver
Hi: I have a problem with an xlet that uses the RMI (IXC) API in the ADB T75 development settop box. I export an object (of type MyObject) implementing the Remote interface, and, later, I import it with no problem. The problem appears after importing
-
How to access the data in a TableView with build-in Dropdownlists
Hi, I build up a TableView with DropdownListBoxes in the cells. All works so far but if I try to access the data in the cells I get the following error message : at java.lang.Thread.run(Thread.java:479) Caused by: java.lang.reflect.InvocationTar
-
Tcode MIGO Background Job Not working
Hi All, I am facing problem in TCode : MIGO for Background JOB of BDC Program with below details, CALL_TRANSACTION MIGO returncode: 1,001 RECORD: 0 MIGO 017 S The front end is not suitable for the transaction (see long text)
-
Problem with Search Results do not appear consistantly except for farm administrator
We have Server farm with multiple web applications hosted on 443 port, all of them available over internet for the authenticated company users to use. When a user searches for a content on the search box on the visited page, some/many users get no re
-
How can I use MS Word within java programming
Hi everyone! I am developing a Java program that will take data from an Access 2000 database, and manipulate it, display the results graphically and in tables. The challenge for me is that I want the program insert the graphics and tables into the MS