"no direct relationship"?
Go To layout [//select layout based on the table]
If there is data in the current record of the current layout that needs to be entered into the new record in the unrelated table, you can use set variable to capture the values before changing layout, then use set field steps to enter those values from the variables into fields in the new record.
So, does that means that I must display the the target table's layout to generate a new record?
I have been used to coding that process in this fashion, where "Table" in any open table:
BLANK FILE "Table"
STORE FILE "Table"
Without changing the current view.
Yes and no. You have to go to that layout, but it need not be visible to the user.
If you see a visible change in layout, you can start your script with Freeze Window.
So, in reality I will always be working on "current table", in this respect.
Yes, What layout, current record, found set and sort order is "current" is critical to the way most scripts execute so you have to keep track of what layout you are on as you establish "table occurrence" context by selecting a layout.
Each table occurrence is identified as a box in Manage | Database | Relationships. A given table can have many occurrences. Each table occurrence has its own found set, current record and sort order. In Layout setup, you select a table occurrence for a layout by selecting it in the "Show Records From" drop down list. There's a similar control for portals in portal setup.