The former England captain instigated the TV special, which will reunite market trader Del Boy (Sir David Jason) and Rodney (Nicholas Lyndhurst) for the first time in a decade.
Beckham said he went to bed so keen on perfecting his lines on the eve of his guest appearance, that he woke up the next morning with the script still on his chest.
The retired football star, 38, was surprised to have been given so much dialogue in the BBC1 Sport Relief special.
"The day of filming started off with a slightly sleepless night, going over my script," Beckham told Radio Times magazine.
"The thought of being on set with Nicholas and David was obviously very nerve-racking. I woke up that morning with my script on my chest.
"I've never done anything like this before, especially with two people I'm really in awe of and have been for many years.
"It wasn't just about learning the script, it was about delivering it; saying the right things at the right time."
Beckham, who has been pictured on set, in the market, wearing a baseball cap and glasses, said that he could "die a happy man" after filming the Peckham-set sketch.
"I'm a huge fan of the show. I have been for many years, as far back as I can remember," he said. "Being from the East End of London, it's what I was brought up on."
Jim Sullivan, the son of the late Only Fools creator John, said it was Beckham who approached them about reuniting the wheeler-dealer Trotter brothers for the first time since a Christmas special in 2003.
"When he first read the script he was a bit surprised to have been given so much dialogue and was nervous, understandably, about having to act alongside David Jason and Nicholas Lyndhurst, but he had no reason to be because his acting and delivery were very good," he said.
"It was lovely to meet him and hear him talk about his favourite episodes and scenes and how his son, Brooklyn, is now also a fan."
Sullivan and his brother Dan had written Roger Lloyd-Pack into the sketch to return to his much-loved role as the gormless Trigger, before learning that the actor was very unwell.
The star, who had pancreatic cancer, died, aged 69, in January.
"We had originally written Trigger into the sketch and Roger was supportive of the whole thing," Sullivan, who wrote episodes of Only Fools spin-off The Green Green Grass, said.
"We had heard that he had been unwell, but had no idea how serious it was. It wasn't until shortly before filming that we heard he was too poorly to perform, such was his eagerness to be involved - a true testament to his character."