Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Net price must be greater than 0 error while creating PO using BAPI

Former Member
0 Likes
2,173

Hi guys!

I'm using BAPI_PO_CREATE1 to create several PO's from a Z table record. I finally achieved that my BAPI to work as wished, with conditions, etc.

The problem im having is that i get the error of net price must be > 0.

I do not have any condition type defined . Is it necessary to define one?

Plz any help will be very appreciated.

Thx.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,346

It will be configuration problem,create one PO manually and see the results

and create same data for Po using Function module and see the results

most of the time net price should be more than 0,keep net price should be more than zero

see the simple program ,what i created :

&----


*& Report ZBAPI

*&

&----


*&

*&

&----


REPORT ZBAPI.

DATA: BEGIN OF i_data OCCURS 0,

text(255),

END OF i_data.

DATA: i_ekko TYPE bapiekkoc.

DATA: it_ekko LIKE TABLE OF i_ekko INITIAL SIZE 0 WITH HEADER LINE.

DATA: BEGIN OF i_ekpo OCCURS 0,

po_item(5),

pur_mat(18),

plant(4),

net_price(23),

disp_quan(13),

END OF i_ekpo.

DATA: it_ekpo LIKE TABLE OF bapiekpoc INITIAL SIZE 0 WITH HEADER LINE .

DATA: BEGIN OF i_eket OCCURS 0,

po_item(5),

deliv_date(8),

quantity(13),

END OF i_eket.

DATA: it_eket LIKE TABLE OF bapieket INITIAL SIZE 0 WITH HEADER LINE.

DATA: v_index TYPE i.

DATA: return TYPE TABLE OF bapireturn INITIAL SIZE 0 WITH HEADER LINE.

DATA: po_num(10).

START-OF-SELECTION.

CALL FUNCTION 'UPLOAD'

  • EXPORTING

  • CODEPAGE = ' '

  • FILENAME = ' '

  • FILETYPE = ' '

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

data_tab = i_data

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • INVALID_TABLE_WIDTH = 2

  • INVALID_TYPE = 3

  • NO_BATCH = 4

  • UNKNOWN_ERROR = 5

  • GUI_REFUSE_FILETRANSFER = 6

  • OTHERS = 7

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at i_data.

if i_data-text(1) = 'H'.

shift i_data-text.

v_index = v_index + 1.

split i_data-text at ',' into i_ekko-doc_type

i_ekko-purch_org

i_ekko-pur_group

i_ekko-vendor.

append i_ekko to it_ekko.

elseif i_data-text(1) = 'I'.

shift i_data-text.

split i_data-text at ',' into i_ekpo-po_item

i_ekpo-pur_mat

i_ekpo-plant

i_ekpo-net_price

i_ekpo-disp_quan.

append i_ekpo.

move-corresponding i_ekpo to it_ekpo.

append it_ekpo.

clear it_ekpo.

else.

shift i_data-text.

split i_data-text at ',' into i_eket-po_item

i_eket-deliv_date

i_eket-quantity.

append it_eket .

move-corresponding i_eket to it_eket.

append it_eket.

clear it_eket.

endif.

endloop.

CALL FUNCTION 'BAPI_PO_CREATE'

EXPORTING

po_header = i_ekko

  • PO_HEADER_ADD_DATA =

  • HEADER_ADD_DATA_RELEVANT =

  • PO_ADDRESS =

  • SKIP_ITEMS_WITH_ERROR = 'X'

  • ITEM_ADD_DATA_RELEVANT =

  • HEADER_TECH_FIELDS =

  • IMPORTING

  • PURCHASEORDER =

tables

po_items = it_ekpo

  • PO_ITEM_ADD_DATA =

po_item_schedules = it_eket

  • PO_ITEM_ACCOUNT_ASSIGNMENT =

  • PO_ITEM_TEXT =

RETURN = return

  • PO_LIMITS =

  • PO_CONTRACT_LIMITS =

  • PO_SERVICES =

  • PO_SRV_ACCASS_VALUES =

  • PO_SERVICES_TEXT =

  • PO_BUSINESS_PARTNER =

  • EXTENSIONIN =

  • POADDRDELIVERY =

.

write: po_num.

use BAPi_TRANSACTION_COMITT FM always

loop at return.

write:/ return-message,return-type.

endloop.

Thanks

Seshu

Message was edited by:

Seshu Maramreddy

Message was edited by:

