1. High Level code is
if "Document Type" = "Document Type"::Invoice then
if NOT (Type in [Type::"",Type::Item]) THEN
ERROR('error message');
2. You need to write code like
if "Document Type" = "Document Type"::Invoice then
IF NOT CONFIRM(
'Posting Date is %1.. Do you want to contineu?',FALSE,
"Posting Date")
THEN
EXIT;