Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Validation

Former Member
0 Likes
692

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

1 ACCEPTED SOLUTION
Read only

former_member212005
Active Contributor
0 Likes
657

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....

4 REPLIES 4
Read only

Former Member
0 Likes
657

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

Read only

RahulKeshav
Active Contributor
0 Likes
657

what sort of document no.you are passing...

like PO,SO,Posting Doc.,etc...

Read only

Former Member
0 Likes
657

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

Read only

former_member212005
Active Contributor
0 Likes
658

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....