Skip to Content
0
Former Member
Mar 09, 2009 at 02:32 PM

Regarding BAPI_REQUISITION_CREATE

70 Views

HI All,

Iam trying to create purchase requisition using BAPI_REQUISITION_CREATE,the following is the code and flat file but is going to dump. showing a message that 'Enter a valid date'.could anybody make me know how to solve the issue.

tables:bapiebanc.

data: begin of itab occurs 0,

doc_type type BAPIEBANC-doc_type,

PUR_GROUP type bapiebanc-PUR_GROUP,

material type bapiebanc-material,

plant type bapiebanc-plant,

  • mat_grp type bapiebanc-matgrp,

quantity type bapiebanc-quantity,

unit type bapiebanc-unit,

deliv_date type

bapiebanc-deliv_date,

end of itab.

data: it_items like bapiebanc occurs 0 with header line.

data:it_ret2 like bapiret2 occurs 0 with header line.

data:i_msg type string.

parameters:p_file TYPE IBIPPARMS-PATH obligatory.

*

**---f4 help for the file from PC

at selection-screen on value-request for p_file.

perform get_f4help.

*

start-of-selection.

*

perform upload_file.

perform call_bapi.

&----


*& Form GET_F4HELP

&----


FORM GET_F4HELP .

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

IMPORTING

FILE_NAME = P_FILE .

ENDFORM. " GET_F4HELP

&----


*& Form UPLOAD_FILE

&----


FORM UPLOAD_FILE .

DATA:V_FILE TYPE STRING.

MOVE P_FILE TO V_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = v_file

  • FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = itab.

IF SY-SUBRC ne 0.

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

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

endif.

ENDFORM. " UPLOAD_FILE

&----


*& Form CALL_BAPI

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM CALL_BAPI .

loop at itab.

move-corresponding itab to it_items.

append it_items.

clear it_items.

CALL FUNCTION 'BAPI_REQUISITION_CREATE'

  • EXPORTING

  • SKIP_ITEMS_WITH_ERROR =

  • AUTOMATIC_SOURCE = 'X'

  • IMPORTING

  • NUMBER =

TABLES

REQUISITION_ITEMS = it_items

  • REQUISITION_ACCOUNT_ASSIGNMENT =

  • REQUISITION_ITEM_TEXT =

  • REQUISITION_LIMITS =

  • REQUISITION_CONTRACT_LIMITS =

  • REQUISITION_SERVICES =

  • REQUISITION_SRV_ACCASS_VALUES =

RETURN = it_ret2

  • REQUISITION_SERVICES_TEXT =

  • REQUISITION_ADDRDELIVERY =

  • EXTENSIONIN =

.

append it_ret2.

endloop.

loop at it_ret2.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = it_ret2-id

  • LANG = '-D'

NO = it_ret2-NUMBER

V1 = it_ret2-MESSAGE_V1

V2 = it_ret2-MESSAGE_V2

V3 = it_ret2-MESSAGE_V3

V4 = it_ret2-MESSAGE_V4

IMPORTING

MSG = i_msg.

  • EXCEPTIONS

  • NOT_FOUND = 1

  • OTHERS = 2

.

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:/ i_msg.

endloop.

flat file:

NB 001 99-110 1100 100 EA 10032009

NB 001 100-110 1100 120 EA 10032009

thanks in advance

mahesh