‎2008 Nov 05 9:16 AM
Moderator message: please use a more meaningful subject in future
Dear ABAP Expert,
I have this program, but i always prompt with error...I even tried to hardcode the GL account '123456' but still system prompting below error.. It seem system truncate the GL account and ignore the first digit...Need your expert advise. Thanks in advance..
Error Message.:
23456 does not exist
E
FI305G/L account 261
0/6
Program proper:
*************************************************************************
SELECTION SCREEN
*************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1 .
*************************************************************************
AT SELECTION SCREEN
*************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE.
***********************************************************************
TO UPLOAD THE DATA *
***********************************************************************
*
START-OF-SELECTION.
V_FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = V_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
tables
data_tab = ITab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
.
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-mat_grp = itab-wgbez.
itab_bapiebanc-plant = itab-name1.
itab_bapiebanc-pur_group = itab-ekgrp.
itab_bapiebanc-preq_name = itab-afnam.
itab_bapiebanc-trackingno = itab-bednr.
itab_bapiebkn-g_l_acct = '123456'.
itab_bapiebkn-cost_ctr = '2000'.
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:/ errmsg-message.
Write:/ errmsg-type.
Write:/ errmsg-id.
write:/ errmsg-number.
errflag = 'X'.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
Edited by: Matt on Nov 5, 2008 10:39 AM
‎2008 Nov 05 9:18 AM
Hi,
check the length of the field that is taking the G/L account number, is it of more than 6 length.
If it is less than that it will truncate.
Thanks & Regards,
Navneeth K.
‎2008 Nov 05 9:17 AM
Hi
I suppose u need to indicate the leading zero, so instead of 123456, insert 0000123456, or u use the fm for convertion routine ALPHA:
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = itab_bapiebkn-g_l_acct
IMPORTING
OUTPUT = itab_bapiebkn-g_l_acct.Max
Edited by: max bianchi on Nov 5, 2008 10:19 AM
‎2008 Nov 05 9:28 AM
Hi,
I tried hardcoding the value of GL account to be '0000123456' ,still the program throw error message..this time it capture
the first four zero 0000 does not exist..
Pls. help. Thanks
‎2008 Nov 05 9:18 AM
Hi,
check the length of the field that is taking the G/L account number, is it of more than 6 length.
If it is less than that it will truncate.
Thanks & Regards,
Navneeth K.
‎2008 Nov 05 9:25 AM
Hi,
I have declared the it same as the data type of bapiebkn-g_l_accnt but still system throw the error message...
DATA:V_FILE TYPE STRING.
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 LIKE bapiebkn-g_l_acct, "G/L Account Number
cc(10), "Cost Center
editor(132), "Text line
END OF itab.
‎2008 Nov 05 9:28 AM
‎2008 Nov 05 9:32 AM
DATA: itab_bapiebkn LIKE bapiebkn OCCURS 0 WITH HEADER LINE.
‎2008 Nov 05 9:20 AM
‎2008 Nov 05 9:23 AM