Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

build the logic

Former Member
0 Kudos

Internal Table

MO SOB OPN USTAT

1234 123410 10 UREL

1234 123410 10 ADMD

4441 123430 10 UREL

4441 123430 10 WIP

5554 123430 10 UREL

5554 123410 10 CTRD

478 546710 10 AL

478 987620 10 AWL

9876 546731 10 ADMD

I want to do build the logic for above data as follows.

this we r getting from legacy I shouldn't distrub the orginal data and I need to make the table as follows.

USTAT1 is the New field . i want to result as this field values.

MO SOB OPN USTAT USTAT1

1234 123410 10 UREL

1234 123410 10 ADMD ADMD

4441 123430 10 UREL

4441 123430 10 WIP WIP

5554 123430 10 UREL

5554 123410 10 CTRD

478 546710 10 AL AL

478 987620 10 AWL

9876 546731 10 ADMD ADMD

HERE MY REUIREMENT IS LIKE THIS: WITH DIFFERENT COMBINATIONS

IF USTAT = UREL AND ADMD THEN IN SAP ADMD

IF USTAT = UREL AND WIP THEN IN SAP WIP

IF USTAT = AL AND AWL THEN IN SAP AL

IF USTAT = OTHER VALUES IN SAP PSW.

Please help me to build the above logic

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Ramesh,

Have an internal table with all fields (including USTAT1) at the last.

so, you will get all records with data till column USTAT.

Now loop on this internal table, and

in each pass get the USTAT (so, for MO 1234 you have UREL in var1 and ADMD in var2 in second pass)

Now, check the values and insert ADMD in USTAT1 for second pass (clear these two variables for next pass)

This is what i understood from ur example.... <b>you can use case stmnt for checking ans assigning value to USTAT1 and then use modify stmnt to modify the record.</b>

Regards,

Raj

Regards

Raj

5 REPLIES 5

Former Member
0 Kudos

Hi,

I didnt get your requirement correctly... Can you explain it more clearly...

You are editing the 2nd row with the USTAT1 field when both the conditions are true....

"IF USTAT = UREL AND ADMD THEN IN SAP ADMD"

What do you mean by THEN IN SAP ADMD?

Lokesh

0 Kudos

i mean in legacy data like USTAT = UREL AND ADMD ...

and i need to put in SAP ADMD.

0 Kudos

Hi,

If I understood it correctly: you need to create a new table with one extra column i.e. USTAT1.

I just wanted to know in the table2 and in the field USTAT1, you want a value ADMD in both the rows where you have the values UREL and ADMD.

Am I right.

Lokesh

Former Member
0 Kudos

Hi Ramesh,

Have an internal table with all fields (including USTAT1) at the last.

so, you will get all records with data till column USTAT.

Now loop on this internal table, and

in each pass get the USTAT (so, for MO 1234 you have UREL in var1 and ADMD in var2 in second pass)

Now, check the values and insert ADMD in USTAT1 for second pass (clear these two variables for next pass)

This is what i understood from ur example.... <b>you can use case stmnt for checking ans assigning value to USTAT1 and then use modify stmnt to modify the record.</b>

Regards,

Raj

Regards

Raj

former_member186741
Active Contributor
0 Kudos

sorry Ramesh but I don't understand.

With your pseudo code statement IF USTAT = UREL AND ADMD THEN IN SAP ADMD.... how can USTAT be 'UREL AND ADMD'? It can't have two simultaneous values.

Also, with MO 9876, how does that end up with ADMD? That doesn't seem to match your 'spec'.

Regards

Neil