You are on page 1of 4

AccessingSingleEntryfromMultilineElementABAP

Development
Inthisarticle,letmeshowyou,howasinglerecordfromamultilinecontainerelementcanbe
accessed,thatisdefinedintheworkflowcontainer.Theworkflowtemplateincludesfoursimplesteps
twostepsarecontaineroperationsteps,onestepisMailstepandthelastoneisaLoopstepto
accesstheentriesofthemultilinecontainerelement.Containerelementsdeclaredintheworkflow
are:

"Cust"ischangingparameter,whichcanbeimportedandexportedandaMultilinecontainer
element.ItstypeisKNA1(GeneralDatainCustomerMaster).
"CustWorkArea"whichisachangingparameter,canbeimportedandexportedandthiselement
actslikeaworkarea.
"Entries"isalsoachangingparameter,whichwillhavethecountofthenumberofrecordsinthe
"CUST"multilineelement.
"Counter"isalocalparameter,whichcannotbeimportedandexported,anditisusedtorunthe
loop,initialvalueis0(zero).

DetailedDescriptionofEachStep:
Four:StepExecute

ThestepExecuteisloop(until)stepwhichwillrun,untilthecounterelementvalueisequaltothe
valuethatisintheelementEntries.
One:StepInc_Counter

ThisstepincrementsthevalueofthelocalparameterCounterbyonevalueforeachiterationofthe
loop.
Two:StepGet_Customer

TheExpression"&CUST&COUNTER&&",herethemultilineelement&CUST&willhaveallthe
recordsandtheelement&COUNTER&willhaveincrementedvalueinthestepinc_counter.Finally
thesinglerecordisassignedtotheelement&CustWorkArea&.
Seethebelowscreenshot

Three:StepMail
ThisstepsimplysendsamailtotheWorkflowinitiator.
HowWorkflowistriggered?
TheworkflowisstartedfromABAPprogrambypassingtheallthecustomerrecordsandthenumber
ofrecordsthatarereadfromthetable.Hereinthebelowsamplecodethenumberofentriesishard
coded.
INCLUDEcntn01_swc. DATA:
t_customerTYPE
STANDARDTABLE
OFkna1,
w_taskTYPEswwwiheadwi_rh_taskVALUE 'WS99000897' ,
t_contTYPETABLEOFswcont,
w_entiresTYPEiVALUE 3 .
SELECT*
FROMkna1
INTOTABLEt_customer
UPTO 3ROWS.
swc0_set_tablet_cont 'CUST't_customer.
swc0_set_elementt_cont 'ENTRIES'w_entires.
CALLFUNCTION 'EWW_WORKFLOW_START'
EXPORTING
x_task=w_task
TABLES
x_container=t_cont
EXCEPTIONS
invalid_task= 1
no_active_plvar= 2
start_failed= 3
general_error= 4
OTHERS= 5 .
IFsysubrc<> 0 .
MESSAGEIDsymsgidTYPEsymsgtyNUMBERsymsgno
WITHsymsgv1symsgv2symsgv3symsgv4.
ELSE.

WRITE:
/ 'WorkflowTriggered' .
ENDIF.WorkflowLog:
Thebelowscreenshotpresentsthecompletionoftheworkflow.

Thanks

You might also like