cancel
Showing results for 
Search instead for 
Did you mean: 

logic as "If Sales Document / Order Item in Orders DSO has no corresponding Sales Document / Order Item in Despatches DSO then 1 else 0 to target DSO

0 Kudos
81

Hi Gurus,

We have a requirement of writing logic on Sales document/Order Item from sources.

Scenario:

Here the scenario is, we have the two DSO's 1) Orders and 2) Despatches at source level and we are loading Orders, Despatches source level DSO's to target DSO with Sales Document/Order Item as Key fields.


We need to write logic as "If Sales Document / Order Item in Orders DSO has no corresponding Sales Document / Order Item in Despatches DSO then 1 else 0 to target DSO.


Please guide.


Thanks,

Pavan kumar

Accepted Solutions (1)

Accepted Solutions (1)

former_member182470
Active Contributor
0 Kudos

Hi Pavan,

You can create either an End routine or Field Routine in DSO3(Target). You can just map the transformation from DSO1(Orders) to DSO3(Target). You will have to look-up DSO2(Despatches) in the routine.

Data : IT1 LIKE DSO1

          IT2 LIKE DSO2

loop at source_package for all entries into IT3

where source_fields-sales doc no EQ IT2-sales doc no.

          AND source_fields-Order Item no EQ IT2-Order Item no.

result 0.

else

result 1.

Note: This is just a rough code to give you an idea. It may not be syntactically correct.

Regards,

Suman

Former Member
0 Kudos

Hi Both,

I think the syntax should contain "OR" between Doc no and Item no. As per his query the Target DSO will have 1 if either of DOCs or ITEMs are equal. Let me know what you guys think

Data : IT1 LIKE DSO1

          IT2 LIKE DSO2

loop at source_package for all entries into IT3

where source_fields-sales doc no EQ IT2-sales doc no.

          OR

source_fields-Order Item no EQ IT2-Order Item no.

result 0.

else

result 1.

Thanks,

Rohit

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Pavan,

please try the below.

Data : IT_DSO1 type STANDARD TABLE OF /BIC/(dso active table),

           WA_DSO1  TYPE /BIC/(dso active table).

SELECT SALES DOC

               ORDER ITEM

  FROM /BIC/........(dso active table)

INTO CORRESPONDING FIELDS OF TABLE IT_DSO1.

loop at IT_DSO1 into WA_DSO1.

    loop at result_package assigning <result_fields>.

   if <result_fields>-sales doc NE WA_DSO1-sales doc   or <result_fields>-order item NE WA_DSO1-order item.  

     New field(result) = 0

    else

    New field(result) = 1.

     endif.

    endloop.

endloop.

Regrads,

Fathima.

0 Kudos

Hi Fathima,

Your code seems to be comparing only DSO1 Sales document/Item. Here my requirement is i need to compare Sales Document/Item of DSO1 with Sales Document/Item of DSO2 before going to target DSO3.

Thanks & Regards,

Pavan Kumar