JMeter use beanshell variable in HTTP Request
In BeanShell Assertion description section you can find the following:
vars - JMeterVariables - e.g. vars.get("VAR1"); vars.put("VAR2","value"); vars.putObject("OBJ1",new Object());
props - JMeterProperties (class java.util.Properties) - e.g. props.get("START.HMS"); props.put("PROP1","1234");
So to set jmeter variable in beanshell code (BeanShell Assertion sampler in your case) use the following:
String docid = "abcd";
vars.put("docid",docid);
or simply
vars.put("docid","abcd");
and then you can refer it as ${docid}, as you've done in your HTTP Request.
If you don't know Java well, you can use any of BSF or JSR223 Test elements and then select Javascript language as scripting language
http://jmeter.apache.org/usermanual/component_reference.html#JSR223_Sampler