2006 Mar 18 7:23 AM
i am getting the error "error in function,000 does not exist"
i am sending u the code & txt file plz check it out and let me know..
REPORT zrv_bapi_pr.
DATA: BEGIN OF itab OCCURS 0,
bsart(4),
."Purchase requisition document type
txz01(40),
."Short text
menge(13),
."Purchase requisition quantity
meins(3),
."Purchase requisition unit of measure
eeind LIKE bapiebanc-deliv_date,
."Item delivery date
wgbez(9),
."Material Group
name1(4),
."Plant
ekgrp(3),
."Purchasing Group
afnam(12),
."Name of requisitioner/requester
bednr(10),
."Requirement Tracking Number
knttp(1),
."Account assignment category
sakto(10),
."G/L Account Number
ps_posid(8),
."Work Breakdown Structure Element (WBS Element)
editor(132),
."Text line
END OF itab.
DATA: itab_bapiebanc LIKE bapiebanc OCCURS 0 WITH HEADER LINE.
DATA: itab_bapiebkn LIKE bapiebkn OCCURS 0 WITH HEADER LINE.
DATA: itab_bapiebantx LIKE bapiebantx OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF errmsg OCCURS 10.
INCLUDE STRUCTURE bapiret2.
DATA: END OF errmsg.
DATA: errflag.
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = 'C:\Documents and Settings\sap\Desktop\New Text Document (2).txt'
filetype = 'DAT'
TABLES
data_tab = itab.
.
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.
LOOP AT itab.
itab_bapiebanc-doc_type = itab-bsart.
itab_bapiebanc-short_text = itab-txz01.
itab_bapiebanc-quantity = itab-menge.
itab_bapiebanc-unit = itab-meins.
itab_bapiebanc-deliv_date = itab-eeind.
itab_bapiebanc-plant = itab-name1.
itab_bapiebanc-pur_group = itab-ekgrp.
itab_bapiebanc-preq_name = itab-afnam.
itab_bapiebanc-trackingno = itab-bednr.
itab_bapiebanc-mat_grp = itab-wgbez.
itab_bapiebanc-acctasscat = itab-knttp.
itab_bapiebkn-g_l_acct = itab-sakto.
itab_bapiebkn-wbs_elem_e = itab-ps_posid.
itab_bapiebantx-text_line = itab-editor.
APPEND itab_bapiebkn.
APPEND itab_bapiebanc.
APPEND itab_bapiebantx.
ENDLOOP.
*
CALL FUNCTION 'BAPI_REQUISITION_CREATE'
TABLES
requisition_items = itab_bapiebanc
requisition_account_assignment = itab_bapiebkn
requisition_item_text = itab_bapiebantx
return = errmsg.
LOOP AT errmsg.
IF errmsg-type EQ 'E'.
WRITE:/'Error in function', errmsg-message.
errflag = 'X'.
ELSE.
WRITE:/ errmsg-message.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
*
*
*LOOP AT itab_bapiebanc.
WRITE:/ itab_bapiebanc-doc_type,
itab_bapiebanc-short_text,
itab_bapiebanc-quantity,
itab_bapiebanc-unit ,
itab_bapiebanc-deliv_date,
itab_bapiebanc-plant,
itab_bapiebanc-pur_group,
itab_bapiebanc-preq_name,
itab_bapiebanc-trackingno,
itab_bapiebanc-mat_grp,
100 itab_bapiebanc-acctasscat.
*
*ENDLOOP.
*
*LOOP AT itab_bapiebkn.
WRITE:/
itab_bapiebkn-g_l_acct,
itab_bapiebkn-wbs_elem_e.
*
*ENDLOOP.
*
*
*
*LOOP AT itab_bapiebantx.
WRITE:/ itab_bapiebantx-text_line.
*ENDLOOP.
**
txt file
NB MOTOR 2 EA 20.04.2006 18000000 0020 010 SANGEETE J505 P 4000 J525.2.2 crompton greaves make,3 phase motor
i am getting the error "error in function,000 does not exist"
i am sending u the code & txt file plz check it out and let me know..
REPORT zrv_bapi_pr.
DATA: BEGIN OF itab OCCURS 0,
bsart(4),
."Purchase requisition document type
txz01(40),
."Short text
menge(13),
."Purchase requisition quantity
meins(3),
."Purchase requisition unit of measure
eeind LIKE bapiebanc-deliv_date,
."Item delivery date
wgbez(9),
."Material Group
name1(4),
."Plant
ekgrp(3),
."Purchasing Group
afnam(12),
."Name of requisitioner/requester
bednr(10),
."Requirement Tracking Number
knttp(1),
."Account assignment category
sakto(10),
."G/L Account Number
ps_posid(8),
."Work Breakdown Structure Element (WBS Element)
editor(132),
."Text line
END OF itab.
DATA: itab_bapiebanc LIKE bapiebanc OCCURS 0 WITH HEADER LINE.
DATA: itab_bapiebkn LIKE bapiebkn OCCURS 0 WITH HEADER LINE.
DATA: itab_bapiebantx LIKE bapiebantx OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF errmsg OCCURS 10.
INCLUDE STRUCTURE bapiret2.
DATA: END OF errmsg.
DATA: errflag.
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = 'C:\Documents and Settings\sap\Desktop\New Text Document (2).txt'
filetype = 'DAT'
TABLES
data_tab = itab.
.
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.
LOOP AT itab.
itab_bapiebanc-doc_type = itab-bsart.
itab_bapiebanc-short_text = itab-txz01.
itab_bapiebanc-quantity = itab-menge.
itab_bapiebanc-unit = itab-meins.
itab_bapiebanc-deliv_date = itab-eeind.
itab_bapiebanc-plant = itab-name1.
itab_bapiebanc-pur_group = itab-ekgrp.
itab_bapiebanc-preq_name = itab-afnam.
itab_bapiebanc-trackingno = itab-bednr.
itab_bapiebanc-mat_grp = itab-wgbez.
itab_bapiebanc-acctasscat = itab-knttp.
itab_bapiebkn-g_l_acct = itab-sakto.
itab_bapiebkn-wbs_elem_e = itab-ps_posid.
itab_bapiebantx-text_line = itab-editor.
APPEND itab_bapiebkn.
APPEND itab_bapiebanc.
APPEND itab_bapiebantx.
ENDLOOP.
*
CALL FUNCTION 'BAPI_REQUISITION_CREATE'
TABLES
requisition_items = itab_bapiebanc
requisition_account_assignment = itab_bapiebkn
requisition_item_text = itab_bapiebantx
return = errmsg.
LOOP AT errmsg.
IF errmsg-type EQ 'E'.
WRITE:/'Error in function', errmsg-message.
errflag = 'X'.
ELSE.
WRITE:/ errmsg-message.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
*
*
*LOOP AT itab_bapiebanc.
WRITE:/ itab_bapiebanc-doc_type,
itab_bapiebanc-short_text,
itab_bapiebanc-quantity,
itab_bapiebanc-unit ,
itab_bapiebanc-deliv_date,
itab_bapiebanc-plant,
itab_bapiebanc-pur_group,
itab_bapiebanc-preq_name,
itab_bapiebanc-trackingno,
itab_bapiebanc-mat_grp,
100 itab_bapiebanc-acctasscat.
*
*ENDLOOP.
*
*LOOP AT itab_bapiebkn.
WRITE:/
itab_bapiebkn-g_l_acct,
itab_bapiebkn-wbs_elem_e.
*
*ENDLOOP.
*
*
*
*LOOP AT itab_bapiebantx.
WRITE:/ itab_bapiebantx-text_line.
*ENDLOOP.
**
txt file
NB MOTOR 2 EA 20.04.2006 18000000 0020 010 SANGEETE J505 P 4000 J525.2.2 crompton greaves make,3 phase motor
2006 Mar 18 7:30 AM
Hi Ravi,
Please use FM <b>GUI_UPLOAD</b> instead of FM UPLOAD (obsolete).
call function 'GUI_UPLOAD'
exporting
filename = 'C:Documents and SettingssapDesktopNew Text Document (2).txt'
filetype = 'DAT'
tables
data_tab = itab.
loop at itab.
...
endloop.I think your error is related to line item in internal table <b>itab_bapiebanc</b>. You need to increment for each loop.
Hope this will help.
Regards,
Ferry Lianto
2006 Mar 19 7:22 AM
Check the structure of your text file and the table itab. It seems to me that there isnt a one-to-one relation between the fields in the itab and the text file (eg: the second field in your itab is text, length 40, whereas in your text file it is something else).
Hence, while uploading, the value in one of the fields might be wrong.
Sudha
2006 Mar 19 8:44 AM
HI ravi
In me51n there is a field called Purchasing Key which is mandatory have you checked that field.
<b>and i told you to use GUI_UPLOAD function.</b>
regards
kishore
Message was edited by: Harikishore Sreenivasulu
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |