‎2009 Jul 15 1:45 PM
Hi,
Am uploading the data from the excel i have to do validation against it.How to do.Am going to upload the company code,year and document number .I have to check all the 3 in one shot.Consider the excel data is like this
CC year docnum
12 2008 15000
13 2009 16000
I have to check if the 15000 doc num exist for year 2008 n cc 12.If not have to proceed with next item.
Have uploaded the excel data's using the FM ALSM_EXCEL_TO_INTERNAL_TABLE.Please suggest me some solutions
‎2009 Jul 15 1:57 PM
You have used the function module ALSM_EXCEL_TO_INTERNAL_TABLE to read data from excel, right?
The internal table which contains the data say GT_UPLOAD should be of type alsmex_tabline right?
In that case, LOOP the internal table GT_UPLOAD and fill your workarea and then append it to internal table.
LOOP AT gt_upload INTO gs_upload.
CASE gs_upload-col.
WHEN '0001'.
gs_wa-cc = gs_upload-value. " IF you want you can validate here also
WHEN '0002'.
gs_wa-year = gs_upload-value. " IF you want you can validate here also
WHEN '0003'.
gs_wa-docnum = gs_upload-value. " IF you want you can validate here also
ENDCASE.
AT END OF row.
APPEND gs_wa TO gt_table
ENDAT.
ENDLOOP.
Now, you have all the data to be validated in GT_TABLE...
Loop the table and validate as per your requirement....
‎2009 Jul 15 1:52 PM
hi srutiram,
IN ALSM_EXCEL_TO_INTERNAL_TABLE
1. If your file has 10001 records in that case , FM treats first record as 0 and 10000 record as 9999 , After this 10001 record is again treated as 0 record in the FM.
Based on the no of records in file FM keeps uploading records.
2. I think you can pass Parameters for FM parameters begin_row etc.. .
Thanks
Saurabh Goel
‎2009 Jul 15 1:53 PM
what sort of document no.you are passing...
like PO,SO,Posting Doc.,etc...
‎2009 Jul 15 1:53 PM
Try the following code and see if it helps in filtering out the entries
w_wa is a work area of table and t_finout would have the final results
SELECT bukrs
belnr
ghjar
FROM bsid
INTO w_wa
FOR ALL ENTIRES IN t_out ' your internal table
WHERE bukrs = t_out-bukrs
AND ghjar = t_out-ghjar.
IF sy-subrc EQ 0.
APPEND w_wa TO t_finout.
ENDIF.
-Karthik
‎2009 Jul 15 1:57 PM
You have used the function module ALSM_EXCEL_TO_INTERNAL_TABLE to read data from excel, right?
The internal table which contains the data say GT_UPLOAD should be of type alsmex_tabline right?
In that case, LOOP the internal table GT_UPLOAD and fill your workarea and then append it to internal table.
LOOP AT gt_upload INTO gs_upload.
CASE gs_upload-col.
WHEN '0001'.
gs_wa-cc = gs_upload-value. " IF you want you can validate here also
WHEN '0002'.
gs_wa-year = gs_upload-value. " IF you want you can validate here also
WHEN '0003'.
gs_wa-docnum = gs_upload-value. " IF you want you can validate here also
ENDCASE.
AT END OF row.
APPEND gs_wa TO gt_table
ENDAT.
ENDLOOP.
Now, you have all the data to be validated in GT_TABLE...
Loop the table and validate as per your requirement....