How to program the function lag

Hi,
I am trying to do a query to reproduce the lag function. I cannot use this function because I want to compare a week from a year to the same week of the year n-1 and we can have 52 or 53 weeks...
I have a lot of problems to do a query that can put the data of the 2 years on the same line of results.
Any suggestions are welcome.
Regards

Below are the rows returned from the above query.
FY_START     FY_START_1     WEEK_START     WEEK_START_1     WEEK_END     WEEK_END_1     FY_END          FY_END_1     WEEK_NUM     WEEK_NUM_1
9/26/2004     9/28/2003     9/26/2004     9/28/2003     10/2/2004     10/4/2003     9/24/2005     9/25/2004     1          1
9/26/2004     9/28/2003     10/3/2004     10/5/2003     10/9/2004     10/11/2003     9/24/2005     9/25/2004     2          2
9/26/2004     9/28/2003     10/10/2004     10/12/2003     10/16/2004     10/18/2003     9/24/2005     9/25/2004     3          3
9/26/2004     9/28/2003     10/17/2004     10/19/2003     10/23/2004     10/25/2003     9/24/2005     9/25/2004     4          4
9/26/2004     9/28/2003     10/24/2004     10/26/2003     10/30/2004     11/1/2003     9/24/2005     9/25/2004     5          5
9/26/2004     9/28/2003     10/31/2004     11/2/2003     11/6/2004     11/8/2003     9/24/2005     9/25/2004     6          6
9/26/2004     9/28/2003     11/7/2004     11/9/2003     11/13/2004     11/15/2003     9/24/2005     9/25/2004     7          7
9/26/2004     9/28/2003     11/14/2004     11/16/2003     11/20/2004     11/22/2003     9/24/2005     9/25/2004     8          8
9/26/2004     9/28/2003     11/21/2004     11/23/2003     11/27/2004     11/29/2003     9/24/2005     9/25/2004     9          9
9/26/2004     9/28/2003     11/28/2004     11/30/2003     12/4/2004     12/6/2003     9/24/2005     9/25/2004     10          10
9/26/2004     9/28/2003     12/5/2004     12/7/2003     12/11/2004     12/13/2003     9/24/2005     9/25/2004     11          11
9/26/2004     9/28/2003     12/12/2004     12/14/2003     12/18/2004     12/20/2003     9/24/2005     9/25/2004     12          12
9/26/2004     9/28/2003     12/19/2004     12/21/2003     12/25/2004     12/27/2003     9/24/2005     9/25/2004     13          13
9/26/2004     9/28/2003     12/26/2004     12/28/2003     1/1/2005     1/3/2004     9/24/2005     9/25/2004     14          14
9/26/2004     9/28/2003     1/2/2005     1/4/2004     1/8/2005     1/10/2004     9/24/2005     9/25/2004     15          15
9/26/2004     9/28/2003     1/9/2005     1/11/2004     1/15/2005     1/17/2004     9/24/2005     9/25/2004     16          16
9/26/2004     9/28/2003     1/16/2005     1/18/2004     1/22/2005     1/24/2004     9/24/2005     9/25/2004     17          17
9/26/2004     9/28/2003     1/23/2005     1/25/2004     1/29/2005     1/31/2004     9/24/2005     9/25/2004     18          18
9/26/2004     9/28/2003     1/30/2005     2/1/2004     2/5/2005     2/7/2004     9/24/2005     9/25/2004     19          19
9/26/2004     9/28/2003     2/6/2005     2/8/2004     2/12/2005     2/14/2004     9/24/2005     9/25/2004     20          20
9/26/2004     9/28/2003     2/13/2005     2/15/2004     2/19/2005     2/21/2004     9/24/2005     9/25/2004     21          21
9/26/2004     9/28/2003     2/20/2005     2/22/2004     2/26/2005     2/28/2004     9/24/2005     9/25/2004     22          22
9/26/2004     9/28/2003     2/27/2005     2/29/2004     3/5/2005     3/6/2004     9/24/2005     9/25/2004     23          23
9/26/2004     9/28/2003     3/6/2005     3/7/2004     3/12/2005     3/13/2004     9/24/2005     9/25/2004     24          24
9/26/2004     9/28/2003     3/13/2005     3/14/2004     3/19/2005     3/20/2004     9/24/2005     9/25/2004     25          25
9/26/2004     9/28/2003     3/20/2005     3/21/2004     3/26/2005     3/27/2004     9/24/2005     9/25/2004     26          26
9/26/2004     9/28/2003     3/27/2005     3/28/2004     4/2/2005     4/3/2004     9/24/2005     9/25/2004     27          27
9/26/2004     9/28/2003     4/3/2005     4/4/2004     4/9/2005     4/10/2004     9/24/2005     9/25/2004     28          28
9/26/2004     9/28/2003     4/10/2005     4/11/2004     4/16/2005     4/17/2004     9/24/2005     9/25/2004     29          29
9/26/2004     9/28/2003     4/17/2005     4/18/2004     4/23/2005     4/24/2004     9/24/2005     9/25/2004     30          30
9/26/2004     9/28/2003     4/24/2005     4/25/2004     4/30/2005     5/1/2004     9/24/2005     9/25/2004     31          31
9/26/2004     9/28/2003     5/1/2005     5/2/2004     5/7/2005     5/8/2004     9/24/2005     9/25/2004     32          32
9/26/2004     9/28/2003     5/8/2005     5/9/2004     5/14/2005     5/15/2004     9/24/2005     9/25/2004     33          33
9/26/2004     9/28/2003     5/15/2005     5/16/2004     5/21/2005     5/22/2004     9/24/2005     9/25/2004     34          34
9/26/2004     9/28/2003     5/22/2005     5/23/2004     5/28/2005     5/29/2004     9/24/2005     9/25/2004     35          35
9/26/2004     9/28/2003     5/29/2005     5/30/2004     6/4/2005     6/5/2004     9/24/2005     9/25/2004     36          36
9/26/2004     9/28/2003     6/5/2005     6/6/2004     6/11/2005     6/12/2004     9/24/2005     9/25/2004     37          37
9/26/2004     9/28/2003     6/12/2005     6/13/2004     6/18/2005     6/19/2004     9/24/2005     9/25/2004     38          38
9/26/2004     9/28/2003     6/19/2005     6/20/2004     6/25/2005     6/26/2004     9/24/2005     9/25/2004     39          39
9/26/2004     9/28/2003     6/26/2005     6/27/2004     7/2/2005     7/3/2004     9/24/2005     9/25/2004     40          40
9/26/2004     9/28/2003     7/3/2005     7/4/2004     7/9/2005     7/10/2004     9/24/2005     9/25/2004     41          41
9/26/2004     9/28/2003     7/10/2005     7/11/2004     7/16/2005     7/17/2004     9/24/2005     9/25/2004     42          42
9/26/2004     9/28/2003     7/17/2005     7/18/2004     7/23/2005     7/24/2004     9/24/2005     9/25/2004     43          43
9/26/2004     9/28/2003     7/24/2005     7/25/2004     7/30/2005     7/31/2004     9/24/2005     9/25/2004     44          44
9/26/2004     9/28/2003     7/31/2005     8/1/2004     8/6/2005     8/7/2004     9/24/2005     9/25/2004     45          45
9/26/2004     9/28/2003     8/7/2005     8/8/2004     8/13/2005     8/14/2004     9/24/2005     9/25/2004     46          46
9/26/2004     9/28/2003     8/14/2005     8/15/2004     8/20/2005     8/21/2004     9/24/2005     9/25/2004     47          47
9/26/2004     9/28/2003     8/21/2005     8/22/2004     8/27/2005     8/28/2004     9/24/2005     9/25/2004     48          48
9/26/2004     9/28/2003     8/28/2005     8/29/2004     9/3/2005     9/4/2004     9/24/2005     9/25/2004     49          49
9/26/2004     9/28/2003     9/4/2005     9/5/2004     9/10/2005     9/11/2004     9/24/2005     9/25/2004     50          50
9/26/2004     9/28/2003     9/11/2005     9/12/2004     9/17/2005     9/18/2004     9/24/2005     9/25/2004     51          51
9/26/2004     9/28/2003     9/18/2005     9/19/2004     9/24/2005     9/25/2004     9/24/2005     9/25/2004     52          52

