09-01-2014 1:58 PM
Hi ABAPer,
I am new to ABAP technology.
Requirement :
There is one excel sheet file and i am transporting into internal table(ts_ipfile). There is another table (Mapping table - suppose ztxxttmrul). I have to validate the excel sheet file data with the mapping table. there are 23 fields in the ts_ipfile. i have done the max part. i have to validate one of the field from the excel sheet with standard sap table tmc1t8 and in one of the fields (GSTRU) of table tmc1t containing the table name. I have to extract the table name from the field and their components. I have done that. i have insert it into internal table say suppose(ts_fieldlist).
Next is i have to compare the fields name present in the ts_fieldlist with the internal table's field names(ts_ipfile) containing excel sheet records. If it matches then i have to check the value under that field name and proceed with that.
could you please look into this as I am solving since 2 days but i am unable to do that.
09-01-2014 3:45 PM
How is your internal table ts_fieldlist being maitained, i.e does each field name is one row in the table?
If that is the case then you can
Read ts_ts_fieldlist with the key ts_ipfile-fld_name (whatever that name is).. When this has happened I am not sure from where you are getting field name but I guess that should be easy..
Hope this helps.
09-01-2014 4:04 PM
Hi Shashikant,
I guess you have to give some more detail:
- what is the content of Excel file?
- what is the layout of your Excel? the 23 fields are in one row only, or one field per row?
- what do you need to validate? each one of this 23 fields or the entire row?
- what is the following action after validation? Or do you only need true/false validation?
Regards,
Tabrez
09-01-2014 5:28 PM
I am sending you the excel sheet file. These records present in the excel fiIe is going to insert in mapping tabe. And i have to validate field SOKC (SO key combination) against the table TMC1T(standard SAP).
Fields present in TMC1T( Mandt, GSTRU, GSTXT).
If GSTXT(SOKEY excel file) is matched then I have to extract table name present in field GSTRU. Then extract field names of that corresponding table.
Next is to compare those field names with the field name present in the excel sheet file Iike
KSCHL | VKORG | VTWEG | SPART | KUNNR |
Note : 4th row of the exceI sheet is not included in the internal table.
IF fieId names is matched then I have to check the data against that fieId Iike it is intiaI or not.
PIease heIp me on this.
09-02-2014 7:38 AM
Hi Shashikant,
I hope you have the logic for the first part where you move the excel sheet into internal table and validate the SOKEY from excel sheet against the table TMC1T. once you get the table name in TMC1T you the below snipet..
data: begin of lt_dd03l occurs 0,
tabname like dd03l-tabname,
fieldname like dd03l-fieldname,
end of lt_dd03l.
select tabname fieldname from dd03l into table lt_dd03l where tabname = tmc1t-gstru.
if sy-subrc = 0.
endif.
This will give you the list of fields in the table identified in TMC1T-GSTRU. Let us know where you are struggling so that we can provided you specific help.
regards
09-02-2014 10:25 AM
IF fieId names is matched then I have to check the data against that fieId Iike it is intiaI or not.
data: begin of lt_dd03l occurs 0,
tabname like dd03l-tabname,
fieldname like dd03l-fieldname,
end of lt_dd03l.
6. Get field names from table returned by the previous query. You have already the solution to this given by Abhijit
select tabname fieldname from dd03l into table lt_dd03l where tabname = lv_tablename.
7. Check if Excel fields are present on lt_dd03l and subsequent processing
loop at lt_excel_fields into lw_excel_fields.
loop at lt_dd03l into lw_dd03l where fieldname = lw_excel_fields-fieldname.
<< your logic here. Perhaps something like this:
select (lw_excel-fieldname) from (lv_tablename) into .
endloop.
endloop.
Regards,
Tabrez
09-07-2014 9:32 PM