2007 Dec 05 5:18 AM
Hi
This is lalitha
i have created bapi successfully but i wanted to know how to write a program in se38 for bapi
please help me
or atleast suggest me how to write the program.
with regards.
hi !!!
we can call the bapi in se38 as normaly we call the function module.
here is the example.
lets suppose ZBAPI_COMPANYCODE_GET_PERIOD is the bapi we created, then
we use that in se38 editorlike this..
call function 'ZBAPI_COMPANYCODE_GET_PERIOD'
exporting
companycodeid = lv_companycode
posting_date = lv_postingdate
IMPORTING
FISCAL_YEAR = lv_fiscalyear
FISCAL_PERIOD = lv_fiscalperiod.
2007 Dec 05 5:30 AM
Hi Lalitha,
once u created ZBAPI with go and check the T-code BAPI . if your bapi is existing in this t-code . than come come SE38 write programe for your BAPI like wat r the parameters you have passed in the bapi same parameter is define your program
and call the function module which are u created than excute your program
i think it will work.
you can refer the program
we use the function module for creating PO
BAP_PO_CTREAT1.
constants : c_x value 'X'.
data: del_date type sy-datum.
data: pohead type bapimepoheader.
data: poheadx type bapimepoheaderx.
data: exp_head type bapimepoheader.
data: return type table of bapiret2 with header line.
data: poitem type table of bapimepoitem with header line.
data: poitemx type table of bapimepoitemx with header line.
data: posched type table of bapimeposchedule with header line.
data: poschedx type table of bapimeposchedulx with header line.
data: ex_po_number type bapimepoheader-po_number.
parameters: p_matnr type ekpo-matnr.
parameters: p_werks type ekpo-werks.
parameters: p_lgort type ekpo-lgort.
parameters: p_menge type ekpo-menge.
parameters: p_lifnr type ekko-lifnr.
parameters: p_ekorg type ekko-ekorg.
parameters: p_ekgrp type ekko-ekgrp.
parameters: p_bukrs type ekko-bukrs.
Header Level Data
pohead-comp_code = p_bukrs.
pohead-doc_type = 'NB' .
pohead-creat_date = sy-datum .
pohead-vendor = p_lifnr.
pohead-purch_org = p_ekorg.
pohead-pur_group = p_ekgrp.
pohead-langu = sy-langu .
pohead-doc_date = sy-datum.
poheadx-comp_code = c_x.
poheadx-doc_type = c_x.
poheadx-creat_date = c_x.
poheadx-vendor = c_x.
poheadx-langu = c_x.
poheadx-purch_org = c_x.
poheadx-pur_group = c_x.
poheadx-doc_date = c_x.
Item Level Data
poitem-po_item = 1.
poitem-material = p_matnr.
poitem-plant = p_werks.
poitem-stge_loc = p_lgort.
poitem-quantity = p_menge.
append poitem.
poitemx-po_item = 1.
poitemx-po_itemx = c_x.
poitemx-material = c_x.
poitemx-plant = c_x .
poitemx-stge_loc = c_x .
poitemx-quantity = c_x .
poitemx-tax_code = c_x .
poitemx-item_cat = c_x .
poitemx-acctasscat = c_x .
append poitemx.
Schedule Line Level Data
posched-po_item = 1.
posched-sched_line = 1.
posched-del_datcat_ext = 'D'.
del_date = sy-datum + 1.
write del_date to posched-delivery_date.
posched-deliv_time = '000001'.
posched-quantity = p_menge.
append posched.
poschedx-po_item = 1.
poschedx-sched_line = 1.
poschedx-po_itemx = c_x.
poschedx-sched_linex = c_x.
poschedx-del_datcat_ext = c_x.
poschedx-delivery_date = c_x.
poschedx-quantity = c_x.
append poschedx.
call function 'BAPI_PO_CREATE1'
exporting
poheader = pohead
poheaderx = poheadx
testrun = ' '
importing
exppurchaseorder = ex_po_number
expheader = exp_head
tables
return = return
poitem = poitem
poitemx = poitemx
poschedule = posched
poschedulex = poschedx.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
if not ex_po_number is initial.
call function 'DEQUEUE_ALL'.
else.
call function 'DEQUEUE_ALL'.
message i036.
Refar these links.
<b>reward is use full</b>
2007 Dec 05 10:29 AM
hi !!!
we can call the bapi in se38 as normaly we call the function module.
here is the example.
lets suppose ZBAPI_COMPANYCODE_GET_PERIOD is the bapi we created, then
we use that in se38 editorlike this..
call function 'ZBAPI_COMPANYCODE_GET_PERIOD'
exporting
companycodeid = lv_companycode
posting_date = lv_postingdate
IMPORTING
FISCAL_YEAR = lv_fiscalyear
FISCAL_PERIOD = lv_fiscalperiod.
2007 Dec 06 7:46 AM
hi lalitha,
check this out
if zbapi is the bapi u gonna call
DATA : itab LIKE zbapi33 OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA : vbeln LIKE vbep-vbeln,
posnr like vbep-posnr.
vbeln = '0000000002'.
posnr = '000100'.
CALL FUNCTION 'ZBAPI'
EXPORTING
vbeln = vbeln
posnr = posnr
tables
ITAB1 =
ITAB2 =
itab3 = itab
return = return.
loop at itab.
WRITE : / itab-banfn, itab-ebeln, itab-BNFPO, itab-EBELP.
endloop.
Thanks & Regards,
Azhar
2007 Dec 06 8:19 AM
The transaction code to edit your BAPI is <b>SE37 </b>as BAPI are function modules.
You can also access your BAPI with transaction <b>SE80 </b>specifying the function group.
Regards,
Yann Portrait
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |