Item Inerval in BAPI_PO_CREATE1
Hi experts,
Is it required to fill out the item interval field in BAPI_PO_CREATE1? The client wants to have differenct interval? Though I have created a working customized bapi for that requirement. I just want to know the impotance of the field, so I could justify it well to them. Thanks!
Dear maui,
Yes i think its need to be maintain (<> space), because from here system Determines the size of the steps between the default item numbers.
Similar Messages
-
PO item characteristic using BAPI_PO_CREATE1
Dear All,
I am uploading open purchase order using BAPI_PO_CREATE1. everything is working fine. but for Semi-finished products i have to upload Individual length. i.e. in characterstics of purchase order item.
kindly helpHi
Please go through the documentation in SE37 for the FM.. It is very clear on how you need to work on this BAPI. It is given with examples.
Regards,
Vishwa. -
Validating vendors in PO item conditions of BAPI_PO_CREATE1
Hai friends,
BAPI_PO_CREATE1 is not validating the vendors of item level conditions(BAPIMEPOCOND-VENDOR_NO).
But I have to validate those vendors existed in SAP or not. please help me.
regards,
Eswar.before passing the data to any screen using bdc(session method or call transaction) or bapi methods you need to validate the data from its check tables say you asked the vendors is not validating u should check the data from lfa1 table whether the vendors are available or not this is nothing but data clensing.
and each record entered in the bapi function module should be fully data validated i.e the data should 99.99% save in the data base table of concerned tables like ekko,ekpo in this case ie. this is nothing but data prusing.
write select statements to lfa1 table & delete the records if in flat file given there is no vendors matched to database tables before passing the vendors to bapi_po_create functionmodule -
Proble in Creating Multiple Item PO using BAPI_PO_CREATE1
Hi All..
I am creating PO using BAPI_PO_CREATE1. I have successfully created with single line item but when i tried to create with multiple line items it gives me error in partners(vendors) which i have used in table POPARTNER.
One more thing, I have created using BAPI with same partner roles with single line item but it gives me error in 2 or more line items.
So, Can Anybody help me in this..
Regards,
Meet Gohel
[email protected]Hi ,
U can use this code n check
*& Report ZPOBAPITRIAL
REPORT ZPOBAPITRIAL.
*DATA DECLARATION
CONSTANTS : C_X VALUE 'X'.
*Structures to hold PO header data
DATA : HEADER LIKE BAPIMEPOHEADER ,
HEADERX LIKE BAPIMEPOHEADERX .
*Internal Tables to hold PO ITEM DATA
DATA : ITEM LIKE BAPIMEPOITEM OCCURS 0 WITH HEADER LINE,
ITEMX LIKE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE,
*Internal table to hold messages from BAPI call
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
data : w_header(40) value 'PO Header'.
DATA : it_item type standard table of BAPIMEPOITEM.
DATA : wa_item like BAPIMEPOITEM occurs 0 with header line.
DATA : it_itemx type standard table of BAPIMEPOITEMX.
DATA : wa_itemx like BAPIMEPOITEMX occurs 0 with header line.
data : ws_langu like sy-langu.
*text-001 = 'PO Header' - define as text element
selection-screen begin of block b1 with frame title text-001.
parameters : company like header-comp_code default '0103' ,
doctyp like HEADER-DOC_TYPE default 'NB' ,
item_int like header-item_intvl default '10' ,
cdate like HEADER-CREAT_DATE default sy-datum ,
vendor like HEADER-VENDOR default '0000500001',
pmnttrms like header-pmnttrms default '0007' ,
pur_org like HEADER-PURCH_ORG default '9000' ,
pur_grp like HEADER-PUR_GROUP default '401' ,
currency like header-currency default 'INR' .
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters : item_num like ITEM-PO_ITEM default '10',
material like ITEM-MATERIAL default '000000000300000014' ,
plant like ITEM-PLANT default '7640' ,
quantity like ITEM-QUANTITY default 10.
selection-screen end of block b2.
START-OF-SELECTION.
*DATA POPULATION
ws_langu = sy-langu. "Language variable
*POPULATE HEADER DATA FOR PO
HEADER-COMP_CODE = company .
HEADER-DOC_TYPE = doctyp .
*HEADER-CREAT_DATE = cdate .
header-item_intvl = item_int .
HEADER-VENDOR = vendor .
HEADER-LANGU = ws_langu .
header-pmnttrms = pmnttrms .
HEADER-PURCH_ORG = pur_org .
HEADER-PUR_GROUP = pur_grp .
header-currency = currency .
*POPULATE HEADER FLAG.
HEADERX-comp_code = c_x.
HEADERX-doc_type = c_x.
*HEADERX-creat_date = c_x.
headerx-item_intvl = c_x .
HEADERX-vendor = c_x.
HEADERX-langu = c_x.
headerx-pmnttrms = c_x .
HEADERX-purch_org = c_x.
HEADERX-pur_group = c_x.
*HEADERX-doc_date = c_x.
*POPULATE ITEM DATA.
wa_ITEM-PO_ITEM = item_num.
wa_ITEM-MATERIAL = material.
wa_ITEM-PLANT = plant.
wa_ITEM-QUANTITY = quantity.
append wa_item to it_item.
wa_ITEM-PO_ITEM = '20'.
wa_ITEM-MATERIAL = '000000000300000020'.
wa_ITEM-PLANT = plant.
wa_ITEM-QUANTITY = quantity.
append wa_item to it_item.
*APPEND ITEM.
*POPULATE ITEM FLAG TABLE
wa_ITEMX-PO_ITEM = item_num.
wa_itEMX-MATERIAL = C_X.
wa_ITEMX-PLANT = C_X .
wa_ITEMX-STGE_LOC = C_X .
wa_ITEMX-QUANTITY = C_X .
wa_ITEMX-TAX_CODE = C_X .
wa_ITEMX-ITEM_CAT = C_X .
wa_ITEMX-ACCTASSCAT = C_X .
append wa_itemx to it_itemx.
*APPEND ITEMX.
wa_ITEMX-PO_ITEM = '20'.
wa_itEMX-MATERIAL = C_X.
wa_ITEMX-PLANT = C_X .
wa_ITEMX-STGE_LOC = C_X .
wa_ITEMX-QUANTITY = C_X .
wa_ITEMX-TAX_CODE = C_X .
wa_ITEMX-ITEM_CAT = C_X .
wa_ITEMX-ACCTASSCAT = C_X .
append wa_itemx to it_itemx.
*BAPI CALL
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = HEADER
POHEADERX = HEADERX
POADDRVENDOR =
TESTRUN =
IMPORTING
EXPPURCHASEORDER =
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
RETURN = RETURN
POITEM = it_ITEM
POITEMX = it_ITEMX.
*Confirm the document creation by calling database COMMIT
*CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
end-of-selection.
*Output the messages returned from BAPI call
LOOP AT RETURN.
WRITE: /001 return-type,
/001 return-message.
ENDLOOP.
award points if helpfull -
Getting errors when iam using BAPI_PO_CREATE1 for Purchase Order creation
Hi sap Gurus,
I am getting Errors when iam using BAPI_PO_CREATE1 for Purchase Order creation that Material (144) does not exist but it is alreardy maintained in MM01.
I dont get how it is coming.and what are the mandatory fields in bapi BAPI_PO_CREATE1 in item level .that is too material only.
pls let me know .
thanks in advance.Hi,
Check the sample code..
report zpo_test .
*DATA DECLARATION
constants : c_x value 'X'.
*Structures to hold PO header data
data : header like bapimepoheader ,
headerx like bapimepoheaderx .
*Structures to hold PO account data
data : account like bapimepoaccount occurs 0 with header line ,
accountx like bapimepoaccountx occurs 0 with header line .
*Internal Tables to hold PO ITEM DATA
data : item like bapimepoitem occurs 0 with header line,
itemx like bapimepoitemx occurs 0 with header line,
*Internal table to hold messages from BAPI call
return like bapiret2 occurs 0 with header line,
*Internal table to hold messages from BAPI call
pocontractlimits like bapiesucc occurs 0 with header line.
data : w_header(40) value 'PO Header',
purchaseorder like bapimepoheader-po_number,
delivery_date like bapimeposchedule-delivery_date.
data : ws_langu like sy-langu.
*text-001 = 'PO Header' - define as text element
selection-screen begin of block b1 with frame title text-001.
parameters : company like header-comp_code default '122' ,
doctyp like header-doc_type default 'NB' ,
cdate like header-creat_date default sy-datum ,
vendor like header-vendor default '2000000012' ,
pur_org like header-purch_org default 'PU01' ,
pur_grp like header-pur_group default '005' .
*sociedad like HEADER-COMP_CODE default '122' ,
*vendedor like HEADER-SALES_PERS default 'sale person'.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters : item_num like item-po_item default '00010',
material like item-material default '12000000' ,
tipo_imp like item-acctasscat default 'K' ,
*pos_doc like ITEM-ITEM_CAT default 'F' ,
shorttxt like item-short_text default 'PRUEBA BAPI' ,
grup_art like item-matl_group default '817230000' ,
plant like item-plant default '3001' ,
mpe like item-trackingno default '9999' ,
*contrato like ITEM-AGREEMENT default '4904000003' ,
*quantity like ITEM-QUANTITY default 1 .
po_unit like item-po_unit default 'EA'.
selection-screen end of block b2.
Par?mnetros de imputaci?n
selection-screen begin of block b3 with frame title text-004.
parameters : centro like account-costcenter default '1220813150',
cuenta like account-gl_account default '6631400' ,
num_pos like account-po_item default '10' ,
serial like account-serial_no default '01' ,
ind_imp like account-tax_code default 'I2' .
selection-screen end of block b3.
start-of-selection.
*DATA POPULATION
ws_langu = sy-langu. "Language variable
*POPULATE HEADER DATA FOR PO
*HEADER-COMP_CODE = sociedad .
header-doc_type = doctyp .
header-vendor = vendor .
header-creat_date = cdate .
header-created_by = 'TD17191' .
header-purch_org = pur_org .
header-pur_group = pur_grp .
header-comp_code = company .
header-langu = ws_langu .
*HEADER-SALES_PERS = vendedor .
*HEADER-CURRENCY = 'DOP' .
*HEADER-ITEM_INTVL = 10 .
*HEADER-PMNTTRMS = 'N30' .
*HEADER-EXCH_RATE = 1 .
*POPULATE HEADER FLAG.
headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-vendor = c_x.
headerx-creat_date = c_x.
headerx-created_by = c_x.
headerx-purch_org = c_x.
headerx-pur_group = c_x.
headerx-langu = c_x.
*HEADERX-sales_pers = c_x.
*HEADERX-CURRENCY = c_x.
*HEADER-ITEM_INTVL = c_x.
*HEADER-PMNTTRMS = c_x.
*HEADER-EXCH_RATE = c_x.
*HEADER-EXCH_RATE = c_x.
*POPULATE ITEM DATA.
item-po_item = item_num.
item-quantity = '1'.
*ITEM-MATERIAL = material .
item-short_text = 'prueba bapi_po_create1'.
*ITEM-TAX_CODE = ''.
item-acctasscat = 'K' .
*ITEM-ITEM_CAT = 'D' .
item-matl_group = '817230000' .
item-plant = '3001' .
item-trackingno = '99999'.
item-preq_name = 'test'.
*ITEM-AGREEMENT = '' .
*ITEM-AGMT_ITEM = ''.
item-quantity = '1' .
item-po_unit = 'EA'.
*ITEM-ORDERPR_UN = 'EA'.
item-conv_num1 = '1'.
item-conv_den1 = '1'.
item-net_price = '1000000' .
item-price_unit = '1'.
item-gr_pr_time = '0'.
item-prnt_price = 'X'.
item-unlimited_dlv = 'X'.
item-gr_ind = 'X' .
item-ir_ind = 'X' .
item-gr_basediv = 'X'.
*ITEM-PCKG_NO = '' .
append item. clear item.
*POPULATE ITEM FLAG TABLE
itemx-po_item = item_num.
itemx-po_itemx = c_x.
*ITEMX-MATERIAL = C_X.
itemx-short_text = c_x.
itemx-quantity = c_x.
*ITEMX-TAX_CODE = C_X.
itemx-acctasscat = c_x.
*ITEMX-ITEM_CAT = c_x.
itemx-matl_group = c_x.
itemx-plant = c_x.
itemx-trackingno = c_x.
itemx-preq_name = c_x.
*ITEMX-AGREEMENT = C_X.
*ITEMX-AGMT_ITEM = c_x.
itemx-stge_loc = c_x.
itemx-quantity = c_x.
itemx-po_unit = c_x.
*ITEMX-ORDERPR_UN = C_X.
itemx-conv_num1 = c_x.
itemx-conv_den1 = c_x.
itemx-net_price = c_x.
itemx-price_unit = c_x.
itemx-gr_pr_time = c_x.
itemx-prnt_price = c_x.
itemx-unlimited_dlv = c_x.
itemx-gr_ind = c_x .
itemx-ir_ind = c_x .
itemx-gr_basediv = c_x .
append itemx. clear itemx.
*POPULATE ACCOUNT DATA.
account-po_item = item_num.
account-serial_no = serial .
account-creat_date = sy-datum .
account-costcenter = centro .
account-gl_account = cuenta .
account-gr_rcpt = 'tester'.
append account. clear account.
*POPULATE ACCOUNT FLAG TABLE.
accountx-po_item = item_num .
accountx-po_itemx = c_x .
accountx-serial_no = serial .
accountx-serial_nox = c_x .
accountx-creat_date = c_x .
accountx-costcenter = c_x .
accountx-gl_account = c_x .
account-gr_rcpt = c_x.
append accountx. clear accountx.
*BAPI CALL
call function 'DIALOG_SET_NO_DIALOG'.
call function 'BAPI_PO_CREATE1'
exporting
poheader = header
poheaderx = headerx
importing
exppurchaseorder = purchaseorder
tables
return = return
poitem = item
poitemx = itemx
poaccount = account
poaccountx = accountx.
*Confirm the document creation by calling database COMMIT
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
IMPORTING
RETURN =
end-of-selection.
*Output the messages returned from BAPI call
loop at return.
write / return-message.
endloop.
Regards
Sudheer -
BAPI_PO_CREATE1 example
*& Report ZCHARLI *
*& Program demonstrates the BAPI call to create Purchase Order *
*& Minimum required parameters are used are as per the current *
*& system configuration *
REPORT ZBAPI_CREATE_PO .
*DATA DECLARATION
CONSTANTS : C_X VALUE 'X'.
*Structures to hold PO header data
DATA : HEADER LIKE BAPIMEPOHEADER ,
HEADERX LIKE BAPIMEPOHEADERX .
*Structures to hold PO account data
DATA : ACCOUNT LIKE BAPIMEPOACCOUNT OCCURS 0 WITH HEADER LINE ,
ACCOUNTX LIKE BAPIMEPOACCOUNTX OCCURS 0 WITH HEADER LINE .
*Structures to hold PO schedule data
DATA : ITEMSCHEDULE LIKE BAPIMEPOSCHEDULE OCCURS 0 WITH HEADER LINE ,
ITEMSCHEDULEX LIKE BAPIMEPOSCHEDULX OCCURS 0 WITH HEADER LINE .
*Structures to hold PO (distrib.imputac.lín.servicios) data
DATA : POSRVACCESSVALUES LIKE BAPIESKLC OCCURS 0 WITH HEADER LINE .
*Structures to hold PO services data
DATA : SERVICES LIKE BAPIESLLC OCCURS 0 WITH HEADER LINE .
*Internal Tables to hold PO ITEM DATA
DATA : ITEM LIKE BAPIMEPOITEM OCCURS 0 WITH HEADER LINE,
ITEMX LIKE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE,
*Internal table to hold messages from BAPI call
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
*Internal table to hold messages from BAPI call
POCONTRACTLIMITS LIKE BAPIESUCC OCCURS 0 WITH HEADER LINE.
data : w_header(40) value 'PO Header',
PURCHASEORDER LIKE BAPIMEPOHEADER-PO_NUMBER,
DELIVERY_DATE LIKE BAPIMEPOSCHEDULE-DELIVERY_DATE.
data : ws_langu like sy-langu.
*text-001 = 'PO Header' - define as text element
selection-screen begin of block b1 with frame title text-001.
parameters : company like header-comp_code default '1000' ,
doctyp like HEADER-DOC_TYPE default 'PM' ,
cdate like HEADER-CREAT_DATE default sy-datum ,
vendor like HEADER-VENDOR default '100006' ,
pur_org like HEADER-PURCH_ORG default '1000' ,
pur_grp like HEADER-PUR_GROUP default '850' ,
sociedad like HEADER-COMP_CODE default '1000' ,
vendedor like HEADER-SALES_PERS default 'Wilda Messina'.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters : item_num like ITEM-PO_ITEM default '00010',
material like ITEM-MATERIAL default 'CRANE' ,
tipo_imp like ITEM-ACCTASSCAT default 'K' ,
pos_doc like ITEM-ITEM_CAT default 'F' ,
shorttxt like ITEM-SHORT_TEXT default 'PRUEBA BAPI' ,
grup_art like ITEM-MATL_GROUP default '350001' ,
plant like ITEM-PLANT default '1000' ,
mpe like ITEM-TRACKINGNO default '9999' ,
contrato like ITEM-AGREEMENT default '4904000003' ,
quantity like ITEM-QUANTITY default 1 .
po_unit like ITEM-PO_UNIT default 'UP'.
selection-screen end of block b2.
Parámnetros para los servicios
selection-screen begin of block b3 with frame title text-003.
parameters : paquete like SERVICES-PCKG_NO default '956',
numlinin like SERVICES-LINE_NO default '9' ,
numlinea like SERVICES-EXT_LINE default '80',
service like SERVICES-SERVICE default '8010',
srv_cant like SERVICES-quantity default '5' ,
precio like SERVICES-GR_PRICE default '300' ,
impuesto like SERVICES-TAX_CODE default 'I2' .
selection-screen end of block b3.
Parámnetros de imputación
selection-screen begin of block b4 with frame title text-004.
parameters : centro like ACCOUNT-COSTCENTER default '120100',
cuenta like ACCOUNT-GL_ACCOUNT default '6501002000' ,
num_pos like ACCOUNT-PO_ITEM default '10' ,
serial like ACCOUNT-SERIAL_NO default '01' ,
ind_imp like ACCOUNT-TAX_CODE default 'I2' .
selection-screen end of block b4.
START-OF-SELECTION.
*DATA POPULATION
ws_langu = sy-langu. "Language variable
*POPULATE HEADER DATA FOR PO
HEADER-COMP_CODE = sociedad .
HEADER-DOC_TYPE = doctyp .
HEADER-VENDOR = vendor .
HEADER-CREAT_DATE = cdate .
HEADER-CREATED_BY = 'TD17191' .
HEADER-PURCH_ORG = pur_org .
HEADER-PUR_GROUP = pur_grp .
HEADER-COMP_CODE = company .
HEADER-LANGU = ws_langu .
HEADER-SALES_PERS = vendedor .
HEADER-CURRENCY = 'DOP' .
*HEADER-ITEM_INTVL = 10 .
*HEADER-PMNTTRMS = 'N30' .
*HEADER-EXCH_RATE = 1 .
*POPULATE HEADER FLAG.
HEADERX-comp_code = c_x.
HEADERX-doc_type = c_x.
HEADERX-vendor = c_x.
HEADERX-creat_date = c_x.
HEADERX-created_by = c_x.
HEADERX-purch_org = c_x.
HEADERX-pur_group = c_x.
HEADERX-langu = c_x.
HEADERX-sales_pers = c_x.
HEADERX-CURRENCY = c_x.
*HEADER-ITEM_INTVL = c_x.
*HEADER-PMNTTRMS = c_x.
*HEADER-EXCH_RATE = c_x.
*HEADER-EXCH_RATE = c_x.
*POPULATE ITEM DATA.
ITEM-PO_ITEM = '10'.
ITEM-QUANTITY = '1'.
*ITEM-MATERIAL = material .
ITEM-SHORT_TEXT = 'prueba bapi_po_create1'.
ITEM-TAX_CODE = 'I2'.
ITEM-ACCTASSCAT = 'K' .
ITEM-ITEM_CAT = 'F' .
ITEM-MATL_GROUP = '350001' .
ITEM-PLANT = '1000' .
ITEM-TRACKINGNO = '99999'.
ITEM-AGREEMENT = '4904000004' .
ITEM-AGMT_ITEM = '0010'.
ITEM-QUANTITY = '1' .
ITEM-PO_UNIT = 'UP'.
*ITEM-ORDERPR_UN = 'UP'.
ITEM-CONV_NUM1 = '1'.
ITEM-CONV_DEN1 = '1'.
ITEM-NET_PRICE = '1000000' .
ITEM-PRICE_UNIT = '1'.
ITEM-GR_PR_TIME = '0'.
ITEM-PRNT_PRICE = 'X'.
ITEM-UNLIMITED_DLV = 'X'.
ITEM-GR_IND = 'X' .
ITEM-IR_IND = 'X' .
ITEM-GR_BASEDIV = 'X'.
ITEM-PCKG_NO = '2748' .
APPEND ITEM. CLEAR ITEM.
*POPULATE ITEM FLAG TABLE
ITEMX-PO_ITEM = item_num.
ITEMX-PO_ITEMX = c_x.
*ITEMX-MATERIAL = C_X.
ITEMX-SHORT_TEXT = C_X.
ITEMX-QUANTITY = C_X.
ITEMX-TAX_CODE = C_X.
ITEMX-ACCTASSCAT = C_X.
ITEMX-ITEM_CAT = c_x.
ITEMX-MATL_GROUP = C_X.
ITEMX-PLANT = C_X.
ITEMX-TRACKINGNO = C_X.
ITEMX-AGREEMENT = C_X.
ITEMX-AGMT_ITEM = c_x.
ITEMX-STGE_LOC = C_X.
ITEMX-QUANTITY = C_X.
ITEMX-PO_UNIT = C_X.
*ITEMX-ORDERPR_UN = C_X.
ITEMX-CONV_NUM1 = C_X.
ITEMX-CONV_DEN1 = C_X.
ITEMX-NET_PRICE = C_X.
ITEMX-PRICE_UNIT = C_X.
ITEMX-GR_PR_TIME = C_X.
ITEMX-PRNT_PRICE = C_X.
ITEMX-UNLIMITED_DLV = C_X.
ITEMX-GR_IND = C_X .
ITEMX-IR_IND = C_X .
ITEMX-GR_BASEDIV = C_X .
ITEMX-PCKG_NO = C_X.
APPEND ITEMX. CLEAR ITEMX.
*POPULATE ITEM SCHEDULE DATA.
ITEMSCHEDULE-PO_ITEM = '00010'.
ITEMSCHEDULE-DEL_DATCAT_EXT = 'T'.
ITEMSCHEDULE-DELIVERY_DATE = '21.04.2005'. "sy-datum + 2 dias.
*ITEM_SCHEDULE-QUANTITY = '1'. "ITDETALLE-CANTIDAD.
APPEND ITEMSCHEDULE.
CLEAR ITEMSCHEDULE.
*POPULATE ITEM FLAG FOR SCHEDULE TABLE.
ITEMSCHEDULEX-PO_ITEM = '10'.
ITEMSCHEDULEX-PO_ITEMX = c_x .
ITEMSCHEDULEX-DEL_DATCAT_EXT = c_x.
ITEMSCHEDULEX-DELIVERY_DATE = c_x .
*ITEMSCHEDULEX-QUANTITY = '1' . "ITDETALLE-CANTIDAD.
APPEND ITEMSCHEDULEX.
CLEAR ITEMSCHEDULEX.
*POPULATE ACCOUNT DATA.
ACCOUNT-PO_ITEM = '10' .
ACCOUNT-SERIAL_NO = serial .
ACCOUNT-CREAT_DATE = sy-datum .
ACCOUNT-COSTCENTER = centro .
ACCOUNT-GL_ACCOUNT = cuenta .
ACCOUNT-CO_AREA = 'CD01' .
ACCOUNT-TAX_CODE = 'I2' .
APPEND ACCOUNT. CLEAR ACCOUNT.
*POPULATE ACCOUNT FLAG TABLE.
ACCOUNTX-PO_ITEM = '10' .
ACCOUNTX-PO_ITEMX = c_x .
ACCOUNTX-SERIAL_NO = serial .
ACCOUNTX-SERIAL_NOX = c_x .
ACCOUNTX-CREAT_DATE = c_x .
ACCOUNTX-COSTCENTER = c_x .
ACCOUNTX-GL_ACCOUNT = c_x .
ACCOUNTX-CO_AREA = c_x .
ACCOUNTX-TAX_CODE = c_x .
APPEND ACCOUNTX. CLEAR ACCOUNTX.
*POPULATE POSRVACCESSVALUES TABLE DATA.
FIRST ENTRY
POSRVACCESSVALUES-PCKG_NO = '0000002749' .
POSRVACCESSVALUES-LINE_NO = '0000000002' .
POSRVACCESSVALUES-SERNO_LINE = '01'.
POSRVACCESSVALUES-PERCENTAGE = '100'.
POSRVACCESSVALUES-SERIAL_NO = '01'.
*POSRVACCESSVALUES-QUANTITY = '1'.
POSRVACCESSVALUES-NET_VALUE = '850'.
APPEND POSRVACCESSVALUES . CLEAR POSRVACCESSVALUES.
SECOND ENTRY
POSRVACCESSVALUES-PCKG_NO = '0000002749' .
POSRVACCESSVALUES-LINE_NO = '0000000003' .
POSRVACCESSVALUES-SERNO_LINE = '01'.
POSRVACCESSVALUES-PERCENTAGE = '100'.
POSRVACCESSVALUES-SERIAL_NO = '01'.
*POSRVACCESSVALUES-QUANTITY =
POSRVACCESSVALUES-NET_VALUE = '150'.
APPEND POSRVACCESSVALUES . CLEAR POSRVACCESSVALUES.
*POPULATE SERVICES DATA.
servicio JERARQUIA SUPERIOR
SERVICES-PCKG_NO = '2748'.
SERVICES-LINE_NO = '0000000001' .
SERVICES-EXT_LINE = '0000000000' .
SERVICES-OUTL_LEVEL = '0'.
SERVICES-OUTL_NO = ' '.
SERVICES-OUTL_IND = 'X'.
SERVICES-SUBPCKG_NO = '2749'.
*SERVICES-SERVICE = ' ' .
SERVICES-EDITION = '0000' .
*SERVICES-BASE_UOM = '
SERVICES-QUANTITY = '0' .
SERVICES-OVF_TOL = '0' .
SERVICES-GR_PRICE = '0' .
SERVICES-FROM_LINE = '1' .
SERVICES-PERS_NO = '00000000' .
SERVICES-PLN_PCKG = '0000000000' .
SERVICES-PLN_LINE = '0000000000' .
SERVICES-CON_PCKG = '0000000000' .
SERVICES-CON_LINE = '0000000000' .
SERVICES-TMP_PCKG = '0000000000' .
SERVICES-TMP_LINE = '0000000000' .
SERVICES-LIMIT_LINE = '0000000000' .
SERVICES-TAX_CODE = impuesto .
*SERVICES-SHORT_TEXT = 'prueba creacion BAPI'.
*SERVICES-MATL_GROUP = '350001'.
APPEND SERVICES. CLEAR SERVICES .
servicio 1
SERVICES-PCKG_NO = '2749'.
SERVICES-LINE_NO = '2' .
SERVICES-EXT_LINE = '10' .
SERVICES-OUTL_LEVEL = '0'.
*SERVICES-OUTL_NO = ' '.
*SERVICES-OUTL_IND = 'X'.
SERVICES-SUBPCKG_NO = '0000000000'.
SERVICES-SERVICE = '000000000000008010'.
SERVICES-EDITION = '0000' .
SERVICES-BASE_UOM = 'UNO' .
SERVICES-UOM_ISO = 'C62' .
SERVICES-QUANTITY = '1' .
SERVICES-PRICE_UNIT = '1' .
SERVICES-OVF_TOL = '0' .
*SERVICES-FROM_LINE = '1' .
SERVICES-SHORT_TEXT = 'prueba creacion BAPI'.
SERVICES-PERS_NO = '00000000' .
SERVICES-PLN_PCKG = '0000001980' .
SERVICES-PLN_LINE = '0000000002' .
SERVICES-CON_PCKG = '0000001980' .
SERVICES-CON_LINE = '0000000002' .
SERVICES-TMP_PCKG = '0000000000' .
SERVICES-TMP_LINE = '0000000000' .
SERVICES-LIMIT_LINE = '0000000000' .
SERVICES-TAX_CODE = 'I2' .
SERVICES-GR_PRICE = '850' .
SERVICES-MATL_GROUP = '350001'.
APPEND SERVICES. CLEAR SERVICES .
*POPULATE CONTRACT LIMITS DATA.
POCONTRACTLIMITS-PCKG_NO = '956'.
POCONTRACTLIMITS-CON_NUMBER = '4903000004'.
POCONTRACTLIMITS-CON_ITEM = '10'.
POCONTRACTLIMITS-NO_LIMIT = c_x.
POCONTRACTLIMITS-PRICE_CHG = c_x.
APPEND POCONTRACTLIMITS. CLEAR POCONTRACTLIMITS .
*BAPI CALL
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = HEADER
POHEADERX = HEADERX
POADDRVENDOR =
TESTRUN =
IMPORTING
EXPPURCHASEORDER = PURCHASEORDER
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
RETURN = RETURN
POITEM = ITEM
POITEMX = ITEMX
POSCHEDULE = ITEMSCHEDULE
POSCHEDULEX = ITEMSCHEDULEX
POACCOUNT = ACCOUNT
POACCOUNTX = ACCOUNTX
POSERVICES = SERVICES.
*Confirm the document creation by calling database COMMIT
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
end-of-selection.
*Output the messages returned from BAPI call
LOOP AT RETURN.
WRITE / RETURN-MESSAGE.
ENDLOOP.This is the code I use to get the package number:
vebeln = AGREEMENT. "open purchase order
first = 'N'.
SELECT * FROM eslh WHERE ebeln = vebeln ORDER BY packno.
IF first = 'N'.
first_pack = eslh-packno.
primero = 'S'.
ELSE.
last_pack = eslh-packno.
ENDIF.
ENDSELECT.
SELECT packno introw extrow srvpos package sub_packno meins brtwr FROM esll INTO TABLE itserv
WHERE packno BETWEEN first_pack AND last_pack.
at the end you'll get the ITSERV internal table with all the services for that specific agreement or contract. Agreement is the same as a BAPIMEPOITEM-AGREEMENT. This services will let you populate the BAPI's SERVICES internal table and you'll have in the "first_pack" variable the value you have to put in the item table in the field item-pckg_no. -
Update delivery address in PO using BAPI BAPI_PO_CREATE1
Hi,
I want to update the delivery address of line item using BAPI BAPI_PO_CREATE1. I am creating address using BAPI BAPI_ADDRESSORG_SAVEREPLICA and I am sending the address number in the import parameter POADDRDELIVERY but it is not updating the delivery address.
Regards,
Anil N.Hi.
after called the BAPI BAPI_PO_CREATE1 call the FM BAPI_TRANSACTION_COMMIT.
it will work
regards
Marco -
Stock Transfer Order: Delivery date issue BAPI_PO_CREATE1
Hi,
I am creating STO using Inbound Delivery data from BAPI_PO_CREATE1
inbound shipping date is 30 may 2014.
Passing below data
HeaderData:
doc_type = 'UB'. "STO
suppl_plnt = '101'
doc_date = inbound shipping date.
comp_code = '1000'
purch_org = '20'
pur_group = '200'
Headerx Data:
doc_type = X
suppl_plnt = X
doc_date = X.
comp_code = X
purch_org = X
pur_group = x
Item Data:
Po_item = tabix of loop
Material = material from Inbound delivery item
plant = '101'
strge_loc = W.
Qunatity = from Inbound item only.
ItemX Data:
Po_item = X
Material = X
plant = 'x
strge_loc = X.
Qunatity = X.
Schedule Line Data:
po_item = tabix of loop
schedule_line = '001'
delivery_date = shipping date
del_datcat_ext = 'D'.
Quantity = quantity from Inbound item.
call function 'bapi_po_create1'.
exporting
poheader = header data
poheaderx = headerx data
importing
exppurchaseorder = po
table
return = return
poitem = item data
poitemx = itemx data
poschedule = schedule data
poschedulex = schedulex data.
when i am creating STO with above method STO is getting created and all data in it also correct but delivery date is 20th june 2014
instead of 30 may 2014.
it is coming as there is planned delivery time that is 21 so it is showing 20th june 2014.
but i need this value as 30th may 2014 only.
please help me on that.
thanks in advance.
Regards,
GauravHello,
You have to populate internal tables pocond and pocondx with values for itm_number,cond_st_no,cond_count,cond_value,cond_type, currency and change_id. Then call BAPI_PO_CREATE1.
Thanks,
Venu -
Creating po using bapi_po_create1
i am using bapi_po_create1 to create po's..po number and item(posnr) numbers are external numbers..so we have External order no range configured based on order type...
Do i need create external number ranges for posnr too..?
For some reason even if pass posnr = '9999', it's creating po's with '10','20'..etc.. is there a flag i need to set in BAPIMEPOITEM???
Thanks
Siva.Hi,
Check the sample code, and Observe the Bold Code. may be you missed that.
REPORT zpo_test .
*DATA DECLARATION
CONSTANTS : c_x VALUE 'X'.
*Structures to hold PO header data
DATA : header LIKE bapimepoheader ,
headerx LIKE bapimepoheaderx .
*Structures to hold PO account data
DATA : account LIKE bapimepoaccount OCCURS 0 WITH HEADER LINE ,
accountx LIKE bapimepoaccountx OCCURS 0 WITH HEADER LINE .
*Internal Tables to hold PO ITEM DATA
DATA : item LIKE bapimepoitem OCCURS 0 WITH HEADER LINE,
itemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE,
*Internal table to hold messages from BAPI call
return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
*Internal table to hold messages from BAPI call
pocontractlimits LIKE bapiesucc OCCURS 0 WITH HEADER LINE.
DATA : w_header(40) VALUE 'PO Header',
purchaseorder LIKE bapimepoheader-po_number,
delivery_date LIKE bapimeposchedule-delivery_date.
DATA : ws_langu LIKE sy-langu.
*text-001 = 'PO Header' - define as text element
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : company LIKE header-comp_code DEFAULT '122' ,
doctyp LIKE header-doc_type DEFAULT 'NB' ,
cdate LIKE header-creat_date DEFAULT sy-datum ,
vendor LIKE header-vendor DEFAULT '2000000012' ,
pur_org LIKE header-purch_org DEFAULT 'PU01' ,
pur_grp LIKE header-pur_group DEFAULT '005' .
*sociedad like HEADER-COMP_CODE default '122' ,
*vendedor like HEADER-SALES_PERS default 'sale person'.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : item_num LIKE item-po_item DEFAULT '00010',
material LIKE item-material DEFAULT '12000000' ,
tipo_imp LIKE item-acctasscat DEFAULT 'K' ,
* pos_doc like ITEM-ITEM_CAT default 'F' ,
shorttxt LIKE item-short_text DEFAULT 'PRUEBA BAPI' ,
grup_art LIKE item-matl_group DEFAULT '817230000' ,
plant LIKE item-plant DEFAULT '3001' ,
mpe LIKE item-trackingno DEFAULT '9999' ,
*contrato like ITEM-AGREEMENT default '4904000003' ,
*quantity like ITEM-QUANTITY default 1 .
po_unit LIKE item-po_unit DEFAULT 'EA'.
SELECTION-SCREEN END OF BLOCK b2.
* Par?mnetros de imputaci?n
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-004.
PARAMETERS : centro LIKE account-costcenter DEFAULT '1220813150',
cuenta LIKE account-gl_account DEFAULT '6631400' ,
num_pos LIKE account-po_item DEFAULT '10' ,
serial LIKE account-serial_no DEFAULT '01' ,
ind_imp LIKE account-tax_code DEFAULT 'I2' .
SELECTION-SCREEN END OF BLOCK b3.
START-OF-SELECTION.
*DATA POPULATION
ws_langu = sy-langu. "Language variable
*POPULATE HEADER DATA FOR PO
*HEADER-COMP_CODE = sociedad .
header-doc_type = doctyp .
header-vendor = vendor .
header-creat_date = cdate .
header-created_by = 'TD17191' .
header-purch_org = pur_org .
header-pur_group = pur_grp .
header-comp_code = company .
header-langu = ws_langu .
*HEADER-SALES_PERS = vendedor .
*HEADER-CURRENCY = 'DOP' .
*HEADER-ITEM_INTVL = 10 .
*HEADER-PMNTTRMS = 'N30' .
*HEADER-EXCH_RATE = 1 .
*POPULATE HEADER FLAG.
headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-vendor = c_x.
headerx-creat_date = c_x.
headerx-created_by = c_x.
headerx-purch_org = c_x.
headerx-pur_group = c_x.
headerx-langu = c_x.
*HEADERX-sales_pers = c_x.
*HEADERX-CURRENCY = c_x.
*HEADER-ITEM_INTVL = c_x.
*HEADER-PMNTTRMS = c_x.
*HEADER-EXCH_RATE = c_x.
*HEADER-EXCH_RATE = c_x.
*POPULATE ITEM DATA.
<b>item-po_item = item_num.</b>
item-quantity = '1'.
*ITEM-MATERIAL = material .
item-short_text = 'prueba bapi_po_create1'.
*ITEM-TAX_CODE = ''.
item-acctasscat = 'K' .
*ITEM-ITEM_CAT = 'D' .
item-matl_group = '817230000' .
item-plant = '3001' .
item-trackingno = '99999'.
item-preq_name = 'test'.
*ITEM-AGREEMENT = '' .
*ITEM-AGMT_ITEM = ''.
item-quantity = '1' .
item-po_unit = 'EA'.
*ITEM-ORDERPR_UN = 'EA'.
item-conv_num1 = '1'.
item-conv_den1 = '1'.
item-net_price = '1000000' .
item-price_unit = '1'.
item-gr_pr_time = '0'.
item-prnt_price = 'X'.
item-unlimited_dlv = 'X'.
item-gr_ind = 'X' .
item-ir_ind = 'X' .
item-gr_basediv = 'X'.
*ITEM-PCKG_NO = '' .
APPEND item.
CLEAR item.
*POPULATE ITEM FLAG TABLE
<b> itemx-po_item = item_num.
itemx-po_itemx = c_x.</b>
*ITEMX-MATERIAL = C_X.
itemx-short_text = c_x.
itemx-quantity = c_x.
*ITEMX-TAX_CODE = C_X.
itemx-acctasscat = c_x.
*ITEMX-ITEM_CAT = c_x.
itemx-matl_group = c_x.
itemx-plant = c_x.
itemx-trackingno = c_x.
itemx-preq_name = c_x.
*ITEMX-AGREEMENT = C_X.
*ITEMX-AGMT_ITEM = c_x.
itemx-stge_loc = c_x.
itemx-quantity = c_x.
itemx-po_unit = c_x.
*ITEMX-ORDERPR_UN = C_X.
itemx-conv_num1 = c_x.
itemx-conv_den1 = c_x.
itemx-net_price = c_x.
itemx-price_unit = c_x.
itemx-gr_pr_time = c_x.
itemx-prnt_price = c_x.
itemx-unlimited_dlv = c_x.
itemx-gr_ind = c_x .
itemx-ir_ind = c_x .
itemx-gr_basediv = c_x .
APPEND itemx. CLEAR itemx.
*POPULATE ACCOUNT DATA.
account-po_item = item_num.
account-serial_no = serial .
account-creat_date = sy-datum .
account-costcenter = centro .
account-gl_account = cuenta .
account-gr_rcpt = 'tester'.
APPEND account. CLEAR account.
*POPULATE ACCOUNT FLAG TABLE.
accountx-po_item = item_num .
accountx-po_itemx = c_x .
accountx-serial_no = serial .
accountx-serial_nox = c_x .
accountx-creat_date = c_x .
accountx-costcenter = c_x .
accountx-gl_account = c_x .
account-gr_rcpt = c_x.
APPEND accountx. CLEAR accountx.
*BAPI CALL
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = header
poheaderx = headerx
IMPORTING
exppurchaseorder = purchaseorder
TABLES
return = return
poitem = item
poitemx = itemx
poaccount = account
poaccountx = accountx.
*Confirm the document creation by calling database COMMIT
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
* IMPORTING
* RETURN =
END-OF-SELECTION.
*Output the messages returned from BAPI call
LOOP AT return.
WRITE / return-message.
ENDLOOP.
Check the Bold code.
Regards
vijay -
Bapi for creating purchase order
hi, iam using BAPI_PO_CREATE1 to create PO's for service. after creating opne PO if i go and create another po within a short span of a minute or so then it does not create the second PO. it gives message that doc does not contain any items.
TABLES: ekpo,zcta_podates,ekko.
DATA iekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.
DATA iekko LIKE ekko OCCURS 0 WITH HEADER LINE.
DATA ipodates LIKE zcta_podates OCCURS 0 WITH HEADER LINE.
DATA : wabldat1 LIKE zcta_podates-podat.
DATA : wabldat2 LIKE zcta_podates-podat.
DATA : wabldat3 LIKE zcta_podates-podat.
DATA : wabldat4 LIKE zcta_podates-podat.
DATA : wabldat5 LIKE zcta_podates-podat.
DATA : wabldat6 LIKE zcta_podates-podat.
DATA : wabldat7 LIKE zcta_podates-podat.
DATA :fname1 TYPE string.
DATA :w_fname1 TYPE string.
DATA : BEGIN OF itab1 OCCURS 0 ,
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(15),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
val3(10),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzcity LIKE ekpo-zzcity,
zzlangu LIKE ekpo-zzlangu,
zzedition LIKE ekpo-zzedition,
zzcolorhue LIKE ekpo-zzcolorhue,
zztypeofad LIKE ekpo-zztypeofad,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab1.
DATA :BEGIN OF itab2 OCCURS 0, " radio
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzcity LIKE ekpo-zzcity,
zzprogramname LIKE ekpo-zzprogramname,
zzdealstructure LIKE ekpo-zzdealstructure,
zztimeband LIKE ekpo-zztimeband,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab2.
DATA :BEGIN OF itab3 OCCURS 0, "tv
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzgenre LIKE ekpo-zzgenre,
zzprogramname LIKE ekpo-zzprogramname,
zzdealstructure LIKE ekpo-zzdealstructure,
zztimeband LIKE ekpo-zztimeband,
zzlangu LIKE ekpo-zzlangu,
zzcity(20), " LIKE ekpo-zzcity,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab3.
DATA :BEGIN OF itab4 OCCURS 0, "OUTDOOR
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
cond(12),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzcity LIKE ekpo-zzcity,
zzlocationorroad LIKE ekpo-zzlocationorroad,
zztypeofad LIKE ekpo-zztypeofad,
zztrafficdirtn LIKE ekpo-zztrafficdirtn,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab4.
DATA :BEGIN OF itab5 OCCURS 0, "INTERNET
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
cond(12),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zztypeofad LIKE ekpo-zztypeofad,
zzsection LIKE ekpo-zzsection,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab5.
DATA :BEGIN OF itab6 OCCURS 0, "CINEMA
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
cond(12),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzcity LIKE ekpo-zzcity,
zzlocationorroad LIKE ekpo-zzlocationorroad,
zzcinemaname LIKE ekpo-zzcinemaname,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab6.
DATA :BEGIN OF itab7 OCCURS 0, "OTHER MEDIA
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(12),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
val3(10),
val4(10),
zzformat LIKE ekpo-zzformat,
zcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzcity LIKE ekpo-zzcity,
zzedition LIKE ekpo-zzedition,
zzcolorhue LIKE ekpo-zzcolorhue,
zztypeofad LIKE ekpo-zztypeofad,
zzlangu LIKE ekpo-zzlangu,
zzgenre LIKE ekpo-zzgenre,
zzprogramname LIKE ekpo-zzprogramname,
zzdealstructure LIKE ekpo-zzdealstructure,
zztimeband LIKE ekpo-zztimeband,
zzlocationorroad LIKE ekpo-zzlocationorroad,
zzsection LIKE ekpo-zzsection,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab7.
DATA :BEGIN OF itab8 OCCURS 0, "NO MEDIA
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
qty(12),
gross(12),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzcity LIKE ekpo-zzcity,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF itab8.
DATA : BEGIN OF str OCCURS 0,
txz01 LIKE mepo1211-txz01,
werks LIKE mepo1211-name1,
srvpos LIKE esll-srvpos,
gross(15),
val1(10), "LIKE esll-frmval1,
val2(10), " LIKE esll-frmval2
val3(10),
val4(10),
zzformat LIKE ekpo-zzformat,
zzcampaign LIKE ekpo-zzcampaign,
zzmeansofad LIKE ekpo-zzmeansofad,
zzcity LIKE ekpo-zzcity,
zzlangu LIKE ekpo-zzlangu,
zzedition LIKE ekpo-zzedition,
zzcolorhue LIKE ekpo-zzcolorhue,
zztypeofad LIKE ekpo-zztypeofad,
zzillumination LIKE ekpo-zzillumination ,
zztrafficdirtn LIKE ekpo-zztrafficdirtn ,
zzstore LIKE ekpo-zzstore ,
zzcasting LIKE ekpo-zzcasting ,
zzgenre LIKE ekpo-zzgenre ,
zzsection LIKE ekpo-zzsection ,
zznumberofdays LIKE ekpo-zznumberofdays ,
zzprogramname LIKE ekpo-zzprogramname ,
zzdealstructure LIKE ekpo-zzdealstructure ,
zztimeband LIKE ekpo-zztimeband ,
zzdate LIKE ekpo-zzdate ,
zzdaysofwk LIKE ekpo-zzdaysofwk ,
zzasnum LIKE ekpo-zzasnum ,
zzlocationorroad LIKE ekpo-zzlocationorroad ,
zzcinemaname LIKE ekpo-zzcinemaname ,
zzcapacity LIKE ekpo-zzcapacity ,
zzfield2 LIKE ekpo-zzfield2 ,
zzfield3 LIKE ekpo-zzfield3 ,
date1(10),
date2(10),
date3(10),
date4(10),
date5(10),
date6(10),
date7(10),
END OF str.
DATA :package(10) TYPE n VALUE '4747'.
DATA :subpackage(10) TYPE n VALUE '4748'.
DATA : l_po_header LIKE bapimepoheader.
DATA : l_po_headerx LIKE bapimepoheaderx.
DATA : l_purchaseorder LIKE bapimepoheader-po_number.
DATA : t_po_account LIKE bapimepoaccount OCCURS 0 WITH HEADER LINE.
DATA : t_po_accountx LIKE bapimepoaccountx OCCURS 0 WITH HEADER LINE.
DATA : t_po_servalue LIKE bapiesklc OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF t_po_items OCCURS 0.
INCLUDE STRUCTURE bapimepoitem.
DATA : END OF t_po_items.
DATA : BEGIN OF t_po_itemsx OCCURS 0.
INCLUDE STRUCTURE bapimepoitemx.
DATA : END OF t_po_itemsx.
DATA : BEGIN OF t_return OCCURS 0.
INCLUDE STRUCTURE bapiret2.
DATA : END OF t_return.
DATA : BEGIN OF t_po_services OCCURS 0.
INCLUDE STRUCTURE bapiesllc.
DATA : END OF t_po_services.
DATA: l_item(5) TYPE n,l_last_po(10).
*TABLES : zerror.
DATA lcounter(3) TYPE n.
DATA : l_errflag.
SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME.
PARAMETER:x_lifnr LIKE ekko-lifnr .
PARAMETER:x_ekorg LIKE ekko-ekorg DEFAULT '9000' .
PARAMETER:x_ekgrp LIKE ekko-ekgrp .
PARAMETER:x_bukrs LIKE ekko-bukrs DEFAULT '0101' .
PARAMETER:x_bsart LIKE ekko-bsart DEFAULT 'ZNB1'.
PARAMETER:x_sdate LIKE ekko-bedat.
PARAMETER : x_edate LIKE ekko-bedat.
PARAMETER: pr_fn1 LIKE ibipparms-path OBLIGATORY.
PARAMETER: rad1 RADIOBUTTON GROUP gr1.
PARAMETER: rad2 RADIOBUTTON GROUP gr1.
PARAMETER: rad3 RADIOBUTTON GROUP gr1.
PARAMETER: rad4 RADIOBUTTON GROUP gr1.
PARAMETER: rad5 RADIOBUTTON GROUP gr1.
PARAMETER: rad6 RADIOBUTTON GROUP gr1.
PARAMETER: rad7 RADIOBUTTON GROUP gr1.
PARAMETER: rad8 RADIOBUTTON GROUP gr1.
SELECTION-SCREEN:END OF BLOCK b1 .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pr_fn1.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = pr_fn1.
MOVE pr_fn1 TO w_fname1.
START-OF-SELECTION.
IF rad1 = 'X'.
PERFORM table_upload TABLES itab1.
ELSEIF rad2 = 'X'.
PERFORM table_upload TABLES itab2.
ELSEIF rad3 = 'X'.
PERFORM table_upload TABLES itab3.
ELSEIF rad4 = 'X'.
PERFORM table_upload TABLES itab4.
ELSEIF rad5 = 'X'.
PERFORM table_upload TABLES itab5.
ELSEIF rad6 = 'X'.
PERFORM table_upload TABLES itab6.
ELSEIF rad7 = 'X'.
PERFORM table_upload TABLES itab7.
ELSEIF rad8 = 'X'.
PERFORM table_upload TABLES itab8.
ENDIF.
LOOP AT str.
SHIFT str-srvpos RIGHT DELETING TRAILING ' '.
OVERLAY str-srvpos WITH '00000000000000000'.
MODIFY str.
ENDLOOP.
CLEAR : l_po_header.
PERFORM create_po_header.
LOOP AT str FROM 2 .
PERFORM append_item.
ENDLOOP.
PERFORM create_po.
WAIT UP TO 5 SECONDS.
SELECT * FROM ekpo INTO CORRESPONDING FIELDS OF TABLE iekpo WHERE ebeln = l_purchaseorder.
COMMIT WORK.
WAIT UP TO 5 SECONDS.
LOOP AT iekpo.
l_item = sy-tabix + 1.
READ TABLE str INDEX l_item.
iekpo-zzfield2 = str-zzfield2 .
iekpo-zzfield3 = str-zzfield3 .
iekpo-zzformat = str-zzformat .
iekpo-zzmeansofad = str-zzmeansofad .
iekpo-zzedition = str-zzedition .
iekpo-zzcolorhue = str-zzcolorhue .
iekpo-zztypeofad = str-zztypeofad .
iekpo-zzcity = str-zzcity .
iekpo-zzlangu = str-zzlangu .
iekpo-zzdaysofwk = str-zzdaysofwk .
iekpo-zzasnum = str-zzasnum .
iekpo-zzlocationorroad = str-zzlocationorroad .
iekpo-zzcinemaname = str-zzcinemaname .
iekpo-zzcapacity = str-zzcapacity .
iekpo-zzcampaign = str-zzcampaign .
iekpo-zzillumination = str-zzillumination .
iekpo-zztrafficdirtn = str-zztrafficdirtn .
iekpo-zzstore = str-zzstore .
iekpo-zzcasting = str-zzcasting .
iekpo-zzgenre = str-zzgenre .
iekpo-zzsection = str-zzsection .
iekpo-zznumberofdays = str-zznumberofdays .
iekpo-zzprogramname = str-zzprogramname .
iekpo-zzdealstructure = str-zzdealstructure .
iekpo-zztimeband = str-zztimeband .
iekpo-zzdate = str-zzdate .
MODIFY iekpo.
ENDLOOP.
WAIT UP TO 2 SECONDS.
COMMIT WORK.
WAIT UP TO 15 SECONDS.
UPDATE ekpo FROM TABLE iekpo.
COMMIT WORK.
WAIT UP TO 2 SECONDS.
SELECT * FROM ekko INTO CORRESPONDING FIELDS OF TABLE iekko WHERE ebeln = l_purchaseorder.
LOOP AT iekko.
iekko-kdatb = x_sdate.
iekko-kdate = x_edate.
MODIFY iekko.
ENDLOOP.
UPDATE ekko FROM TABLE iekko.
COMMIT WORK.
WAIT UP TO 1 SECONDS.
CLEAR l_item.
l_item = 10.
LOOP AT str FROM 2 .
CONCATENATE str-date1+6(4) str-date1+3(2) str-date1(2) INTO wabldat1.
CONCATENATE str-date2+6(4) str-date2+3(2) str-date2(2) INTO wabldat2.
CONCATENATE str-date3+6(4) str-date3+3(2) str-date3(2) INTO wabldat3.
CONCATENATE str-date4+6(4) str-date4+3(2) str-date4(2) INTO wabldat4.
CONCATENATE str-date5+6(4) str-date5+3(2) str-date5(2) INTO wabldat5.
CONCATENATE str-date6+6(4) str-date6+3(2) str-date6(2) INTO wabldat6.
CONCATENATE str-date7+6(4) str-date7+3(2) str-date7(2) INTO wabldat7.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '001'.
ipodates-podat = wabldat1.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '002'.
ipodates-podat = wabldat2.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '003'.
ipodates-podat = wabldat3.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '004'.
ipodates-podat = wabldat4.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '005'.
ipodates-podat = wabldat5.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '006'.
ipodates-podat = wabldat6.
APPEND ipodates.
ipodates-ebeln = l_purchaseorder.
ipodates-ebelp = l_item.
ipodates-linno = '007'.
ipodates-podat = wabldat7.
APPEND ipodates.
l_item = l_item + 10.
ENDLOOP.
WAIT UP TO 1 SECONDS.
MODIFY zcta_podates FROM TABLE ipodates.
COMMIT WORK.
WAIT UP TO 2 SECONDS.
ipodates-podat,ipodates-ebeln,ipodates-ebelp,ipodates-linno.
WAIT UP TO 5 SECONDS.
LOOP AT t_return.
WRITE :/ t_return-message.
ENDLOOP.
free : ipodates,iekpo,str,itab1,itab2,itab3,itab4,itab5,itab6,itab7,itab8.
*& Form create_po_header
FORM create_po_header .
l_po_header-comp_code = '0101'. " Company Code
l_po_header-doc_type = x_bsart. "'ZNB1'. " Order Typr BSART
l_po_header-creat_date = sy-datum. " P.O Dt - BEDAT
l_po_header-doc_date = sy-datum.
l_po_header-vendor = x_lifnr.
l_po_header-vper_start = x_sdate.
l_po_header-vper_end = x_edate.
l_po_header-purch_org = '9000'. " Purch. Org - EKKO-EKORG
l_po_header-pur_group = x_ekgrp. " Purch Group - EKKO-EKGRP
l_po_header-currency_iso = 'INR'.
CLEAR : l_po_headerx.
l_po_headerx-po_number = 'X'.
l_po_headerx-comp_code = 'X'." Company Code
l_po_headerx-doc_type = 'X'. " Order Typr BSART
l_po_headerx-vendor = 'X'. "Vendor - EKKO-LIFNR
l_po_headerx-purch_org = 'X'. " Purch. Org - EKKO-EKORG
l_po_headerx-pur_group = 'X'. " Purch Group - EKKO-EKGRP
l_po_headerx-currency_iso = 'X'. " Currency Default field for Enjoy
l_po_headerx-ref_1 = 'X'.
ENDFORM. " create_po_header
*& Form APPEND_ITEM
FORM append_item .
package = package + 2.
subpackage = package + 1.
l_item = l_item + 10.
t_po_items-po_item = l_item.
t_po_items-acctasscat = 'K'.
t_po_items-item_cat = 'D'.
t_po_items-short_text = str-txz01. .
t_po_items-plant = str-werks . " P
t_po_items-tax_code = 'S1'.
t_po_items-pckg_no = package. " 4748. "package.
APPEND t_po_items.
CLEAR t_po_items.
t_po_itemsx-po_item = l_item.
t_po_itemsx-po_itemx = 'X'.
t_po_itemsx-acctasscat = 'X'.
t_po_itemsx-item_cat = 'X'.
t_po_itemsx-short_text = 'X'.
t_po_itemsx-plant = 'X'.
t_po_itemsx-tax_code = 'X'.
t_po_itemsx-pckg_no = 'X'.
APPEND t_po_itemsx.
CLEAR t_po_itemsx.
t_po_account-po_item = l_item.
t_po_account-serial_no = 1.
t_po_account-quantity = 1.
t_po_account-distr_perc = '00'.
t_po_account-costcenter = '0006079000'. " 'BR034'.
t_po_account-gl_account = '0054014071'. "'0000135075'.
t_po_account-co_area = '1001'.
APPEND t_po_account.
CLEAR t_po_account.
t_po_accountx-po_item = l_item.
t_po_accountx-serial_no = 1.
t_po_accountx-quantity = 'X'.
t_po_accountx-distr_perc = 'X'.
t_po_accountx-costcenter = 'X'.
t_po_accountx-gl_account = 'X'.
t_po_accountx-co_area = 'X'.
APPEND t_po_accountx.
CLEAR t_po_accountx.
t_po_services-pckg_no = package. "'4748'.
t_po_services-line_no = '0000000001' .
t_po_services-ext_line = '0000000000' .
t_po_services-outl_level = '0'.
t_po_services-outl_no = ' '.
t_po_services-outl_ind = 'X'.
t_po_services-subpckg_no = subpackage . "'4749'.
APPEND t_po_services. CLEAR t_po_services .
t_po_services-pckg_no = subpackage . "'4749'.
t_po_services-line_no = '0000000002' .
t_po_services-ext_line = '10' .
t_po_services-outl_level = '0'.
t_po_services-service = str-srvpos. "'000000000003000045'.
t_po_services-gr_price = str-gross. "'2000.00'.
t_po_services-form_val1 = str-val1. "'10.000'.
t_po_services-form_val2 = str-val2. "'33.000'.
if rad1 = 'x'.
t_po_services-form_val3 = str-val3. " '3.000'.
endif.
t_po_services-tax_code = 'S1'.
APPEND t_po_services. CLEAR t_po_services .
t_po_servalue-pckg_no = subpackage . "'4749'.
t_po_servalue-line_no = '0000000002' .
t_po_servalue-serial_no = '01'.
APPEND t_po_servalue . CLEAR t_po_servalue.
ENDFORM. " APPEND_ITEM
*& Form create_po
FORM create_po .
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = l_po_header
poheaderx = l_po_headerx
IMPORTING
exppurchaseorder = l_purchaseorder
TABLES
return = t_return
poitem = t_po_items
poitemx = t_po_itemsx
poaccount = t_po_account
poaccountx = t_po_accountx
poservices = t_po_services
posrvaccessvalues = t_po_servalue
WAIT UP TO 15 SECONDS.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
ENDFORM. " create_po
*& Form TABLE_UPLOAD
FORM table_upload TABLES p_itab1. " structure < itab1 #local# >
"Insert correct name for <...>.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = w_fname1
filetype = 'ASC'
has_field_separator = 'X'
read_by_line = 'X'
replacement = '#'
TABLES
data_tab = p_itab1.
LOOP AT p_itab1.
MOVE-CORRESPONDING p_itab1 TO str.
APPEND str.
CLEAR p_itab1.
ENDLOOP.
* WAIT UP TO 5 SECONDS.
ENDFORM. " TABLE_UPLOADHi,
Check this sample code..how to use the BAPI_PO_CREATE1.
REPORT Z_TEST_PO .
*DATA DECLARATION
CONSTANTS : C_X VALUE 'X'.
*Structures to hold PO header data
DATA : HEADER LIKE BAPIMEPOHEADER ,
HEADERX LIKE BAPIMEPOHEADERX .
*Structures to hold PO account data
DATA : ACCOUNT LIKE BAPIMEPOACCOUNT OCCURS 0 WITH HEADER LINE ,
ACCOUNTX LIKE BAPIMEPOACCOUNTX OCCURS 0 WITH HEADER LINE .
*Internal Tables to hold PO ITEM DATA
DATA : ITEM LIKE BAPIMEPOITEM OCCURS 0 WITH HEADER LINE,
ITEMX LIKE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE,
*Internal table to hold messages from BAPI call
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
*Internal table to hold messages from BAPI call
POCONTRACTLIMITS LIKE BAPIESUCC OCCURS 0 WITH HEADER LINE.
DATA : W_HEADER(40) VALUE 'PO Header',
PURCHASEORDER LIKE BAPIMEPOHEADER-PO_NUMBER,
DELIVERY_DATE LIKE BAPIMEPOSCHEDULE-DELIVERY_DATE.
DATA : WS_LANGU LIKE SY-LANGU.
*text-001 = 'PO Header' - define as text element
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : COMPANY LIKE HEADER-COMP_CODE DEFAULT '122' ,
DOCTYP LIKE HEADER-DOC_TYPE DEFAULT 'NB' ,
CDATE LIKE HEADER-CREAT_DATE DEFAULT SY-DATUM ,
VENDOR LIKE HEADER-VENDOR DEFAULT '2000000012' ,
PUR_ORG LIKE HEADER-PURCH_ORG DEFAULT 'PU01' ,
PUR_GRP LIKE HEADER-PUR_GROUP DEFAULT '005' .
*sociedad like HEADER-COMP_CODE default '122' ,
*vendedor like HEADER-SALES_PERS default 'sale person'.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS : ITEM_NUM LIKE ITEM-PO_ITEM DEFAULT '00010',
MATERIAL LIKE ITEM-MATERIAL DEFAULT '12000000' ,
TIPO_IMP LIKE ITEM-ACCTASSCAT DEFAULT 'K' ,
*pos_doc like ITEM-ITEM_CAT default 'F' ,
SHORTTXT LIKE ITEM-SHORT_TEXT DEFAULT 'PRUEBA BAPI' ,
GRUP_ART LIKE ITEM-MATL_GROUP DEFAULT '817230000' ,
PLANT LIKE ITEM-PLANT DEFAULT '3001' ,
MPE LIKE ITEM-TRACKINGNO DEFAULT '9999' ,
*contrato like ITEM-AGREEMENT default '4904000003' ,
*quantity like ITEM-QUANTITY default 1 .
PO_UNIT LIKE ITEM-PO_UNIT DEFAULT 'EA'.
SELECTION-SCREEN END OF BLOCK B2.
* Par?mnetros de imputaci?n
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-004.
PARAMETERS : CENTRO LIKE ACCOUNT-COSTCENTER DEFAULT '1220813150',
CUENTA LIKE ACCOUNT-GL_ACCOUNT DEFAULT '6631400' ,
NUM_POS LIKE ACCOUNT-PO_ITEM DEFAULT '10' ,
SERIAL LIKE ACCOUNT-SERIAL_NO DEFAULT '01' ,
IND_IMP LIKE ACCOUNT-TAX_CODE DEFAULT 'I2' .
SELECTION-SCREEN END OF BLOCK B3.
START-OF-SELECTION.
*DATA POPULATION
WS_LANGU = SY-LANGU. "Language variable
*POPULATE HEADER DATA FOR PO
*HEADER-COMP_CODE = sociedad .
HEADER-DOC_TYPE = DOCTYP .
HEADER-VENDOR = VENDOR .
HEADER-CREAT_DATE = CDATE .
HEADER-CREATED_BY = 'TD17191' .
HEADER-PURCH_ORG = PUR_ORG .
HEADER-PUR_GROUP = PUR_GRP .
HEADER-COMP_CODE = COMPANY .
HEADER-LANGU = WS_LANGU .
*HEADER-SALES_PERS = vendedor .
*HEADER-CURRENCY = 'DOP' .
*HEADER-ITEM_INTVL = 10 .
*HEADER-PMNTTRMS = 'N30' .
*HEADER-EXCH_RATE = 1 .
*POPULATE HEADER FLAG.
HEADERX-COMP_CODE = C_X.
HEADERX-DOC_TYPE = C_X.
HEADERX-VENDOR = C_X.
HEADERX-CREAT_DATE = C_X.
HEADERX-CREATED_BY = C_X.
HEADERX-PURCH_ORG = C_X.
HEADERX-PUR_GROUP = C_X.
HEADERX-LANGU = C_X.
*HEADERX-sales_pers = c_x.
*HEADERX-CURRENCY = c_x.
*HEADER-ITEM_INTVL = c_x.
*HEADER-PMNTTRMS = c_x.
*HEADER-EXCH_RATE = c_x.
*HEADER-EXCH_RATE = c_x.
*POPULATE ITEM DATA.
ITEM-PO_ITEM = ITEM_NUM.
ITEM-QUANTITY = '1'.
*ITEM-MATERIAL = material .
ITEM-SHORT_TEXT = 'prueba bapi_po_create1'.
*ITEM-TAX_CODE = ''.
ITEM-ACCTASSCAT = 'K' .
*ITEM-ITEM_CAT = 'D' .
ITEM-MATL_GROUP = '817230000' .
ITEM-PLANT = '3001' .
ITEM-TRACKINGNO = '99999'.
ITEM-PREQ_NAME = 'test'.
*ITEM-AGREEMENT = '' .
*ITEM-AGMT_ITEM = ''.
ITEM-QUANTITY = '1' .
ITEM-PO_UNIT = 'EA'.
*ITEM-ORDERPR_UN = 'EA'.
ITEM-CONV_NUM1 = '1'.
ITEM-CONV_DEN1 = '1'.
ITEM-NET_PRICE = '1000000' .
ITEM-PRICE_UNIT = '1'.
ITEM-GR_PR_TIME = '0'.
ITEM-PRNT_PRICE = 'X'.
ITEM-UNLIMITED_DLV = 'X'.
ITEM-GR_IND = 'X' .
ITEM-IR_IND = 'X' .
ITEM-GR_BASEDIV = 'X'.
*ITEM-PCKG_NO = '' .
APPEND ITEM. CLEAR ITEM.
*POPULATE ITEM FLAG TABLE
ITEMX-PO_ITEM = ITEM_NUM.
ITEMX-PO_ITEMX = C_X.
*ITEMX-MATERIAL = C_X.
ITEMX-SHORT_TEXT = C_X.
ITEMX-QUANTITY = C_X.
*ITEMX-TAX_CODE = C_X.
ITEMX-ACCTASSCAT = C_X.
*ITEMX-ITEM_CAT = c_x.
ITEMX-MATL_GROUP = C_X.
ITEMX-PLANT = C_X.
ITEMX-TRACKINGNO = C_X.
ITEMX-PREQ_NAME = C_X.
*ITEMX-AGREEMENT = C_X.
*ITEMX-AGMT_ITEM = c_x.
ITEMX-STGE_LOC = C_X.
ITEMX-QUANTITY = C_X.
ITEMX-PO_UNIT = C_X.
*ITEMX-ORDERPR_UN = C_X.
ITEMX-CONV_NUM1 = C_X.
ITEMX-CONV_DEN1 = C_X.
ITEMX-NET_PRICE = C_X.
ITEMX-PRICE_UNIT = C_X.
ITEMX-GR_PR_TIME = C_X.
ITEMX-PRNT_PRICE = C_X.
ITEMX-UNLIMITED_DLV = C_X.
ITEMX-GR_IND = C_X .
ITEMX-IR_IND = C_X .
ITEMX-GR_BASEDIV = C_X .
APPEND ITEMX. CLEAR ITEMX.
*POPULATE ACCOUNT DATA.
ACCOUNT-PO_ITEM = ITEM_NUM.
ACCOUNT-SERIAL_NO = SERIAL .
ACCOUNT-CREAT_DATE = SY-DATUM .
ACCOUNT-COSTCENTER = CENTRO .
ACCOUNT-GL_ACCOUNT = CUENTA .
ACCOUNT-GR_RCPT = 'tester'.
APPEND ACCOUNT. CLEAR ACCOUNT.
*POPULATE ACCOUNT FLAG TABLE.
ACCOUNTX-PO_ITEM = ITEM_NUM .
ACCOUNTX-PO_ITEMX = C_X .
ACCOUNTX-SERIAL_NO = SERIAL .
ACCOUNTX-SERIAL_NOX = C_X .
ACCOUNTX-CREAT_DATE = C_X .
ACCOUNTX-COSTCENTER = C_X .
ACCOUNTX-GL_ACCOUNT = C_X .
ACCOUNT-GR_RCPT = C_X.
APPEND ACCOUNTX. CLEAR ACCOUNTX.
*BAPI CALL
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = HEADER
POHEADERX = HEADERX
IMPORTING
EXPPURCHASEORDER = PURCHASEORDER
TABLES
RETURN = RETURN
POITEM = ITEM
POITEMX = ITEMX
POACCOUNT = ACCOUNT
POACCOUNTX = ACCOUNTX.
*Confirm the document creation by calling database COMMIT
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN =
END-OF-SELECTION.
*Output the messages returned from BAPI call
LOOP AT RETURN.
WRITE / RETURN-MESSAGE.
ENDLOOP.
Regards
vijay -
BAPI for Create PO from Sales Order Data and POST GR from PO created
Dear,
Can u help me how to create BAPI for Purchase Order creation from sales order Data
what the bapi to Post GR from the PO created.
Regards,
ManojHello Manoj what you have to do to create PO from PR is that
1) Use BAPISDORDER_GETDETAILEDLIST (pass sales order number in sales_document table) and then get PR (Purchase requisition number from this BAPI.
2) Use BAPI_REQUISITION_GETDETAIL to get PR items
3) Use BAPI_PO_CREATE1 to craete PO from PR then.
to create goods movement you can use
BAPI_GOODSMVT_CREATE
REWARDS IF USEFUL. -
BAPI to create Delivery from Sales Order posting EIKP data
Hi All,
I'm searching for BAPIs to create a Delivery from Sales Order which I can update/insert data into EIKP table because I am receiving data that it must be saved into ZOLLA and ZOLLB fields (Customs Office: Office of Exit/Entry and Destination for Foreign Trade).
I tried with BAPI_OUTB_DELIVERY_SAVEREPLICA, BAPI_OUTB_DELIVERY_CREATE_SLS and BAPI_DELIVERYPROCESSING_EXEC but I didn't find structures with these fields.
Please, I need some help to resolve this issue.
Thanks in advance.Hello Manoj what you have to do to create PO from PR is that
1) Use BAPISDORDER_GETDETAILEDLIST (pass sales order number in sales_document table) and then get PR (Purchase requisition number from this BAPI.
2) Use BAPI_REQUISITION_GETDETAIL to get PR items
3) Use BAPI_PO_CREATE1 to craete PO from PR then.
to create goods movement you can use
BAPI_GOODSMVT_CREATE
REWARDS IF USEFUL. -
Hi,
Can anybody send me some sample code to handle multiple files in application server. My requirement is to create an interface to create PO and GR from the file residing in Application server. Multiple files will be in application server. No selection screens are there. BAPI used are BAPI_PO_CREATE1 and BAPI_GOODSMVT_CREATE. And If anyone has already created this interface, please give me some idea of how to read multiple files and if possible send some sample code.
Any help will be greatly appreciated.
Regards,
NaveenHi Naveen,
Go through this link.
BAPI_PO_CREATE1
Re: Proble in Creating Multiple Item PO using BAPI_PO_CREATE1
BAPI_GOODSMVT_CREATE
http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm
http://www.4ap.de/abap/bapi_goodsmvt_create.php
Reward Points For the Helpful.
Regards,
Harini.S -
We have a strange issue. We are creating Service Purchase Orders by using BAPI_PO_CREATE1 function module. The source for creating PO is a Z table wherein it contains approximately 1000 records. We create one PO per Vendor and all POs are creating successfully but strangely GL account number and cost centers are missing in every 100, 200, 300, 400, 500, etc. line items and have NO issue with other line items. Our purchase order line item interval is 1 which means at every 100th line item we have an issue in missing GL account number and cost centers. We also checked by changing line item interval to '10' and still we have issue at every 1000th line item.
We searched for OSS notes but no luck. Did anyone come across this kind of issue ? Could you please advise.
Regards,
Krishyou can either share your code and your source file to have the people check if the error is on your part or you can directly contact SAP if you are the opinion that it is an error in their BAPI code.
But without looking at code and source file it is not possible to do any evaluation except you are looking for clairvoyants -
hi,
Hello all, please help!! I used function BAPI_PO_CREATE1 to create PO with limit item but function returned message error '518 No account assignment exist for service line 0000000000'. Can anyone give me an idea to slove this problem?
i am passing po header, po headerx, po item , po itemx, po account, po accountx, po limits, po services, po service values, to bapi. if i comment package number in po limits structure , po was creating but limits data not updating in po., if i pass package number i am getting above error.
Thanks In Advance,
regardshi Dinesh,
am also having same error for bap po create1 . did it get resolved for you? please help its urgently needed for me here
Maybe you are looking for
-
How to display a region in the center of the page
Hi, I am trying to position a region in the center of the page and I am using the following in the region attributes field style="width:70%; region = "center";" but the region is positioned to the left only. Is there any other method to do this work.
-
FRM-47109 cannot locate image file
Hi guys, I created an image item on my form which will displays a picture from my hard disk when user click once. Trigger: When-Image-Pressed trigger code: read_image_file('C:\Nissan_xtrail','JPEG','product_image'); But the following error is return
-
Process does not perform an update.
I have this PL/SQL process in my page: UPDATE tag_order SET order_date = SYSDATE WHERE order_number = :P16_Order_Number; COMMIT; Unfortunately, it does not perform the update. What could be wrong? FYI: In order to get to the page where this process i
-
Just wanted to throw this out to see if anyone else has seen this. I have my X set for maximum battery saver, display brightness set at about 30% and the screen set to go blank after 30 seconds. Several mornings I have noticed the battery has lost
-
using utl_tcp for ftp between servers, would it be possible to use the ip address of the server as v_hostname VARCHAR2(255) := '192.168.0.101' instaed of a domain name v_hostname VARCHAR2(255) := 'ftp.oracle.com';