Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

BAPI_PO_CREATE..........

Hi gurus,

I have written this scenario before too but I didn't get the significant answer and I need to submit my program within an hour, so can anyone of you please help me in solvig this problem .

I have a scenario where I need to use BAPI_PO_CREATE1 to create PO's for multiple line items, and the file that I will be uploading looks like this:

the sequence of the fileds are:

<b>Ref no., Vendor, material,Quantity, Price, Ord_unit, Plant,

Strg_loc, purch_org, purch_grp,c_code, doc_typ</b>

1 101 123 100 10 car 101 121 114 112 222 NB

1 101 234 100 10 buc 101 121 114 112 222 NB

1 101 567 100 10 car 101 121 114 112 222 NB

2 102 123 100 10 car 101 121 114 112 222 NB

2 102 567 100 10 car 101 121 114 112 222 NB

3 103 234 100 10 buc 101 121 114 112 222 NB

3 103 567 100 10 car 101 121 114 112 222 NB

3 103 123 100 10 car 101 121 114 112 222 NB

4 104 567 100 10 car 101 121 114 112 222 NB

The refrence no. field in the text file will act as a unique identifier i.e. all records having the same REF NO should belong to the same purchase order, so basically in my case my program should create 4 Po's for the above text file for ref no. 1,2,3 and 4.

I don't have much time left so I will be really greatful to you if you guys will answer this problenm using my own objects as I very less time is left, I will really appreciate you efforts.

data: poheader LIKE bapimepoheader,

poheaderx LIKE bapimepoheaderx,

poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE,

poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE,

return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,

return2 LIKE bapiret2 OCCURS 0 WITH HEADER LINE,

exppurchaseorder LIKE bapimepoheader-po_number,

poschedule LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE,

poschedulex LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.

data: begin of it_input_file OCCURS 0,

ref_no(2),

c_code(4),

doc_typ(4),

doc_date(10),

vend_no(10),

purch_org(4),

purch_grp(3),

currency(3),

item_no(3),

material(18),

Plant(4),

Strg_loc(4),

Quantity(13),

Price(10),

ord_unit(7),

del_date(10),

seq_num(5) type n,

end of it_input_file.

v_semfile = p_ifname.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

filename = v_semfile

filetype = 'DAT'

TABLES

data_tab = it_input_file

EXCEPTIONS

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_table_width = 4

invalid_type = 5

no_batch = 6

unknown_error = 7

gui_refuse_filetransfer = 8

OTHERS = 9.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question