Application Development and Automation 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: 
Read only

Need Help in writing code in my update rules

Former Member
0 Likes
404

Hi Experts,

I'm sorry to put this question here.. but I need help from the ABAP experts in solving the issue which I have. So please help me in this regard.

I need help in writing a start routine from ODS1 to ODS2.

ODS1 is having the information from R/3 which which contains data like this.

Key Fields :

1] 0DOC_NUMBER - sales Document

2] ZPARVW1 - Partner Function info object

Data Fields:

1] 0Customer

2] 0Vendor

3] 0Employee

4] changedon

5] created on.

6] overall status of document

here ZPARVW1 will be having all partner functions ID which are coming from R/3. Like SP, BP, PY, PE, ZR.

these refers to Ship to party, Bill to Party, Payer, Sales employee, Forwarder..

in this partner functions SP,BP,PY refers to Customer

and PE refers to 0Employee

and ZR refers to 0Vendor.

here one sales document will be having multiple partner funtions at the same time.

In my lower level ODS I have the values as separate entries like

ODS1:

Doc_num: ZPARVW1: 0Customer: 0Vendor: 0Employee

546788 : SP: 567890

546788 ; BP:786899

546788 ; PY: 768980

546788 ; PE ; ; ; 467589

546788 ; ZR; ; 56789 respectively.

as for a particular document number I have multiple entries in the lower level ODS1

Now I have to write a code in the update rules of ODS2 like

for a particular Document number I need all the partner functions to be available as a single record. like

0Doc_Number : 0Ship_To; 0Billtoprty; 0Payer; 0sales employee; 0forwarder

546788 : 567890 ; 567890 ; 567890 ; 467589 ; 56789

in ODS2 I have partner funtions as Info objects replacing the partner functions ID's.

Please advice me in writing the code for the same.

Points will be awarded.

thanks

Vishnu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
380

Hi Vishnu,

you'll have to do a copy of your data_package:

xt_dp[] = data_package[].

Then refresh data_package and sort xt_dp by doc_num.

Loop at xt_dp into xh_dp.

case xh_dp-ZPARVW1.

when 'SP'.

move xh_dp-partnerno to lh_data-0Customer.

when 'BP'.

move xh_dp-partnerno to lh_data-0Vendor.

.....

AT END OF doc_num.

append lh_data to data_package.

endat.

endloop.

Don't forget to transfer the doc_num as well and take care of clearing the structure at the right time.

Another possibility would be to use a dynamic definition with field-symbols but I don't know if you've already worked with that.

Hope that helps!

Regards

Nicola

Hi Experts,

I'm sorry to put this question here.. but I need help from the ABAP experts in solving the issue which I have. So please help me in this regard.

I need help in writing a start routine from ODS1 to ODS2.

ODS1 is having the information from R/3 which which contains data like this.

Key Fields :

1] 0DOC_NUMBER - sales Document

2] ZPARVW1 - Partner Function info object

Data Fields:

1] 0Customer

2] 0Vendor

3] 0Employee

4] changedon

5] created on.

6] overall status of document

here ZPARVW1 will be having all partner functions ID which are coming from R/3. Like SP, BP, PY, PE, ZR.

these refers to Ship to party, Bill to Party, Payer, Sales employee, Forwarder..

in this partner functions SP,BP,PY refers to Customer

and PE refers to 0Employee

and ZR refers to 0Vendor.

here one sales document will be having multiple partner funtions at the same time.

In my lower level ODS I have the values as separate entries like

ODS1:

Doc_num: ZPARVW1: 0Customer: 0Vendor: 0Employee

546788 : SP: 567890

546788 ; BP:786899

546788 ; PY: 768980

546788 ; PE ; ; ; 467589

546788 ; ZR; ; 56789 respectively.

as for a particular document number I have multiple entries in the lower level ODS1

Now I have to write a code in the update rules of ODS2 like

for a particular Document number I need all the partner functions to be available as a single record. like

0Doc_Number : 0Ship_To; 0Billtoprty; 0Payer; 0sales employee; 0forwarder

546788 : 567890 ; 567890 ; 567890 ; 467589 ; 56789

in ODS2 I have partner funtions as Info objects replacing the partner functions ID's.

Please advice me in writing the code for the same.

Points will be awarded.

thanks

Vishnu

1 REPLY 1
Read only

Former Member
0 Likes
381

Hi Vishnu,

you'll have to do a copy of your data_package:

xt_dp[] = data_package[].

Then refresh data_package and sort xt_dp by doc_num.

Loop at xt_dp into xh_dp.

case xh_dp-ZPARVW1.

when 'SP'.

move xh_dp-partnerno to lh_data-0Customer.

when 'BP'.

move xh_dp-partnerno to lh_data-0Vendor.

.....

AT END OF doc_num.

append lh_data to data_package.

endat.

endloop.

Don't forget to transfer the doc_num as well and take care of clearing the structure at the right time.

Another possibility would be to use a dynamic definition with field-symbols but I don't know if you've already worked with that.

Hope that helps!

Regards

Nicola