Q:

Nested lists replacing of elements

I have a list of the form 
SpecialCycle12={{{1, 2, 0, 0, 0, 0, 0}}, {{3, 2, 1, 0, 0, 0, 0}}}`

And the list 
primitiveNonSpecialCycleCase2 = {
  {{3}, {4}, {5}, {6}, {7}}, {{3, 4}, {5}, {6}, {7}},
  {{3, 4}, {5, 6}, {7}}, {{3, 4, 5}, {6}, {7}},
  {{3, 4, 5}, {6, 7}}, {{3, 4, 5, 6}, {7}}, {{3, 4, 5, 6, 7}}
 }

I want to replace the elements in the smallest parenthesis of List2 in the position represented by the previous element in the elements of List1. For instance, the first element of List1 has 5 zeroes and so I will replace all the elements of List2 that have 5 numbers, first I want to consider {{3}, {4}, {5}, {6}, {7}} and I will replace 3 in position 3, 4 in position 4 and so on and finally want to get {1,2,3,4,5,6,7}; when I consider {{3, 4}, {5}, {6}, {7}} I want to replace 4 in position 3, 3 in position 4, 5 in position 5, 6 in position 6 and so on to finally get {1,2,4,3,5,6,7}; when I consider {{3, 4}, {5, 6}, {7}} I want to replace 3 in position 4, 4 in position 3, 5 in position 6, 6 in position 5 and finally 7 in position 7, to finally get {1,2,4,3,6,5,7}. 
I tried doing this with the following line of code 
Table[
  ReplacePart[SpecialCycle12[[i]][[l]],
    Thread[RotateRight[primitiveNonSpecialCycleCase2[[i]][[j]][[k]]] -> primitiveNonSpecialCycleCase2[[i]][[j]][[k]]]
   ],
  {i, Length[SpecialCycle12]}, {j, Length[primitiveNonSpecialCycleCase2]},
  {k, Length[primitiveNonSpecialCycleCase2[[j]]]}, {l, Length[SpecialCycle12[[i]]]}
 ]

But I am getting a result of the form 
{{{{1, 2, 3, 0, 0, 0, 0}}, {{1, 2, 0, 4, 0, 0, 0}},
 {{1, 2, 0, 0, 5, 0, 0}}, {{1, 2, 0, 0, 0, 6, 0}},
 {{1, 2, 0, 0, 0, 0, 7}}, {{1, 2, 0, 0, 0, 0, 0}},
 {{1, 2, 0, 0, 0, 0, 0}}}, {{{1, 2, 4, 3, 0, 0, 0}},
 {{1, 2, 0, 0, 5, 0, 0}}, {{1, 2, 0, 0, 0, 6, 0}},
 {{1, 2, 0, 0, 0, 0, 7}}, {{1, 2, 0, 0, 0, 0, 0}}}

Does anyone have a suggestion on how I could improve my code to get the result I want?

A:

Well, I thought this would be quite easy with tables, but the code turned into arguably a bit of a whale, still posting it in case you find it useful, after all it does work.
sc12 = {{{1, 2, 0, 0, 0, 0, 0}}, {{3, 2, 1, 0, 0, 0, 0}}};
pnscc2 = {{{3}, {4}, {5}, {6}, {7}}, {{3, 4}, {5}, {6}, {7}}, {{3, 
     4}, {5, 6}, {7}}, {{3, 4, 5}, {6}, {7}}, {{3, 4, 5}, {6, 
     7}}, {{3, 4, 5, 6}, {7}}, {{3, 4, 5, 6, 8}}};
Table[Table[
   If[Length[pnscc2[[i, j]]] != 1, 
    pnscc2[[i, j]] = Reverse[pnscc2[[i, j]]]], {j, 
    Length[pnscc2[[i]]]}]; 
  pnscc2[[i]] = Flatten[pnscc2[[i]]], {i, Length[pnscc2]}];
Table[If[Depth[pnscc2[[i, j]]] == 1, 
   pnscc2[[i, j]] = List[pnscc2[[i, j]]]], {i, Length[pnscc2]}, {j, 
   5}];
k = 1;
newlist = ConstantArray[sc12, Length[pnscc2]];
While[k < Length[pnscc2] + 1, j = 1; 
 Table[If[newlist[[k]][[1, 1, i]] == 0, 
   newlist[[k]] = 
    ReplacePart[newlist[[k]], {{1, 1, i}} -> pnscc2[[k, j, 1]]]; 
   j++], {i, 7}]; k++]
newlist

{{{{1, 2, 3, 4, 5, 6, 7}}, {{3, 2, 1, 0, 0, 0, 0}}},
{{{1, 2, 4, 3, 5, 6, 7}}, {{3, 2, 1, 0, 0, 0, 0}}},
{{{1, 2, 4, 3, 6, 5, 7}}, {{3, 2, 1, 0, 0, 0, 0}}},
{{{1, 2, 5, 4, 3, 6, 7}}, {{3, 2, 1, 0, 0, 0, 0}}},
{{{1, 2, 5, 4, 3, 7, 6}}, {{3, 2, 1, 0, 0, 0, 0}}},
{{{1, 2, 6, 5, 4, 3, 7}}, {{3, 2, 1, 0, 0, 0, 0}}},
{{{1, 2, 8, 6, 5, 4, 3}}, {{3, 2, 1, 0, 0, 0, 0}}}}

