SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Modify WBS elements



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> CO
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Tue Mar 24, 2009 1:12 pm    Post subject: Modify WBS elements Reply with quote

Code:
TABLES: prps, proj.

DATA: l_flag(1) TYPE c,
      im_prps LIKE prps,
      wa_prhi TYPE prhi,
      lt_prhi TYPE TABLE OF prhi,
      wa_prps TYPE prps,
      lt_prps TYPE TABLE OF prps,
      replace VALUE '2'. "Yes(1) or No(2)

DEFINE subst_field.
  &1 = &2.
  l_flag = 'X'.
END-OF-DEFINITION.

DEFINE fill_field.
  if &1 is initial.
    &1 = &2.
  endif.
END-OF-DEFINITION.

*save local copy of PRPS
im_prps = prps.

* Determine all the subordinates of current WBS element
CALL FUNCTION 'GET_TREE_FROM_PRHI'
     EXPORTING
          i_pspnr             = im_prps-pspnr
     TABLES
          psp_tree            = lt_prhi
     EXCEPTIONS
          input_error         = 1
          psp_hierarchy_error = 2
          psp_not_found       = 3
          OTHERS              = 4.

LOOP AT lt_prhi INTO wa_prhi.

  IF wa_prhi-up = im_prps-pspnr. "creating a sub level

*Get the values of the current level
    CALL FUNCTION 'CJDW_PRPS_GET'
         EXPORTING
              posnr     = wa_prhi-posnr
         IMPORTING
              e_prps    = wa_prps
         EXCEPTIONS
              cancel    = 1
              not_found = 2
              OTHERS    = 3.

* Do the substitution
    subst_field:
    wa_prps-usr02 proj-zzfund_center,
    wa_prps-zzdrain_basin im_prps-zzdrain_basin,
    wa_prps-zzdistrict im_prps-zzdistrict,
    wa_prps-zzlocation im_prps-zzlocation,
    wa_prps-zzfunc_id im_prps-zzfunc_id,
    wa_prps-zzutil_id im_prps-zzutil_id,
    wa_prps-usr01 im_prps-usr01,
    wa_prps-usr00 im_prps-usr00,
    wa_prps-func_area im_prps-func_area,
    wa_prps-usr10 im_prps-usr10.

* Do not overwrite lower structure value if one
* has been entered.
    fill_field:
    wa_prps-vernr im_prps-vernr.
    fill_field:
    wa_prps-astnr im_prps-astnr.

    IF NOT im_prps-zzfund_center IS INITIAL.
      subst_field:
      wa_prps-usr02 im_prps-zzfund_center.
    ENDIF.
  ENDIF.

  IF NOT l_flag IS INITIAL.
* Update the project
    CALL FUNCTION 'CJDW_PRPS_MODIFY'
         EXPORTING
              i_prps    = wa_prps
         EXCEPTIONS
              not_found = 1
              posnr     = 2
              OTHERS    = 3.
    CLEAR l_flag.
  ENDIF.

ENDLOOP.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> CO All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.