Similar Messages

  • How to use the function module ....

    hi
    how to use the function module ssf_function_module_name in smartforms

    Hi..
    If you are using this Function module, you can get the generated function module name of smartform dynamically. It is good progrmaming practice to get the fucntion module name dynamically because there might be some problems if you are hard coding in program.
    This will return the name of the function module and then from the exporting parameters you can use the fucntion module name to pass parameters to Smartforms.
    Check this link.I am expalining here how to use this function module.
    https://wiki.sdn.sap.com/wiki/pages/pointstab/viewpageversion.action?pageId=36109&version=2
    Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    <b>Reward points if useful</b>
    Regards
    Ashu

  • How to program a midi foot controller on Mainstage? Does anyone knows how to program the foot controller with exclusive solo channel in order not to dance "tip tap" while from clean guitar I go to crunch or solo? How to do this programming on Mainstage?

    How to program a midi foot controller on Mainstage? Does anyone knows how to program the foot controller with exclusive solo channel in order not to dance "tip tap" while from clean guitar I go to crunch or solo? How to do this programming on Mainstage?
    I basically managed to learn how to invert parameters which allows me to be as default in the clean guitar channel and if I switch the first button on the midi foot controller I switch to crunch, but at this point I tryied so hard to programm the second and third button to switch, only through a button in one step, to a third channel for distorsion or a 4th channel for solo guitar but I couldn't figured out how this work can be done!
    I would appreciate if anyone could help or share this experience with others who are experiencing the same problem.
    Cheers.
    F.

    I cannot seem to get mainstage to recognize my FCB either. I am using IFCB. Anyone figure this out?
    Thanks,
    Eric

  • How to get the function name/ID  of the current page

    HI,
    I searched the forum and google, but it is not clear on how to get the function name of the current page.
    I have 4 functions in my self service A ,B,C,D (seeded page links ) they all have to go to a page called hhhPG. Based on which function user is clicks I have to show the data in hhhPG.
    so my question is how to get the function name ? I mean I need to know if user click on link A , B, C or D link and came to this page.
    I found below in one forum and also there is getfunctionID in pageContext , but I do not know what to pass to getfunctionid("???") to get value.
    FunctionSecurity funcSecurity = pageContext.getFunctionSecurity();
    Or is there a better way of know where user is coming from ? like geturl....
    Please help, I need this ASAP.
    Thank you.

    Use below to find out how the user came into the page
    FunctionSecurity funcSecurity = pageContext.getFunctionSecurity();
    boolean isFunc1 = funcSecurity.testFunction(funcSecurity.getFunction("YOUR_FUNCTION_SHORT_NAME1"));
    boolean isFunc2 = funcSecurity.testFunction(funcSecurity.getFunction("YOUR_FUNCTION_SHORT_NAME2"));
    boolean isFunc3 = funcSecurity.testFunction(funcSecurity.getFunction("YOUR_FUNCTION_SHORT_NAME3"));
    boolean isFunc4 = funcSecurity.testFunction(funcSecurity.getFunction("YOUR_FUNCTION_SHORT_NAME4"));
    So one of them will be true based on the function the user came in.
    Write your logic based on these flags.
    Regards,
    Peddi.

  • How to use the function module 'HR_ES_FEATURE_BACKFIELD'

    Hi,
    How to use the function module 'HR_ES_FEATURE_BACKFIELD'?
    I need the usage from both technical as well as functional point of view.
    What is the use of this function module and technically how it is to be used to retrieve a feature for a particular employee.

    hey iam from functional side can u be little bit clear of that feature
    thanks
    sikindar

  • Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Out of the box, to use the function keys as function keys, hold down the fn key when you press the key. Otherwise, you get the picture function on the key. You can reverse this behavior in the Keyboard system prefs.

  • How to get the function name in controller class

    Hi experts ,
    I am new to the OAF framework.
    i have created the two functions and bot he the function have the same controller class .i want to capture the function name or function id in the controller class.
    can you please let me know how to get the function id or function name in the controller class.

    Hi apurba,
    Thanks for the quick reply.
    i am trying to get the function name from the FunctionSecurity class,
    However in FunctionSecurity class there is no such method defined as getFunctionName();
    my requirement is ,i have two functions functionA and functionB defined.
    both the function has the same controller class.in controller class ,i need to get the function name ,based on the function name
    i will redirect the page to respective page.
    looking forward for you response.
    appreciate your help
    Thanks,
    KT

  • How to use the function module /IRM/IPBB_AGREEMENT_CREATE.

    Hi all,
    Please help me how to use the function module /IRM/IPBB_AGREEMENT_CREATE.
    It is a Vistex fuction module which is used to create Sales contract in SAP-Vistex. If anyone has use the function module and do have the sample code please share it.
    Thanks.

    FORM create_agreement TABLES pt_agreement
                                           CHANGING po_agreement .
      CONSTANTS: c_strt_knumh TYPE knumh VALUE '0000000000'.
      DATA: lc_kona  TYPE /irm/s_gkona,
            lc_cbasp TYPE /irm/s_ipcbasp,
          lt_cbapr TYPE /irm/t_ipcbapr,         "Partners
          lc_cbapr TYPE /irm/s_ipcbapr,
          lt_cbadt TYPE  /irm/t_ipcbadt,        "Dates
          lc_cbadt TYPE  /irm/s_ipcbadt,
          lt_cbafs TYPE  /irm/t_ipcbafs,
          lc_cbafs TYPE  /irm/s_ipcbafs,
          lt_cbacn TYPE  /irm/t_ipcbacn,
          lc_cbacn TYPE  /irm/s_ipcbacn,
          lt_cbacl TYPE  /irm/t_ipcbacl,
          lc_cbacl TYPE  /irm/s_ipcbacl,
          lt_cbtpv TYPE  /irm/t_ipagtpv,
          lc_cbtpv TYPE  /irm/s_ipagtpv,
          lt_texts TYPE  text_lh,
          lc_texts TYPE  itclh,
          lt_cbasd TYPE  /irm/t_ipcbasd,
          lc_cbasd TYPE  /irm/s_ipcbasd,
          lc_agreement    TYPE  /irm/s_ipcbasp_doc,
          lc_e_log_number TYPE  balognr,
          lt_messages     TYPE  /irm/t_gprolog.
      DATA: lt_vake      TYPE  cond_vakevb_t,
            lc_vake      TYPE LINE OF cond_vakevb_t,
            lt_konh      TYPE  /irm/t_gkonh,
            lc_konh      TYPE LINE OF /irm/t_gkonh,
            lt_konp      TYPE  /irm/t_gkonp,
            lc_konp      TYPE LINE OF /irm/t_gkonp,
            lt_konw      TYPE  /irm/t_gkonwu,
            lc_konw      TYPE LINE OF /irm/t_gkonwu,
            lt_konm      TYPE  /irm/t_gkonmu,
            lc_konm      TYPE LINE OF  /irm/t_gkonmu,
            lt_komg      TYPE  /irm/t_gkomg_index,
            lc_komg      TYPE LINE OF /irm/t_gkomg_index,
            lt_user_data TYPE  /irm/t_gpraxfu_index,
            lc_user_data TYPE LINE OF /irm/t_gpraxfu_index.
      DATA: lc_updt(1) TYPE c.
      DATA: lc_knumh TYPE knumh.
      DATA: BEGIN OF lc_str_knumh,
             hd(2) TYPE c VALUE '$$',
             inc_num(8) TYPE c,
            END OF lc_str_knumh.
      DATA: blank_agree_key TYPE knuma VALUE '~~~~~~~~~~'.
      FIELD-SYMBOLS <konh_line> LIKE LINE OF lt_konh.
      FIELD-SYMBOLS <konp_line> LIKE LINE OF lt_konp.
      DATA: lc_rule TYPE type_key_rule.
      READ TABLE pt_agreement INTO lc_rule INDEX 1.
    SELECT SINGLE * FROM  kona
            WHERE  vkorg   = lc_rule-vkorg
            AND    vtweg   = '10'
            AND    spart   = '10'
            AND    boart   = 'ZPS1'
            AND    botext  = lc_rule-sap_agkey.
    IF sy-subrc = 0.
       lc_updt = 'U'.
    ELSE.
      lc_updt = 'I'.
    ENDIF.
      LOOP AT pt_agreement INTO lc_rule.
        MOVE sy-tabix TO lc_str_knumh-inc_num.
        CONDENSE lc_str_knumh-inc_num NO-GAPS.
        WHILE lc_str_knumh-inc_num+7(1) = ' '.
          CONCATENATE '0' lc_str_knumh-inc_num INTO lc_str_knumh-inc_num.
          CONDENSE lc_str_knumh-inc_num NO-GAPS.
        ENDWHILE.
        CONCATENATE '$$' lc_knumh INTO lc_knumh.
        MOVE lc_str_knumh TO lc_knumh.
       MOVE c_strt_knumh TO lc_knumh.
        CLEAR: lc_konh, lc_konp, lc_komg.
        MOVE: lc_rule-vkorg    TO lc_komg-komg-vkorg,
              '10'             TO lc_komg-komg-vtweg,
              '10'             TO lc_komg-komg-spart,
              p_waers          TO lc_komg-komg-waerk,
              '1300'           TO lc_komg-komg-bukrs,
              lc_rule-lifnr    TO lc_komg-komg-lifnr,
              lc_knumh         TO lc_komg-knumh,
              lc_knumh         TO lc_konh-knumh,
              lc_knumh         TO lc_konp-knumh,
              lc_rule-datab    TO lc_konh-datab,
              lc_rule-datbi    TO lc_konh-datbi.
        CASE lc_rule-tablnam.
          WHEN 'A701'.                   "Every Agreement will have a A701 rule -
            "Therefore we acn setup the header using A701
            MOVE: 'New       '  TO lc_kona-knuma,
                  lc_rule-vkorg TO lc_kona-vkorg,
                  '10'          TO lc_kona-vtweg,
                  '10'          TO lc_kona-spart,
                  'ZPS1'        TO lc_kona-boart,
                  'C'           TO lc_kona-abtyp,
                  'V'           TO lc_kona-kappl,
                  p_waers       TO lc_kona-waers,
                  lc_rule-knuma_ag TO lc_kona-abrex,
                  'ZPS2'        TO lc_kona-kobog,
                  lc_rule-datab TO lc_kona-datab,
                  lc_rule-datbi TO lc_kona-datbi,
                  lc_rule-sap_agkey TO lc_kona-botext,
                  '1300'        TO lc_kona-bukrs,
                  'I'           TO lc_kona-updkz.
            MOVE: 'New       '  TO lc_cbasp-knuma_ag,
                  'ZPS1'        TO lc_cbasp-boart_ag,
                  p_waers       TO lc_cbasp-waers,
                  'A'           TO lc_cbasp-setl_mth,
                  'B'           TO lc_cbasp-setl_typ,
                  'A2'          TO lc_cbasp-ident,
                  'E'           TO lc_cbasp-setlm,
                  'ZPDA'        TO lc_cbasp-pargr,
                  'X'           TO lc_cbasp-npric,
                  'LF'          TO lc_cbasp-stprl,
                  lc_rule-lifnr TO lc_cbasp-stpar,
                  lc_rule-contract_rev  TO lc_cbasp-rvnum,
                  'I'           TO lc_cbasp-updkz.
            CONCATENATE: blank_agree_key
                   lc_rule-lifnr        INTO lc_konh-vakey.
            MOVE: lc_rule-lifnr TO lc_konp-lifnr.
          WHEN 'A703'.
            CONCATENATE: blank_agree_key
                         lc_rule-kunnr      INTO lc_konh-vakey.
            MOVE lc_rule-kunnr TO lc_komg-komg-kunnr.
          WHEN 'A709'.
            CONCATENATE: blank_agree_key
            lc_rule-zzprodh1  lc_rule-zzprodh2  lc_rule-zzprodh3
                   lc_rule-zzprodh4  lc_rule-zzprodh5 INTO lc_konh-vakey.
            CONCATENATE: lc_rule-zzprodh1  lc_rule-zzprodh2  lc_rule-zzprodh3
                   lc_rule-zzprodh4  lc_rule-zzprodh5 INTO lc_komg-komg-prodh.
          WHEN 'A710'.
            CONCATENATE: blank_agree_key
                lc_rule-matkl   INTO lc_konh-vakey.
            MOVE lc_rule-matkl TO lc_komg-komg-matkl.
          WHEN 'A711'.
            CONCATENATE: blank_agree_key
                 lc_rule-matnr   INTO lc_konh-vakey.
            MOVE lc_rule-matnr TO lc_komg-komg-matnr.
            IF lc_rule-kschl = 'ZPPL'.
              MOVE: 'C'              TO lc_konp-krech,
                    'CAD'              TO lc_konp-konwa.
              lc_konp-kbetr = lc_rule-net_po_price * 1.
            ENDIF.
          WHEN 'A717'.
          WHEN 'A718'.
            CONCATENATE: blank_agree_key
                 lc_rule-zzextwg INTO lc_konh-vakey.
            MOVE lc_rule-zzextwg TO lc_komg-komg-zzextwg.
         WHEN 'A719'.
           CONCATENATE: blank_agree_key
                lc_rule-werks INTO lc_konh-vakey.
           MOVE lc_rule-werks TO lc_komg-komg-werks.
         WHEN 'A721'.
           CONCATENATE: blank_agree_key
                 lc_rule-kunnr lc_rule-werks INTO lc_konh-vakey.
           MOVE: lc_rule-kunnr TO lc_konp-kunnr,
                 lc_rule-kunnr TO lc_komg-komg-kunnr.
          WHEN 'A722'.
            CONCATENATE: blank_agree_key
                         lc_rule-vkbur INTO lc_konh-vakey.
            MOVE lc_rule-vkbur TO lc_komg-komg-vkbur.
          WHEN 'A724'.
            CONCATENATE: blank_agree_key
                          lc_rule-kunnr lc_rule-vkbur INTO lc_konh-vakey.
            MOVE: lc_rule-kunnr TO lc_konp-kunnr,
                  lc_rule-kunnr TO lc_komg-komg-kunnr,
                  lc_rule-vkbur TO lc_komg-komg-vkbur.
        ENDCASE.
        MOVE: 'A'                  TO lc_konh-kvewe,
              lc_rule-tablnam+1(3) TO lc_konh-kotabnr,
              lc_rule-kappl        TO lc_konh-kappl,
              lc_rule-kschl        TO lc_konh-kschl.
        REPLACE ALL OCCURRENCES OF '~' IN lc_konh-vakey WITH ' '.
        APPEND lc_konh TO lt_konh.
        CLEAR lc_konh.
    *--- Add in the KONP.Do we need to add
        MOVE: lc_rule-kappl        TO lc_konp-kappl,
              lc_rule-kschl        TO lc_konp-kschl,
              'G'                  TO lc_konp-krech.
        IF lc_rule-kschl+3(1) = '%'.
          MOVE: 'A'              TO lc_konp-krech,
                '%'              TO lc_konp-konwa.
          lc_konp-kbetr = lc_rule-rebate_perc * 1.
        ENDIF.
        APPEND lc_konp TO lt_konp. CLEAR lc_konp.
        APPEND lc_komg TO lt_komg. CLEAR lc_komg.
      ENDLOOP.
      IF  lc_updt = 'I'.
        CALL FUNCTION '/IRM/IPCB_AGREEMENT_CREATE'
          EXPORTING
          I_MESSAGES_DISPLAY        = ' '
          I_SAVE_MESSAGES           = ' '
          I_COMMIT_WORK             = 'X'
          I_CALL_FROM_WS            = ' '
            is_kona                   = lc_kona
            is_cbasp                  = lc_cbasp
            it_cbapr                  = lt_cbapr
            it_cbadt                  = lt_cbadt
            it_cbafs                  = lt_cbafs
            it_cbacn                  = lt_cbacn
            it_cbacl                  = lt_cbacl
            it_cbtpv                  = lt_cbtpv
            it_texts                  = lt_texts
            it_cbasd                  = lt_cbasd
          IMPORTING
            es_agreement              = lc_agreement
            e_log_number              = lc_e_log_number
          TABLES
            t_messages                = lt_messages
         CHANGING
          CT_VAKE                   = lt_vake
          ct_konh                   = lt_konh
          ct_konp                   = lt_konp
          CT_KONW                   = lt_konw
          CT_KONM                   = lt_konm
           ct_komg                   = lt_komg
          CT_USER_DATA              = lt_usr_data
          EXCEPTIONS
            no_documents_to_process   = 1
            no_authorization          = 2
            creation_failed           = 3
            new_pricing_not_maitained = 4
            OTHERS                    = 5.
        IF sy-subrc <> 0.
    Implement suitable error handling here
        ELSE.
          MOVE: lc_agreement-knuma_ag TO po_agreement,
                lc_agreement-knuma_ag TO lc_kona-knuma.
        ENDIF.
        APPEND LINES OF lt_messages TO gt_messages.
      ELSE.
        MOVE-CORRESPONDING kona TO lc_kona.
      ENDIF.
      LOOP AT lt_konh ASSIGNING <konh_line>.
        MOVE lc_kona-knuma TO <konh_line>-vakey+0(10).
       move '&'           to <konh_line>-knumh+0(1).
      ENDLOOP.
      LOOP AT lt_konp ASSIGNING <konp_line>.
       MOVE lc_kona-knuma TO <konp_line>-vakey+0(10).
        move '&'           to <konh_line>-knumh+0(1).
      ENDLOOP.
      lc_kona-updkz = 'U'.
      lc_cbasp-updkz = 'U'.
      CLEAR lt_messages.
      CALL FUNCTION '/IRM/IPCB_AGREEMENT_CHANGE'
        EXPORTING
        I_MESSAGES_DISPLAY      = ' '
        I_SAVE_MESSAGES         = ' '
        I_COMMIT_WORK           = 'X'
        I_INIT_DATA             = 'X'
          is_kona                 = lc_kona
          is_cbasp                = lc_cbasp
         it_cbapr                = lt_cbapr
         it_cbadt                = lt_cbadt
         it_cbafs                = lt_cbafs
         it_cbacl                = lt_cbacl
         it_cbacn                = lt_cbacn
        IT_FIELDS               =
         it_texts                = lt_texts
       IMPORTING
         e_log_number            = lc_e_log_number
         TABLES
           t_messages              = lt_messages
        CHANGING
          cs_agreement            = lc_agreement
        CT_VAKE                 = lt_vake
          ct_konh                 = lt_konh
          ct_konp                 = lt_konp
        CT_KONW                 = lt_konw
        CT_KONM                 = lt_konm
          ct_komg                 = lt_komg
        CT_USER_DATA            = lt_usr_data
        EXCEPTIONS
          no_documents_to_process = 1
          no_authorization        = 2
          change_failed           = 3
          agreement_locked        = 4
          OTHERS                  = 5.
    IF sy-subrc <> 0.
    Implement suitable error handling here
    ENDIF.
      APPEND LINES OF lt_messages TO gt_messages.
    ENDFORM.                    " CREATE_AGREEMENT

  • How to Use the Function Module 'BAPI_BUSPROCESSND_CHANGEMULTI'

    Dear Experts,
             Can anyone Explain me how to Use the Function Module 'BAPI_BUSPROCESSND_CHANGEMULTI'.My Requirement is i want to change the Partners of the Service Order.It is Very Urgent Requirement Please Help me.
    Thanks & Regards,
    Ashok.

    Hi,
    For service order you can use FM 'BAPI_ACTIVITYCRM_CHANGEMULTI' as it is much easier to use.
    Sample code is below. You can use that:
    "fill the details of partner which is
              "to be added as main partner or in place of Interaction Agent
              wa_partner_new-ref_guid = w_guid_ref.
              wa_partner_new-ref_handle = '0000000000'.
              wa_partner_new-ref_kind = 'A'.
              wa_partner_new-kind_of_entry = wa_partner-kind_of_entry.
              wa_partner_new-ref_partner_handle = '0000'.
              wa_partner_new-ref_partner_fct = 'Z_IA'.
    "wa_partner-partner_no : New partner no.
              wa_partner_new-ref_partner_no = wa_partner-partner_no.
              wa_partner_new-ref_no_type = wa_partner-ref_no_type.
              wa_partner_new-ref_display_type = wa_partner-ref_display_type.
              wa_partner_new-display_type = 'BP'.
              wa_partner_new-no_type = 'BP'.
              wa_partner_new-partner_fct = 'Z_IA'.
    "w_partner_no : Old partner no. which is to be changed
              wa_partner_new-partner_no = w_partner_no.
              wa_partner_new-mainpartner = 'X'.
              INSERT wa_partner_new INTO TABLE it_partner_new.
              wa_partner_newx-display_type = 'X'.
              wa_partner_newx-no_type = 'X'.
              wa_partner_newx-partner_fct = 'X'.
              wa_partner_newx-partner_no = 'X'.
              wa_partner_newx-mainpartner = 'X'.
              INSERT wa_partner_newx INTO TABLE it_partner_newx.
      IF it_partner_new[] IS NOT INITIAL AND it_partner_newx[] IS NOT INITIAL.
        "maintain all changes to be done
        CALL FUNCTION 'BAPI_ACTIVITYCRM_CHANGEMULTI'
          TABLES
            partner  = it_partner_new
            partnerx = it_partner_newx.
        CLEAR : wa_guid1.
        REFRESH : it_guid1.
        wa_guid1-guid = w_guid_ref.
        APPEND wa_guid1 TO it_guid1.
        "save the changes
        CALL FUNCTION 'BAPI_ACTIVITYCRM_SAVE'
          TABLES
            objects_to_save = it_guid1.
        "commit the transaction
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
    Reply fro any further help.
    Please reward points if helpful.
    Regards,
    Ashlesha

  • About HR infotype 0024, How to use the function moudle:RHPP_Q_PROFILE_WRITE

    Hi:
    About HR infotype 0024,As qualification data goes to the OM Infotypes, How to use the function moudle:RHPP_Q_PROFILE_WRITE?
    thank you.

    thank you and the 'BAPI_QUALIPROF_CHANGE' can wok.
    DATA:it_profile_add TYPE bapiqualific_tab OCCURS 0 WITH HEADER LINE,
         it_profile_delete TYPE bapiqualific_tab OCCURS 0 WITH HEADER LINE,
         it_return TYPE bapireturn1 OCCURS 0 WITH HEADER LINE.
    it_profile_add-obj_id = '20000116'.  "Q ID
    it_profile_add-rating = '0001'.      "精通程度
    APPEND it_profile_add.
    CALL FUNCTION 'BAPI_QUALIPROF_CHANGE'
      EXPORTING
        plvar                = '01'
        otype                = 'AP'  "申请者
        sobid                = '00000170' "PERNR NUMBER
    IMPORTING
       return               = it_return
      TABLES
        profile_add          = it_profile_add
        profile_delete      = it_profile_delete
      ERR_PROFILE          =
      CHANGE_PROFILE       =
    READ TABLE it_return WITH KEY type = 'E'.
    IF sy-subrc = 0.
      MESSAGE 'FAILED' TYPE 'I'.
    ELSE.
      MESSAGE 'SUCCESS' TYPE 'I'.
    ENDIF.

  • How to debug the function separately which is added in the package

    Hi Friends, I want to know how to debug the function separately, by taking it from package,. and i dont no where to add begin and end. and dont no how to give input to the function. ANd how to find the error which is detected from production, so i want to find from which statement its failing. So please guide me to proceed further. thanks in advance.

    { FUNCTION fn_get_trail_id (p_incr PLS_INTEGER DEFAULT 1) RETURN PLS_INTEGER IS
    p_trail_id tb_xop_orders_trail.trail_id%TYPE;
    BEGIN
    IF p_incr >= 1 THEN
    SELECT sq_xop_trail_id.NEXTVAL INTO p_trail_id FROM DUAL;
    RETURN p_trail_id;
    ELSIF p_incr = 0 THEN
    SELECT sq_xop_trail_id.CURRVAL INTO p_trail_id FROM DUAL;
    RETURN p_trail_id;
    END IF;
    END;
    -- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    BEGIN
    ppr_openlog('AQ');
    ppr_request_lock(v_cb_handle, v_cb_lock);
    pr_xop_log_errors('AQ: ==== cb started ('||descr.msg_id||') ====');
    my function is like this, how i can i in clude it in declare statement, and how to assign values for that.. and where i have to include "begin".plz help me

  • How to copy the function group

    hi there,
    i want to copy the function group 2012. plz let me know the possibility.

    use FM <b>RS_FUNCTION_POOL_COPY</b>  to copy
    Look at this thread
    how to copy the function group

  • How to code the function of  add+delete+edit using jsp??

    how to code the function of add+delete+edit using jsp??i'm also using the ms sql server 2000 as a database. pls help me!!

    Hi,
    I think you will find the following useful.
    Performing Inserts, Updates, and Deletes
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html

  • How to view the function INTAX

    Hi Gurus,
    could you please tell me how to check the function INTAX as my tax in not getting calculated properly.
    thanks.
    Rgds,
    Vishwas

    Hi,
    I suggest you to read the documentation of INTAX through PE04. You will have a better understanding of the calculation process.
    It is given clear. Please try this before you go for a debugging option.
    - Suresh

  • How to Create the Function Module Exit

    Hi,
      How to Create the Function Module Exit. Please tell me the step by step procedure.

    Hi,
    Check this link for how to create the function module exit..
    http://sap.niraj.tripod.com/id62.html
    Thanks
    naren

Maybe you are looking for

  • No sound when using Airplay for Movies on Apple TV

    For reasons unknow, when I try to stream full length movies (Lion King and Nemo bought from iTunes) from my iPhone or Macbook Pro using Airplay, there is no sound.  When I stream smaller movies, like Boundin' the Pixar Short, there is no problem. Sid

  • Diff in IT 0027 and IT 1018 ie.. Cost Distribution

    Hello Experts, My Earlier thread is not found.... so opening another thread........ ( My Question was about -> What is the diff between IT 1018 and IT 0027? If anyone could explain with an example would be great).... Correct me if i am wrong, from th

  • ATI Radeon 4870 on K9AGM2-L ?

    Hello, I am planning to buy a new ATI radeon 4870 video card. But I need at least 2 SATA because I am using 2 SATA HDDs. It is a double slot video card solution and I see it is long...Does anyone have such card installed on this mobo MSI K9AGM2-L? Do

  • Run form more then once from development

    Hi, I use formbuilder 10g and try for testing run my application by clicking the button run form in form builder. At this time the runtime environment always needs the password a second time and, if I try to run it a second time again, I have to rest

  • Any standard table that keep tracks of changes in user attributes

    Hi, We have a HR system and we are tyring to find out a standard table that keep tracks of changes(when was it changed,who changed it,what has been changed) in user details like email,address etc. Plz let me know the solution Thanks Bala Duvvuri