‎2011 Sep 02 9:46 AM
Sir,
I'm getting error while executing PR BAPI i.e id delivery date.
but i'm not getting why?.
Please, help me.
Thanks
Manoj.
*&---------------------------------------------------------------------*
*& Report ZTEST_BAPI1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZTEST_BAPI1.
DATA: BEGIN OF itab OCCURS 0,
bsart(4), "Purchase requisition document type
werks(4), "Plant
menge(13), "Purchase requisition quantity
meins(3), "Purchase requisition unit of measure
matnr(18), " material no
eeind(8),
* BSTYP ,
END OF itab.
DATA: itab_bapiebanc LIKE bapiebanc OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF errmsg OCCURS 100.
INCLUDE STRUCTURE bapiret2.
DATA: END OF errmsg.
DATA: errflag.
CALL FUNCTION 'UPLOAD'
EXPORTING
* CODEPAGE = ' '
FILENAME = 'C:\ '
FILETYPE = 'DAT'
* 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 = itab
* 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.
.
write sy-subrc.
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-plant = itab-werks.
itab_bapiebanc-material = itab-matnr.
* itab_bapiebanc-BSTYP = itab-BSTYP.
itab_bapiebanc-DELIV_DATE = itab-eeind .
APPEND itab_bapiebanc.
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'.
‎2011 Sep 02 9:53 AM
Requested date (field DELIV_DATE always in the format YYYYMMDD) and date category (field DEL_DATCAT (internal representation, e.g. 1 for current date) or DEL_DATCAT_EXT (external representation, e.g. T for current date))
At least the following data is required:
Item counter (field PREQ_ITEM)
Material number (field MATERIAL)
The following can also be passed on as an alternative to the material number:
Material group (field MATL_GROUP) and
Short text (field SHORT_TEXT) and
Unit of measure (field PREQ_UNIT) and
Price (field PREQ_PRICE) and
Purchasing group (field PUR_GROUP)
If the material number is passed on, the material group, the short text etc., are adopted from the material master record.
‎2011 Sep 02 9:53 AM
Requested date (field DELIV_DATE always in the format YYYYMMDD) and date category (field DEL_DATCAT (internal representation, e.g. 1 for current date) or DEL_DATCAT_EXT (external representation, e.g. T for current date))
At least the following data is required:
Item counter (field PREQ_ITEM)
Material number (field MATERIAL)
The following can also be passed on as an alternative to the material number:
Material group (field MATL_GROUP) and
Short text (field SHORT_TEXT) and
Unit of measure (field PREQ_UNIT) and
Price (field PREQ_PRICE) and
Purchasing group (field PUR_GROUP)
If the material number is passed on, the material group, the short text etc., are adopted from the material master record.
‎2011 Sep 02 11:35 AM
Hi manoj,
Check as Jurgen told. Check the return parameters it will give a clear idea what and all fields are needed to import.Small suggestion from my side use gui_upload or classes instead of upload.
Regards,
Madhu.