We Import the Required Idoc into the Integration Repository and we get the Idoc Structure. Then What is the need to specify the IDOC in IDX2.
SAP PI replied
It is used during translation from IDOC to XML format and in opposite direction from XI XML message to IDOC. IDX2 contains only a CACHE (one more !) of IDoc metadatas (structures!). It's NOT necessary to have it and you don't configure it, because this cache will be automaticaly filled by XI when an idoc will be sent/received.
There are a couple of situation where IDX2 can be useful on the XI system.
1. When we want to test connection between the XI and SAP backend system.
2. When an IDoc has changed, and the meta data stored in XI needs to be update.
When an IDoc is sent from the SAP backend system to XI, XI will first check to see if the
meta data for the IDoc is already in its persistent cache. If not, then XI will use the
configuration in IDX1 to retrieve the IDoc meta data from the backend system. If the
meta is already in cache, then it will NOT do so. Therefore, when an IDoc has changed,
it is necessary to manually update the new meta data on XI, or delete it from the cache, so
that the latest version can be retrieved. IDX2 is used for this purpose.
check this link for detail: