Purchase Order (BAPI_PO_CREATE! -- EXTENSIONIN)
Hi people!!
I want to create purchase order with the BAPI BAPI_PO_CREATE1, but i have to populated some fields of EKKO table that they are´nt in BAPI and i have to used the EXTENSIONIN structure.
Some example?
This Bapi saved this fields with EXTENSIONIN or
do i have to do something more?
Sorry, but my english is very short and very poor,
Thanks and kind regards,...
Hi Juan,
To use the extension in structure:
Declare a local structure (say 'mystruct') with the type of the structure that contains the fields you want to add (it may be declared in the dictionary).
Declare another local structure (say 'mystructx') with the same fields name but with types CHAR1 (they are flags).
Fill mystruct with the values you want.
Fill mystructx with 'X' when you want to modify the corresponding fields.
you will have to fill 2 lines in EXTENSIONIN for header, and 2 lines for each item :
<u>First line :</u>
STRUCTURE : the name of the type of mystruct.
VALUEPART1 : the 240 first characters of mystruct
VALUEPART2 : the 240 following characters of mystruct (of blank if mystruct is not long enough)
VALUEPART3 : the 240 following characters of mystruct (of blank if mystruct is not long enough)
VALUEPART4: the 240 following characters of mystruct (of blank if mystruct is not long enough)
<u>Second line :</u>
STRUCTURE : the name of the type of mystructx.
VALUEPART1 : the 240 first characters of mystructx
VALUEPART2 : the 240 following characters of mystructx (of blank if mystruct is not long enough)
VALUEPART3 : the 240 following characters of mystructx (of blank if mystruct is not long enough)
VALUEPART4: the 240 following characters of mystructx (of blank if mystruct is not long enough)
Hope that helps.
Tell if you want examples.
Similar Messages
-
Purchase Order item customer fields
I have the following scenario:
- I need to save some customer fields in Purchase Order item, when it is generated through the Shopping Cart (EBP).
- When EBP will generate a PO in backend (R/3), it calls B470_PO_CREATE function module and inside it calls BAPI_PO_CREATE1 in R/3. This call does not use extensionin parameter.
- I have all the values in PO_ITEMS parameters. (an append structure in bapi_mepoitem).
- Trying to solve this, I think I have to use EXIT_SAPL2012_001 to create the extensionin parameter.
- Anyone else has this problem?
- How can I create the extensionin parameter? Is it only necessary to add 'BAPI_TE_MEPOITEM' and 'BAPI_TE_MEPOITEMX'?
- Do you have an example?
Thank you!Hi
You have to extend CI_EKPODBX with the same fieldnames with type BAPIUPDATE (in SE11), and then while passing the EXTENSIONIN to the bapi, you have to flag those. Like the following:
DATA: wa_extensionin TYPE BAPIPAREX,
wa_BAPIPAREX TYPE BAPIPAREX,
wa_BAPI_TE_MEPOITEM TYPE BAPI_TE_MEPOITEM,
wa_BAPI_TE_MEPOITEMX TYPE BAPI_TE_MEPOITEMX.
wa_BAPI_TE_MEPOITEM-po_item = <PO Line No.>.
wa_BAPI_TE_MEPOITEM-ZZZ_FIELD1 = <z-field value>.
wa_BAPIPAREX-STRUCTURE = 'BAPI_TE_MEPOITEM'.
wa_BAPIPAREX-VALUEPART1 = wa_BAPI_TE_MEPOITEM.
APPEND wa_BAPIPAREX TO extensionin.
wa_BAPI_TE_MEPOITEMX-po_item = <PO Line No.>.
wa_BAPI_TE_MEPOITEMX-ZZZ_FIELD1 = 'X'.
wa_BAPIPAREX-STRUCTURE = 'BAPI_TE_MEPOITEMX'.
wa_BAPIPAREX-VALUEPART1 = wa_BAPI_TE_MEPOITEMX.
APPEND wa_BAPIPAREX TO extensionin.
This will work. Please let me know if it does not.
See related links ->
Re: BAPI_PO_CREATE1 and EXTENSIONIN structure
Re: Passing custom fields to BAPI
Problem in populating userfields in PO using BAPI_PO_CREATE1
Re: BAPI_PO_CHANGE
Yann i need ur help..
Re: Custom field values are not being transfered to the backend system
Problem in populating userfields in PO using BAPI_PO_CREATE1
Re: Implement ME_PROCESS_PO_CUST-Urgently!
Re: Purchase Order (BAPI_PO_CREATE! --> EXTENSIONIN)
Re: How to use BAPI extensions?
Re: BAPI_PO_CREATE1 user fields not saving on EKPO
BAPI_PO_CREATE1 - EXIT_SAPL2012_001
Do let me know.
Regards
- Atul -
BAPI for updating tax code for purchase order..
Hi friends,
I have one requirement to change tax code for multiple Purchase order but the
thing is they should not go for release.So what should I prefer BDC or BAPI.
I am thinking to implement it through BAPI, but I don't know what procedure to follow.
If somebody can provide me a small guiding steps or code then it will be very helpful for me..
Thnaks in advance..
Useful answers will be rewarded with points....
Regards,
Rajesh AkarteHi Friend,
BAPI_ACC_PURCHASE_ORDER_CHECK Accounting: Check Purchase Order
BAPI_ACC_PURCHASE_ORDER_POST Accounting: Post Purchase Order
MEWP BAPIs Purchase order
BAPI_PO_CREATE Create Purchase Order
BAPI_PO_GETDETAIL Display Purchase Order Details
BAPI_PO_GETITEMS List Purchase Order Items
BAPI_PO_GETITEMSREL List Purchase Orders for Release (Approval): New as of 4.0A
BAPI_PO_GETRELINFO Display Detailed Release (Approval) Information on Purchase Order
BAPI_PO_GET_LIST List Purchase Orders - Only up to 4.0A
BAPI_PROCOPERATION_GETCATALOGS Determine Valid Catalogs as Value Help
BAPI_PROCOPERATION_GETINFO Analysis of Objects to be Generated in Purchasing
<b>AND</b>
Use condition type NAVS with access sequence 0003 to default the taxcode in the purchase order item using conditions. Materials Management -> Purchasing -> Purchasing order processing ->define screen layout at document level. Search for the transaction ME21.Double click on ME21. Then search for TaxCode
Use condition type NAVS with access sequence 0003 to default the taxcode in the purchase order item using conditions.
A2: Go to IMG.
Materials Management -> Purchasing -> Purchasing order processing ->define screen layout at document level.
Search for the transaction ME21.Double click on ME21. Then search for TaxCode. It is advisable to configure also the info record. The tax code should be a required entry, and whatever you specify here will be the default value in the Purchase order.
Materials Management -> Purchasing -> Purchasing info record -> define screen layout.
When you get here you search for the transaction ME12 ,double click here; search for Input VAT indicator.
Regards ,
Kumar. -
Bapi_po_create is not creating Purchase Orders for multiple records in file
Hi All.
iam trying to create contracts and Purchase Orders In me21n,me31k .
here iam using bdc for contract creation against services and using bapi_po_create for PO Creations.
in this process i could create contracts and POs for the first record in the file but for second record bapi_po_create couldnt create POs and the return table in bapi says
1.document contains no items.
2.no services or limits have been maintained.
wil be waiitng for r great answer.
bye.
regards.
seeta.Hi Seeta Ram,
Did you pass the table PO_ITEM_SCHEDULES to BAPI_PO_CREATE with the coresponding Item numbers for each item in the table PO_ITEMS?
Regards,
Vitz. -
PURCHASE ORDER WITH OUT BAPI_PO_CREATE CAN WE CREATE?
PURCHASE ORDER WITH OUT calling BAPI_PO_CREATE CAN WE CREATE?
Don't Post your question with all Caps. Follow the Rules of Engagement
Edited by: Vijay Babu Dudla on Apr 23, 2009 1:46 AM[Create Purchase order with program|can we create purchase order through report programming?]
Plz be clear about your requirement instead of posting questions like these.
Don't violate forum rules with Duplicate posts -
HEADER TEXT in purchase orders using BAPI_PO_CREATE
How to update HEADER TEXT in purchase orders using BAPI_PO_CREATE or BAPI_PO_CREATE1?Please advice for both types.
Hi Srini ,
IF you are using the BAPI_PO_CREATE , we are not having the parameter to pass Header Text.
If you want to get Header Text directly then Use BAPI_PO_CREATE1 wiht a parameter POTEXTHEADER (I am not sure it is there in 4.7).
If BAPI_PO_CREATE1 does not exist in 4.7 then use create_text function module to update the the Header text
Hope it helps
Rgds
Sree M
Edited by: Sree Merugu on Jun 13, 2008 5:10 PM -
Hai,
how to upload the purchase order when one PO has three line items,
another has 100 line items, and so on.
can i use BAPI_PO_Create FM for this ?
if it possible ,how to use ?
Thanks & regards,
ManikandanCheck the following ex:
Data Declaration for BAPI *****************
data: begin of pohead occurs 10.
include structure BAPIMEPOHEADER.
data: end of pohead.
data: begin of poheadx occurs 10.
include structure BAPIMEPOHEADERX.
data: end of poheadx.
*EXPPURCHASEORDER
data: BEGIN OF ponum.
include structure BAPIMEPOHEADER.
data: end of ponum.
data: begin of poitem occurs 100.
include structure BAPIMEPOITEM.
data: end of poitem.
data: begin of poitemx occurs 100.
include structure BAPIMEPOITEMX.
data: end of poitemx.
data: begin of errmsg occurs 10.
include structure bapiret2.
data: end of errmsg.
data : errflag.
START-OF-SELECTION.
PERFORM UPLOAD_DATA.
*& Form UPLOAD_DATA
text
--> p1 text
<-- p2 text
FORM UPLOAD_DATA .
data: p_fdir(200) type c .
p_fdir = gfile.
data: begin of it_filedir occurs 10.
include structure salfldir.
data: end of it_filedir.
Get Current Directory Listing for OUT Dir
call function 'RZL_READ_DIR_LOCAL'
EXPORTING
name = p_fdir
TABLES
file_tbl = it_filedir.
data: it_filedir1 like it_filedir occurs 0 with header line.
loop at it_filedir.
if it_filedir-name(4) = 'CPOR' or it_filedir-name(4) = 'cpor'.
move it_filedir-name to it_filedir1-name.
append it_filedir1.
endif.
endloop.
IF IT_FILEDIR1[] IS INITIAL.
STOP.
ENDIF.
REFRESH I_MSG1.
CLEAR I_MSG1.
loop at it_filedir1.
REFRESH I_TAB.
REFRESH I_TAB2.
REFRESH I_TAB1.
data: g_file(100) type c .
name = it_filedir1-name.
concatenate: gfile '\' name into g_file.
data : i_tab1(200).
OPEN DATASET g_file FOR INPUT IN TEXT MODE
ENCODING DEFAULT
IGNORING CONVERSION ERRORS.
IF SY-SUBRC EQ 0.
DO.
READ DATASET g_file INTO i_tab1.
if sy-subrc = 0.
split i_tab1 at ',' into i_tab-verkf i_tab-verkf1 i_tab-lifnr
i_tab-ebelp1 i_tab-werks
i_tab-matnr i_tab-idnlf
i_tab-menge i_tab-bprme i_tab-lewed i_tab-netpr.
else.
exit.
endif.
APPEND i_tab.
clear i_tab.
ENDDO.
ENDIF.
*************** error testing*******************
LOOP AT i_tab.
MOVE-CORRESPONDING i_tab TO etab1.
append etab1.
clear etab1.
ENDLOOP.
*************** end error testing*******************
DELETE DATASET g_file.
CLOSE DATASET g_file.
concatenate:
hfile '\' date1 '\' name into h_file.
OPEN DATASET h_file FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT
IGNORING CONVERSION ERRORS.
IF SY-SUBRC EQ 0.
LOOP AT I_TAB.
CONCATENATE I_TAB-VERKF ',' I_TAB-VERKF1 ',' I_TAB-LIFNR ','
I_TAB-EBELP1 ',' I_TAB-WERKS ',' I_TAB-MATNR ','
I_TAB-IDNLF ',' I_TAB-MENGE ',' I_TAB-BPRME ','
I_TAB-LEWED ',' I_TAB-NETPR INTO I_TAB2.
TRANSFER i_tab2 TO h_file.
ENDLOOP.
ENDIF.
CLOSE DATASET h_file.
MOVE I_TAB[] TO I_TAB3[].
DELETE ADJACENT DUPLICATES FROM I_TAB COMPARING VERKF.
loop at i_tab.
refresh pohead.
refresh poheadx.
refresh poitem.
refresh poitemX.
pohead-DOC_TYPE = i_tab-bsart.
pohead-VENDOR = i_tab-lifnr.
pohead-PURCH_ORG = c_ekorg.
pohead-CREAT_DATE = i_tab-verkf1.
pohead-PUR_GROUP = c_ekgrp.
pohead-COMP_CODE = c_bukrs.
pohead-SALES_PERS = I_TAB-VERKF2.
pohead-doc_date = sy-datum.
pohead-langu = sy-langu.
append pohead.
poheadx-DOC_TYPE = c_x.
poheadx-VENDOR = c_x.
poheadx-PURCH_ORG = c_x.
poheadx-PUR_GROUP = c_x.
poheadx-COMP_CODE = c_x.
poheadx-SALES_PERS = c_x.
poheadx-doc_date = c_x.
poheadx-langu = c_x.
append poheadx.
loop at i_tab3 WHERE VERKF = I_TAB-VERKF.
poitem-PO_ITEM = i_tab3-ebelp1.
poitem-MATERIAL = i_tab3-MATNR.
poitem-QUANTITY = i_tab3-MENGE.
poitem-PO_UNIT = i_tab3-BPRME.
poitem-NET_PRICE = i_tab3-NETPR.
poitem-PLANT = i_tab3-WERKS.
poitem-GR_TO_DATE = i_tab3-LEWED.
poitem-tax_code = c_x.
poitem-item_cat = c_x.
POITEM-ACCTASSCAT = c_x.
poitem-AGREEMENT = i_tab3-ebeln.
poitem-AGMT_ITEM = i_tab3-ebelp1.
poitem-VEND_MAT = i_tab3-IDNLF.
append poitem.
poitemx-PO_ITEM = i_tab3-ebelp1.
poitemx-MATERIAL = c_x.
poitemx-QUANTITY = c_x.
poitemx-PO_UNIT = c_x.
poitemx-NET_PRICE = c_x.
poitemx-PLANT = c_x.
poitemx-GR_TO_DATE = c_x.
poitemx-tax_code = c_x.
poitemx-item_cat = c_x.
POITEMx-ACCTASSCAT = c_x.
poitemx-AGREEMENT = 'X'.
poitemx-AGMT_ITEM = 'X'.
poitemx-VEND_MAT = c_x.
append poitemx.
endloop.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = pohead
POHEADERX = poheadx
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
EXPPURCHASEORDER =
EXPHEADER = ponum
EXPPOEXPIMPHEADER =
TABLES
RETURN = errmsg
POITEM = poitem
POITEMX = poitemx
POADDRDELIVERY =
POSCHEDULE =
POSCHEDULEX =
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
clear errflag.
loop at errmsg.
if errmsg-type eq 'E'.
write:/'Error in function', errmsg-message.
errflag = 'X'.
else.
write:/ errmsg-message.
endif.
endloop.
if errflag is initial.
commit work and wait.
if sy-subrc ne 0.
write:/ 'Error in updating'.
exit.
else.
write:/ ponum-PO_NUMBER, ponum-comp_code.
endif.
endif.
endloop.
ENDFORM. " UPLOAD_DATA -
Creation of purchase order using bapi
hi gurus,
Can anyone give me an example of how to create purchase order using bapiHi use BAPI_PO_CREATE.. I have an eg. of changing a PO using BAPI. This is almost similar to create.. Go thru and let me know if u need more info..
Dont forget to use 'BAPI COMMIT' after the function call...
DATA:
*Update Short text, qty, net price, item no.,
*agreement no. and agreement line no.
it_po_item TYPE TABLE OF bapimepoitem,
*Select fields
it_po_item_x TYPE TABLE OF bapimepoitemx,
*Delivery date
it_po_schedule TYPE TABLE OF bapimeposchedule,
*Select fields
it_po_schedule_x TYPE TABLE OF bapimeposchedulx,
*Return parameters
it_return TYPE TABLE OF bapiret2,
*PO Account
it_po_account TYPE TABLE OF bapimepoaccount,
*Select fields
it_po_account_x TYPE TABLE OF bapimepoaccountx,
Condition Types
it_po_cond TYPE TABLE OF bapimepocond,
*Select fields
it_po_cond_x TYPE TABLE OF bapimepocondx,
it_po_text type table of BAPIMEPOTEXT.
Structures
DATA:
st_po_header TYPE bapimepoheader,
st_po_header_x TYPE bapimepoheaderx,
st_po_item LIKE LINE OF it_po_item,
st_po_item_x LIKE LINE OF it_po_item_x,
st_po_schedule LIKE LINE OF it_po_schedule,
st_po_schedule_x LIKE LINE OF it_po_schedule_x,
st_return TYPE bapiret2,
st_po_account LIKE LINE OF it_po_account,
st_po_account_x LIKE LINE OF it_po_account_x,
st_po_cond LIKE LINE OF it_po_cond,
st_po_cond_x LIKE LINE OF it_po_cond_x,
st_po_text like line of it_po_text.
Variables
DATA : po_number TYPE bapimepoheader-po_number,
w_item_no(10) TYPE n VALUE '1'.
START-OF-SELECTION.
test values
po_number = '94490'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = po_number
IMPORTING
OUTPUT = po_number
st_po_item-po_item = w_item_no.
st_po_item-quantity = '00.000'.
st_po_item-delete_ind = 'X'.
st_po_item-short_text = 'ZMU-test1'.
st_po_item-agreement = '0060000128'.
st_po_item-agmt_item = '1'.
st_po_item-net_price = '1'.
st_po_item_x-po_item = w_item_no.
st_po_item_x-po_itemx = 'X'.
st_po_item_x-delete_ind = 'X'.
st_po_item_x-quantity = 'X'.
st_po_item_x-short_text = 'X'.
st_po_item_x-agreement = 'X'.
st_po_item_x-agmt_item = 'X'.
st_po_item_x-net_price = 'X'.
st_po_schedule-po_item = w_item_no.
st_po_schedule-delivery_date = '9/19/2008'.
st_po_schedule-quantity = '1'.
st_po_schedule_x-po_item = w_item_no.
st_po_schedule_x-po_itemx = 'X'.
st_po_schedule_x-delivery_date = 'X'.
st_po_schedule_x-quantity = 'X'.
st_po_cond-itm_number = w_item_no.
st_po_cond-cond_type = 'PB00'.
st_po_cond-cond_value = '1.000'.
st_po_cond-currency = 'USD'.
st_po_cond-change_id = 'U'.
st_po_cond_x-itm_number = w_item_no.
st_po_cond_x-itm_numberx = 'X'.
st_po_cond_x-cond_type = 'X'.
st_po_cond_x-cond_value = 'X'.
st_po_cond_x-currency = 'X'.
st_po_cond_x-change_id = 'X'.
st_po_text-PO_NUMBER = po_number.
st_po_text-PO_ITEM = w_item_no.
st_po_text-TEXT_LINE = 'MU_TEST1 MU_TEST2'.
APPEND:
st_po_item_x TO it_po_item_x,
st_po_item TO it_po_item.
st_po_schedule_x TO it_po_schedule_x,
st_po_schedule TO it_po_schedule,
st_po_cond TO it_po_cond,
st_po_cond_x TO it_po_cond_x,
st_po_text to it_po_text.
st_po_text-PO_NUMBER = po_number.
st_po_text-PO_ITEM = w_item_no.
st_po_text-TEXT_LINE = 'MU_TEST2'.
st_po_text-TEXT_FORM = '03'.
append st_po_text to it_po_text.
PERFORM function_call.
LOOP AT it_return INTO st_return.
WRITE:/ st_return-message, 'Message type =', st_return-type,/.
ENDLOOP.
REFRESH:
it_return,
it_po_item,
it_po_item_x,
it_po_cond,
it_po_cond_x.
PERFORM update_price.
WRITE:/ 'After update - Messages'.
LOOP AT it_return INTO st_return.
WRITE:/ st_return-message, 'Message type =', st_return-type,/.
ENDLOOP.
data: begin of test occurs 0,
f1,
end of test.
FORM function_call *
FORM function_call.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = po_number
POHEADER =
POHEADERX =
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
IMPORTING
EXPHEADER =
TABLES
return = it_return
poitem = it_po_item
poitemx = it_po_item_x
POADDRDELIVERY =
poschedule = it_po_schedule
poschedulex = it_po_schedule_x
poaccount =
POACCOUNTPROFITSEGMENT =
poaccountx =
POCONDHEADER =
POCONDHEADERX =
pocond = it_po_cond
pocondx = it_po_cond_x
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POTEXTHEADER =
POTEXTITEM = it_po_text
POPARTNER =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = st_return.
ENDFORM. -
How to create purchase order using VA01 for BAPI?
how to create purchase order using VA01 for BAPI?
Hi Arun,
Please check this link
Example Program for BAPI_PO_CREATE1
Re: BAPI_PO_CREATE1
Questions in BAPI_PO_CREATE1
Problem with BAPI_PO_CREATE1
*& Report BAPI_PO_CREATE *
REPORT bapi_po_create.
Input File Declaration
TYPES: BEGIN OF ty_input_file,
column1 TYPE char50,
column2 TYPE char50,
column3 TYPE char50,
column4 TYPE char50,
column5 TYPE char50,
column6 TYPE char50,
column7 TYPE char50,
column8 TYPE char50,
column9 TYPE char50,
column10 TYPE char50,
column11 TYPE char50,
column12 TYPE char50,
column13 TYPE char50,
column14 TYPE char50,
column15 TYPE char50,
column16 TYPE char50,
column17 TYPE char50,
column18 TYPE char50,
END OF ty_input_file.
DATA: i_input_file TYPE STANDARD TABLE OF ty_input_file,
wa_input_file TYPE ty_input_file.
CONSTANTS: c_path TYPE char20 VALUE 'C:\',
c_mask TYPE char9 VALUE ',.,..',
c_mode TYPE char1 VALUE 'O',
c_filetype TYPE char10 VALUE 'ASC',
c_x TYPE char01 VALUE 'X'.
PARAMETERS : p_fname LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
Browse Presentation Server
PERFORM f4_presentation_file.
START-OF-SELECTION..
Read presentation server file
PERFORM f1003_upload_file.
IF NOT i_input_file[] IS INITIAL.
PERFORM split_data.
ENDIF.
*& Form f4_presentation_file
*& F4 Help for presentation server
FORM f4_presentation_file .
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = c_path
mask = c_mask
mode = c_mode
title = text-001
IMPORTING
filename = p_fname
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " f4_presentation_file
*& Form f1003_upload_file
*& Upload File
FORM f1003_upload_file .
DATA: lcl_filename TYPE string.
lcl_filename = p_fname.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lcl_filename
filetype = c_filetype
has_field_separator = c_x
TABLES
data_tab = i_input_file
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
ENDFORM. " f1003_upload_file
*& Form split_data
Collect data for creating Purchase Order
FORM split_data .
DATA: i_poitem TYPE STANDARD TABLE OF bapimepoitem,
i_poitemx TYPE STANDARD TABLE OF bapimepoitemx,
i_poitem_sch TYPE STANDARD TABLE OF bapimeposchedule,
i_poitem_schx TYPE STANDARD TABLE OF bapimeposchedulx,
i_acct_*** TYPE STANDARD TABLE OF bapimepoaccount,
i_acct_assx TYPE STANDARD TABLE OF bapimepoaccountx,
i_services TYPE STANDARD TABLE OF bapiesllc ,
i_srvacc TYPE STANDARD TABLE OF bapiesklc,
i_return TYPE STANDARD TABLE OF bapiret2,
wa_header TYPE bapimepoheader,
wa_headerx TYPE bapimepoheaderx,
wa_poitem TYPE bapimepoitem,
wa_poitemx TYPE bapimepoitemx,
wa_poitem_sch TYPE bapimeposchedule,
wa_poitem_schx TYPE bapimeposchedulx,
wa_acct_*** TYPE bapimepoaccount,
wa_acct_assx TYPE bapimepoaccountx,
wa_services TYPE bapiesllc,
wa_srvacc TYPE bapiesklc,
wa_return TYPE bapiret2,
ws_po TYPE bapimepoheader-po_number.
break gbpra8.
wa_services-pckg_no = 10.
wa_services-line_no = 1.
wa_services-outl_no = '0'.
wa_services-outl_ind = c_x.
wa_services-subpckg_no = 20.
APPEND wa_services TO i_services.
wa_srvacc-pckg_no = 10.
wa_srvacc-line_no = 1.
wa_srvacc-serno_line = 01.
wa_srvacc-serial_no = 01.
wa_srvacc-percentage = 100.
APPEND wa_srvacc TO i_srvacc.
LOOP AT i_input_file INTO wa_input_file.
IF wa_input_file-column2 EQ 'HD'.
wa_header-doc_type = wa_input_file-column3.
wa_header-creat_date = sy-datum.
wa_header-created_by = sy-uname.
wa_header-vendor = wa_input_file-column4.
PERFORM conversion_output USING wa_header-vendor
CHANGING wa_header-vendor.
wa_header-comp_code = 'DE03'.
wa_header-purch_org = 'DE03'.
wa_header-pur_group = 'DE1'.
wa_header-vper_start = wa_input_file-column9.
wa_header-vper_end = wa_input_file-column10.
wa_headerx-comp_code = c_x.
wa_headerx-doc_type = c_x.
wa_headerx-creat_date = c_x.
wa_headerx-created_by = c_x.
wa_headerx-vendor = c_x.
wa_headerx-purch_org = c_x.
wa_headerx-pur_group = c_x.
wa_headerx-vper_start = c_x.
wa_headerx-vper_end = c_x.
ENDIF.
IF wa_input_file-column2 EQ 'IT'.
wa_poitem-po_item = wa_input_file-column3.
wa_poitem-short_text = wa_input_file-column6.
wa_poitem-plant = wa_input_file-column8.
wa_poitem-quantity = '1'.
wa_poitem-tax_code = 'V0'.
wa_poitem-item_cat = 'D'.
wa_poitem-acctasscat = 'K'.
wa_poitem-matl_group = wa_input_file-column7.
wa_poitem-pckg_no = '10'.
APPEND wa_poitem TO i_poitem .
wa_poitemx-po_item = wa_input_file-column3.
wa_poitemx-po_itemx = c_x.
wa_poitemx-short_text = c_x.
wa_poitemx-plant = c_x.
wa_poitemx-quantity = c_x.
wa_poitemx-tax_code = c_x.
wa_poitemx-item_cat = c_x.
wa_poitemx-acctasscat = c_x.
wa_poitemx-matl_group = c_x.
wa_poitemx-pckg_no = c_x.
APPEND wa_poitemx TO i_poitemx.
wa_poitem_sch-po_item = wa_input_file-column3.
wa_poitem_sch-delivery_date = sy-datum.
APPEND wa_poitem_sch TO i_poitem_sch.
wa_poitem_schx-po_item = wa_input_file-column3.
wa_poitem_schx-po_itemx = c_x.
wa_poitem_schx-delivery_date = c_x.
APPEND wa_poitem_schx TO i_poitem_schx.
wa_acct_***-po_item = 10.
wa_acct_***-serial_no = 01.
wa_acct_***-gl_account = '0006360100'.
wa_acct_***-co_area = '1000'.
wa_acct_***-costcenter = 'KC010000'.
APPEND wa_acct_*** TO i_acct_***.
wa_acct_***-po_item = 10.
wa_acct_***-serial_no = 02.
wa_acct_***-gl_account = '0006360100'.
wa_acct_***-co_area = '1000'.
wa_acct_***-costcenter = 'KC010000'.
APPEND wa_acct_*** TO i_acct_***.
wa_acct_assx-po_item = 10.
wa_acct_assx-serial_no = 01.
wa_acct_assx-po_itemx = c_x.
wa_acct_assx-serial_nox = c_x.
wa_acct_assx-gl_account = c_x.
wa_acct_assx-co_area = c_x.
wa_acct_assx-costcenter = c_x.
APPEND wa_acct_assx TO i_acct_assx.
wa_acct_assx-po_item = 10.
wa_acct_assx-serial_no = 02.
wa_acct_assx-po_itemx = c_x.
wa_acct_assx-serial_nox = c_x.
wa_acct_assx-gl_account = c_x.
wa_acct_assx-co_area = c_x.
wa_acct_assx-costcenter = c_x.
APPEND wa_acct_assx TO i_acct_assx.
wa_services-pckg_no = 20.
wa_services-line_no = 2.
wa_services-service = wa_input_file-column9.
wa_services-quantity = '100'.
wa_services-gr_price = '100'.
wa_services-userf1_txt = wa_input_file-column13.
APPEND wa_services TO i_services.
wa_srvacc-pckg_no = 20.
wa_srvacc-line_no = 1.
wa_srvacc-serno_line = 02.
wa_srvacc-serial_no = 02.
wa_srvacc-percentage = 100.
APPEND wa_srvacc TO i_srvacc.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = wa_header
poheaderx = wa_headerx
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
exppurchaseorder = ws_po
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
return = i_return
poitem = i_poitem
poitemx = i_poitemx
POADDRDELIVERY =
poschedule = i_poitem_sch
poschedulex = i_poitem_schx
poaccount = i_acct_***
POACCOUNTPROFITSEGMENT =
poaccountx = i_acct_assx
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
poservices = i_services
posrvaccessvalues = i_srvacc
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
break gbpra8.
LOOP AT i_return INTO wa_return.
ENDLOOP.
ENDFORM. " split_data
*& Form conversion_output
Conversion exit input
FORM conversion_output USING p_ip
CHANGING p_op.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = p_ip
IMPORTING
output = p_op.
ENDFORM. " conversion_output
Best regards,
raam -
Step by step bapi for purchase order
hi friends,
i am very new to bapi i have requiremet to upload purchase order
using bapi can any one tell me how to use bapi_po_create
which parameter i hvae to pass .plz do the need ful.
regards
sonuHi Sir,
I am sending you the code in which i have implemented bapi pocreate.Please go through the FM ,you will easily understand it.
Plz do reward if useful.
Thankx.
method do_handle_event.
*CALL METHOD SUPER->DO_HANDLE_EVENT
EXPORTING
EVENT =
HTMLB_EVENT =
HTMLB_EVENT_EX =
GLOBAL_MESSAGES =
RECEIVING
GLOBAL_EVENT =
data: event_id type string.
data zpr_num1 type banfn.
data zreturn type zsn_bapiret2.
data ret type bapireturn-type.
data message type bapi_msg.
data returnval type bapimepoheader-po_number.
data: r_view type ref to if_bsp_page.
data: crt_view type ref to if_bsp_page.
data po_num_head type bapimepoheader.
data zpoheader_it type zbapimepoheader_tab.
data zpoheaderx_it type zbapimepoheaderx_tab.
to add a new item to list
if htmlb_event is bound and htmlb_event->server_event = 'onadd'.
zpr_num = request->get_form_field( 'PRNo' ) .
data: zpr_num3 type banfn.
call function 'ZCONVERT_ALPHA'
exporting
input = zpr_num
importing
output = zpr_num3.
zpr_num = zpr_num3.
data: temp_tab1 type zrmheader.
delete from zrmheader.
zpoheader-vendor = request->get_form_field( 'Vendor' ) .
zpoheader-purch_org = request->get_form_field( 'POrg' ).
zpoheader-pur_group = request->get_form_field( 'PGrp' ).
zpoheader-doc_type = 'NB'.
zpoheader-item_intvl = request->get_form_field( 'Item' ).
zpoheader-comp_code = request->get_form_field( 'CCode' ).
zpoheader-doc_date = request->get_form_field( 'DocDate' ).
delivdate_new = request->get_form_field( 'DelivDate' ).
temp_tab1-vendor = request->get_form_field( 'Vendor' ) .
temp_tab1-purch_org = request->get_form_field( 'POrg' ).
temp_tab1-pur_group = request->get_form_field( 'PGrp' ).
temp_tab1-doc_type = 'NB'.
temp_tab1-item_intvl = request->get_form_field( 'Item' ).
temp_tab1-comp_code = request->get_form_field( 'CCode' ).
temp_tab1-doc_date = request->get_form_field( 'DocDate' ).
data: temp_tabx1 type zrmheaderx.
delete from zrmheaderx.
temp_tabx1-vendor = 'x'.
temp_tabx1-purch_org = 'x'.
temp_tabx1-pur_group = 'x'.
temp_tabx1-doc_type = 'x'.
temp_tabx1-comp_code = 'x'.
temp_tabx1-doc_date = 'x'.
insert into zrmheader values temp_tab1.
insert into zrmheaderx values temp_tabx1.
data: temp_tab type zrmitem .
data: temp_tabx type zrmitemx.
zitem1-acctasscat = request->get_form_field( 'A' ).
temp_tab-acctasscat = request->get_form_field( 'A' ).
zitem1-item_cat = request->get_form_field( 'I' ).
temp_tab-item_cat = request->get_form_field( 'I' ).
zitem1-material = request->get_form_field( 'Material' ).
temp_tab-material = request->get_form_field( 'Material' ).
zitem1-quantity = request->get_form_field( 'POQuantity' ).
temp_tab-quantity = request->get_form_field( 'POQuantity' ).
zitem1-po_unit = request->get_form_field( 'OUN' ).
temp_tab-po_unit = request->get_form_field( 'OUN' ).
zitem1-net_price = request->get_form_field( 'NetPrice' ).
temp_tab-net_price = request->get_form_field( 'NetPrice' ).
zitem1-plant = request->get_form_field( 'Plnt' ).
temp_tab-plant = request->get_form_field( 'Plnt' ).
zitem1-po_item = request->get_form_field( 'Item' ).
temp_tab-po_item = request->get_form_field( 'Item' ).
zitem1-stge_loc = request->get_form_field( 'Sloc' ).
temp_tab-stge_loc = request->get_form_field( 'Sloc' ).
zitem1-customer = request->get_form_field( 'Customer' ).
temp_tab-customer = request->get_form_field( 'Customer' ).
zitem1-incoterms2 = 'XDFGRT'.
temp_tab-incoterms2 = 'XDFGRT'.
append zitem1 to zitem.
insert into zrmitem values temp_tab.
zitemx1-acctasscat = 'x'.
zitemx1-item_cat = 'x'.
zitemx1-material = 'x'.
zitemx1-quantity = 'x'.
zitemx1-net_price = 'x'.
zitemx1-plant = 'x'.
zitemx1-po_item = 00010.
zitemx1-po_itemx = 'x'.
zitemx1-stge_loc = 'x'.
zitemx1-customer = 'x'.
zitemx1-incoterms2 = 'x'.
append zitemx1 to zitemx.
temp_tabx-acctasscat = 'x'.
temp_tabx-item_cat = 'x'.
temp_tabx-material = 'x'.
temp_tabx-quantity = 'x'.
temp_tabx-net_price = 'x'.
temp_tabx-plant = 'x'.
temp_tabx-po_item = 00010.
temp_tabx-po_itemx = 'x'.
temp_tabx-stge_loc = 'x'.
temp_tabx-customer = 'x'.
temp_tabx-incoterms2 = 'x'.
insert into zrmitemx values temp_tabx.
select * from zrmitem into corresponding fields of table zitem.
zpr_num = request->get_form_field( 'PRNo' ) .
call function 'ZCONVERT_ALPHA'
exporting
input = zpr_num
importing
output = zpr_num1.
LEN =
call function 'BAPI_REQUISITION_GETDETAIL'
exporting
number = zpr_num1
ACCOUNT_ASSIGNMENT = ' '
ITEM_TEXTS = ' '
SERVICES = ' '
SERVICE_TEXTS = ' '
tables
requisition_items = item_tab
REQUISITION_ACCOUNT_ASSIGNMENT =
REQUISITION_TEXT =
REQUISITION_LIMITS =
REQUISITION_CONTRACT_LIMITS =
REQUISITION_SERVICES =
REQUISITION_SERVICES_TEXTS =
REQUISITION_SRV_ACCASS_VALUES =
RETURN =
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
*IMPORTING
*RETURN = i_return
to save the item details and generate a PO number
elseif htmlb_event is bound and htmlb_event->server_event = 'onsave'.
zpr_num = request->get_form_field( 'PRNo' ) .
data: zpr_num4 type banfn.
call function 'ZCONVERT_ALPHA'
exporting
input = zpr_num
importing
output = zpr_num4.
zpr_num = zpr_num4.
data: temp_t2 type zrmsched,
count2 type n,
a2 type n value 1.
data:temp_t type zrmitem,
count type n,
a type n value 1.
select * from zrmitem into corresponding fields of table data_tab.
count = sy-dbcnt.
do count times.
read table data_tab into temp_t index a.
a = a + 1.
zitem1-po_item = temp_t-po_item.
zitem1-acctasscat = temp_t-acctasscat.
zitem1-item_cat = temp_t-item_cat.
zitem1-material = temp_t-material.
zitem1-quantity = temp_t-quantity.
zitem1-po_unit = temp_t-po_unit.
zitem1-net_price = temp_t-net_price.
zitem1-plant = temp_t-plant.
zitem1-stge_loc = temp_t-stge_loc.
zitem1-customer = temp_t-customer.
zitem1-incoterms2 = temp_t-incoterms2.
append zitem1 to zitem.
zitemx1-acctasscat = 'x'.
zitemx1-item_cat = 'x'.
zitemx1-material = 'x'.
zitemx1-quantity = 'x'.
zitemx1-net_price = 'x'.
zitemx1-plant = 'x'.
zitemx1-po_item = temp_t-po_item.
zitemx1-po_itemx = 'x'.
zitemx1-stge_loc = 'x'.
zitemx1-customer = 'x'.
zitemx1-incoterms2 = 'x'.
append zitemx1 to zitemx.
enddo.
count2 = sy-dbcnt.
zpoheader-vendor = request->get_form_field( 'Vendor' ) .
zpoheader-purch_org = request->get_form_field( 'POrg' ).
zpoheader-pur_group = request->get_form_field( 'PGrp' ).
zpoheader-doc_type = 'NB'.
zpoheader-item_intvl = request->get_form_field( 'Item' ).
zpoheader-comp_code = request->get_form_field( 'CCode' ).
zpoheader-doc_date = request->get_form_field( 'DocDate' ).
delivdate_new = request->get_form_field( 'DelivDate' ).
zpoheaderx-vendor = 'x'.
zpoheaderx-purch_org = 'x'.
zpoheaderx-pur_group = 'x'.
zpoheaderx-doc_type = 'x'.
zpoheaderx-comp_code = 'x'.
zpoheaderx-doc_date = 'x'.
data: zpovendor type elifn.
call function 'ZCONVERT_ALPHA'
exporting
input = zpoheader-vendor
importing
output = zpovendor.
zpoheader-vendor = zpovendor.
call function 'BAPI_PO_CREATE1'
exporting
poheader = zpoheader
poheaderx = zpoheaderx
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
importing
exppurchaseorder = po_num
EXPHEADER = PO_NUM_HEAD
EXPPOEXPIMPHEADER =
tables
RETURN = zreturn
poitem = zitem
poitemx = zitemx
POADDRDELIVERY =
POSCHEDULE = zposched
POSCHEDULEX = zposchedx
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
IMPORTING
RETURN =
delete from zrmitem.
delete from zrmitemx.
select * from zrmitem into corresponding fields of table zitem.
if po_num = ' '.
po_num = 'Try Again'.
endif.
to store po_num and corresponding pr number
data: temp_tt type zpo_pr_nums.
temp_tt-pr_num = zpr_num.
temp_tt-po_num = po_num.
insert into zpo_pr_nums values temp_tt.
to store po num and corresponding delivery date
data: wa11 type zpo_delivdate.
wa11-po_number = po_num.
wa11-deliv_date = delivdate_new.
insert into zpo_delivdate values wa11.
zpoheader-vendor = ' '.
zpoheader-purch_org = ' '.
zpoheader-pur_group = ' '.
zpoheader-doc_type = ' '.
zpoheader-item_intvl = ' '.
zpoheader-comp_code = ' '.
zpoheader-doc_date = ' '.
delivdate_new = ' '.
to enter a PR Number
elseif htmlb_event is bound and htmlb_event->server_event = 'onenter'.
delete from zrmitem.
delete from zrmitemx.
select * from zrmitem into corresponding fields of table zitem.
zpr_num = request->get_form_field( 'PRNo' ) .
call function 'ZCONVERT_ALPHA'
exporting
input = zpr_num
importing
output = zpr_num1.
LEN =
call function 'BAPI_REQUISITION_GETDETAIL'
exporting
number = zpr_num1
ACCOUNT_ASSIGNMENT = ' '
ITEM_TEXTS = ' '
SERVICES = ' '
SERVICE_TEXTS = ' '
tables
requisition_items = item_tab
REQUISITION_ACCOUNT_ASSIGNMENT =
REQUISITION_TEXT =
REQUISITION_LIMITS =
REQUISITION_CONTRACT_LIMITS =
REQUISITION_SERVICES =
REQUISITION_SERVICES_TEXTS =
REQUISITION_SRV_ACCASS_VALUES =
RETURN =
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
*IMPORTING
*RETURN = i_return
to select an item from drop down item menu
elseif htmlb_event is bound and htmlb_event->server_event = 'select'.
data: zselection2 type bnfpo.
data: data type ref to cl_htmlb_dropdownlistbox.
zpr_num = request->get_form_field( 'PRNo' ) .
data: zpr_num2 type banfn.
call function 'ZCONVERT_ALPHA'
exporting
input = zpr_num
importing
output = zpr_num2.
data ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'dropdownlistbox'
id = 'ItemSel'
if data is not initial.
zselection2 = data->selection.
endif.
zpoheader-vendor = request->get_form_field( 'Vendor' ) .
zpoheader-purch_org = request->get_form_field( 'POrg' ).
zpoheader-pur_group = request->get_form_field( 'PGrp' ).
zpoheader-doc_type = 'NB'.
zpoheader-item_intvl = request->get_form_field( 'Item' ).
zpoheader-comp_code = request->get_form_field( 'CCode' ).
zpoheader-doc_date = request->get_form_field( 'DocDate' ).
call function 'BAPI_REQUISITION_GETDETAIL'
exporting
number = zpr_num2
ACCOUNT_ASSIGNMENT = ' '
ITEM_TEXTS = ' '
SERVICES = ' '
SERVICE_TEXTS = ' '
tables
requisition_items = item_tab
REQUISITION_ACCOUNT_ASSIGNMENT =
REQUISITION_TEXT =
REQUISITION_LIMITS =
REQUISITION_CONTRACT_LIMITS =
REQUISITION_SERVICES =
REQUISITION_SERVICES_TEXTS =
REQUISITION_SRV_ACCASS_VALUES =
RETURN =
data wa1 type bapieban.
loop at item_tab into wa1.
if wa1-preq_item = zselection2.
item_new = wa1-preq_item.
material_new = wa1-material.
plant_new = wa1-plant.
quantity_new = wa1-quantity.
unit_new = wa1-unit.
delivdate_new = wa1-deliv_date.
endif.
endloop.
endif. -
Create a Purchase order using the BAPI using the data in the XML file.
Hello Gurus,
here is the scenario can anyone help me how to proceed explaining the procedure?
Create a Purchase order using the BAPI using the data in the XML file.
comprehensive explanations are appreciated.
thanks in advance.hi,
first use fm "bapi_po_create".
then use fm "BAPI_ACC_GL_POSTING_POST"
The demo environment was made with real business scenario in mind, but following subjects need to be addressed in a live implementation:
No exceptions and error handling is implemented, except the order rejection (e.g. partly delivery);
In Navision both XML Ports and the XML DOM has been used to integrate with SAP XI, because XML ports has some drawbacks regarding to Namespaces in XML Documents (mandatory in SAP XI);
A minimum of SAP and Navision customization is required to implement this solution. (e.g. user exit in SAP, Navision XML DOM). -
Can we create purchase order through report programming?
hi experts.....
can we create purchase order through report programming?If yes plz give me the thread details?Hi,
Use this code in a program by using a BAPI function module
Anothe rway is using classical/ALV report using call transaction from a report for changing the PO
loop at i_header.
header-ref_1 = i_header-legacy.
headerx-ref_1 = c_x.
header-doc_type = i_header-bsart.
headerx-doc_type = c_x.
header-comp_code = i_header-bukrs.
headerx-comp_code = c_x.
header-purch_org = i_header-ekorg.
headerx-purch_org = c_x.
header-pur_group = i_header-ekgrp.
headerx-pur_group = c_x.
header-vendor = i_header-lifnr.
headerx-vendor = c_x.
concatenate i_header-bedat+4(4)
i_header-bedat+0(2)
i_header-bedat+2(2)
into header-doc_date.
headerx-doc_date = c_x.
header-created_by = i_header-ernam.
headerx-created_by = c_x.
header-currency = i_header-waers.
headerx-currency = c_x.
concatenate i_header-kdatb+4(4)
i_header-kdatb+0(2)
i_header-kdatb+2(2)
into header-vper_start.
headerx-vper_start = c_x.
loop at i_items where legacy = i_header-legacy.
item-po_item = i_items-ebelp.
itemx-po_item = i_items-ebelp.
itemx-po_itemx = c_x.
if i_header-bsart = 'NB'.
item-material = i_items-ematn.
itemx-material = c_x.
schedule-quantity = i_items-menge * 1000.
schedulex-quantity = c_x.
else.
item-short_text = i_items-ematn.
itemx-short_text = c_x.
item-matl_group = '1000'.
itemx-matl_group = c_x.
schedule-quantity = '1'.
schedulex-quantity = c_x.
endif.
item-plant = i_items-werks.
itemx-plant = c_x.
schedule-po_item = i_items-ebelp.
schedule-sched_line = '1'.
schedulex-po_item = i_items-ebelp.
schedulex-sched_line = '1'.
schedulex-po_itemx = c_x.
schedulex-sched_linex = c_x.
concatenate i_items-eildt+0(2)
i_items-eildt+2(2)
i_items-eildt+4(4)
into schedule-delivery_date.
schedulex-delivery_date = c_x.
item-price_unit = i_items-peinh * 100.
itemx-price_unit = c_x.
item-tax_code = i_items-mwskz.
itemx-tax_code = c_x.
item-shipping = i_items-evers.
itemx-shipping = c_x.
account-po_item = i_items-ebelp.
accountx-po_item = i_items-ebelp.
accountx-po_itemx = c_x.
if i_header-bsart = 'FO'.
item-pckg_no = sy-tabix.
itemx-pckg_no = 'X'.
limits-pckg_no = sy-tabix.
limits-limit = i_items-overalllimit.
limits-exp_value = i_items-expectedoverall.
posrvaccessvalues-pckg_no = sy-tabix.
posrvaccessvalues-line_no = '0'.
posrvaccessvalues-serno_line = '00'.
posrvaccessvalues-percentage = '100.0'.
posrvaccessvalues-serial_no = '01'.
account-serial_no = '1'.
accountx-serial_no = '1'.
accountx-serial_nox = c_x.
account-quantity = '1'.
accountx-quantity = c_x.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = i_items-kostl
importing
output = account-costcenter.
accountx-costcenter = c_x.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = i_items-sakto
importing
output = account-gl_account.
accountx-gl_account = c_x.
item-acctasscat = i_items-knttp.
itemx-acctasscat = c_x.
item-item_cat = i_items-epstp.
itemx-item_cat = c_x.
endif.
append:item,itemx,schedule,schedulex,account,accountx,limits,posrvaccessvalues.
clear :item,itemx,schedule,schedulex,account,accountx,limits,posrvaccessvalues.
endloop.
call function 'BAPI_PO_CREATE1'
exporting
poheader = header
poheaderx = headerx
* POADDRVENDOR =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
* NO_MESSAGING =
* NO_MESSAGE_REQ =
* NO_AUTHORITY =
* NO_PRICE_FROM_PO =
importing
exppurchaseorder = ponumber
* EXPHEADER =
* EXPPOEXPIMPHEADER =
tables
return = return
poitem = item
poitemx = itemx
* POADDRDELIVERY =
poschedule = schedule
poschedulex = schedulex
poaccount = account
* POACCOUNTPROFITSEGMENT =
poaccountx = accountx
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
polimits = limits
* POCONTRACTLIMITS =
* POSERVICES =
posrvaccessvalues = posrvaccessvalues.
* POSERVICESTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* POEXPIMPITEM =
* POEXPIMPITEMX =
* POTEXTHEADER =
* POTEXTITEM =
* ALLVERSIONS =
* POPARTNER =
if ponumber eq space.
loop at return where type = 'E'.
clear buffer.
move-corresponding return to e_return.
concatenate i_header-legacy e_return into buffer.
transfer buffer to p2_file.
endloop.
move-corresponding i_header to i_eheader.
transfer i_eheader to p3_file.
loop at i_items where legacy = i_header-legacy.
move-corresponding i_items to i_eitems.
transfer i_eitems to p4_file.
endloop.
else.
commit work and wait.
endif.
clear:ponumber,header,headerx,item,itemx,account,accountx,limits,return,schedule,schedulex,posrvaccessvalues.
refresh:item,itemx,account,accountx,limits,return,schedule,schedulex,posrvaccessvalues.
endloop.
close dataset p2_file.
close dataset p3_file.
close dataset p4_file.
Regards
Krishna -
hello all,
i am new to web dynpro for java.i have already done an application
"Creating a Web Dynpro Application Accessing ABAP Functions" this application
have good document on sdn.
this application is working fine .
Now i got an requiremnt for creating a purchase order in web dynpro for java.
in normal report when i call the bapi the parameter are the header, headerx,item, itemx is an internal table.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = HEADER
POHEADERX = HEADERX
POADDRVENDOR =
TESTRUN =
IMPORTING
EXPPURCHASEORDER =
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
RETURN = RETURN
POITEM = ITEM
POITEMX = ITEMX.
i just want to know how can i fill these internal table in web dynpro
for java to create an application accessing "Bapi_po_create" .
ThanksHi Gopal,
I'm not sure what is your issue, it seems you're not really understanding how the Model structure works in WDP.
I'll assume few things here, like you know how to Import the Model into the WDP, and you know a little bit about what Java Classes will represent this Model in the Project.
Try these steps:
1. Import your Model into the Project;
2. Open your Component Modeler, create a Data Link between your Model / Component (Or Custom Controller, as you prefer)
- You can also use the "Apply Template -> Service Controler"
3. Map the Input of your Model as the Main Node, check the Input Tables (you prob. will have two, POITEM = ITEM - POITEMX = ITEMX)
4. Also, check the Return box, since this is BAPI return (You can use to display Backend messages)
Now you have the Model mapped into your Controller, you need to develop the Java function to execute it.
1. Create a new Input class, like
BAPI_PO_CREATE1_Input purchaseOrderCreateInput = new BAPI_PO_CREATE1_Input();
2. Bind your Input Node, in the Controller, with your Input Class;
wdContext.nodeBAPI_PO_CREATE1().bind(purchaseOrderCreateInput);
3. Set any Import parameters you need:
purchaseOrderCreateInput.setEXPPURCHASEORDER(XXXX);
4. To Add references to the Table, you will perform something like:
First, you need to know what "Structure" you need to add (POItem Structure) - You have a Java class that represents that Structure..
POITEM_Element poItemElement = new POITEM_Element();
poItemElement.setPROPERTY(); /// Set your Properties
purchaseOrderCreateInput.getPOITEM().add(poItemElement);
5. Execute your Input,
purchaseOrderCreateInput .execute();
Hope it helps,
Regards,
Daniel -
How to create a purchase order in sapR/3
Hi,
I want create a purchase order in SAPR/3 system.so for that i need some information like
which bapi i need to run,input parameters for that bapi.Important values and how to set them.pls kindly send me the related information about that and also send me the java code to do it.bapi for creating ourchase order is bapi_po_create.
Try run it and in return table will be error message about mandatory/wrong parameters.
For more information get documenatation about that bapi (eq. sap gui, "bapi" transaction) or ask in abap forum
Regards
Vedran -
BAPI needed for Goods Receipt Purchase Order(Transaction : MIGO)
Hi all,
We have a requirement where in we need to post the documents throuh BAPI for Goods receipt Purchase order(Transaction: MIGO).
Any inputs on this..is highly appreciable...
thanks in advance...
regards..
prathima.Hi,
use 'BAPI_GOODSMVT_CREATE'
Check this sample.
code
REPORT ZRICH_0001 .
Structures for BAPI
DATA: GM_HEADER TYPE BAPI2017_GM_HEAD_01.
DATA: GM_CODE TYPE BAPI2017_GM_CODE.
DATA: GM_HEADRET TYPE BAPI2017_GM_HEAD_RET.
DATA: GM_ITEM TYPE TABLE OF
BAPI2017_GM_ITEM_CREATE WITH HEADER LINE.
DATA: GM_RETURN TYPE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA: GM_RETMTD TYPE BAPI2017_GM_HEAD_RET-MAT_DOC.
CLEAR: GM_RETURN, GM_RETMTD. REFRESH GM_RETURN.
Setup BAPI header data.
GM_HEADER-PSTNG_DATE = SY-DATUM.
GM_HEADER-DOC_DATE = SY-DATUM.
GM_CODE-GM_CODE = '04'. " MB1A
Write 971 movement to table
CLEAR GM_ITEM.
MOVE '412' TO GM_ITEM-MOVE_TYPE .
MOVE 'Q' TO GM_ITEM-SPEC_STOCK.
MOVE '3800533484' TO GM_ITEM-MATERIAL.
MOVE '1' TO GM_ITEM-ENTRY_QNT.
*MOVE 'PC' TO GM_ITEM-ENTRY_UOM.
MOVE '1060' TO GM_ITEM-PLANT.
MOVE '0007' TO GM_ITEM-STGE_LOC.
*MOVE '0901' TO GM_ITEM-MOVE_REAS.
MOVE 'P203601001' TO GM_ITEM-WBS_ELEM.
MOVE 'P203601001' TO GM_ITEM-VAL_WBS_ELEM.
APPEND GM_ITEM.
Call goods movement BAPI
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = GM_HEADER
GOODSMVT_CODE = GM_CODE
IMPORTING
GOODSMVT_HEADRET = GM_HEADRET
MATERIALDOCUMENT = GM_RETMTD
TABLES
GOODSMVT_ITEM = GM_ITEM
RETURN = GM_RETURN.
IF NOT GM_RETMTD IS INITIAL.
COMMIT WORK AND WAIT.
CALL FUNCTION 'DEQUEUE_ALL'.
ELSE.
COMMIT WORK AND WAIT.
CALL FUNCTION 'DEQUEUE_ALL'.
ENDIF.
WRITE:/ GM_RETMTD.
LOOP AT GM_RETURN.
WRITE:/ GM_RETURN.
ENDLOOP.
[/code]
Also check the Bapis
BAPI_PO_CREATE --> To create Purchase Order
BAPI_PO_CHANGE --> To change Purchase Order
BAPI_PO_GETDETAIL --> Todisplay Purchase Order
Regards,
Raj.
Maybe you are looking for
-
All right. I'll admit it. I'm new to Java. But after multiple weeks of hard work, I finally wrote The Ultimate Java Applet. At least, in my own mind. It's that pride thing again, gotta watch that. Finally had all the bugs ironed out, and it worked be
-
Error in executing dynamic SQL
i am getting error in executing dynamic SQL declare vr_RenewService NUMBER(10,0); vr_sql VARCHAR2(50); begin vr_sql:='Select Case when 5 <= 365 Then 1 When 1= 0 Then 1 else 0 end into' || TO_CHAR(vr_RenewService) || 'from dual;'; execute immediate vr
-
Unable to read sounds in my library.
hello, I have a little problem, when I open a new audio track, none of my library sounds works, I can't read them. whereas when I open a software instrument track, everything works. what can I do? what manipulation have I got to do to read the sounds
-
Hi am trying to download os x mountain lion & keep gatting "502 bad gateway" error & will not let me download although I have logged in & paid. I've also had this problem with iTunes movies rental & purchase. I'm not getting much love from Apple eit
-
Dear Expert, In cost center master data, there was assignment for 1 profit center into cost center. Is it possible to allocate one cost center to many profit center? If yes, where is the tcode for the configuration setting and how is the process flow