In some complex detailed scheduling scenarios, it may happen that at the end of planning, you face that there is a gap between of the setup and the produce activity of an operation.
If you open the Production Data Structure for the Product, you see that the activity relationship constraint is Minimum Interval:
with nor minimum, neither maximum time defined.
Which means that however heuristics try to schedule the two activity next to each other, but not on all costs.
By default this constraint type is generated automatically during integration of the Product, based on the master data in ECC system.
Earlier there was in standard another constraint type supported: Minimum = Maximum = 0. Which forces the setup and produce activity sticked together.
If you go away from the standard to achieve the 'Min=Max=0' constraint type for the activity relation, one possible solution would be to manipulate the PDS object before it would be saved in APO. The suitable BAdI is /SAPAPO/CURTO_CREATE with its method BEFORE_SAVE. The activity constraints are accessable in the structure CS_PPDS_RTO-HIRARCHY-ADD_APPLICTN_DATA-SEQ_GROUPS-ACTIVITIES. Find the 'S'etup and 'P'roduce activites belonging together (having same OPRCOUNTER) and set the CONSTRAINT_TYPE to '3' (= Min=Max=0), with also making sure they have same unit in the SEQ_UNIT field.
If you dont want to manipulate the PDS at creation, alternatively, you could use the BAdI /SAPAPO/CULLRTOEXPL, Method CHANGE_EXPL_RESULT to manipulate the result of the BOM Explosion. Whithin the method in the the table CT_INTERN_CONSTRAINTS you can identify the record of the activity relationships and set the field CONSTRAINT_TYPE to '3'. Which would couse the constraint type to be generated as Min=Max=0 Equal constraint.
However with these possibilities you can force the LiveCache to schedule setup and produce activity without gap, in very complex scenarios it would lead that the LiveCache will hardly find a solution for all the scheduled activities, or maybe scheduling error messages would appear.