Application Development 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: 

uploading field from excel sheet only of length 4 into SAP Table

Former Member
0 Kudos

Dear Friend,

I want to upload fields like Compny Code & Business Area of length 4 characters into SAP Tables. But in the excel sheet at some places Co Code & Business Area of length less than 4 characters is maintained which I want to ignore ie. those items should not be updated into the tables.

Plz guide me how this can b done, what code I shuld write for this.

Thanks,

Nishu

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You can condense the value after populating to table-field by

CONDENSE ITAB-FIELDNAME.

Later you can find out the field length using STRLEN.

if it is less than 4 then dont populate.

2 REPLIES 2

Former Member
0 Kudos

Hi,

You can condense the value after populating to table-field by

CONDENSE ITAB-FIELDNAME.

Later you can find out the field length using STRLEN.

if it is less than 4 then dont populate.

former_member181962
Active Contributor
0 Kudos

Hi Nishu,

There is no way you can validate the fields and their lengths before you ipload them into internal tables.

First you should upload them and then loop the intrenal table to delete such records.

loop at itab.

if strlen(itab-comp_code) < 4.

delete itab index sy-tabix.

endif.

endloop.

Regards,

Ravi