‎2006 Nov 28 3:29 PM
Hi All,
The date fields must be 8 chars long and must be valid date.
The correct values of the data the posting keys and accounts must exist in SAP
I was upload the data from Excel to internal table then validate above mention
How to do this plz give me guidelines or sample code
I look forward to your reply
Thanks & Regards
SEK
‎2006 Nov 28 3:35 PM
loop at itab.
*use DATE_CHECK_PLAUSIBILITY to check date
*using the check tables of posting keys and accounts validate them
endloop.
‎2006 Nov 28 3:38 PM
Hi All,
Thank you for your reply
Do you have any sample code plz send me for posting keys and accounts
Thanks & Regards
Raja Sekhar.T
‎2006 Nov 28 3:45 PM
for posting key validate using TBSL table , field BSCHL
for account validate on SKA1 table , field SAKNR
‎2006 Nov 28 4:27 PM
Hi Chandhra Sekhar,
Thank you for you your reply
How to validate During populate of internal table for Account and Posting key
If you have any sample code plz send me , it would be helpful for me
Thanks & Regards
Raja Sekhar.T
‎2006 Nov 28 3:38 PM
hi
good
i dont think you can validate the data if you r using the CALL TRANSACTION or BDC SESSION method ,but yes you can do it using LSMW,
if you r trying to migrate any wrong data using CALL TRANSACTION or BDC SESSION method than while running the process itself it ll give you error,but dynamically you can't validate the data.
thanks
mrutyun^
‎2006 Nov 28 3:41 PM
hi Shekar,
For Validating date use FM DATE_CHECK_PLAUSIBILITY
DATA: v_date TYPE sydatum.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = v_date
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: / 'INvalid date'.
ELSE.
WRITE: / 'Correct date'.
ENDIF.Regards,
Santosh
‎2006 Nov 28 3:41 PM
Hi Raja,
TYPE-POOLS truxs.
tables : ztable.
types: begin of t_tab,
col1(5) type c,
col2(5) type c,
col3(5) type c,
end of t_tab.
data : itab type standard table of t_tab,
wa type t_tab.
data it_type type truxs_t_text_data.
parameter p_file type rlgrap-filename.
data ttab type tabname.
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
.
start-of-selection.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
i_tab_raw_data = it_type
i_filename = p_file
tables
i_tab_converted_data = itab[]
EXCEPTIONS
CONVERSION_FAILED = 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.
end-of-selection.
loop at itab into wa.
ztable-col1 = wa-col1.
<b>Validate Date using Date_Plausibity_check.</b>
ztable-col2 = wa-col2.
ztable-col3 = wa-col3.
modify ztable.
endloop.
Hope this Helps
Manish
‎2006 Nov 28 3:50 PM
Hi
- Date Validation: u can use any fm to manage the data (for ex. DATE_CHECK_PLAUSIBILITY)
- Posting key Validation: check if it exists in TBSL
- Account: it depends on which kind of account:
a) Vendor: check if it exists in LFA1;
b) Customer: check if it exists in KNA1;
d) G/L: check if it exists in SKA1;
Max