(In case it was a one time use link search for Infineon application note AN-1077)
Bottom line you need two regulation loops. One to establish a sinusoidal average current consumption and a second one for the output. Between both systems you need an energy reservoir to supply your load when the input power drops too low.
For harmonic elimination only, the concept is that your reference current is described as the difference between the measured distorted load current minus the fundamental component of the measured distorted load current.
Assuming fixed dc bus voltage this reference can be used in a conventional inverter pwm scheme with feedback to apply the necessary correction.
In this idealized case the source current should be sinusoidal.
There are several techniques in the literature to achieve this, describe above is only the concept.
See: TC Green, JH Marks great review titled Control techniques for active power filters