Skip to Content
0
Former Member
Feb 27, 2010 at 06:10 PM

Splitting one internal table record into four records

67 Views

I have the below structure,

My requirement is I have to divide one record into four records,

Exam.

From the source I am getting data below.

Mat1 date key1 key2 key3 key4.

Now I want to divide the above record into four records i.e

Mat1 date v1 key1

Mat1 date v2 key2

Mat1 date v3 key3

Mat1 date v4 key4

.

.

Here V1 V2 V3 V4 are constants and it is there in the target structure as type.

Below I tried u2026u2026.

Please give some idea.

TYPES: BEGIN OF y_source_fields ,
         KYF_0002 TYPE /BIC/OIZCOUNT ,
         KYF_0004 TYPE /BIC/OIZCOUNT ,
         KYF_0001 TYPE /BIC/OIZCOUNT ,
         KYF_0003 TYPE /BIC/OIZCOUNT ,
         Matno TYPE /BI0/OIMATERIAL ,
         CALDAY TYPE /BI0/OICALDAY ,
       END OF y_source_fields .
TYPES: yt_source_fields TYPE STANDARD TABLE OF y_source_fields .

TYPES: BEGIN OF y_target_fields ,
         Matno TYPE /BI0/OIMATERIAL,
         CALDAY TYPE /BI0/OICALDAY ,
         TYPYE TYPE /BIC/OIZATNAM ,
         COUNT TYPE /BIC/OIZCOUNT ,
       END OF y_target_fields .
TYPES: yt_target_fields TYPE STANDARD TABLE OF y_target_fields .

DATA: ls_source TYPE y_source_fields,
ls_target TYPE y_target_fields.

DATA: V1(3) TYPE C VALUE 'V1',
      V2(3) TYPE C VALUE 'V2',
      V3(3) TYPE C VALUE 'V3',
      V4(3) TYPE C VALUE 'V4',
      int type i.



*----------- End of type definitions --------------------------------
FORM compute_data_transformation
     USING     it_source TYPE yt_source_fields
               ir_context TYPE REF TO if_rsan_rt_routine_context
     EXPORTING et_target TYPE yt_target_fields .
*--------- Begin of transformation code -----------------------------


Loop at it_source into ls_source.
if ls_source-bp_respper <> 0.
do 4 times.


enddo.


endif.
Endloop.


*---------- End of transformation code ------------------------------
ENDFORM.

Thanks inadvance.

Trecy.

Edited by: Thomas Zloch on Feb 27, 2010 9:34 PM