BAPI parameters
Hi all,
It is told that we have to create a structure in order to pass input values to a BAPI, whether it is via import paramter or tables parameter.
When i tried to declare a import parameter with TYPE declaration also BAPI was generated and worked fine.
<b>Why is it necessary to create a structure to import/export values?</b>
Please throw light on the concept behind declaring the structures
Hi All,
I have a doubt regarding the logic behind declaring a separate BAPI structure for import paramters and use it.
Let me explain you clearly,
Whenever we pass an import parameter(like vendor number/sales order number) to an normal function module we declare it using either like/type referring to an existing dictionary structure field. but when the number of import parameters increase we may think of creating a single structure with all and use it for simplicity.
But when it is the case with a BAPI, it is suggested that we create a structure even when we have single import parameter.
for example.
supposing that we create a normal function module to get the details of a given Vendor, then we declare the import parameter as below
VENDORNO LIKE LFA1-LIFNR
But if we observe the BAPI_VENDOR_DISPLAY, We find that declaration for the same as
<b>VENDORNO like BAPIVENDOR_ID-VENDOR_NO,
where BAPIVENDOR_ID is a separate BAPI sturcture created and assocaited only with Business object "Vendor".</b>
I tried it by declaring as for a normal FM, even then it work fine.
Now my question is,
If SAP Suggests that we have a separate structure for all import parameters starting with name BAPI and use only those fields to reference with,
what is the logic/reason behind asking so.
I had created a BAPI with paramters referring to standard database fields like
VENDORNO like LFA1-LIFNR and it is still working
I had also written interface programs using VB/ .NET to access the data from my own BAPI and standard BAPI's and both were working alike.
so anyone <b>please give me the reason/logic behind declaring a separate BAPI stuture for all the import parameters</b> to be used in a method.
Similar Messages
-
Obtaining BAPI Parameters in Adapter Module
Hi All
I am using JRA way for obtaining BAPI parameters in Adapter Modules.
Could someone provide me some guidance on the same.
Which method in java will be used in retreving the value from BAPI inside module.(Example: Filename)
and method for passing the same to BAPI using adapter module
Regards
Abhishek MahajanHi ,
refer this link
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/ad09cd07-0a01-0010-93a9-933e247d3ba4
Which service pack you are working on ?
If you are on SP14 then you need not create a wrapper, you can use standar SAP feature to do this.
http://help.sap.com/saphelp_nw04/helpdata/en/c8/e80440a832e369e10000000a155106/content.htm
Commit Control for Individual BAPI Calls
If you want to use this communication channel to call BAPIs as remote-enabled function modules that change data in the database, set the indicator.
If executed successfully, the transaction is written to the database by calling the function module BAPI_TRANSACTION_COMMIT explicitly. If an error occurs, the transaction is rolled back by BAPI_TRANSACTION_ROLLBACK.
If your working on service pack <SP14 then refer the link below...this will help you in creating a wrapper..
https://websmp203.sap-ag.de/~sapdownload/011000358700000328352005E/HowtouseBAPandccBPM.pdf
regards
Surya -
BAPI parameters for movement type 532
Hello experts,i create a production order without material with TCODE co07,then i use BAPI 'BAPI_GOODSMVT_CREATE' to do the by-products GR(531),it is sucessful at this point,but when i do 532 reversal,it is failed,i have set below BAPI parameters:
ls_goodsmvt_item-material = gs_list-matnr.
ls_goodsmvt_item-plant = gs_list-werks.
ls_goodsmvt_item-stge_loc = gs_list-lgort.
ls_goodsmvt_item-orderid = gs_list-aufnr.
ls_goodsmvt_item-move_type = '532'.
ls_goodsmvt_item-order_itno = gs_list-posnr.
ls_goodsmvt_item-reserv_no = gs_list-rsnum.
ls_goodsmvt_item-res_item = gs_list-rspos.
ls_goodsmvt_item-entry_uom = gs_list-meins.
After i run the BAPI and commit,the posting is sucessfull, but the move type 532 would be replaced by 531 within the BAPI,pls. help me,thank you in advance.I do a test,if i do not transport reservation parameters(reserv_no,res_item),the bapi could post the 532 sucessfully,but it posted to unplaned goods issue,i want to post to planned goods issue,pls. help.
-
Updating SAP fields through BAPI (which are not BAPI parameters)
Hello,
I need to update season and collection fields in sales order (AFS), these fields are not in sales order creation BAPI. Can I still somehow use them in extensionin as parameters?? How do we do it?? BAPI: /AFS/BAPI_SALESORD_CREATEFDATA
Also there is another BAPI /AFS/VBAK_SALESDOCUMENT_CHANGE which has these fields in ITEM_EX table (which is extension for item table provided by SAP), but this dosent update the sales order as well.
I would appreciate if anyone has a clue how to do this.
Thanks,
Amit./AFS/VBAK_SALESDOCUMENT_CHANGE
Append structure BAPE_VBAP
J_3ASEAN
/AFS/COLLECTION
/AFS/THEME
Append structure BAPE_VBAPX
J_3ASEAN CHAR1
/AFS/COLLECTION CHAR1
/AFS/THEME CHAR1
Table: ITEMS_EX
OPERATION 009
DOC_NUMBER 200000608
ITM_NUMBER 000000
MATERIAL 2000010022
UPDAT_FLAG I
SEASON C1
COLLECTION DAM
THEME SEG
Pass the season Fields through EXTENSIONIN structure to update data into tables.
STRUCTURE BAPE_VBAP
VALUEPART1 020000060800000000000000C1 DAM SEG
STRUCTURE BAPE_VBAPX
VALUEPART1 0200000608000000XXXX -
BAPI parameters mismatch problem
Hi All,
I have been assigned to object wherein i need to insert bapi BAPI_GOODSMVT_CREATE in function module ZQM06_FM_TASK_GOODS_MOVEMENT. The problem is that i need to fill the structure that i can pass it to BAPI but the import parameters of FM ZQM06_FM_TASK_GOODS_MOVEMENT contain structure that is mismatching. I mean to say that the FM is importing VIQMEL data and from that data i need to fill up structure that would be paased to Bapi BAPI_GOODSMVT_CREATE .
As of now i am not able to map data into structure from VIQMEL so is there any FM or BAPI available for which i can pass VIQMEL data and it returnns me sales order data which in turn i can pass it to the specified bapi BAPI_GOODSMVT_CREATE ?
Your response is highly appreciable.
Thanks & Regards,
ParagHi Parag,
There is no any such function module to pass the data from Bapi to normal function modules.
If the structure of the Function modules are different, only way is finding the matching fields of the both function modules.
Check what all are the matching fields and populate internally after calling the Bapi BAPI_GOODSMVT_CREATE fm. within the function module code itself. Then commit your work. It will definitely work.
But increases the program overhead for you populating and checking all the fields. It is the way to solve this issue.
Because BAPI structures some times will not match with standard structures.
First you try to populate the Item data, with structure BAPI2017_GM_ITEM_CREATE. if this is done correctly you can handle the rest.
Regards,
Santosh Kumar M. -
Issue with BAPI parameters - BAPI_SALESORDER_CHANGE
Hi,
I am trying to use BAPI_SALESORDER_CHANGE to modify the contents of the sales order item quantity. but the below code was not working, can any one correct the below program.
I have seen the same type of post few months back but no one provided the solution till now. I hope experts can correct my program. Surely i will reward.
regards
jaya
REPORT y_bapi1 .
TABLES: vbap.
DATA:
bapichdr LIKE bapisdh1,
bapichdrx LIKE bapisdh1x,
bapirtn LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
bapiitm LIKE bapisditm OCCURS 0 WITH HEADER LINE,
bapiitmx LIKE bapisditmx OCCURS 0 WITH HEADER LINE.
DATA: s_vbap LIKE vbap.
PARAMETERS: p_vbeln LIKE vbap-vbeln DEFAULT '40486',
p_posnr LIKE vbap-posnr DEFAULT '20'.
start-of-selection.
START-OF-SELECTION.
PERFORM get_data_4m_vbap.
PERFORM fill_header_in.
PERFORM fill_header_inx.
PERFORM fill_item_in.
PERFORM fill_item_inx.
PERFORM call_bapi_so_change.
PERFORM call_bapi_commit.
*& Form get_data_4m_vbap
text
FORM get_data_4m_vbap.
SELECT SINGLE * FROM
vbap
INTO s_vbap
WHERE vbeln = p_vbeln
AND posnr = p_posnr.
ENDFORM. " get_data_4m_vbap
*& Form fill_header_in
text
FORM fill_header_in.
*bapichdr
ENDFORM. " fill_header_in
*& Form fill_header_inx
text
FORM fill_header_inx.
bapichdrx-updateflag = 'U'.
ENDFORM. " fill_header_inx
*& Form fill_item_in
text
FORM fill_item_in.
bapiitm-itm_number = p_posnr.
bapiitm-target_qty = s_vbap-kwmeng + 5.
APPEND bapiitm.
CLEAR bapiitm.
ENDFORM. " fill_item_in
*& Form fill_item_inx
text
FORM fill_item_inx.
bapiitmx-itm_number = p_posnr.
bapiitmx-updateflag = 'U'. " I for insert & D for Delete
bapiitmx-TARGET_QTY = 'X'.
APPEND bapiitmx.
CLEAR bapiitmx.
bapiitmx-itm_number = p_posnr.
bapiitmx-updateflag = 'I'. " I for insert & D for Delete
bapiitmx-target_qty = 'X'.
APPEND bapiitmx.
CLEAR bapiitmx.
ENDFORM. " fill_item_inx
*& Form call_bapi_SO_change
text
FORM call_bapi_so_change.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_vbeln
order_header_in = bapichdr
order_header_inx = bapichdrx
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
NO_STATUS_BUF_INIT = ' '
TABLES
return = bapirtn
order_item_in = bapiitm
order_item_inx = bapiitmx
PARTNERS =
PARTNERCHANGES =
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
SCHEDULE_LINES =
SCHEDULE_LINESX =
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
READ TABLE bapirtn WITH KEY id = 'V1' number = '311'.
IF sy-subrc <> 0.
PERFORM bapi_errorlist.
ENDIF.
ENDFORM. " call_bapi_SO_change
*& Form call_bapi_commit
text
FORM call_bapi_commit.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
RETURN =
ENDFORM. " call_bapi_commit
*& Form bapi_errorlist
text
FORM bapi_errorlist.
DATA: bapierr TYPE c,
string TYPE string,
i TYPE i.
bapierr = 'X'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
LEAVE TO LIST-PROCESSING.
SET PF-STATUS 'LIST'.
FORMAT INTENSIFIED ON.
WRITE: / 'BAPI ERROR OCCURED' COLOR COL_NEGATIVE INVERSE ON.
SKIP 1.
LOOP AT bapirtn.
CONCATENATE bapirtn-type bapirtn-number '(' bapirtn-id ')'
INTO string.
WRITE: / string.
i = strlen( bapirtn-message ).
WRITE bapirtn-message(i).
ENDLOOP.
LEAVE TO SCREEN 0100.
ENDFORM. " bapi_errorlistHello Jaya,
The problem would be you are not using SCHEDULE_LINES ,so try to use.
see the below program for referenec:
REPORT ZTRIALBAPICHANGE message-id z3d .
DATA:I_HEADER1 TYPE BAPISDH1.
DATA:I_HEADER1X TYPE BAPISDH1X.
DATA:I_PART1 LIKE BAPIPARNR OCCURS 0 WITH HEADER LINE.
DATA:I_ITEMS1 LIKE BAPISDITM OCCURS 0 WITH HEADER LINE.
DATA:I_ITEMS1X LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.
DATA:I_SCH1 LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE.
DATA:I_SCH1X LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE.
data:err like bapiret2 occurs 0 with header line.
DATA:RETSALES LIKE VBAK-VBELN.
DATA:R(4).
R = '609'.
I_HEADER1-SALES_ORG = '0001'.
I_HEADER1-DISTR_CHAN = '01'.
I_HEADER1-DIVISION = '01'.
MOVE:'U' TO I_HEADER1X-UPDATEFLAG.
MOVE:'X' TO I_HEADER1X-SALES_ORG.
MOVE:'X' TO I_HEADER1X-DISTR_CHAN.
MOVE:'X' TO I_HEADER1X-DIVISION.
**PARTNER
CALL FUNCTION 'CONVERSION_EXIT_PARVW_INPUT'
EXPORTING
INPUT = 'SP'
IMPORTING
OUTPUT = I_PART1-PARTN_ROLE.
I_PART1-PARTN_NUMB = '0000000011'.
APPEND I_PART1.
**ITEM DETAILS
I_ITEMS1-MATERIAL = '000000000000000011'.
I_ITEMS1-ITM_NUMBER = '000011'.
APPEND I_ITEMS1.
MOVE:'U' TO I_ITEMS1X-UPDATEFLAG.
MOVE:'X' TO I_ITEMS1X-MATERIAL.
APPEND I_ITEMS1X.
**SCHEDULE LINE
I_SCH1-ITM_NUMBER = '000011'.
I_SCH1-REQ_QTY = '100'.
I_SCH1-SCHED_LINE = '0000'.
APPEND I_SCH1.
MOVE:'U' TO I_SCH1X-UPDATEFLAG.
MOVE:'X' TO I_SCH1X-ITM_NUMBER.
MOVE:'X' TO I_SCH1X-REQ_QTY.
MOVE:'X' TO I_SCH1X-SCHED_LINE.
APPEND I_SCH1.
UNPACK R TO RETSALES.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = RETSALES
ORDER_HEADER_IN = I_HEADER1
order_header_inx = I_HEADER1X
SIMULATION = 'X'
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
tables
return = ERR
ORDER_ITEM_IN = I_ITEMS1
ORDER_ITEM_INX = I_ITEMS1X
PARTNERS = I_PART1
PARTNERCHANGES =
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
SCHEDULE_LINES = I_SCH1
SCHEDULE_LINESX = I_SCH1X
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
loop at err.
format color 4.
write:/ err-type,
err-id,
err-number,
err-message,
err-log_no,
err-log_msg_no,
err-message_v1,
err-message_v2,
err-message_v3,
err-message_v4,
err-parameter,
err-row,
err-field,
err-system.
*WRITE:/10 ERR-MESSAGE.
endloop.
IF ERR-TYPE <> 'E'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
MESSAGE S101 WITH RETSALES.
ELSE.
MESSAGE S100.
ENDIF.
Thanks
Seshu -
Hello everyone.
We are trying to build a Java application for Leave Request similar to the one in ESS.
So, I have identified following l RFC's for generating a Leave request .Theses are:
PT_ARQ_REQUEST_PREPARE
PT_ARQ_REQUEST_CHECK
PT_ARQ_REQUEST_EXECUTE
Please can you tell me what are the paramaters i need to pass in this function module.
PT_ARQ_REQUEST_PREPARE
IM_REQUEST_ID
IM_WI_IDI
M_COMMAND
IM_PERNR
IM_MODUS
IM_DEBUG
Please guide me how to use all the function module for generating a Leave Request successfully
Thanks in advance.Hi Leo,
In se38 execute the report RPTARQUIATEST
These three function modules are used in it.
You can debug and check how the import and export parameters are handled. -
How BAPI Tables parameters are passed by reference
Hi Gurus,
I have a genuine doubt regarding BAPI parameters. I would like to point out the genreal rules of bapi like,
1. BAPI parameters should be passed by value. (Because they are rfc fm's. So both systems will be in different servers. This is the normal scenario.)
2. But the tables parameters in BAPI can't be passed by value. Instead they are passed by reference.
3. I know they use some kind of delta mechanism to transfer tables parameters to remote servers.
So gurus I would like to know what exactly happens when a tables parameter is passed. And also I didn't understand the delta mechanism. Kindly guide me.
Thanks in advance,
Jerry JeromeYou'll see in [SAP Library - RFC - Parameter Handling in Remote Calls|http://help.sap.com/saphelp_nw04s/helpdata/en/22/042551488911d189490000e829fbbd/frameset.htm] that tables are not passed by reference when you use RFC. It also explains the delta.
When you make a remote function call, the system handles parameter transfer differently than it does with local calls.
TABLES parameters
The actual table is transferred, but not the table header. If a table parameter is not specified, an empty table is used in the called function.
The RFC uses a delta managing mechanism to minimize network load during parameter and result passing. Internal ABAP tables can be used as parameters for function module calls. When a function module is called locally, a parameter tables is transferred u201Cby reference". This means that you do not have to create a new local copy. RFC does not support transfer u201Cby referenceu201D. Therefore, the entire table must be transferred back and forth between the RFC client and the RFC server. When the RFC server receives the table entries, it creates a local copy of the internal table. Then only delta information is returned to the RFC client. This information is not returned to the RFC client every time a table operation occurs, however; instead, all collected delta information is passed on at once when the function returns to the client.
The first time a table is passed, it is given an object-ID and registered as a "virtual global table" in the calling system. This registration is kept alive as long as call-backs are possible between calling and called systems. Thus, if multiple call-backs occur, the change-log can be passed back and forth to update the local copy, but the table itself need only be copied once (the first time). -
Create a sales order with reference to another one. (BAPI)
Hi everybody,
I'm trying to create a new sales order with reference to another one (That's important because of the documents flow).
I'm using 'BAPI_SALESORDER_CREATEFROMDAT2' but I couldn´t do it yet. I've read some ideas about this kind of creation in this forum; but I still haven´t found the solution yet.
Some ideas about the BAPI parameters I nedd to complete?
Thanks in advance!!Hi,
Go through this one
*& Report ZSD_R_SALESORDER
report zsd_r_salesorder1 line-size 132 message-id zmmbapi .
*& Created By : shailaja
*& Created on : 13.10.2007
*& Requested By : vardhman
*& Description of program :
Internal table definition *
data: gt_order_header_in like bapisdhead occurs 0 with header line,
gt_return like bapireturn1 occurs 0 with header line, " Return Messages
gt_order_items_in like bapiitemin occurs 0 with header line, " Item Data
gt_salesdocument like bapivbeln-vbeln , "Number of Generated Document
gt_order_partners like bapiparnr occurs 0 with header line, "Document Partner
gt_return1 like bapiret2 occurs 0 with header line.
Data definition *
types: begin of ty_gt_ft_sales ,
partn_numb(10) type n ,"Customer Number 1
partn_role(2) ,"Partner function
sales_org(4) , "Sales Organization
distr_chan(2) , "Distribution Channel
division(002), "DIVISION
doc_type(4) , "Sales Document Type
purch_no(020), "Purchase order
material(18), "MATERIAL
targetquantity(020),"Target quantity
reqqty(020), "Req quantity
reqdate(010), "req date
*REQ_DATE_H(010),
ref_1(012), "Ref
unload_pt(025),
*PARTN_ROLE(2) ,"Partner function
*PARTN_NUMB(10) ,"Customer Number 1
end of ty_gt_ft_sales,
begin of ty_header ,
partn_numb(10) ,"Customer Number 1
partn_role(2) ,"Partner function
sales_org(4) , "Sales Organization
distr_chan(2) , "Distribution Channel
division(002), "DIVISION
doc_type(4) , "Sales Document Type
purch_no(020), "Purchase order
unload_pt(025),
req_date_h(010),
end of ty_header,
begin of ty_item,
material(18), "MATERIAL
targetquantity(020),"Target quantity
reqqty(020), "Req quantity
reqdate(010), "req date
ref_1(012), "Ref
*UNLOAD(025),
end of ty_item.
data : msg(240) type c, " Return Message
e_rec(8) type c, " Error Records Counter
rec_no(8) type c, " Records Number Indicator
s_rec(8) type c, " Successful Records Counter
t_rec(8) type c, " Total Records Counter
v_matnr like mara-matnr,
v_parvw type parvw.
data : gt_ft_sales type standard table of ty_gt_ft_sales with header line.
data : wa_gt_ft_sales type ty_gt_ft_sales,
wa_order_items_in like gt_order_items_in,
wa_gt_ft_sales1 type ty_gt_ft_sales,
wa_header type ty_header,
salesdocument like bapivbeln-vbeln.
selection block for EXCEL UPLOAD FILE
selection-screen begin of block b1 with frame title text-000.
parameters file type ibipparms-path obligatory.
selection-screen end of block b1.
*<<<<AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .
at selection-screen on value-request for file .
perform getname.
form getname.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
importing
file_name = file.
endform.
*TOP-OF-PAGE.
top-of-page.
skip 3.
format color col_heading inverse on.
write 40 text-001.
format color col_heading inverse off.
skip 1.
format color col_negative inverse on.
write :/ text-002, 13 sy-mandt , 104 text-003, 121 sy-uname,
/ text-004, 13 sy-datum , 104 text-005, 121 sy-uzeit.
format color col_negative inverse off.
skip 3.
*START-OF-SELECTION.
start-of-selection.
perform get_data.
perform bapi.
*end-of-page.
perform result.
form result.
t_rec = e_rec + s_rec.
skip 3.
format color col_total inverse on.
write: /38 text-007, t_rec.
format color col_total inverse off.
format color col_negative inverse on.
write: /38 text-008, e_rec.
format color col_negative inverse off.
format color col_total inverse on.
write: /38 text-009, s_rec.
format color col_total inverse off.
endform.
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
call function 'WS_UPLOAD' "#EC *
exporting
filename = file
filetype = 'DAT'
tables
data_tab = gt_ft_sales
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
others = 11.
if sy-subrc 0 .
message e000.
endif.
endform. " get_data
*& Form BAPI
form bapi .
loop at gt_ft_sales into wa_gt_ft_sales.
wa_gt_ft_sales1 = wa_gt_ft_sales.
at new partn_numb.
wa_header-doc_type = wa_gt_ft_sales1-doc_type..
wa_header-sales_org = wa_gt_ft_sales1-sales_org . "'0001'
wa_header-distr_chan = wa_gt_ft_sales1-distr_chan. "'01'
wa_header-division = wa_gt_ft_sales1-division. " '01'
wa_header-purch_no = wa_gt_ft_sales1-purch_no.
wa_header-req_date_h = wa_gt_ft_sales1-reqdate.
call function 'CONVERSION_EXIT_PARVW_INPUT'
exporting
input = wa_gt_ft_sales1-partn_role
importing
output = v_parvw.
wa_header-partn_role = v_parvw.
wa_header-partn_numb = wa_gt_ft_sales1-partn_numb.
wa_header-unload_pt = wa_gt_ft_sales1-unload_pt.
move-corresponding wa_header to gt_order_partners.
move-corresponding wa_header to gt_order_header_in.
append gt_order_header_in.
append gt_order_partners.
endat.
call function 'CONVERSION_EXIT_CCMAT_INPUT'
exporting
input = wa_gt_ft_sales1-material
importing
output = v_matnr.
gt_order_items_in-material = v_matnr .
gt_order_items_in-target_qty = wa_gt_ft_sales1-targetquantity . "'1000'
gt_order_items_in-req_qty = wa_gt_ft_sales1-reqqty.
gt_order_items_in-req_date = wa_gt_ft_sales1-reqdate.
*GT_ORDER_ITEMS_IN-BILL_DATE = wa_GT_FT_SALES1-REQDATE.
gt_order_items_in-ref_1 = wa_gt_ft_sales1-ref_1.
append gt_order_items_in.
clear : wa_gt_ft_sales1,wa_header.
at end of partn_numb.
call function 'BAPI_SALESORDER_CREATEFROMDAT1'
exporting
order_header_in = gt_order_header_in
WITHOUT_COMMIT = ' '
CONVERT_PARVW_AUART = 'X'
importing
salesdocument = salesdocument
SOLD_TO_PARTY =
SHIP_TO_PARTY =
BILLING_PARTY =
return = gt_return
tables
order_items_in = gt_order_items_in
order_partners = gt_order_partners.
ORDER_ITEMS_OUT =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CCARD =
ORDER_CFGS_BLOB =
ORDER_SCHEDULE_EX =
if gt_return-type eq 'E' .
e_rec = e_rec + 1.
read table gt_return with key id = 'V1'.
format color col_negative inverse on.
rec_no = e_rec + s_rec.
concatenate text-006 rec_no ':'
gt_return-message into msg separated by space .
condense msg.
write: / msg.
format color col_negative inverse off.
elseif gt_return-number = '000'.
s_rec = s_rec + 1.
format color col_positive inverse on.
msg = 'SUCCESS'.
condense msg.
write: / msg .
format color col_positive inverse off.
write :/ salesdocument, 'Has been created'.
perform commit_mm.
endif.
clear: gt_return[], msg.
endat.
endloop.
endform. " SLALE_UPLOAD_DATA
*& Form COMMIT_MM
text
--> p1 text
<-- p2 text
form commit_mm .
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
importing
return = gt_return1.
clear: gt_order_items_inhttp://].\"GT_ORDER_CONDITIONS_IN[.
endform. " COMMIT_MM
inthis pass re_doc field in header...
Edited by: Naresh kumar -
Hi,
We had created a custom BAPI.
This BAPI is having a method, which in turn calls a custom FM (RFC enabled).
This was working fine but due to some requirement we had to change the structure of one of the parameter used in the interface of the FM. This parameter was in 'Tables'.
Now we require to change this structure again and have to delete some of the fields, but when we try to do the same we get an error message :
"BAPI-structure: invalid change: position field <F1> should be deleted"
here <F1> is the field that we deleted.
Has anyone seen such an error and knows the Correction.
Please help.
Thanks,
Ad.Hello,
You can not change the structure of the BAPI parameters, once it is released..!
So, try to create a new structure with your necessary fields, replace it in your existing structure and again release the BAPI.
Regards,
Naimesh
Reward points, if it is helpful..! -
PS Project description when creating sales order using BAPI
I am trying to create sales orders using BAPI_SALESORDER_CREATE_FROMDAT2.
Because of the material configuration in table TCN61 the material will trigger a project creation in the project system.
Now, in order to create a project, we must provide the project description.
I would like to ask you if anyone knows how to pass the project description in one of the BAPI parameters.
Thank you for your help.Thank you Sreedhar for the answer.
I tried the CAMPAIGN field but did not work...
In fact, I am not able to find a field, in any of the of the tables, that could hold the project description (PROJ-POST1).
An entry is created in PROJ table when we manually create a sales order for materials specified in table TCN61.
Thanks. -
BAPI for Non PO Invoice posting?
Hi Experts,
I am posting invoices using BAPI_INCOMINGINVOICE_CREATE. These invoices have POs associated with the Item Details. This is working fine for me.
I want to post invoices that DO NOT have a PO. Can someone please point me to a BAPI that is similar to BAPI_INCOMINGINVOICE_CREATE in functionality but does not require a PO?
Thanks,
- Vik.I too was looking for a BAPI for non PO invoice posting. I found that the above counsel did not work for me. Instead of creating a buyside invoice, it just created a journal entry. What DID work for me was BAPI_ACC_INVOICE_RECEIPT_POST.
Below, I am pasteing the subroutines that I created for its calling. In it, for my purposes, only the invoice amount is parameter driven. My needs allowed all other BAPI parameters to stay the same.
I hope that this helps someone.
Donald Nigro
FORM create_buyside_invoice USING value(invoice_amt) TYPE p.
DATA:
gd_documentheader LIKE bapiache03,
it_accountpayable LIKE bapiacap03 OCCURS 0 WITH HEADER LINE,
it_accountgl LIKE bapiacgl03 OCCURS 0 WITH HEADER LINE,
it_accounttax LIKE bapiactx01 OCCURS 0 WITH HEADER LINE,
it_currencyamount LIKE bapiaccr01 OCCURS 0 WITH HEADER LINE,
it_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA:
wa_obj_key(20) TYPE c.
fill header
gd_documentheader-username = sy-uname.
gd_documentheader-header_txt = 'E-Payables Invoice'.
gd_documentheader-comp_code = 'EAUS'.
gd_documentheader-doc_date = sy-datum.
gd_documentheader-pstng_date = sy-datum.
gd_documentheader-doc_type = 'KR'.
CONCATENATE 'BOA' sy-datum sy-uzeit(4)
INTO gd_documentheader-ref_doc_no.
fill AP (line 1)
it_accountpayable-itemno_acc = 1.
IF sy-sysid(3) = 'DEV'.
it_accountpayable-vendor_no = '0600013370'.
ELSE.
it_accountpayable-vendor_no = '0600009022'.
ENDIF.
APPEND it_accountpayable.
fill GL (line 2)
it_accountgl-itemno_acc = 2.
it_accountgl-gl_account = '0001112227'.
it_accountgl-comp_code = 'EAUS'.
it_accountgl-pstng_date = sy-datum.
it_accountgl-fisc_year = sy-datum(4).
it_accountgl-fis_period = sy-datum+4(2).
it_accountgl-bus_area = '0100'.
APPEND it_accountgl.
fill currency ammounts for lines 1 & 2
it_currencyamount-currency = 'USD'.
it_currencyamount-itemno_acc = 1.
it_currencyamount-amt_doccur = invoice_amt * -100.
APPEND it_currencyamount.
it_currencyamount-itemno_acc = 2.
it_currencyamount-amt_doccur = invoice_amt * 100..
APPEND it_currencyamount.
CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_CHECK'
EXPORTING
documentheader = gd_documentheader
TABLES
accountpayable = it_accountpayable
accountgl = it_accountgl
accounttax = it_accounttax
currencyamount = it_currencyamount
return = it_return.
PERFORM invoice_error_check TABLES it_return.
CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
EXPORTING
documentheader = gd_documentheader
IMPORTING
obj_key = wa_obj_key
TABLES
accountpayable = it_accountpayable
accountgl = it_accountgl
accounttax = it_accounttax
currencyamount = it_currencyamount
return = it_return.
PERFORM invoice_error_check TABLES it_return.
COMMIT WORK.
WRITE: / 'ePayables Bank of America'.
WRITE: / ' Invoice Document Number:',
wa_obj_key(10).
ENDFORM.
Form invoice_error_check
FORM invoice_error_check TABLES it_return STRUCTURE bapiret2.
DATA:
bapi_success(5) TYPE c VALUE 'false'.
LOOP AT it_return.
IF it_return-type = 'S' AND bapi_success = 'false'.
bapi_success = 'true'.
ENDIF.
ENDLOOP.
IF bapi_success = 'false'.
WRITE: / 'Unable to post a buyside invoice with',
'BAPI_ACC_INVOICE_RECEIPT_POST'.
LOOP AT it_return.
WRITE: / 'Message Type: ', it_return-type,
/ 'Message Class: ', it_return-id,
/ 'Message Number: ', it_return-number,
/ 'Message: ', (80) it_return-message.
ENDLOOP.
ROLLBACK WORK.
STOP.
ENDIF.
ENDFORM. -
BAPI Create Contract Account in Module PSCD
Hi all,
I have a requirement create Contract Account (TCode CAA1) in module PSCD by BAPI.
I use BAPI : BAPI_CTRACCONTRACTACCOUNT_CR1.
I set value for some required parameters and Perform BAPI, i receive 2 error messages in RETURN parameter :
- Enter a value in field Account Determ. ID
- Enter a value in field Payment Terms
I don't know where to set value for Account Determ.ID and Payment Terms in BAPI.
I searched description of BAPI parameters but there is no BAPI parameter suitable.
I also searched on this forum but no topic found.
Pls help,
Thank.
nvsinh.Hi all,
The problem is solved.
The proplem comes from release version of ECC6.
Thanks all,
Sinhto -
BAPI_MATERIAL_MAINTAINDATA_RT reorder point & Forecast parameters
Hi
I use BAPI_MATERIAL_MAINTAINDATA_RT for change reorder point and only this, but after run i see that the forecast parameters changed too.
example code
head-material = matnr.
head-logst_view = 'X'.
plant-material = matnr.
plant-plant = werks.
plant-reorder_pt = value.
plantx-material = matnr.
plantx-plant = werks.
plantx-reorder_pt = 'X'.
CALL function 'BAPI_MATERIAL_MAINTAINDATA_RT'
EXPORTING
headdata = head
Importing
return = return
TABLES
plantdata = plant
plantdatax = plantx.
I try to select/deselect auto_reset (reset forecast model automatically) but nothing was changed.
Do you know what is wrong whit this??
Best Regards
Szymon Glapiak
Edited by: Szymon Glapiak on Nov 4, 2008 6:20 PMHi,
You might need to check for an OSS Note for this BAPI.
For detailed Desc of BAPI, Refer to http://abap.wikiprog.com/wiki/BAPI_MATERIAL_MAINTAINDATA_RT
Or you can also use WE60 for IDOC ARTMAS01, the segment definition will help you to understand the BAPI parameters. -
BAPI to checkin file as new content version
Hi,
I am looking for a BAPI that allows me to checkin an original as a new content version via SAP JCo (similar to the "Check In as New Version" UI feature). I couldn't get it to work using the standard BAPIs BAPI_DOCUMENT_*
Is there a remote capable standard BAPI that does the job?
Regards
MichaelHi Thierry,
thanks for your quick response.
I tried that one. I found it to checkin new files.
With BAPI_DOCUMENT_CHECKIN_REPLACE2 I can replace originals.
But I failed to create new content version of an existing orginal.
Could you provide me with an example, of how to fill the BAPI parameters in order to create a new content version?
Many thanks
Michael
Maybe you are looking for
-
PDF Form to XML. How to handle invoice detail lines
I am using LC Designer 7.x on a PDF form that has a submit button that loads a ColdFusion MX7 page that will save the XML in a MS SQL 2005 XML field. My source of confusion is how to handle the invoice detail lines on the PDF invoice form. The XML th
-
TNS: connection closed error with SQL*net
Hi all, I've got a new installation of Oracle 11.1.0.6.0 enterprise (Linux). It works fine with direct sqlplus connections but I'm having problems with SQL*net and JDBC thin client connections. The database is built correctly and works fine: user@cth
-
How do I stop Imovie from automatically searching for videos when I open the program. It will not allow me to do anything and I cannot start a new session.
-
The xml page can not be displayed
I modified a customized report. The report ends in error The following tags were not closed: XXPAY012RPT LIST_G_COMPANY , Please help
-
Can I rearrange the folders in my Mailbox
I have a iPhone 4S and want to rearrange the folders - how do I do that?