2.23.1 Payload

The object being dragged and dropped is the Payload:

The examples in this section use a common payload reusable part DD_EMPPL. It contains a working list of the employee information and a method to add items to the payload and to retrieve items from it.

Source for the DD_EMPPL Payload

Copy and paste this code to a reusable part named DD_EMPPL and compile it:

FUNCTION options(*DIRECT)

BEGIN_COM role(*EXTENDS #PRIM_OBJT)

DEF_LIST name(#PAYLOAD) fields(#EMPNO #SURNAME #GIVENAME #DEPTMENT #SECTION) counter(#LISTCOUNT) type(*WORKING)

DEFINE_PTY name(Payload_items) get(*auto #listcount)

* Add an item to the payload

MTHROUTINE name(Add_to_payload)

DEFINE_MAP for(*input) class(#empno) name(#Employee_ID) mandatory('')

DEFINE_MAP for(*input) class(#surname) name(#Employee_Surname) mandatory('')

DEFINE_MAP for(*input) class(#Givename) name(#Employee_Givename) mandatory('')

DEFINE_MAP for(*input) class(#Deptment) name(#Employee_Department) mandatory('')

DEFINE_MAP for(*input) class(#Section) name(#Employee_Section) mandatory('')

CHANGE field(#EMPNO) to('#Employee_ID.value')

CHANGE field(#SURNAME) to('#Employee_Surname.value')

CHANGE field(#GIVENAME) to('#Employee_Givename.value')

CHANGE field(#DEPTMENT) to('#Employee_Department.value')

CHANGE field(#SECTION) to('#Employee_Section.value')

ADD_ENTRY to_list(#PAYLOAD)

ENDROUTINE

MTHROUTINE name(Get_payload_Item)

DEFINE_MAP for(*input) class(#Listentry) name(#Payload_item)

DEFINE_MAP for(*output) class(#empno) name(#Employee_ID) mandatory('')

DEFINE_MAP for(*output) class(#surname) name(#Employee_Surname) mandatory('')

DEFINE_MAP for(*output) class(#Givename) name(#Employee_Givename) mandatory('')

DEFINE_MAP for(*output) class(#Deptment) name(#Employee_Department) mandatory('')

DEFINE_MAP for(*output) class(#Section) name(#Employee_Section) mandatory('')

CHANGE field(#LISTENTRY) to('#PAYLOAD_ITEM.VALUE')

GET_ENTRY number(#LISTENTRY) from_list(#PAYLOAD)

SET com(#Employee_ID) VALUE(#empno)

SET com(#Employee_Surname) VALUE(#surname)

SET com(#Employee_Givename) VALUE(#givename)

SET com(#Employee_Department) VALUE(#deptment)

SET com(#Employee_Section) VALUE(#section)

ENDROUTINE

END_COM