Seshu Maramreddy

Hi guys!

I'm using BAPI_PO_CREATE1 to create several PO's from a Z table record. I finally achieved that my BAPI to work as wished, with conditions, etc.

The problem im having is that i get the error of net price must be > 0.

I do not have any condition type defined . Is it necessary to define one?

Plz any help will be very appreciated.

Thx.

1 REPLY 1
Read only

Former Member
0 Likes
1,347

It will be configuration problem,create one PO manually and see the results

and create same data for Po using Function module and see the results

most of the time net price should be more than 0,keep net price should be more than zero

see the simple program ,what i created :

&----


*& Report ZBAPI

*&

&----


*&

*&

&----


REPORT ZBAPI.

DATA: BEGIN OF i_data OCCURS 0,

text(255),

END OF i_data.

DATA: i_ekko TYPE bapiekkoc.

DATA: it_ekko LIKE TABLE OF i_ekko INITIAL SIZE 0 WITH HEADER LINE.

DATA: BEGIN OF i_ekpo OCCURS 0,

po_item(5),

pur_mat(18),

plant(4),

net_price(23),

disp_quan(13),

END OF i_ekpo.

DATA: it_ekpo LIKE TABLE OF bapiekpoc INITIAL SIZE 0 WITH HEADER LINE .

DATA: BEGIN OF i_eket OCCURS 0,

po_item(5),

deliv_date(8),

quantity(13),

END OF i_eket.

DATA: it_eket LIKE TABLE OF bapieket INITIAL SIZE 0 WITH HEADER LINE.

DATA: v_index TYPE i.

DATA: return TYPE TABLE OF bapireturn INITIAL SIZE 0 WITH HEADER LINE.

DATA: po_num(10).

START-OF-SELECTION.

CALL FUNCTION 'UPLOAD'

  • EXPORTING

  • CODEPAGE = ' '

  • FILENAME = ' '

  • FILETYPE = ' '

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

data_tab = i_data

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • INVALID_TABLE_WIDTH = 2

  • INVALID_TYPE = 3

  • NO_BATCH = 4

  • UNKNOWN_ERROR = 5

  • GUI_REFUSE_FILETRANSFER = 6

  • OTHERS = 7

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at i_data.

if i_data-text(1) = 'H'.

shift i_data-text.

v_index = v_index + 1.

split i_data-text at ',' into i_ekko-doc_type

i_ekko-purch_org

i_ekko-pur_group

i_ekko-vendor.

append i_ekko to it_ekko.

elseif i_data-text(1) = 'I'.

shift i_data-text.

split i_data-text at ',' into i_ekpo-po_item

i_ekpo-pur_mat

i_ekpo-plant

i_ekpo-net_price

i_ekpo-disp_quan.

append i_ekpo.

move-corresponding i_ekpo to it_ekpo.

append it_ekpo.

clear it_ekpo.

else.

shift i_data-text.

split i_data-text at ',' into i_eket-po_item

i_eket-deliv_date

i_eket-quantity.

append it_eket .

move-corresponding i_eket to it_eket.

append it_eket.

clear it_eket.

endif.

endloop.

CALL FUNCTION 'BAPI_PO_CREATE'

EXPORTING

po_header = i_ekko

  • PO_HEADER_ADD_DATA =

  • HEADER_ADD_DATA_RELEVANT =

  • PO_ADDRESS =

  • SKIP_ITEMS_WITH_ERROR = 'X'

  • ITEM_ADD_DATA_RELEVANT =

  • HEADER_TECH_FIELDS =

  • IMPORTING

  • PURCHASEORDER =

tables

po_items = it_ekpo

  • PO_ITEM_ADD_DATA =

po_item_schedules = it_eket

  • PO_ITEM_ACCOUNT_ASSIGNMENT =

  • PO_ITEM_TEXT =

RETURN = return

  • PO_LIMITS =

  • PO_CONTRACT_LIMITS =

  • PO_SERVICES =

  • PO_SRV_ACCASS_VALUES =

  • PO_SERVICES_TEXT =

  • PO_BUSINESS_PARTNER =

  • EXTENSIONIN =

  • POADDRDELIVERY =

.

write: po_num.

use BAPi_TRANSACTION_COMITT FM always

loop at return.

write:/ return-message,return-type.

endloop.

Thanks

Seshu

Message was edited by:

Seshu Maramreddy

Message was edited by:

Seshu Maramreddy