A method for treating and/or handling piece goods being moved in at least one row, in particular, for the purpose of forming layers, which piece goods of a row each have approximately equal or different and/or variable spaces between each other, and which piece goods are fed by means of at least one horizontal conveyor from a packaging station and/or equipping station or from another upstream handling device and/or conveying device to a grouping station and/or layer-forming station having a seizing range , which seizing range defines and/or spatially delimits a movement range of at least one manipulator , which at least one manipulator seizes at least one piece good in a work cycle in a gripping manner from the at least one row and moves it into a defined relative target position and/or target alignment, in particular, with regard to a piece good layer to be formed, - wherein the at least one horizontal conveyor arranged upstream in transport direction of the piece goods from the grouping station and/or layer-forming station is assigned at least one sensor device for the acquisition of position data and/or dimension data and/or alignment data regarding the piece goods being transported on the horizontal conveyor , - wherein the sensor device generates electronic output signals from the acquired position data and/or dimension data and/or alignment data for the piece goods being transported on the horizontal conveyor , - which output signals are processed and used to control the manipulator in a manner adapted to the detected positions and/or dimensions and/or alignments of piece goods, in particular, with regard to a particular piece good layer to be formed by means of the manipulator , - wherein the manipulator moves and/or rotates and/or shifts individual or a plurality of piece goods within the seizing range based on the sensor signals acquired and processed by the sensor device and provided to a control device of the manipulator , - wherein the sensor device performs a mechanical scan, characterised in that - the sensor device performs the mechanical scan with adjustable lateral guide rails on both sides of a transport path of the piece goods on the horizontal conveyor , wherein a width of a piece good is determined by means of a detection of torques of actuators during the advancing of the adjustable lateral guide rails toward side surfaces of the piece goods . - wherein the at least one horizontal conveyor arranged upstream in transport direction of the piece goods from the grouping station and/or layer-forming station is assigned at least one sensor device for the acquisition of position data and/or dimension data and/or alignment data regarding the piece goods being transported on the horizontal conveyor , - wherein the sensor device generates electronic output signals from the acquired position data and/or dimension data and/or alignment data for the piece goods being transported on the horizontal conveyor , - which output signals are processed and used to control the manipulator in a manner adapted to the detected positions and/or dimensions and/or alignments of piece goods, in particular, with regard to a particular piece good layer to be formed by means of the manipulator , - wherein the manipulator moves and/or rotates and/or shifts individual or a plurality of piece goods within the seizing range based on the sensor signals acquired and processed by the sensor device and provided to a control device of the manipulator , - wherein the sensor device performs a mechanical scan, characterised in that - the sensor device performs the mechanical scan with adjustable lateral guide rails on both sides of a transport path of the piece goods on the horizontal conveyor , wherein a width of a piece good is determined by means of a detection of torques of actuators during the advancing of the adjustable lateral guide rails toward side surfaces of the piece goods . <EOS>