Hello,
(PI Mapping newbie here - please be gentle )
I'm working on mapping an IDoc to a csv flat file.
I need to interrogate certain fields of the source IDoc and return a particular field.
The IDoc in question is based on HRMD_A09 - Segment E1P0041 (Date Specifications).
I want to return the date value from one of the 12 repeating fields (DAT01 - DAT12) - the one I want will be identified by the date type fields DAR01 - DAR12.
I could create a UDF that passes a total of 25 arguments and build a big horrid if - then - else with 12 nested comparisons - I'd like to think there is a better and cleaner solution possible.
If I pass a whole IDoc Segment to a UDF as an argument, how can I parse the value into the individual components?
I'm reading up and trying to understand the "all values of a context"/"all values of a queue" concepts - not sure that the answer is in this direction.
If I were to write this in ABAP it would be easy - I'd be able to pass the segment as a parameter into a form routine so that it is typed according to the segment, and then I'd be able to write up a "do varying" loop structure.
l_wa_ee_records-corrected_lsl_date = me->get_date_type( im_p0041 = ls_p0041
im_date_type = 'LS' ).
METHOD get_date_type .
DATA: l_dar TYPE datar,
l_dat TYPE dardt,
l_date TYPE d.
DO 12 TIMES VARYING l_dar FROM im_p0041-dar01
NEXT im_p0041-dar02
VARYING l_dat FROM im_p0041-dat01
NEXT im_p0041-dat02.
IF l_dar IS INITIAL.
EXIT.
ELSEIF l_dar = im_date_type.
l_date = l_dat.
EXIT.
ENDIF.
ENDDO.
Any ideas will be appreciated - thanks in advance