Create a function to display full details of an order.
Files Involved
Physical files ORDHDR (order header), ORDLIN (order lines), CUSMST (customer master) and PROMST (product master).
RDML Program
GROUP_BY NAME(#ORDERHEAD) FIELDS(#ORDER #DATDUE #CUSTNO
#NAME #ADDL1)
DEF_LIST NAME(#ORDERLINE) FIELDS(#ORDLIN #PRODNO #DESC
#QTY #VALUE)
BEGIN_LOOP
<< Get order number and fetch header and customer details >>
L10 REQUEST FIELDS(#ORDER)
FETCH FIELDS(#ORDERHEAD) FROM_FILE(ORDHDR)
WITH_KEY(#ORDER) NOT_FOUND(L10) ISSUE_MSG(*YES)
FETCH FIELDS(#ORDERHEAD) FROM_FILE(CUSTMST)
WITH_KEY(#CUSTNO) NOT_FOUND(L10) ISSUE_MSG(*YES)
<< Build list of associated lines and product details >>
CLR_LIST NAMED(#ORDERLINE)
SELECT FIELDS(#ORDERLINE) FROM_FILE(ORDLIN)
WITH_KEY(#ORDER)
FETCH FIELDS(#ORDERLINE) FROM_FILE(PROMST)
WITH_KEY(#PRODNO)
ADD_ENTRY TO_LIST(#ORDERLINE)
ENDSELECT
<< Display full details of the order >>
DISPLAY FIELDS(#ORDERHEAD) BROWSELIST(#ORDERLINE)
END_LOOP