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 logic for sales data

Former Member
0 Likes
501

Hi all,

I need small logic ...

VBELN ITEM PSTVY SPART PRCTR NETWR

2767 10 ZTAC 10 1008 234.00

2767 20 TAC 18 1801 3456.00

2767 30 ZTAC 10 1008 234.00

2767 40 ZTAC 10 1008 234.00

2767 50 TAC 10 1008 234.00

i want the update the SPART and PRCTR for evey item what ever the Item have PSTVY = TAC

means Update the all the line item material profit centre and division to tools (TAC) Configurable material profit center and division. like below.

VBELN ITEM PSTVY SPART PRCTR NETWR

2767 10 ZTAC 18 1801 234.00

2767 20 TAC 18 1801 3456.00

2767 30 ZTAC 18 1801 234.00

2767 40 ZTAC 18 1801 234.00

2767 50 TAC 10 1801 234.00

please help me in this.

regards,

Rama

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
452

Hi,

Check this code..

SORT itab BY vbeln item.

READ TABLE itab INTO wa WITH KEY pstvy = 'TAC'.
LOOP AT itab.
  IF itab-spart NE wa-spart AND itab-pstvy NE wa-pstvy.
    itab-spart = wa-spart.
  ENDIF.

  IF itab-prctr  NE wa-prctr .
    itab-prctr  = wa-prctr .
  ENDIF.

  MODIFY itab.
ENDLOOP.

Hi all,

I need small logic ...

VBELN ITEM PSTVY SPART PRCTR NETWR

2767 10 ZTAC 10 1008 234.00

2767 20 TAC 18 1801 3456.00

2767 30 ZTAC 10 1008 234.00

2767 40 ZTAC 10 1008 234.00

2767 50 TAC 10 1008 234.00

i want the update the SPART and PRCTR for evey item what ever the Item have PSTVY = TAC

means Update the all the line item material profit centre and division to tools (TAC) Configurable material profit center and division. like below.

VBELN ITEM PSTVY SPART PRCTR NETWR

2767 10 ZTAC 18 1801 234.00

2767 20 TAC 18 1801 3456.00

2767 30 ZTAC 18 1801 234.00

2767 40 ZTAC 18 1801 234.00

2767 50 TAC 10 1801 234.00

please help me in this.

regards,

Rama

1 REPLY 1
Read only

Former Member
0 Likes
453

Hi,

Check this code..

SORT itab BY vbeln item.

READ TABLE itab INTO wa WITH KEY pstvy = 'TAC'.
LOOP AT itab.
  IF itab-spart NE wa-spart AND itab-pstvy NE wa-pstvy.
    itab-spart = wa-spart.
  ENDIF.

  IF itab-prctr  NE wa-prctr .
    itab-prctr  = wa-prctr .
  ENDIF.

  MODIFY itab.
ENDLOOP.