Long fields used in BAPI
Hi.
I have to create a custom BAPI which has one import field as string type. because BAPI doesnt support string data type, I have changed it to char2048 which is giving warning. Ignoring it, when I try releasing it in transaction SWO1, its throwing an error telling "More than 255 characters is not allowed for a field in BAPI." I am getting XML data in that field (coming from Datastage). One thing that we can do is we can split the data in the format of 255 chars long in datastage but I cant change the value in datastage tool but I can play with the data on my system working on ABAP. Can anyone please help me out with the solution for it. So, instead of splitting the data in datastage/middleware, can we do somthing in BAPI that it accepts 2000 chars in one field.
(High Priority task).
Regards'
Sitesh.
Please read the Rules of Engagement for these forums. The fact that something is high priority for you, does not make it high priority for us, the volunteer contributors to the forums. This form of words "high priority", or similiar is not permitted.
matt
Similar Messages
-
Display Long field Description in 2 lines in Header when using REUSE_ALV_HI
Hi,
I am using REUSE_ALV_HIERSEQ_LIST_DISPLAY .
I need to have 2 lines in the header to display long field descriptions like
Ex Shipment Notification Idoc or Billing Document Cancel should appear as
Shipment Notification Billing Document
Idoc Cancel
Is there a way of doing this when calling the above ALV function?
Thanks
PrashantHi Prashanta ,
We can give headers in ALV using short/medium/long text.
And this comes in one line. You can use short/medium text, if possible.
Hence , having 2 lines in the header to display long field descriptions is not possible.
Hope this helps you. -
How to get custom field value in vbkd table using "SD_SALESDOCUMENT_CREATE" bapi
Hi Experts,
Need your help . In one program Iam using SD_SALESDOCUMENT_CREATE bapi .
i/p for my report is am excel.
excel is having below formatt.
To create salesdoc we are using SD_SALESDOC_CREATE bapi.
but After execution of the program we are unable to find the ZZFV_SBCNT (which is custom field) in VBKD w.r.t salesdocument.
Need your help what we need to do to reflect the value in vbkd table.
Here temp will contains the data from excel
1)
FORM f_move_header_data .
wg_header-doc_type = wg_temp-auart . "Order type
wg_header-sales_org = wg_temp-vkorg . "Sales Organization
wg_header-distr_chan = wg_temp-vtweg . "Distribution Channel
wg_header-division = wg_temp-spart. "Division
wg_header-sales_off = wg_temp-vkbur . "Sales Office
wg_header-sales_grp = wg_temp-vkgrp . "Sales Group
wg_header-purch_no_c = wg_temp-bstnk . "Customer purchase order number
wg_header-pymt_meth = wg_temp-zlsch . "Payment Method
wg_header-zzychan_role = wg_temp-zzychan_role_i. "Channel Role
wg_header-zzysub_role = wg_temp-zzysub_role . "Submitter Role
wg_header-zzy_inv_for_opt = wg_temp-zzinv_format . "Invoice Format Optio
wg_header-ord_reason = wg_temp-augru . "Order Reason Code
wg_header-bill_block = wg_temp-faksp. "Billing Block
wg_headerx-doc_type = c_set . "Order type
wg_headerx-sales_org = c_set . "Sales Organization
wg_headerx-distr_chan = c_set . "Distribution Channel
wg_headerx-division = c_set. "Division
wg_headerx-sales_off = c_set . "Sales Office
wg_headerx-sales_grp = c_set . "Sales Group
wg_headerx-purch_no_c = c_set . "Customer purchase order number
wg_headerx-pymt_meth = c_set . "Payment Method
wg_headerx-zzychan_role = c_set. "Channel Role
wg_headerx-zzysub_role = c_set . "Submitter Role
wg_headerx-zzy_inv_for_opt = c_set . "Invoice Format Option
wg_headerx-ord_reason = c_set . "Order Reason Code
wg_headerx-bill_block = c_set. "Billing Block
ENDFORM. " F_MOVE_HEADER_DATA
2)
FORM f_move_item_data .
wg_item-itm_number = g_itmnumber. "Item number
wg_item-material = wg_process-matnr . "Material
wg_item-target_qty = wg_process-target_qty. "Targeted Qty
wg_item-item_categ = wg_process-pstyv. "Sales document item category
wg_item-zzylegal_i = wg_process-zzlegal. "Legal Contract
**********Added this line for vbkd-ZZFV_SBCNT****************************
wg_item-zzfv_sbcnt = wg_process-zzfv_sbcnt.
APPEND wg_item TO i_item.
wg_itemx-material = c_set . "Material
wg_itemx-target_qty = c_set. "Targeted Qty
wg_itemx-item_categ = c_set. "Sales document item category
wg_itemx-zzylegal_i = c_set. "Legal Contract
wg_itemx-zzsteady_date = c_set . "Amortization Start Date
wg_itemx-zzsteady_end_dat = c_set. "Amortization Stop Date
**********Added this line for vbkd-ZZFV_SBCNT****************************
wg_itemx-ZZFV_SBCNt = c_set. "
APPEND wg_itemx TO i_itemx.
CLEAR : wg_itemx.
endform.
3)
FORM f_move_head_ext
wg_extension-structure = c_ext_vbak.
wg_ext_vbak-zzinv_format = wg_temp-zzinv_format.
wg_ext_vbak-zzychan_role = wg_temp-zzychan_role_i.
wg_ext_vbak-zzysub_role = wg_temp-zzysub_role.
wg_extension+30 = wg_ext_vbak.
APPEND wg_extension to i_extension.
CLEAR wg_extension.
wg_extensionx-structure = c_ext_vbakx.
wg_ext_vbakx-zzinv_format = c_set.
wg_ext_vbakx-zzlegal = c_set.
wg_ext_vbakx-zzychan_role = c_set.
wg_ext_vbakx-zzysub_role = c_set.
wg_extensionx+30 = wg_ext_vbakx.
APPEND wg_extensionx TO i_extensionx.
CLEAR wg_extensionx.
ENDFORM. " F_MOVE_HEAD_EXT
*& Form F_MOVE_ITEM_EXT
* Item Extension
4)
FORM f_move_item_ext .
* Structure for BAPI parameter Extension
wg_extension-structure = c_ext_vbap.
wg_ext_vbap-posnr = g_itmnumber.
wg_ext_vbap-zzsteady_date = wg_process-zzsteady_date . "Amortization Start Date
wg_ext_vbap-zzsteady_end_dat = wg_process-zzsteady_end_dat. "Amortization Stop Date
wg_ext_vbap-zzlegal = wg_process-zzlegal. "Legal Contract
wg_extension+30 = wg_ext_vbap.
APPEND wg_extension to i_extension.
* Structure for BAPI parameter Extension - Update Indicator Fields
wg_extensionx-structure = c_ext_vbapx.
wg_ext_vbapx-posnr = g_itmnumber.
wg_ext_vbapx-zzsteady_date = c_set .
wg_ext_vbapx-zzsteady_end_dat = c_set.
* wg_ext_vbapx-zzlegal = c_set.
*wg_process-zzfv_sbcnt = c_set.
wg_extensionx+30 = wg_ext_vbapx.
APPEND wg_extensionx TO i_extensionx.
CLEAR wg_extensionx.
and bapi calling is like below.
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
sales_header_in = wg_header
sales_header_inx = wg_headerx
logic_switch = wg_logic_switch
business_object = fp_bus_obj
status_buffer_refresh = 'X'
IMPORTING
salesdocument_ex = g_sorder
TABLES
return = i_return
sales_items_in = i_item
sales_items_inx = i_itemx
sales_partners = i_partner
sales_conditions_in = i_cond
sales_conditions_inx = i_condx
sales_text = i_text
extensionin = i_extension
extensionex = i_extensionx.
still we are not getting ZZFV_SBCNT value in VBKD table w.r.t created salesdoc(g_sorder)
Please help me from this issue.
Thank You..Hi,
Please let me know how to add custom fields in the characteristic list, My clients wants department and profit center grouping.
Please tell me how to solve it..
Thanks & Regards,
Reena.. -
Hello experts,
I have added one field using append structure in table MARC. I want to updated this field usnign BAPI_MATERIAL_SAVEDATA. can anybody tell me the procedure to do that?
Thanks in advance.Hello,
Check the documentation of the function module BAPI_MATERIAL_SAVEDATA. There is a parameter in the FM - EXTENSIONIN where in new fields added to the table can be used to be updated.
The documentation of that parameters tells you how this can be achieved.
Create 2 structures of the type BAPI_TE_MARA and BAPI_TE_MARAX
Now assign the field structure of the workarea of type BAPIPAREX. Assume gs_extensionin is of type BAPIPAREX and gs_bapi_te_mara is of type BAPI_TE_MARA (this should have the fields that have been added in the table)
gs_extensionin-structure = 'BAPI_TE_MARA'.
gs_extensionin-valuepart+0(18) = gs_bapi_te_mara-matnr.
gs_extensionin-valuepart+18(length of the new field) = ga_bapi_te_mara-<new field added in the structure>.
append gs_extensionin to gt_extensionin.
gs_extensioninx-structure = 'BAPI_TE_MARAX'.
gs_extensioninx-valuepart+0(18) = gs_bapi_te_mara-matnr.
gs_extensioninx-valuepart+18(1) = 'X'..
append gs_extensioninx to gt_extensioninx.
Now pass these tables gt_extensionin and gt_extensionx to the parameters extensionin and extensioninx of the function module BAPI_MATERIAL_SAVEDATA.
Also try searching SDN using Extending BAPI's
Hope this will help in solving your query.
Regards,
Sachin -
Structure used in BAPI with prdefined field
Hi All,
Is it ok to use predefined field in a structure used in BAPI? Will there be any limitation? Any advantage if we use data elements and domains.
Regards,
SeemaHi,
Using predefined fileds in a structure should not be a problem. The only think you should consider is if there is a possibility that the component owner to which this structure belongs may change this structure. So if you are sure that there will be no such risk, then go ahead.
Domains cannot be directly used within a program/FM/BAPI. Domains can only be associated with Data elements that can be used in BAPI. It is always safe to use DATA ELEMENTS as generally changes to them are avoided as they have huge dependencies.
I hope this clarifies your query.
Best Regards,
Saurabh -
Wat is the use of bapi .in sap...
thx.
regurds .
nainesh.hi,
what is BAPI?
BAPI stands for Business API(Application Program Interface).
A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
You can make your function module remotely enabled in attributes of Function module but
A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).
BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
The following standardized BAPIs are provided:
Reading instances of SAP business objects
GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.
The BAPI GetList() is a class method.
GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type
The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.
Create( ) and CreateFromData! ( )
The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.
Change( )
The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.
Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.
The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.
Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.
Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.
BAPI-step by step
http://www.sapgenie.com/abap/bapi/example.htm
just refer to the link below
http://www.sapmaterial.com/?gclid=CN322K28t4sCFQ-WbgodSGbK2g
list of all bapis
http://www.planetsap.com/LIST_ALL_BAPIs.htm
for BAPI's
http://www.sappoint.com/abap/bapiintro.pdf
http://www.sappoint.com/abap/bapiprg.pdf
http://www.sappoint.com/abap/bapiactx.pdf
http://www.sappoint.com/abap/bapilst.pdf
http://www.sappoint.com/abap/bapiexer.pdf
http://service.sap.com/ale
http://service.sap.com/bapi
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
http://www.planetsap.com/Bapi_main_page.htm
http://www.topxml.com/sap/sap_idoc_xml.asp
http://www.sapdevelopment.co.uk/
http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
Also refer to the following links..
www.sap-img.com/bapi.htm
www.sap-img.com/abap/bapi-conventions.htm
www.planetsap.com/Bapi_main_page.htm
www.sapgenie.com/abap/bapi/index.htm
Checkout !!
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://techrepublic.com.com/5100-6329-1051160.html#
Example Code
U need to give the step_nr, item_nr, cond_count and cond_type so the correct conditon will be updated. If no condition exists for the given parameters, a new condition will be created.
U can find these parameters for a particular condition type in table KONV.
*& Form saveTransactionJOCR
text
--> p1 text
<-- p2 text
FORM saveTransactionJOCR .
data: salesdocument like BAPIVBELN-VBELN,
order_header_inx like bapisdh1x,
order_header_in like bapisdh1,
return type standard table of bapiret2 with header line,
conditions_in type standard table of bapicond with header line,
conditions_inx type standard table of bapicondx with header line,
logic_switch like BAPISDLS,
step_nr like conditions_in-cond_st_no,
item_nr like conditions_in-itm_number,
cond_count like conditions_in-cond_count,
cond_type like conditions_in-cond_type.
salesdocument = wa_order_information-VBELN.
LOGIC_SWITCH-COND_HANDL = 'X'.
order_header_inx-updateflag = 'U'.
conditions
clear conditions_in[].
clear conditions_inx[].
clear: step_nr,
item_nr,
cond_count,
cond_type.
step_nr = '710'.
item_nr = '000000'.
cond_count = '01'.
cond_type = 'ZCP2'.
CONDITIONS_IN-ITM_NUMBER = item_nr.
conditions_in-cond_st_no = step_nr.
CONDITIONS_IN-COND_COUNT = cond_count.
CONDITIONS_IN-COND_TYPE = cond_type.
CONDITIONS_IN-COND_VALUE = 666.
CONDITIONS_IN-CURRENCY = 'EUR'.
append conditions_in.
CONDITIONS_INX-ITM_NUMBER = item_nr.
conditions_inx-cond_st_no = step_nr.
CONDITIONS_INX-COND_COUNT = cond_count.
CONDITIONS_INX-COND_TYPE = cond_type.
CONDITIONS_INX-UPDATEFLAG = 'U'.
CONDITIONS_INX-COND_VALUE = 'X'.
CONDITIONS_INX-CURRENCY = 'X'.
append conditions_inx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = salesdocument
ORDER_HEADER_IN = order_header_in
ORDER_HEADER_INX = order_header_inx
LOGIC_SWITCH = logic_switch
TABLES
RETURN = return
CONDITIONS_IN = conditions_in
CONDITIONS_INX = conditions_inx
if return-type ne 'E'.
commit work and wait.
endif.
ENDFORM. " saveTransactionJOCR
Bdc to Bapi
The steps to be followed are :
1. Find out the relevant BAPI (BAPI_SALESORDER_CHANGE for VA02).
[for VA01 use BAPI_SALESORDER_CREATEFROMDAT2]
2. Create a Z program and call the BAPi (same as a Funtion module call).
2. Now, if you see this BAPi, it has
-> Importing structures.
eg: SALESDOCUMENT: this will take the Sales order header data as input.
-> Tables parameters:
eg: ORDER_ITEM_IN: this will take the line item data as input.
Note :
Only specify fields that should be changed
Select these fields by entering an X in the checkboxes
Enter a U in the UPDATEFLAG field
Always specify key fields when changing the data, including in the checkboxes
The configuration is an exception here. If this needs to be changed, you need to complete it again fully.
Maintain quantities and dates in the schedule line data
Possible UPDATEFLAGS:
U = change
D = delete
I = add
Example
1. Delete the whole order
2. Delete order items
3. Change the order
4. Change the configuration
Notes
1. Minimum entry:
You must enter the order number in the SALESDOCUMENT structure.
You must always enter key fields for changes.
You must always specify the update indicator in the ORDER_HEADER_INX.
2. Commit control:
The BAPI does not run a database Commit, which means that the application must trigger the Commit so that the changes are read to the database. To do this, use the BAPI_TRANSACTION_COMMIT BAPI.
For further details... refer to the Function Module documentation for the BAPi.
Bapi to VB(Visual Basic)
Long back I had used the following flow structure to acheive the same.
Report -> SM59 RFC destination -> COM4ABAP -> VB.exe
my report uses the rfc destination to create a COM session with com4abap. com4abap calls the vb.exe and manages the flow of data between sap and vb exe.
You need to have com4abap.exe
If com4abap is installed you will find it in sapgui installatin directory , C:\Program Files\SAPpc\sapgui\RFCSDK\com4abap.
else refer OSS note 419822 for installation of com4abap
after making the settings in com4abap to point to the vb program and setting up rfc destination in sm59 to point to com4abap session , you can use the following function modules to call the vb code.
for setting up com4abap and rfc destination please refer to the documentation for com4abap.
Invoke NEW DCOM session
call function 'BEGIN_COM_SESSION'
exporting
service_dest = service_dest "(this will be a RFC destination created in SM59)
importing
worker_dest = worker_dest
exceptions
connect_to_dcom_service_failed = 1
connect_to_dcom_worker_failed = 2
others = 3.
call function 'create_com_instance' destination worker_dest
exporting
clsid = g_c_clsid
typelib = g_c_typelib
importing
instid = g_f_oid
exceptions
communication_failure = 1 message g_f_msg
system_failure = 2 message g_f_msg
invalid_instance_id = 3
others = 4.
call function 'com_invoke' destination worker_dest
exporting
%instid = g_f_oid
%method = 'UpdatePDF'
sntemp = g_v_const_filent
snsysid = sy-sysid
snflag = 'N'
tables
rssaptable = g_t_pdfdetail1
%return = g_t_pdfdetail1 "t_test
exceptions
communication_failure = 1 message g_f_msg
system_failure = 2 message g_f_msg
invalid_instance_id = 3
others = 4.
then close the com session , using
FM delete_com_instance
FM END_COM_SESSION
cheers,
Hema. -
Open Purchase Order UPload Using the BAPI 's
i need to upload the open Purchase Order using the BAPI function BAPI_PO_CREATE1., below is the given fileds blod are for Header, header will Repeat for the line items,can any one help me out using the BAIP's for upload the PO, i need sample code for this ........
Thanks & Regards
Raghu
<u>Field Name Field Description Type Length</u>
<b>EBELN Purchasing Document Number CHAR 010 X
BUKRS Company Code CHAR 004 MN10 C
EKORG Purchasing Organization CHAR 004 MN00 C
EKGRP Purchasing group CHAR 003 X
BSART Order type (Purchasing) CHAR 004 X
LIFNR Account Number of Vendor or Creditor CHAR 010 X
BEDAT Purchase Order Date DATS 010 X
ZTERM Terms of payment key CHAR 004 X
WAERS Currency Key CUKY 005 X
INCO1 Incoterms (part 1) CHAR 003 X
INCO2 Incoterms (part 2) CHAR 028 X</b>
EBELP Item Number of Purchasing Document NUMC 005 X
EMATN Material number CHAR 018 X
WERKS Plant CHAR 004 X
LGORT Storage location CHAR 004 X
EPSTP Item category in purchasing document CHAR 001 X
KNTTP Account assignment category CHAR 001 X
EINDT Item delivery date DATS 010 X
MENGE "Purchase order quantity (direct input, transfer of POs)" CHAR 013 X
MEINS Order unit UNIT 003 X
NETPR "Net price: Document currency (direct input, transfer of" CHAR 011 X
PEINH "Price unit (direct input, transfer of POs)" CHAR 005 X
BPRME Order Price Unit (Purchasing) UNIT 003 X
BPUMZ Numerator: Conversion OPUn into OUn (direct input of POs CHAR 005 X
BPUMN Denominator: Conversion OPUn into OUn (direct input of P CHAR 005 X
SAKTO Cost element CHAR 010 X
KOSTL Cost Center CHAR 010 X
VBELN Sales and Distribution Document Number CHAR 010 X
VBELP Sales document item NUMC 006 X
WEMPF Goods recipient CHAR 012 X
WEBTH "Amount in local currency (direct input, transfer of POs)" CHAR 013 X
WEBTF "Amount in document currency (direct input, transfer of P" CHAR 013 X
WEREF Flag for treatment of GR/IR (direct input of POs) CHAR 001 X
SPINF Indicator: Update info record CHAR 001 X
WEPOS Goods Receipt Indicator CHAR 001 X
REPOS Invoice receipt indicator CHAR 001 Xi need to upload the open Purchase Order using the BAPI function BAPI_PO_CREATE1., below is the given fileds blod are for Header, header will Repeat for the line items,can any one help me out using the BAIP's for upload the PO, i need sample code for this ........
Thanks & Regards
Raghu
<u>Field Name Field Description Type Length</u>
<b>EBELN Purchasing Document Number CHAR 010 X
BUKRS Company Code CHAR 004 MN10 C
EKORG Purchasing Organization CHAR 004 MN00 C
EKGRP Purchasing group CHAR 003 X
BSART Order type (Purchasing) CHAR 004 X
LIFNR Account Number of Vendor or Creditor CHAR 010 X
BEDAT Purchase Order Date DATS 010 X
ZTERM Terms of payment key CHAR 004 X
WAERS Currency Key CUKY 005 X
INCO1 Incoterms (part 1) CHAR 003 X
INCO2 Incoterms (part 2) CHAR 028 X</b>
EBELP Item Number of Purchasing Document NUMC 005 X
EMATN Material number CHAR 018 X
WERKS Plant CHAR 004 X
LGORT Storage location CHAR 004 X
EPSTP Item category in purchasing document CHAR 001 X
KNTTP Account assignment category CHAR 001 X
EINDT Item delivery date DATS 010 X
MENGE "Purchase order quantity (direct input, transfer of POs)" CHAR 013 X
MEINS Order unit UNIT 003 X
NETPR "Net price: Document currency (direct input, transfer of" CHAR 011 X
PEINH "Price unit (direct input, transfer of POs)" CHAR 005 X
BPRME Order Price Unit (Purchasing) UNIT 003 X
BPUMZ Numerator: Conversion OPUn into OUn (direct input of POs CHAR 005 X
BPUMN Denominator: Conversion OPUn into OUn (direct input of P CHAR 005 X
SAKTO Cost element CHAR 010 X
KOSTL Cost Center CHAR 010 X
VBELN Sales and Distribution Document Number CHAR 010 X
VBELP Sales document item NUMC 006 X
WEMPF Goods recipient CHAR 012 X
WEBTH "Amount in local currency (direct input, transfer of POs)" CHAR 013 X
WEBTF "Amount in document currency (direct input, transfer of P" CHAR 013 X
WEREF Flag for treatment of GR/IR (direct input of POs) CHAR 001 X
SPINF Indicator: Update info record CHAR 001 X
WEPOS Goods Receipt Indicator CHAR 001 X
REPOS Invoice receipt indicator CHAR 001 X -
Assignment on Sales Order creation using a BAPI
hi,
i m new 2 bapi,so i usually knw how 2 create BAPI
1. Create a sales order using BAPI with the header details from selection screen and item details from the file.
2. Have the minimum required header fields for a sales order Sales order type, sales org, distribution channel, division, customer, purchase order type, purchase order number as the selection screen parameters.
3. Have a field to enter the presentation server path on the selection screen where the file with item details is stored. File will have material, size and quantity required.
4. Validate all the relevant selection screen entries.
5. Create a sales order with the obtained details using the BAPI
BAPI_SALESORDER_CREATEFROMDAT2
6. Catch all the BAPI errors and display a report. If the BAPI call was successful display the sales order document number and the items. If the call fails, display all the error message encountered.Hi Priya,
Here is the sample program , it may helpful check,
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
PARAMETERS: p_auart TYPE auart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Sales organization
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Distribution channel
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Division.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
Sold-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Ship-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
Material
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Quantity.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Plant
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
SELECTION-SCREEN END OF LINE.
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.
Initialization.
INITIALIZATION.
v_text = 'Order type'.
v_text1 = 'Sales Org'.
v_text2 = 'Distribution channel'.
v_text3 = 'Division'.
v_text4 = 'Sold-to'.
v_text5 = 'Ship-to'.
v_text6 = 'Material'.
v_text7 = 'Quantity'.
v_text9 = 'Plant'.
Start-of-selection.
START-OF-SELECTION.
Header data
Sales document type
header-doc_type = p_auart.
headerx-doc_type = 'X'.
Sales organization
header-sales_org = p_vkorg.
headerx-sales_org = 'X'.
Distribution channel
header-distr_chan = p_vtweg.
headerx-distr_chan = 'X'.
Division
header-division = p_spart.
headerx-division = 'X'.
headerx-updateflag = 'I'.
Partner data
Sold to
partner-partn_role = 'AG'.
partner-partn_numb = p_sold.
APPEND partner.
Ship to
partner-partn_role = 'WE'.
partner-partn_numb = p_ship.
APPEND partner.
ITEM DATA
itemx-updateflag = 'I'.
Line item number.
item-itm_number = '000010'.
itemx-itm_number = 'X'.
Material
item-material = p_matnr.
itemx-material = 'X'.
Plant
item-plant = p_plant.
itemx-plant = 'X'.
Quantity
item-target_qty = p_menge.
itemx-target_qty = '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 = p_menge.
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. -
Netprice Picked up from last document-Open PO load using LSMW BAPI method.
Hi Experts,
I m doing Open PO load using LSMW BAPI method...(BAPI_PO_CREAT1).
Inside the LSMW BAPI picks up the NETPR value from the last document and doesnt consider the value from load file...
Please advice me how to handle this issue...
I tried giving values to field CALCTYPE at item level or POCOND table with with carry out new pricing options....but nothig works for me...
PLease give your valuable inputs to achieve the requirement....
Bharathi.Jread OSS Note 580225 - Purchasing BAPIs: Conditions and pricing
-
How to Use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA
Hi ,
How to use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA.
May i know what are the input parameters & fields mandatory
for each Table structures ct_data , ct_datax , it_descript , it_longtext.
Can any one explain me Step by Step Process.
B'cos i tried with below code. Equipment is not getting created.
wa_itab-equipment_ext = '000000000100000001'.
wa_itab-descript = 'Test 2 -> Lube Oil Pump'.
wa_itab-text_language = 'EN'.
wa_itab-sdescript = 'Short Description'.
APPEND wa_itab TO it_itab.
CLEAR wa_itab.
LOOP AT it_itab INTO wa_itab.
ct_data-ta_guid = '000000000000000001'.
ct_data-equipment_ext = wa_itab-equipment_ext.
ct_data-descript = wa_itab-descript .
ct_data-valid_date = sy-datum.
ct_data-equicatgry = 'M'.
APPEND ct_data.
CLEAR ct_data.
ct_datax-ta_guid = '000000000000000001'.
ct_datax-equipment_ext = 'X'.
ct_datax-equipment = 'X'.
APPEND ct_datax.
CLEAR ct_datax.
it_descript-ta_guid = '000000000000000001'.
it_descript-text_language = wa_itab-text_language.
it_descript-descript = wa_itab-sdescript .
APPEND it_descript.
CLEAR it_descript.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'LTXT'.
it_longtext-text_line = 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'aaaaaaaaaaaaaaa'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'bbbbbbbbbbbb'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'cccccccccccccccc'.
APPEND it_longtext.
CLEAR it_longtext.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
call BAPI-function in this system
CALL FUNCTION 'BAPI_EQUIPMENT_SAVEREPLICA'
TABLES
ct_data = ct_data
ct_datax = ct_datax
it_descript = it_descript
it_longtext = it_longtext
return = return
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE : 'Successful'.
ENDIF.
IF NOT return IS INITIAL.
LOOP AT return.
IF return-type = 'A' OR return-type = 'E'.
WRITE : 'Error'.
ENDIF.
ENDLOOP.
ENDIF.
REFRESH return.
ENDLOOP.
Regards
SUrendarHi ,
How to use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA.
May i know what are the input parameters & fields mandatory
for each Table structures ct_data , ct_datax , it_descript , it_longtext.
Can any one explain me Step by Step Process.
B'cos i tried with below code. Equipment is not getting created.
wa_itab-equipment_ext = '000000000100000001'.
wa_itab-descript = 'Test 2 -> Lube Oil Pump'.
wa_itab-text_language = 'EN'.
wa_itab-sdescript = 'Short Description'.
APPEND wa_itab TO it_itab.
CLEAR wa_itab.
LOOP AT it_itab INTO wa_itab.
ct_data-ta_guid = '000000000000000001'.
ct_data-equipment_ext = wa_itab-equipment_ext.
ct_data-descript = wa_itab-descript .
ct_data-valid_date = sy-datum.
ct_data-equicatgry = 'M'.
APPEND ct_data.
CLEAR ct_data.
ct_datax-ta_guid = '000000000000000001'.
ct_datax-equipment_ext = 'X'.
ct_datax-equipment = 'X'.
APPEND ct_datax.
CLEAR ct_datax.
it_descript-ta_guid = '000000000000000001'.
it_descript-text_language = wa_itab-text_language.
it_descript-descript = wa_itab-sdescript .
APPEND it_descript.
CLEAR it_descript.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'LTXT'.
it_longtext-text_line = 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'aaaaaaaaaaaaaaa'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'bbbbbbbbbbbb'.
APPEND it_longtext.
CLEAR it_longtext.
it_longtext-ta_guid = '000000000000000001'.
it_longtext-text_language = wa_itab-text_language.
it_longtext-text_id = 'INTV'.
it_longtext-text_line = 'cccccccccccccccc'.
APPEND it_longtext.
CLEAR it_longtext.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
call BAPI-function in this system
CALL FUNCTION 'BAPI_EQUIPMENT_SAVEREPLICA'
TABLES
ct_data = ct_data
ct_datax = ct_datax
it_descript = it_descript
it_longtext = it_longtext
return = return
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE : 'Successful'.
ENDIF.
IF NOT return IS INITIAL.
LOOP AT return.
IF return-type = 'A' OR return-type = 'E'.
WRITE : 'Error'.
ENDIF.
ENDLOOP.
ENDIF.
REFRESH return.
ENDLOOP.
Regards
SUrendar -
I have followed the instructions on this blog. http://blog.cloudshare.com/2012/10/22/how-to-fix-sharepoint-2013-web-application-error-the-context-has-expired-and-can-no-longer-be-used/ and
it fixes the problem for a short time. I have to keep doing IISResets to get my farm backup.
Please Help.Have you trid Ajay Khanna's suggestion from the comments field?
From Central Admin- Select the web application and Select --> Web Application General Settings --> Navigate to 'Web page Security validation', change or disable the timeout field.
Steven Andrews
SharePoint Business Analyst: LiveNation Entertainment
Blog: baron72.wordpress.com
Twitter: Follow @backpackerd00d
My Wiki Articles:
CodePlex Corner Series
Please remember to mark your question as "answered" if this solves (or helps) your problem. -
The Context has expired and can no longer be used error
Hello All,
I am getting ‘The context has expired and can no longer be used.’ error.
The last thing that was modified on the farm was Distributed Cache Service.
We stopped it on the application server and only have it run on the two WFE’s servers.
Also the cache size was changed to 2048MB.
Is it possible that this change is causing the error?
We don’t have ‘Default Time Zone’ selected for the web application.
But we never saw this error till now.
Any suggestions?
Thank you,
ZabciaHi Zabcia,
Thanks for posting this issue,
following could be the reason of raising this issue
1. Security context of your session might be expired
2. Somebody/you might have change the data time of your server.
you can follow below mentioned steps to fix this issue
Just change/update the Date/Time in the SharePoint server
Increase the Security context in SharePoint central admin. This can be done by following the below steps:
Go to central admin
Go to "Application management section" Go to "Web Application General Settings"
Go to "Web page Security validation" section & increase the timeout field. Or, you can simply disable this option.
I hope this is helpful to you, mark it as Helpful.
If this works, Please mark it as Answered.
Regards,
Dharmendra Singh (MCPD-EA | MCTS)
Blog : http://sharepoint-community.net/profile/DharmendraSingh -
Reg: Mandatory fields updation with BAPI
Hi..
We are working on BDC using BAPI. In this if flat files contians only 4 fields and the mandatory fields in the application are seven then system needs to through error message. But with BAPI the program is updating the database without throwing error eventhough all mandatory fileds are not filled up with data.. Where exactly we need to do modifications to get error message when mandatory fields are not filled up with input.
RegardsHi Verendra
Sometimes the function modules/BAPI's used by SAP do a direct update on the database tables. In such scnearios the entries are created in the system even though if the mandatory entries are not filled.
If the number of mandatory fields are small, then before the BAPI call, check if all the mandatory fields are filled or not;throw error in case of empty fields & bypass the BAPI call.
In case the mandatory fields are too high, then in that case, please use BDC recording to update the data.
Regards
Chetan
PS:Reward points if you find this helpful. -
Passing Changed extended fields using ALE-IDOC to receiving system
Hi all,
Please tell me how passing changed extended fields using ALE-IDOC to receiving system can be achieved. Is it possible by Chnage pointer concept.Do i need to do some coading after data enters into receiving system as it is required while creating the entries in database table.
For ex. in matmas05 extended for classification and inspection view and then created using 'CREATION'
related bapi.Do i also need to incorporate the changes by change related bapi or ir can be handled by change pointer concept.
Thanks.Hi Sanu
1) Please tell me how passing changed extended fields using ALE-IDOC to receiving system can be achieved. Is it possible by Chnage pointer concept.
=> Looks like you have extended standard IDOC here. so you need to find User Exit or BADI for the Push program to populate the additional fields. Yes, it is possible thru change pointers as well.
1) Do i need to do some coading after data enters into receiving system as it is required while creating the entries in database table.
=> Yes, as suggested in 1 try finding User Exits/BADIs.
Regards
Shital -
How to populate cusotom fields using BAPI_GOODSMVT_CREATE for MIGO
Hi,
I was to update custom field using BAPI_GOODSMVT_CREATE for MIGO and store it is MSEG table.
Please tell me how to proceed.
Moderator message: last warning, if you continue to post the same thread again, I will submit your user ID for deletion. See my comments in your previous posts.
Edited by: Thomas Zloch on Jul 14, 2011 4:38 PMHi ANID,
Thanks for the reply.
I have checked in the documention of the bapi and no communication structure regarding to the bapi is there so i am not able to figure out where to add the custom field so that it can be added in the MKPF table.
Regads
Dipak
Maybe you are looking for
-
*XDIM_REQUIRED statement not working
Hi, we want to use the *XDIM_REQUIRED statement in a script for BPC NW in order to ensure that for a certain dimension, one explicetly has selected values (instead of leaving default <ALL>) in the data package. For this I would like to use the *XDIM_
-
PERNR search help in ABAP Web Dynpro
All, I wish to add a search help based on PERNR into my web dynpro application. I have used the code: *create a range table lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'ZEMP_SEL' ). *add a new field to range table wd_thi
-
We are considering removing Active Directory from our environment (mainly due to the fact that all our servers are now cloud hosted), and I am trying to come up with a proposal/plan of attack from the SQL side. Has anyone done this before? I.E had SQ
-
So my song plays just fine in GarageBand, but when I export to iTunes, there are some popping noises that come in (very subtly) at the same parts in the song. Here are some troubleshooting things I've already checked: 1) It is not my speakers -- I've
-
[req] mysql administrator & query browser
anyone thinking about adding it to the repos?