Komk & Komp

Hi
my requirement is to calculate RE-PRICING for sales order using function module PRICING
i have VBELN and POSNR for sales order.
any one knows how to populate komk and komp structure to pass FM PRICING???
thankx
Message was edited by:
        Ripal Patel

Hi
I don't know why you are struggling with this fun module PRICING?
Generally in SD and MM modules Pricing is a major area where we need to configure lot of things to get the prices correctly like
Define condition records in VK11, Condition Tables, Access sequences and Condition records and the pricing procedures etc.
Once you define all these things then the data will be in the tables KONV and KONP tables.
using the VBAK-KNUMV  and VBAP-POSNR fields to KONV-KNUMV and KONV-KPOSN fields we get the respective pricing related data for that condition type(KSCHL).
so take the help of a functional guy in this regard to configure the pricing procedure and make use of it.
reward if useful
regards
Anji

Similar Messages

  • How we know tables for komv, komk, komp structures in ME23n Trans for PO

    Hi gurus,
    We are extracting data of PO relating to me23n and sending that data to XI. Its working fine. But some fields value are getting wrong. I am getting problem with komv, komk, and komp structures, bcoz i dont know which tables i have to use. I am using konv right now.
    Pls give some suggestions.
    and also how we get netwr value in the header i.e. total amout of items and price element rate KOMV-KBETR in header.
    ex: KOMV-KBETR
         KOMK-WAERK
         KOMP-NETWR
         TDTEXT based on ID
         ZTEXT (item level text, and header level text).
    Thanks in advance...

    Pls see my code...
    *This for Header.............*
          i_zzep_pohdr_s-doc_date = i_ekko-bedat.    "14
          SELECT SINGLE * FROM t052 INTO i_t052 WHERE zterm = i_ekko-zterm.
          IF sy-subrc = 0.
            i_zzep_pohdr_s-pay_trms = i_t052-zterm.     "15
          ENDIF.
          SELECT SINGLE * FROM tcurc INTO i_tcurc WHERE waers = i_ekko-waers.
          IF sy-subrc = 0.
            i_zzep_pohdr_s-curr = i_tcurc-waers.     "16
          ENDIF.
          i_zzep_pohdr_s-ex_rate = i_ekko-wkurs.     "17
          i_zzep_pohdr_s-ex_rate_fxd = i_ekko-kufix. "18
          i_zzep_pohdr_s-inco = i_ekko-inco1.        "19
          i_zzep_pohdr_s-add_inco = i_ekko-inco2.    "20
          SELECT SINGLE * FROM t685t INTO i_t685t
          WHERE spras = i_ekko-spras.
          IF sy-subrc = 0.
            i_zzep_pohdr_s-pri_ele_cond_desc = i_t685t-vtext. "21
          ENDIF.
          SELECT SINGLE * FROM konv INTO i_konv WHERE knumv = i_ekko-knumv.
          IF sy-subrc = 0.
            IF i_konv-kschl = 'PBXX'.
    *          i_zzep_pohdr_s-Pri_ele_rate = i_konv-kbetr.                "22
              i_zzep_pohdr_s-pri_ele_curr_cond = i_konv-waers.           "23
              i_zzep_pohdr_s-pri_ele_cond_val_doc_curr = i_konv-kwert_k. "24
            ENDIF.
          ENDIF.
          MOVE i_ekko-ebeln TO xname.
          CALL FUNCTION 'READ_TEXT'
            EXPORTING
    *   CLIENT                        = SY-MANDT
              id                            = 'F02'
              language                      = sy-langu
              name                          = xname
              object                        = 'EKKO'
    *   ARCHIVE_HANDLE                = 0
    *   LOCAL_CAT                     = ' '
    * IMPORTING
    *   HEADER                        =
            TABLES
              lines                         = i_xtline
       EXCEPTIONS
         id                            = 1
         language                      = 2
         name                          = 3
         not_found                     = 4
         object                        = 5
         reference_check               = 6
         wrong_access_to_archive       = 7
         OTHERS                        = 8
          IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ELSE.
            CLEAR temp.
            LOOP AT i_xtline INTO rline.
              IF rline-tdline IS NOT INITIAL.
                CONCATENATE temp rline-tdline INTO temp SEPARATED BY space.
              ENDIF.
            ENDLOOP.
            MOVE temp TO i_zzep_pohdr_s-hdr_lvl_txt_cont . "28
          ENDIF.
          SELECT SINGLE * FROM t166k INTO i_t166k WHERE bsart = i_ekko-bsart.
          IF sy-subrc = 0.
            i_zzep_pohdr_s-hdr_lvl_txt_id = i_t166k-tdid.            "26
          ENDIF.
          SELECT SINGLE * FROM t166k INTO i_t166k WHERE bsart = i_ekko-bsart.
          IF sy-subrc = 0.
            SELECT SINGLE * FROM ttxot INTO i_ttxot WHERE tdobject = i_t166k-tdobject
                                                    AND tdspras = i_ekko-spras.
            IF sy-subrc = 0.
              i_zzep_pohdr_s-hdr_lvl_txt_desc_id = i_ttxot-tdtext. " 27
            ENDIF.
          ENDIF.
          APPEND i_zzep_pohdr_s TO t_zzep_pohdr_t.
        ENDLOOP.
    *This for Items.............*
    SELECT * FROM t166p INTO TABLE i_t166p WHERE bstyp = i_ekpo-bstyp
                                                  AND pstyp = i_ekpo-pstyp.
          IF sy-subrc = 0.
            LOOP AT i_t166p INTO wa_t166p.
              IF wa_t166p-tdid = 'F01'.
                i_zzep_podet_s-itm_lvl_txt_id = wa_t166p-tdid.            "29
              ENDIF.
            ENDLOOP.
            SELECT SINGLE * FROM ttxot INTO i_ttxot WHERE tdobject = 'EKPO'
                                                    AND tdspras = sy-langu.
            IF sy-subrc = 0.
              i_zzep_podet_s-itm_lvl_txt_desc_id = i_ttxot-tdtext. " 27
            ENDIF.
          ENDIF.
    *select single * from stxl into i_stxl where tdspras = i_ekko-spras.
    *select single * from
          APPEND i_zzep_podet_s TO t_zzep_podet_t.
          sum = sum + i_zzep_podet_s-pri_ele_net_val_doc_curr.
          CLEAR i_zzep_podet_s.
        ENDLOOP.
        CLEAR current_line.
        LOOP AT t_ekko INTO i_ekko.
          current_line = sy-tabix.
          LOOP AT t_ekpo INTO i_ekpo WHERE ebeln = i_ekpo-ebeln.
            IF sy-subrc = 0.
              *MOVE sum TO i_zzep_pohdr_s-pri_ele_net_val_doc_curr.* (NETWR)
              *MOVE sum TO i_zzep_pohdr_s-pri_ele_rate.* (KBETR)
            ENDIF.
          ENDLOOP.
          MODIFY t_zzep_pohdr_t FROM i_zzep_pohdr_s INDEX current_line.
        ENDLOOP.
      ENDIF.
    I already down althose wht u suggested previous...
    just see this code and give suggestion where i have to change my code....
    I am getting doubt when i am using ..
    IF i_konv-kschl = 'PBXX'.
                i_zzep_podet_s-pri_ele_rate = i_zzep_podet_s-ext_val_itm.                "25
                i_zzep_podet_s-pri_ele_curr_cond = i_konv-waers.           "26
                i_zzep_podet_s-pri_ele_cond_val_doc_curr = i_konv-kwert_k. "27
              ENDIF.
    and..
    CLEAR current_line.
        LOOP AT t_ekko INTO i_ekko.
          current_line = sy-tabix.
          LOOP AT t_ekpo INTO i_ekpo WHERE ebeln = i_ekpo-ebeln.
            IF sy-subrc = 0.
              MOVE sum TO i_zzep_pohdr_s-pri_ele_net_val_doc_curr.
              MOVE sum TO i_zzep_pohdr_s-pri_ele_rate.
            ENDIF.
          ENDLOOP.
          MODIFY t_zzep_pohdr_t FROM i_zzep_pohdr_s INDEX current_line.
        ENDLOOP.
      ENDIF.
    pls suggest me...
    thanks.
    Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 12:49 PM

  • Adding a new field to field catalogue

    Hi experts,
    My client has got a requirement where he want to use departure region for calculating of taxes. This field was not availble in field catalog but avalaible in KOMK, I have extended the same to field catalog. Now I have created the condiation table and maintained the condition records. But when I create a PO system is not picking up this filed. I see ! sysmbol. and I get this message " Access not made (initialized feild)". So please help me in resolving this problem.
    Thanks in advance

    Hi,
    Thanks for the quick response. But I was under the impression that the user exit needs to be used only if the feild is not available in KOMK, KOMP and KOMG structure. But the field required by me i.e. REGIOA is available in  KOMK & KOMG structure.
    So you feel still I need to activate the user exit you had mentioned?

  • Calculate Pricing in Sales Order Based on Characterestic Values

    Hi All,
    We are using Sales Order and assigning service product as material. On saving sales order, a service order is created. Per SAP standard design, we can only assign Qty=1 for the service product. As a work around, we have a characteristics that captures service quantity. Now I want to influence pricing based on this char value using Calculation Type Formula in the pricing procedure.
    Please suggest as to how I can capture the characteristics value in the formula routine created using VOFM? Is there any structure that shows the characteristics value during run time of order creation?

    hey,
    go throw structures KOMP ( VBAP ) and KOMV ( VBAK) and manipulate with your subroutine
    the qty and the net value .
    Before Saving - KOMK,KOMP --> running the pricing functions ( matching according to the access )
                          ---> KOMV --> XKOMV
    After Saving    ========>      VBAK/VBAP
    you can capture the values throw this structures .
    BR
    ASA

  • Ihave created a script, i need to email in pdf format.

    Hi Experts,
    There are 2 criterias...
    1. criteria
    I have created a script, i need to mail it. Please give me a step by step guide to perform it .. . Please give the comments in all the functional module to be used.
    Do we have to write a separate program to send email or in the same program. i'll post my program along with this mail. I'm using this program to display report after delivery on that particular date.
    REPORT  ZREPORTTOEMAIL LINE-SIZE 400.
    data : count, i  type i.
    TABLES :  VBFA,         "Sales Document Flow
              VBAK,
              KNA1,
              VBKD,
              VBAP,
              LIPS,
              LIKP,
              KONP,
              KOMK,
              KOMP,
              zkna1,
              konv.
    data : l_vbeln like vbfa-vbeln,
           l_posnr like vbfa-posnn,
           l_KNUMV like vbak-KNUMV,
           L_BILL_ITEM LIKE vbfa-posnn ,
           l_netwr like vbrp-netwr,
           l_MWSBP like vbrp-mwsbp.
    DATA: BEGIN OF TKOMV OCCURS 50.
            INCLUDE STRUCTURE KOMV.
    DATA: END OF TKOMV.
    DATA: BEGIN OF TKOMVD OCCURS 50.
            INCLUDE STRUCTURE KOMVD.
    DATA: END OF TKOMVD.
    TYPE-POOLS: SLIS.
    DATA: FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
          HEADING  TYPE SLIS_T_LISTHEADER,
          LAYOUT   TYPE SLIS_LAYOUT_ALV,
          EVENTS   TYPE SLIS_T_EVENT,
          REPNAME  LIKE SY-REPID,
          F2CODE   LIKE SY-UCOMM VALUE  '&ETA',
          G_SAVE(1) TYPE C,
          G_EXIT(1) TYPE C,
          G_VARIANT LIKE DISVARIANT,
          GX_VARIANT LIKE DISVARIANT.
    DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
    CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    DATA: BEGIN OF itab occurs 0,
            kunnr like likp-kunnr,      "ship to party
            NAME2   LIKE  KNA1-NAME1,   "text
            ORT01   LIKE  KNA1-ORT01,   "City
            BSTNK   LIKE  VBAK-BSTNK,   "customer P O
            BSTDK   LIKE  VBAK-BSTDK,   "date
            vbeln like likp-vbeln,      "delivery
            ernam like likp-ernam,      "person
            vstel like likp-vstel,      "shipping point
            vkorg like likp-vkorg,      "sales org
            lfdat like likp-lfdat,      "delivery date
            kunag like likp-kunag,      "sold to party
            NAME1   LIKE  KNA1-NAME1,   "text
            bil_to like VBAK-KUNNR,
            name3 like kna1-name1,
            traid like likp-traid,      "transport/vehicle no
            BOLNR LIKE LIKP-BOLNR,
            wadat_ist like likp-wadat_ist, "good mov. date
            posnr like lips-posnr,      "item
            matnr like lips-matnr,      "material
            arktx like lips-arktx,      "item text
            matkl like lips-matkl,      "mat group
            werks like lips-werks,      "plant
            lgort like lips-lgort,      "stoage location
            lfimg like lips-lfimg,      "del qty
            MEINS LIKE LIPS-MEINS,
            vrkme like lips-vrkme,      "sales unit
            UMVKZ LIKE LIPS-UMVKZ,
            UMVKN LIKE LIPS-UMVKN,
            charg like lips-charg,      "batch
            vgbel like lips-vgbel,      "reference doc
            mtart like lips-mtart,      "mat type
            vkbur like lips-vkbur,      "sales office
            vkgrp like lips-vkgrp,      "sales group
            vtweg like lips-vtweg,      "Distribution Channel
            spart like lips-spart,      "division
            billno like vbak-vbeln,
            basic like komvd-kwert,
            budat like bkpf-budat,
            fin_amt like vbrp-NETWR,
    END OF itab.
    data : begin of jtab occurs 0,
    kunnr like likp-kunnr,
    name2 like kna1-name2,
    vbeln like likp-vbeln,
    zkunnr like zkna1-zkunnr,
    zname like zkna1-zname,
    end of jtab.
    SELECTION-SCREEN SKIP 1 .
    SELECTION-SCREEN BEGIN OF BLOCK BLOCK1 WITH FRAME TITLE TEXT-003.
    SELECT-OPTIONS   : ABC FOR LIKP-WADAT_IST DEFAULT SY-DATUM
                                  NO INTERVALS   .
    SELECT-OPTIONS   : S_MATNR FOR  LIPS-MATNR NO INTERVALS   .
    SELECT-OPTIONS   : S_VKORG FOR  LIKP-VKORG NO INTERVALS.
    SELECT-OPTIONS   : S_VSTEL FOR  LIKP-VSTEL NO INTERVALS.
    SELECT-OPTIONS   : S_VKBUR FOR  LIKP-VKBUR NO INTERVALS.
    SELECT-OPTIONS   : S_VKGRP FOR  LIPS-VKGRP.
    SELECT-OPTIONS   : S_SPART FOR  LIPS-SPART.
    SELECT-OPTIONS   : S_VBELN3 FOR  LIKP-VBELN.
    SELECT-OPTIONS   : S_MATKL FOR  LIPS-MATKL NO INTERVALS,
                       S_KUNAG FOR LIKP-KUNAG.
    SELECTION-SCREEN  END OF BLOCK BLOCK1.
    select * from likp into corresponding fields of itab
                  WHERE  WADAT_IST IN ABC
                  AND    VBELN IN S_VBELN3
                  AND    VKORG IN S_VKORG
                  and VSTEL in S_VSTEL
                  AND VKBUR IN S_VKBUR
                  and lfart like 'Z%'
                  AND    VBTYP = 'J'
                  AND KUNAG IN S_KUNAG.
    select * from lips into corresponding fields of itab
                    WHERE VBELN =  ITAB-VBELN
                    AND   MATNR IN S_MATNR
                    AND   MATKL IN S_MATKL
                    AND VKBUR IN S_VKBUR
                    AND VKGRP IN S_VKGRP
                    AND SPART IN S_SPART.
    IF ITAB-VRKME = 'RM' AND ITAB-MEINS = 'KG'.
    ITAB-LFIMG = ITAB-LFIMG * ( ITAB-UMVKZ / ITAB-UMVKN ).
    ITAB-VRKME = 'KG'.
    ENDIF.
    SELECT SINGLE BSTNK BSTDK INTO (ITAB-BSTNK,ITAB-BSTDK) FROM VBAK
                     WHERE VBELN = ITAB-VGBEL.
    SELECT SINGLE NAME1 ORT01 FROM KNA1 INTO (ITAB-NAME2,ITAB-ORT01)
                                 WHERE KUNNR = ITAB-KUNNR.
    SELECT SINGLE NAME1 FROM KNA1 INTO ITAB-NAME1
                                 WHERE KUNNR = ITAB-KUNAG.
    *select single vbeln POSNN into (itab-billno,L_BILL_ITEM)  from vbfa where VBELV = itab-vbeln
    *and POSNV = itab-posnr and VBTYP_N in ('M','U').
    select vbeln POSNN from vbfa up to 1 rows into (itab-billno,L_BILL_ITEM)   where VBELV = itab-vbeln
    and POSNV = itab-posnr and VBTYP_N in ('M','U') order by vbeln DESCENDING .
    endselect.
    select single * from vbfa where vbelv = itab-billno and posnv = l_bill_item and
    vbtyp_n = 'N'.
    if sy-subrc = 0.
    clear : itab-billno, l_bill_item.
    endif.
    select single budat from bkpf into itab-budat where xblnr = itab-billno and
    blart = 'RV'.
    select single NETWR MWSBP into (l_netwr, l_MWSBP) from vbrp where vbeln = itab-billno
    and posnr = l_bill_item.
    itab-fin_amt = l_netwr + l_MWSBP.
    clear : l_netwr, l_MWSBP.
    select single kunnr from vbpa into itab-bil_to where
    vbeln = itab-BILLNO and PARVW = 'RE'.
    select single name1 into itab-name3 from kna1
    where kunnr = itab-bil_to.
    *select single VBELV POSNV from vbfa into (l_vbeln,l_posnr)
    *where VBELN = itab-vbeln and
    *POSNN = itab-posnr and VBTYP_N = 'J'.
    *select single VBELN POSNN from vbfa into (l_vbeln,l_posnr)
    *where VBELV = itab-vbeln and
    *POSNV = itab-posnr and VBTYP_N = 'M'.
    select VBELN POSNN from vbfa up to 1 rows into (l_vbeln,l_posnr)
    where VBELV = itab-vbeln and
    POSNV = itab-posnr and VBTYP_N = 'M' order by vbeln DESCENDING.
    endselect.
    select single * from vbfa where vbelv = l_vbeln and posnv = l_posnr and
    vbtyp_n = 'N'.
    if sy-subrc = 0.
    clear : l_vbeln, l_posnr.
    endif.
    if sy-subrc = 0.
    *select single KNUMv into l_KNUMv from vbak where vbeln = l_vbeln
    select single KNUMv into l_KNUMv from vbRk where vbeln = l_vbeln
    select * from konv where knumv = l_knumv and kposn = l_posnr and
    kschl in ('ZR00','ZR01','ZR02','ZOBC').
    itab-basic = itab-basic + KONV-KBETR.
    ENDSELECT.
    else.
    *select single KNUMv into l_KNUMv from ekko where ebeln = itab-vgbel.
    *select single KBETR from konv into itab-basic where knumv = l_knumv
    *and kposn = itab-posnr and kschl = 'P101'.
    select single KNUMv into l_KNUMv from VBRK where VBELN = itab-BILLNO.
    select * from konv where knumv = l_knumv and kposn = l_BILL_ITEM AND
    kschl in ('ZR00','ZR01','ZR02','ZOBC').
    itab-basic = itab-basic + KONV-KBETR.
    ENDSELECT.
    *zkna1-zkunnr = itab-kunnr.
    *insert zkna1.
    endif.
         clear : l_vbeln, L_BILL_ITEM, L_POSNR.
    APPEND ITAB.
    clear : itab-basic, itab-lfimg.
         ENDSELECT.
              clear : itab.
    ENDSELECT.
    <b>perform zscript.</b>
    *&      Form  zscript
          text
    -->  p1        text
    <--  p2        text
    FORM zscript .
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
      APPLICATION                       = 'TX'
      ARCHIVE_INDEX                     =
      ARCHIVE_PARAMS                    =
      DEVICE                            = 'PRINTER'
      DIALOG                            = 'X'
       FORM                              = 'ZREPORT2EMAIL'
       LANGUAGE                          = SY-LANGU
      OPTIONS                           =
      MAIL_SENDER                       =
      MAIL_RECIPIENT                    =
      MAIL_APPL_OBJECT                  =
      RAW_DATA_INTERFACE                = '*'
      SPONUMIV                          =
    IMPORTING
      LANGUAGE                          =
      NEW_ARCHIVE_PARAMS                =
      RESULT                            =
    EXCEPTIONS
      CANCELED                          = 1
      DEVICE                            = 2
      FORM                              = 3
      OPTIONS                           = 4
      UNCLOSED                          = 5
      MAIL_OPTIONS                      = 6
      ARCHIVE_ERROR                     = 7
      INVALID_FAX_NUMBER                = 8
      MORE_PARAMS_NEEDED_IN_BATCH       = 9
      SPOOL_ERROR                       = 10
      CODEPAGE                          = 11
      OTHERS                            = 12
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT ITAB.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'MANU'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'MAIN'
    IMPORTING
      PENDING_LINES                  =
    EXCEPTIONS
      ELEMENT                        = 1
      FUNCTION                       = 2
      TYPE                           = 3
      UNOPENED                       = 4
      UNSTARTED                      = 5
      WINDOW                         = 6
      BAD_PAGEFORMAT_FOR_PRINT       = 7
      SPOOL_ERROR                    = 8
      CODEPAGE                       = 9
      OTHERS                         = 10
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                         =
      RDI_RESULT                     =
    TABLES
      OTFDATA                        =
    EXCEPTIONS
      UNOPENED                       = 1
      BAD_PAGEFORMAT_FOR_PRINT       = 2
      SEND_ERROR                     = 3
      SPOOL_ERROR                    = 4
      CODEPAGE                       = 5
      OTHERS                         = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " zscript
    The above one is first criteria just to understand how to send mail to the customers.
    <b>Second criteria</b> is i have to send the mail to the particular customer with only their details, the process should continue until it sends to all the customers with their details for that particular date.
    Please help me out.
    I have seen so many posts in the sdn but not able to understand the functional modules, how they declare that and how does it works...
    Please provide me a good material to understand the functional module and to declare them.
    Please solve this query i'll reward them with very good points.
    Thanks in advance.
    A.Rafique.

    Hi babar haroon,
    Thanks for the link.....
    I went through that link, i created smart form but i was not able to get the results because the pgm gets terminated after executing. I'll show u the code, the code is active. Please check out and tell me if  i have missed anything in the code...
    *& Report  ZZZ_TEST3
    REPORT  ZZZ_TEST3.
    *internal table declarations
    data: i_otf type itcoo occurs 0 with header line,
          i_tline type table of tline with header line,
          i_receivers type table of somlreci1 with header line,
          i_record like solisti1 occurs 0 with header line,
    *Objects to send mail.
          i_objpack like sopcklsti1 occurs 0 with header line,
          i_objtxt like solisti1 occurs 0 with header line,
          i_objbin like solisti1 occurs 0 with header line,
          i_reclist like somlreci1 occurs 0 with header line,
    *workarea declaration.
          w_objhead TYPE soli_tab,
          w_ctrlop TYPE ssfctrlop,
          w_compop TYPE ssfcompop,
          w_return TYPE ssfcrescl,
          w_doc_chng typE sodocchgi1,
          w_data TYPE sodocchgi1,
          w_buffer TYPE string,"To convert from 132 to 255
    Variables declarations
          v_form_name TYPE rs38l_fnam,
          v_len_in LIKE sood-objlen,
          v_len_out LIKE sood-objlen,
          v_len_outn TYPE i,
          v_lines_txt TYPE i,
          v_lines_bin TYPE i.
    call function 'SSF_FUNCTION_MODULE_NAME'
    *call function '/1BCDWB/SF00000105'
          exporting
          formname = 'ZZZ_TEST2'
          importing
          fm_name = v_form_name
          exceptions
          no_form = 1
          no_function_module = 2
          others = 3.
          IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          w_ctrlop-getotf = 'X'.
          w_ctrlop-no_dialog = 'X'.
          w_compop-tdnoprev = 'X'.
         CALL FUNCTION '/1BCDWB/SF00000105'
          EXPORTING
            ARCHIVE_INDEX              =
            ARCHIVE_INDEX_TAB          = itab1
            ARCHIVE_PARAMETERS         =
            CONTROL_PARAMETERS         =
            MAIL_APPL_OBJ              =
            MAIL_RECIPIENT             =
            MAIL_SENDER                =
            OUTPUT_OPTIONS             =
            USER_SETTINGS              = 'X'
          IMPORTING
            DOCUMENT_OUTPUT_INFO       =
            JOB_OUTPUT_INFO            = wa
            JOB_OUTPUT_OPTIONS         =
          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.
    CALL FUNCTION v_form_name
          EXPORTING
          control_parameters = w_ctrlop
          output_options = w_compop
          user_settings = 'X'
          IMPORTING
          job_output_info = w_return
          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.
          i_otf[] = w_return-otfdata[].
          CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
          format = 'PDF'
          max_linewidth = 132
          IMPORTING
          bin_filesize = v_len_in
          TABLES
          otf = i_otf
          lines = i_tline
          EXCEPTIONS
          err_max_linewidth = 1
          err_format = 2
          err_conv_not_possible = 3
          OTHERS = 4.
          IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          Convert PDF from 132 to 255.
          LOOP AT i_tline.
          Replacing space by ~
          TRANSLATE i_tline USING '~'.
          CONCATENATE w_buffer i_tline INTO w_buffer.
          ENDLOOP.
    Replacing ~ by space
          TRANSLATE w_buffer USING '~'.
          DO.
          i_record = w_buffer.
          Appending 255 characters as a record
          APPEND i_record.
          SHIFT w_buffer LEFT BY 255 PLACES.
          IF w_buffer IS INITIAL.
          EXIT.
          ENDIF.
          ENDDO.
          Refresh: i_reclist,
          i_objtxt,
          i_objbin,
          i_objpack.
          clear w_objhead.
          Object with PDF.
          i_objbin[] = i_record[].
         DESCRIBE TABLE i_objbin LINES v_lines_bin.
          Object with main text of the mail.
          i_objtxt = 'Find attached the output of the smart form.'.
          APPEND i_objtxt.
         DESCRIBE TABLE i_objbin LINES v_lines_txt.
          i_objtxt = 'Regards,'.
          APPEND i_objtxt.
          i_objtxt = 'J.Jayanthi'.
          APPEND i_objtxt.
          DESCRIBE TABLE i_objtxt LINES v_lines_txt.
          Document information.
          w_doc_chng-obj_name = 'Smartform'.
          w_doc_chng-expiry_dat = sy-datum + 10.
          w_doc_chng-obj_descr = 'Smart form output'.
          w_doc_chng-sensitivty = 'F'. "Functional object
          w_doc_chng-doc_size = v_lines_txt * 255.
          Pack to main body as RAW.
          Obj. to be transported not in binary form
          CLEAR i_objpack-transf_bin.
          Start line of object header in transport packet
          i_objpack-head_start = 1.
          Number of lines of an object header in object packet
          i_objpack-head_num = 0.
          Start line of object contents in an object packet
          i_objpack-body_start = 1.
          Number of lines of the object contents in an object packet
          i_objpack-body_num = v_lines_txt.
          Code for document class
          i_objpack-doc_type = 'RAW'.
          APPEND i_objpack.
          Packing as PDF.
          i_objpack-transf_bin = 'X'.
          i_objpack-head_start = 1.
         i_objpack-head_num = 1.
          i_objpack-head_num = 0.
          i_objpack-body_start = 1.
          i_objpack-body_num = v_lines_bin.
          i_objpack-doc_type = 'PDF'.
          i_objpack-obj_name = 'Smartform'.
          CONCATENATE 'Smartform_output' '.pdf'
          INTO i_objpack-obj_descr.
          i_objpack-doc_size = v_lines_bin * 255.
          APPEND i_objpack.
          Document information.
          CLEAR i_reclist.
          e-mail receivers.
         i_reclist-receiver = '[email protected]'.
          i_reclist-receiver = '[email protected]'.
          i_reclist-express = 'X'.
          i_reclist-rec_type = 'U'. "Internet address
          APPEND i_reclist.
          Sending mail.
          CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
          document_data = w_doc_chng
          put_in_outbox = 'X'
          TABLES
          packing_list = i_objpack
          object_header = w_objhead
          contents_hex = i_objbin
          contents_txt = i_objtxt
          receivers = i_reclist
          EXCEPTIONS
          too_many_receivers = 1
          document_not_sent = 2
          document_type_not_exist = 3
          operation_no_authorization = 4
          parameter_error = 5
          x_error = 6
          enqueue_error = 7
          OTHERS = 8.
          IF sy-subrc <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    Please reply me back, it is very urgent..
    Thanks and regards.
    A.Rafique

  • Table for MM (Purchase- ME23N) Tax

    Hi friends,
    In my Report, I have to calculate & Display,  Material Purchase taxes.
    ( In ME23N --> Item --> Invoice -->Taxes AND ME23N --> Item -->Conditions)
    Can I have any Condition table for this entries (Like for SD & CS we have transparant table KONV)
    How can I display it?
    Regards,
    Ashlesha

    REPORT zreport10 .TABLES : ekko , ekpo , t001 , komk , komp . DATA mwsbp TYPE komp-mwsbp . PARAMETERS : p_ebeln TYPE ekpo-ebeln , p_ebelp TYPE ekpo-ebelp .START-OF-SELECTION . PERFORM calculate_tax USING p_ebeln p_ebelp CHANGING mwsbp . WRITE mwsbp .
    FORM calculate_tax *
    FORM calculate_tax USING p_ebeln TYPE ekpo-ebeln
    p_ebelp TYPE ekpo-ebelp
    CHANGING p_mwsbp TYPE komp-mwsbp . CONSTANTS: bstyp-info VALUE 'I',
    bstyp-ordr VALUE 'W',
    bstyp-banf VALUE 'B',
    bstyp-best VALUE 'F',
    bstyp-anfr VALUE 'A',
    bstyp-kont VALUE 'K',
    bstyp-lfpl VALUE 'L',
    bstyp-lerf VALUE 'Q'. DATA : taxcom TYPE taxcom ,
    t_konv TYPE TABLE OF komv WITH HEADER LINE .
    DATA: BEGIN OF tkomv OCCURS 50.
    INCLUDE STRUCTURE komv.
    DATA: END OF tkomv. DATA: BEGIN OF tkomvd OCCURS 50. "Belegkonditionen
    INCLUDE STRUCTURE komvd.
    DATA: END OF tkomvd. DATA : BEGIN OF tkomvh OCCURS 50.
    INCLUDE STRUCTURE komv.
    DATA : vtext LIKE t685t-vtext.
    DATA : END OF tkomvh. SELECT SINGLE *
    INTO ekko
    FROM ekko
    WHERE ebeln = p_ebeln . SELECT SINGLE *
    INTO ekpo
    FROM ekpo
    WHERE ebeln = p_ebeln
    AND ebelp = p_ebelp . SELECT SINGLE *
    INTO t001
    FROM t001
    WHERE bukrs = ekko-bukrs . taxcom-bukrs = ekpo-bukrs.
    taxcom-budat = ekko-bedat.
    taxcom-waers = ekko-waers.
    taxcom-kposn = ekpo-ebelp.
    taxcom-mwskz = ekpo-mwskz.
    taxcom-txjcd = ekpo-txjcd.
    taxcom-shkzg = 'H'.
    taxcom-xmwst = 'X'.
    IF ekko-bstyp EQ bstyp-best.
    taxcom-wrbtr = ekpo-netwr.
    ELSE.
    taxcom-wrbtr = ekpo-zwert.
    ENDIF. taxcom-lifnr = ekko-lifnr.
    taxcom-land1 = ekko-lands.
    taxcom-ekorg = ekko-ekorg.
    taxcom-hwaer = t001-waers.
    taxcom-llief = ekko-llief.
    taxcom-bldat = ekko-bedat.
    taxcom-matnr = ekpo-ematn.
    taxcom-werks = ekpo-werks.
    taxcom-bwtar = ekpo-bwtar.
    taxcom-matkl = ekpo-matkl.
    taxcom-meins = ekpo-meins. IF ekko-bstyp EQ bstyp-best.
    taxcom-mglme = ekpo-menge.
    ELSE.
    IF ekko-bstyp EQ bstyp-kont AND ekpo-abmng GT 0.
    taxcom-mglme = ekpo-abmng.
    ELSE.
    taxcom-mglme = ekpo-ktmng.
    ENDIF.
    ENDIF.
    IF taxcom-mglme EQ 0.
    taxcom-mglme = 1000.
    ENDIF.
    taxcom-mtart = ekpo-mtart. IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF. CALL FUNCTION 'J_1BSA_COMPONENT_ACTIVE'
    EXPORTING
    bukrs = ekko-bukrs
    component = 'BR'
    EXCEPTIONS
    component_not_active = 1
    OTHERS = 2. IF sy-subrc IS INITIAL. komk-mandt = ekko-mandt.
    komk-kalsm = ekko-kalsm.
    IF ekko-kalsm = ''.
    komk-kalsm = 'RM0000'.
    ENDIF.
    komk-kappl = 'M'.
    komk-waerk = ekko-waers.
    komk-knumv = ekko-knumv.
    komk-lifnr = ekko-lifnr.
    komp-kposn = ekpo-ebelp.
    komp-matnr = ekpo-matnr.
    komp-werks = ekpo-werks.
    komp-matkl = ekpo-matkl.
    komp-infnr = ekpo-infnr.
    komp-evrtn = ekpo-konnr.
    komp-evrtp = ekpo-ktpnr.
    CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
    EXPORTING
    comm_head_i = komk
    comm_item_i = komp
    language = 'E'
    TABLES
    tkomv = tkomv
    tkomvd = tkomvd.
    CALL FUNCTION 'J_1B_NF_PO_DISCOUNTS'
    EXPORTING
    i_kalsm = ekko-kalsm
    i_ekpo = ekpo
    IMPORTING
    e_ekpo = ekpo
    TABLES
    i_konv = t_konv. IF NOT ekko-llief IS INITIAL.
    taxcom-lifnr = ekko-llief.
    ENDIF. ENDIF. CALL FUNCTION 'FIND_TAX_SPREADSHEET'
    EXPORTING
    buchungskreis = t001-bukrs
    EXCEPTIONS
    not_found = 1
    OTHERS = 2. CALL FUNCTION 'CALCULATE_TAX_ITEM'
    EXPORTING
    i_taxcom = taxcom
    IMPORTING
    e_taxcom = taxcom
    EXCEPTIONS
    mwskz_not_defined = 1
    mwskz_not_found = 2
    mwskz_not_valid = 3
    steuerbetrag_falsch = 4
    country_not_found = 5
    OTHERS = 6. IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF. p_mwsbp = taxcom-wmwst .
    ENDFORM. " calculate_tax

  • CALCULATE_TAX_ITEM how to use it

    hello al
    cud u tell me what values shud be passed into CALCULATE_TAX_ITEM function module.
    and how to use it.

    Hi,
         REPORT zreport10 .
    TABLES : ekko , ekpo , t001 , komk , komp .
    DATA mwsbp TYPE komp-mwsbp .
    PARAMETERS : p_ebeln TYPE ekpo-ebeln ,
    p_ebelp TYPE ekpo-ebelp .
    START-OF-SELECTION .
    PERFORM calculate_tax USING p_ebeln p_ebelp CHANGING mwsbp .
    WRITE mwsbp .
    FORM calculate_tax *
    FORM calculate_tax USING p_ebeln TYPE ekpo-ebeln
    p_ebelp TYPE ekpo-ebelp
    CHANGING p_mwsbp TYPE komp-mwsbp .
    CONSTANTS: bstyp-info VALUE 'I',
    bstyp-ordr VALUE 'W',
    bstyp-banf VALUE 'B',
    bstyp-best VALUE 'F',
    bstyp-anfr VALUE 'A',
    bstyp-kont VALUE 'K',
    bstyp-lfpl VALUE 'L',
    bstyp-lerf VALUE 'Q'.
    DATA : taxcom TYPE taxcom ,
    t_konv TYPE TABLE OF komv WITH HEADER LINE .
    DATA: BEGIN OF tkomv OCCURS 50.
    INCLUDE STRUCTURE komv.
    DATA: END OF tkomv.
    DATA: BEGIN OF tkomvd OCCURS 50. "Belegkonditionen
    INCLUDE STRUCTURE komvd.
    DATA: END OF tkomvd.
    DATA : BEGIN OF tkomvh OCCURS 50.
    INCLUDE STRUCTURE komv.
    DATA : vtext LIKE t685t-vtext.
    DATA : END OF tkomvh.
    SELECT SINGLE *
    INTO ekko
    FROM ekko
    WHERE ebeln = p_ebeln .
    SELECT SINGLE *
    INTO ekpo
    FROM ekpo
    WHERE ebeln = p_ebeln
    AND ebelp = p_ebelp .
    SELECT SINGLE *
    INTO t001
    FROM t001
    WHERE bukrs = ekko-bukrs .
    taxcom-bukrs = ekpo-bukrs.
    taxcom-budat = ekko-bedat.
    taxcom-waers = ekko-waers.
    taxcom-kposn = ekpo-ebelp.
    taxcom-mwskz = ekpo-mwskz.
    taxcom-txjcd = ekpo-txjcd.
    taxcom-shkzg = 'H'.
    taxcom-xmwst = 'X'.
    IF ekko-bstyp EQ bstyp-best.
    taxcom-wrbtr = ekpo-netwr.
    ELSE.
    taxcom-wrbtr = ekpo-zwert.
    ENDIF.
    taxcom-lifnr = ekko-lifnr.
    taxcom-land1 = ekko-lands.
    taxcom-ekorg = ekko-ekorg.
    taxcom-hwaer = t001-waers.
    taxcom-llief = ekko-llief.
    taxcom-bldat = ekko-bedat.
    taxcom-matnr = ekpo-ematn.
    taxcom-werks = ekpo-werks.
    taxcom-bwtar = ekpo-bwtar.
    taxcom-matkl = ekpo-matkl.
    taxcom-meins = ekpo-meins.
    IF ekko-bstyp EQ bstyp-best.
    taxcom-mglme = ekpo-menge.
    ELSE.
    IF ekko-bstyp EQ bstyp-kont AND ekpo-abmng GT 0.
    taxcom-mglme = ekpo-abmng.
    ELSE.
    taxcom-mglme = ekpo-ktmng.
    ENDIF.
    ENDIF.
    IF taxcom-mglme EQ 0.
    taxcom-mglme = 1000.
    ENDIF.
    taxcom-mtart = ekpo-mtart.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CALL FUNCTION 'J_1BSA_COMPONENT_ACTIVE'
    EXPORTING
    bukrs = ekko-bukrs
    component = 'BR'
    EXCEPTIONS
    component_not_active = 1
    OTHERS = 2.
    IF sy-subrc IS INITIAL.
    komk-mandt = ekko-mandt.
    komk-kalsm = ekko-kalsm.
    IF ekko-kalsm = ''.
    komk-kalsm = 'RM0000'.
    ENDIF.
    komk-kappl = 'M'.
    komk-waerk = ekko-waers.
    komk-knumv = ekko-knumv.
    komk-lifnr = ekko-lifnr.
    komp-kposn = ekpo-ebelp.
    komp-matnr = ekpo-matnr.
    komp-werks = ekpo-werks.
    komp-matkl = ekpo-matkl.
    komp-infnr = ekpo-infnr.
    komp-evrtn = ekpo-konnr.
    komp-evrtp = ekpo-ktpnr.
    CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
    EXPORTING
    comm_head_i = komk
    comm_item_i = komp
    language = 'E'
    TABLES
    tkomv = tkomv
    tkomvd = tkomvd.
    CALL FUNCTION 'J_1B_NF_PO_DISCOUNTS'
    EXPORTING
    i_kalsm = ekko-kalsm
    i_ekpo = ekpo
    IMPORTING
    e_ekpo = ekpo
    TABLES
    i_konv = t_konv.
    IF NOT ekko-llief IS INITIAL.
    taxcom-lifnr = ekko-llief.
    ENDIF.
    ENDIF.
    CALL FUNCTION 'FIND_TAX_SPREADSHEET'
    EXPORTING
    buchungskreis = t001-bukrs
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    <b>CALL FUNCTION 'CALCULATE_TAX_ITEM'</b>
    EXPORTING
    i_taxcom = taxcom
    IMPORTING
    e_taxcom = taxcom
    EXCEPTIONS
    mwskz_not_defined = 1
    mwskz_not_found = 2
    mwskz_not_valid = 3
    steuerbetrag_falsch = 4
    country_not_found = 5
    OTHERS = 6.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    p_mwsbp = taxcom-wmwst .
    ENDFORM. " calculate_tax
    Regards

  • Access Sequence For Import PO Conditions

    Hi,
      As in case of import PO we have to add Excise condition seperately with customr vendor ID  as per our regular process while maaking IMport PO  we are adding 3 common condition JCV1,  JECV,   J1CV  and after selecting those condition we are entring the tax % and then custom vendor ID      for those three condition i want to make condition record  lik e when user create a import PO  for import PO our document type is IM  and if compnay code is MS10  when user select condition JCV1  automatically from the condition record system should pick the tax %  and the vednor  .  so how to do it,
    as first w= i have to create the condition table then that table have to assign to a assecc sequext and then that assescc sequence have to be assign to condition type  so in condition  table which filed to be select , I am not getting filed for PO doc, type and condition type from inmaintian condition table fileds .
    regards,
      zafar

    sorry i thought u talking about document number
    u will have to do development for that
    eithere u do
    The following development steps have to be realized before starting with the field catalog extension:
    ??? Create data elements
    ??? Create Append Structure ZAKOMPAZ
    ??? Add Append Structure to KOMP and KOMG
    The fields have to exist in table KOMG, KOMK, or KOMP.
    or
    To use your own fields for the price determination process, you must extend the communication structure table (KOMK, KOMP or KOMG where the KOMG Table represents the sum of KOMK and KOMP and contains all the fields that can be used in price determination). New fields entered in KOMK and/or KOMP are adopted in the structure KOMG automatically. There have been two enhancements that you should look at when you would like to append KOMK or KOMP as detailed hereunder -
    1) In respect of KOMK - Use Function Module EXIT_SAPLMEKO_001 (User Exit LMEKO001) which includes ZXM06U14.
    2) In respect of KOMP - Use Function Module EXIT_SAPLMEKO_002 (User Exit LMEKO002) which includes ZXM06U15.
    hope this helps

  • Marketing Attribute in Condition Table (Listing)

    Hi Guys !!
    Usage in a condition table for listings. Can a marketing attribute be added to the field catalog and used as part of the access seq when proposing a listing in an order or activity journal?
    Urgently Help needed.

    Hi Jacob,
    For any application,
    Go to the field catalog screen and click add new field button.
    Now just enter the field called Test and then Enter.
    Now it will say that "Field test doesnot exist in tables KOM, KOMK, KOMP* etc where * can change with the application.
    Your duty is to include your new fields in all these structures. This can be done with the help of a technical guy in SE11 or SE12. For example if you want to include a field called Item category, then include the field say ITCG in these structures in SE11/12. Make sure that the new field shd start with Z.
    Now for the structures to update this field with the item category of the material, the technical coding needs to be taken in some of the user exits like
    userexit_pricing_prepare_tkomp in the include program MV45AFZZ for order transactions in pricing or userexit_pricing_prepare_tkomp user exit in the include RV60AFZZ for billing transactions.
    For other applications,like outputs, etc, the user exit and the include may vary.
    Once this is done, during pricing, the new field will be updated with the value in the pricing communication structures as per the code written in the includes, and using that value, we can base our condition records.
    Reward points if it helps you.
    If you need further info, please let me know.

  • Purchase contract Net Price

    Hello all,
    Is there a FM to determine the net price of the purchase contract.
    The field EKPO-NETPR works fine when only one condition extist, but if u create a new one with a new validity of dates the EKPO-NETPR does not get updates.
    So what i need is a FM to determine the NETPR from the current condition values.
    Thank you
    Nuno SIlva

    try this program .. it retreive tax.. i think the structure taxcom will also give you net price
    REPORT zreport10 .
    TABLES : ekko , ekpo , t001 , komk , komp .
    DATA mwsbp TYPE komp-mwsbp .
    PARAMETERS : p_ebeln TYPE ekpo-ebeln ,
                 p_ebelp TYPE ekpo-ebelp .
    START-OF-SELECTION .
      PERFORM calculate_tax USING p_ebeln p_ebelp CHANGING mwsbp .
      WRITE mwsbp .
    *       FORM calculate_tax                                            *
    FORM calculate_tax USING    p_ebeln TYPE ekpo-ebeln
                                p_ebelp TYPE ekpo-ebelp
                       CHANGING p_mwsbp TYPE komp-mwsbp .
      CONSTANTS: bstyp-info VALUE 'I',
                 bstyp-ordr VALUE 'W',
                 bstyp-banf VALUE 'B',
                 bstyp-best VALUE 'F',
                 bstyp-anfr VALUE 'A',
                 bstyp-kont VALUE 'K',
                 bstyp-lfpl VALUE 'L',
                 bstyp-lerf VALUE 'Q'.
      DATA : taxcom TYPE taxcom ,
             t_konv TYPE TABLE OF komv WITH HEADER LINE .
      DATA: BEGIN OF tkomv OCCURS 50.
              INCLUDE STRUCTURE komv.
      DATA: END OF tkomv.
      DATA: BEGIN OF tkomvd OCCURS 50. "Belegkonditionen
              INCLUDE STRUCTURE komvd.
      DATA: END OF tkomvd.
      DATA : BEGIN OF tkomvh OCCURS 50.
              INCLUDE STRUCTURE komv.
      DATA : vtext LIKE t685t-vtext.
      DATA : END OF tkomvh.
      SELECT SINGLE *
        INTO ekko
        FROM ekko
       WHERE ebeln = p_ebeln .
      SELECT SINGLE *
         INTO ekpo
         FROM ekpo
        WHERE ebeln = p_ebeln
          AND ebelp = p_ebelp .
      SELECT SINGLE *
        INTO t001
        FROM t001
       WHERE bukrs = ekko-bukrs .
      taxcom-bukrs = ekpo-bukrs.
      taxcom-budat = ekko-bedat.
      taxcom-waers = ekko-waers.
      taxcom-kposn = ekpo-ebelp.
      taxcom-mwskz = ekpo-mwskz.
      taxcom-txjcd = ekpo-txjcd.
      taxcom-shkzg = 'H'.
      taxcom-xmwst = 'X'.
      IF ekko-bstyp EQ bstyp-best.
        taxcom-wrbtr = ekpo-netwr.
      ELSE.
        taxcom-wrbtr = ekpo-zwert.
      ENDIF.
      taxcom-lifnr = ekko-lifnr.
      taxcom-land1 = ekko-lands.
      taxcom-ekorg = ekko-ekorg.
      taxcom-hwaer = t001-waers.
      taxcom-llief = ekko-llief.
      taxcom-bldat = ekko-bedat.
      taxcom-matnr = ekpo-ematn.
      taxcom-werks = ekpo-werks.
      taxcom-bwtar = ekpo-bwtar.
      taxcom-matkl = ekpo-matkl.
      taxcom-meins = ekpo-meins.
      IF ekko-bstyp EQ bstyp-best.
        taxcom-mglme = ekpo-menge.
      ELSE.
        IF ekko-bstyp EQ bstyp-kont AND ekpo-abmng GT 0.
          taxcom-mglme = ekpo-abmng.
        ELSE.
          taxcom-mglme = ekpo-ktmng.
        ENDIF.
      ENDIF.
      IF taxcom-mglme EQ 0.
        taxcom-mglme = 1000.
      ENDIF.
      taxcom-mtart = ekpo-mtart.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CALL FUNCTION 'J_1BSA_COMPONENT_ACTIVE'
           EXPORTING
                bukrs                = ekko-bukrs
                component            = 'BR'
           EXCEPTIONS
                component_not_active = 1
                OTHERS               = 2.
      IF sy-subrc IS INITIAL.
        komk-mandt = ekko-mandt.
        komk-kalsm = ekko-kalsm.
        IF ekko-kalsm = ''.
          komk-kalsm = 'RM0000'.
        ENDIF.
        komk-kappl = 'M'.
        komk-waerk = ekko-waers.
        komk-knumv = ekko-knumv.
        komk-lifnr = ekko-lifnr.
        komp-kposn = ekpo-ebelp.
        komp-matnr = ekpo-matnr.
        komp-werks = ekpo-werks.
        komp-matkl = ekpo-matkl.
        komp-infnr = ekpo-infnr.
        komp-evrtn = ekpo-konnr.
        komp-evrtp = ekpo-ktpnr.
        CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
             EXPORTING
                  comm_head_i = komk
                  comm_item_i = komp
                  language    = 'E'
             TABLES
                  tkomv       = tkomv
                  tkomvd      = tkomvd.
        CALL FUNCTION 'J_1B_NF_PO_DISCOUNTS'
             EXPORTING
                  i_kalsm = ekko-kalsm
                  i_ekpo  = ekpo
             IMPORTING
                  e_ekpo  = ekpo
             TABLES
                  i_konv  = t_konv.
        IF NOT ekko-llief IS INITIAL.
          taxcom-lifnr = ekko-llief.
        ENDIF.
      ENDIF.
      CALL FUNCTION 'FIND_TAX_SPREADSHEET'
           EXPORTING
                buchungskreis = t001-bukrs
           EXCEPTIONS
                not_found     = 1
                OTHERS        = 2.
      CALL FUNCTION 'CALCULATE_TAX_ITEM'
           EXPORTING
                i_taxcom            = taxcom
           IMPORTING
                e_taxcom            = taxcom
           EXCEPTIONS
                mwskz_not_defined   = 1
                mwskz_not_found     = 2
                mwskz_not_valid     = 3
                steuerbetrag_falsch = 4
                country_not_found   = 5
                OTHERS              = 6.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      p_mwsbp = taxcom-wmwst  .
    ENDFORM.                    " calculate_tax

  • Proforma Invoice - Condition Table Assignment.

    We have Proforma Invoice with COndition table.Now the Problem is that ,this condition dsnt available in the Previous Documents.That means it is dirctly attached to Billing Documnt.Can any one help me out ,that whr would be the configuration of this assignment.
    Viru.

    Hi Viru
    Check KOMK , KOMP structures and KONV table also
    Regards
    Srinath

  • Cannot find a field for creating a condition table

    Hi all,
    I m trying to create a shipment scenarios which involves shipment cost based on prices,boxes,material....etc. to start with i tried to create a condition table, here the key combination needs to have the filed 'boxes' in it. I am not able to find it even in the master table. Is there any other place whr i can find it or how can i add this into the list?(master table)
    any input is highly appreciated.
    regards/aryan.

    Hi
    Try to ad the filed from the field catalog ,In case the required combination field is not there u can add the field through the following process to filed catalog and create the condition table.
    It is most common that one or other time we need to use this function while configuring multi tasking & complex Pricing Architecture.
    Here Aim giving a simple guide to add fields to the Pricing Field Catalogues:
    For example you want to use field PSTYV ('Sales document item category') that is included in structure KOMP ('Pricing Communication Item') as a key for a condition table.
    When you create a condition table (Transaction V/03), however, the system does not propose the field in the field catalog.
    Condition access, field catalog, allowed fields, KOMG, KOMK, KOMP, KOMPAZ, KOMKAZ, PSTYV are the other terms which we need to know about, to add Fields.
    Reason and Prerequisites
    For technical reasons, field PSTYV was included in structure KOMP, however, not in structure KOMG ('Allowed Fields for Condition Structures').
    Proceed as follows:
    1. Call up the ABAP Dictionary (Transaction SE11) and create data type ZZPSTYV. Choose PSTYV as a domain.As a short text, you can use, for example, 'ZZ - sales document item category' and as a field label, you can use the field labels of PSTYV.Save, check and activate your entries.
    2. Call up structure KOMPAZ in the ABAP Dictionary (Transaction SE11) in the change mode and make the following entry:
    Component Component type
    ZZPSTYV ZZPSTYV
    Save, check and activate the change you made.
    3. Note:Because of the change in structure KOMPAZ, field ZZPSTYV is now known in structures KOMG and KOMP because structure KOMPAZ is included in both structures.
    4. Call up Transaction SPRO. Navigate to 'Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control' and execute 'Define Condition Tables'.
    Choose 'Conditions: Allowed fields' and include ZZPSTYV as a new entry.
    5. Note:Now you can use field ZZPSTYV as a key field when you create a condition table Axxx.
    6. Supply the new field you defined by including the following source code line in USEREXIT_PRICING_PREPARE_TKOMP:
    MOVE xxxx-PSTYV TO TKOMP-ZZPSTYV.
    In order processing you find the user exit in Include MV45AFZZ, and in billing document processing you find it in Include RV60AFZZ.
    Consider that you can also use this note as a help if you want to use other customer-specific fields as key fields in a condition table.
    For header fields, use structure KOMKAZ instead of structure KOMPAZ and USEREXIT_PRICING_PREPARE_TKOMK instead of USEREXIT_PRICING_PREPARE_TKOMP.
    For more information, see Transaction SPRO via the path 'Sales and Distribution -> System Modifications -> Create New Fields (Using Condition Technique) -> New Fields for Pricing' and OSS Note 21040.

  • Billing Indicator - Question

    Hi All,
    Happy New Year.
    I have configured a new output type for E-mail. This output type is hooked up with an Access Seq which has Condition table (Fields are: Sales Org, Bill Type, and Billing Indicator). The output type is getting determined fine and the overall process is working fine.
    Issue - Requirement is to maintain the Billing Indicator at the Sold To level for E-mail Customers. But when processed the billing indicator is being pulled from Payer insted of Sold To level. For customers with same Sold to/Bill to/Payer/Ship to, this works fine. But for customers where they have different payer than the sold To and have different Billing indicator, it's causing the problem. We can't change the billing indicator of payer to E-mail. This has to be maintained at the Sold To leve.
    I am looking to confirm if there is any way to force the system to pull/check the billing indicator from Sold To instead of payer?
    Any Help is greatly appreciated.
    Thanks.
    Irfan

    Irfan,
    There is an issue with the condition table.
    The standard field "Billing Indicator" may refer to the Billing Indicator of the payer in the invoice document. The field also refers to the billing indicator of the payer, instead of sold to party.
    You can enable this by creating a new field called "SP Billing Indicator" say example ZZ_BLIN. Append this field in the structures KOMG( KOMK, KOMP). Also you have take up a coding USEREXIT_PRICING_PREPARE_TKOMP in the include RV60AFZZ. In this include you have to write a small piece of code which says that
    MOVE KNVP-ZZBLIN to TKOMP-ZZBLIN where KNVP-KUNNR = VBRK-KUNAG(Sold to party)
    Once this code is written, you can create a new condition table and include the table in access sequence and now try your test. It should work fine

  • Pricing gap issue

    Hi
    Experts,
       As we are in to implementation of a project, the thing is i just want to have few gaps which were a solved earlier in pricing so that i can have some idea about it . I would be greatful if u could send me some gaps  in pricing which were filled .
    thanks

    Any pricing condition key combination, which doesnt available in pricing field catelog, you need to add / append these fields in pricing communication structure(KOMG) & transfer to Header / Item level pricing tables such as KOMP / KONK.
    eg: Freight capture , depends on
    " Incoterms / shipping conditions / dep. zone / destination zone / forwarding agent & Zfield"
    then , Zfield is not available while creating cond table. so field has to be created in KOMG first. once its available in KOMK/KOMP , create cond table.
    " adding new fields in pricing & trasferring to transaction" , search in forum will find earlier threads with very good explanation.

  • User exits used in sales and distribution?

    i need  some  user exits   that we commonly  used in sd. please if  somebody has  worked on  user exits . and  how  are  they used..
    points will be awarded  to all  for replying...
    thanks in advance
    Neha.

    Hi refer below
    It is most common that one or other time we need to use this function while configuring multi tasking & complex Prcing Architecture.
    Here Iam giving a simple guide to add fields to the Pricing Field Catalogues:
    For example you want to use field PSTYV ('Sales document item category') that is included in structure KOMP ('Pricing Communication Item') as a key for a condition table.
    When you create a condition table (Transaction V/03), however, the system does not propose the field in the field catalog.
    Condition access, field catalog, allowed fields, KOMG, KOMK, KOMP, KOMPAZ, KOMKAZ, PSTYV are the other terms which we need to know about, to add Fields.
    Reason and Prerequisites
    For technical reasons, field PSTYV was included in structure KOMP, however, not in structure KOMG ('Allowed Fields for Condition Structures').
    Proceed as follows:
    1. Call up the ABAP Dictionary (Transaction SE11) and create data type ZZPSTYV. Choose PSTYV as a domain.As a short text, you can use, for example, 'ZZ - sales document item category' and as a field label, you can use the field labels of PSTYV.Save, check and activate your entries.
    2. Call up structure KOMPAZ in the ABAP Dictionary (Transaction SE11) in the change mode and make the following entry:
    Component   Component type
    ZZPSTYV     ZZPSTYV
    Save, check and activate the change you made.
    3. Note:Because of the change in structure KOMPAZ, field ZZPSTYV is now known in structures KOMG and KOMP because structure KOMPAZ is included in both structures.
    4. Call up Transaction SPRO. Navigate to 'Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control' and execute 'Define Condition Tables'.
    Choose 'Conditions: Allowed fields' and include ZZPSTYV as a new entry.
    5. Note:Now you can use field ZZPSTYV as a key field when you create a condition table Axxx.
    6. Supply the new field you defined by including the following source code line in USEREXIT_PRICING_PREPARE_TKOMP:
                  MOVE xxxx-PSTYV TO TKOMP-ZZPSTYV.
    In order processing you find the user exit in Include MV45AFZZ, and in billing document processing you find it in Include RV60AFZZ.
    Consider that you can also use this note as a help if you want to use other customer-specific fields as key fields in a condition table.
    For header fields, use structure KOMKAZ instead of structure KOMPAZ and USEREXIT_PRICING_PREPARE_TKOMK instead of USEREXIT_PRICING_PREPARE_TKOMP.
    For more information, see Transaction SPRO via the path 'Sales and Distribution -> System Modifications -> Create New Fields (Using Condition Technique) -> New Fields for Pricing' and OSS Note 21040.
    USEREXIT
      Userxits allow us to add our own functionality to SAP standard program
    without  modifying it . These are implemented in the form of subroutines and hence are also known as FORM EXITs. The userexits are generally collected in includes and attached to the standard program by the SAP.
        All Userexits start with the word USEREXIT_...
    FORM USEREXIT_..
    z..
    ENDFORM.
    The problem lies in finding the correct userexit and how to find it if one exists for the purpose. Once the correct userexit is found the necessary
    customer code is inserted in the customer include starting with the z..
    in the form routine.
    e.g. USEREXIT_SAVE_DOCUMENT_PREPARE
    Certain application like SD still provide this form of enhancement using userexit but this practice is no longer being followed for newer extensions
    instead they are using EXITs which come bundeled in enhancement packages . Neverthiless existing USEREXITS will be supported by SAP an all the newer versions of SAP.
    HOW TO FIND USEREXITS
      Userexits can be found in number of ways:
    1) To find userexits in SD module , goto object navigator(SE80) and select
        development class from the list and enter VMOD in it. All of the userexits in SD are contained in the development class VMOD. Press
    enter and you will find all the includes which contain userexits in SD for
    different functions like PRICING, ORDER PROCESSING etc. Select the userexit according to the requirement and read the comment inserted in it
    and start coding .
    Some examples of userexits in SD(SALES & DISTRIBUTION ) are:
    1)ADDING OF NEW FIELDS IN PRICING  
    In Pricing in SD the fields on the basis of which pricing is done are derived from the FIELD CATALOG which is a structure KOMG .This structure is used to transfer transaction data to the pricing procedure in SD and is also known as communication structure.This structure KOMG consists of two tables KOMK for Header related fields and KOMP for item related fields.
       The fields which are not in either of the two tables KOMK and KOMP
    cannot be used in pricing .Sometimes a need arises when the pricing
    is to be based on some other criteria which is not present in the form of fields in either of the two tables.
      This problem can be solved by using USEREXITS which are provided for pricing in SD.
      Pricing takes place both when the SALES ORDER ( Transaction VA01) is created as well as when INVOICING ( Transaction VF01) is done.Hence SAP provides 2 userexits ,one for sales order processing which is
    USEREXIT_PRICING_PREPARE_TKOMP  or
    USEREXIT_PRICING_PREPARE_TKOMK
    Depending upon which table (KOMK or KOMP) the new fields were inserted we use either of the above two userexits.These userexits are found in include MV45AFZZ of the standard SAP sales order creation program SAPMV45A.
    In the case of userexit which will be called when invoicing is done ,these
    are provided in the include RY60AFZZ which is in the standard SAP
    program SAPMV45A. The name of the userexits are same. i.e
    USEREXIT_PRICING_PREPARE_TKOMP  or
    USEREXIT_PRICING_PREPARE_TKOMK
    These userexits are used for passing the data from the communication structure to the pricing procedure, for this we have to fill the newely
    created field in the communication structure KOMG for this we fill the code in the above userexit using the MOVE statement after the data that
    has to be passed is taken from the database table by using the SELECT statement. The actual structure which is visible in these userexits and which is to be filled for that particular field is TKOMP or TKOMK.
    Before the coding for these userexits is done ,it is necessary to create a new field in either of the two tables KOMK or KOMP .For this purpose
    includes are provided in each of them .
    To create the field in header data(KOMK) the include provided is KOMKAZ
    and to create the field in item data(KOMP) the include provided is KOMPAZ.
    One possible example for the need of creating new fields can be e.g. Frieght to be based upon transportation zone ,for this no field is available in field catalog and hence it can be created in KOMK and then above userexits can be used to fill the transportation data to it.
    2)The other method of finding userexit is to find the word USEREXIT in the
    associated program of the transaction for which we want to determine userexit using SE38.
    3)The other method of finding userexits is to find the include in case of SD/MM applications where the userexits are located ,this can be found in the SAP reference IMG generally in the subfolder under SYSTEM MODIFICATION.
    Some other examples of userexits in SD are:
    USEREXIT_NUMBER_RANGE
    This userexit is used to assign a different internal document number to the
    sales order(VA01) when it is created depending on some criteria like a different SALES ORGANIZAION(VKORG) .
    USEREXIT_SAVE_DOCUMENT_PREPARE
    This userexit is used to insert the ABAP code which will be called when
    the document (sales order VA01) is just about to be saved.This userexit is used generally for custom checks on different fields , to display some information before the order will be saved or for making changes to certain fields before the sales order will be saved.
    Exits & Enhancements
    There are mainly six types of EXITs in sap which have been collected in the form of enhancement packages and attached to standard code in SAP.
    These are different from USEREXIT in the way that they are implemented
    in the form of FUNCTIONs while in USEREXITS we use form routines for their implementation. These are also sometimes known as function exits .
       These start from the word EXIT_ followed by the program name and then followed by a three digit number.
    e.g.  EXIT_SAPMV45A_002
      This exit is found in SD in enhancement V45A0002.
    TYPES OF EXITS
    1)MENU EXITS
    2)FUNCTION EXITS
    3)TABLE EXITS
    4)SCREEN EXITS
    5)KEYWORD EXITS
    6)FIELD EXITS
    We use SAP transactions CMOD and SMOD to manage exits. Before implementing an exit , it is required to create the project by using CMOD
    selecting the enhancement e.g. V45A0002 and selecting the component
    (one which fulfills our need) i.e the exit which will be implemented in SMOD and after coding has been done the project has to be activated.
      An exit can be coded only once.
    FUNCTION EXITS
      These are used to add functionality through ABAP code . These start from the word EXIT_programname_NNN ending in a 3 digit number. No access code is required to implement any tupe of exit including function exits.
       The function exits are called from the standard SAP program in the form
    of ABAP statement
    CALL CUSTOMER-FUNCTION 'NNN'
    This is in contrast to USEREXITs where PERFORM statement is used to call
    the required userexit.
    To implement the FUNCTION EXITs first of all the project is created and a suitable enhancement package is selected and from its compnents the function exit to be implemented is selected and on double clicking it the exit code will appear in ABAP EDITOR(se38) where a Z include will be found and the customer code should be entered in this include.
    e.g.
    ADDING A DEFAULT SOLD-TO-PARTY in Sales Order Creation
        To show a default sold-to-party in this field when the user creates a sales order (VA01) we can use a function exit .This function exit is located
    in enhancement no V45A0002 . Before we can choose the exit we have to
    create a project in CMOD after that enter V45A0002 in the enhancement field and click on the components . In the components you will see the
    exit EXIT_SAPMV45A_002 . This exit is used for our purpose.
      Double clicking on this exit will takes us to function builder (SE37) . This
    function exit has one exporting parameters and two importing parameters, we are interested in exporting parameter which is  E_KUNNR
    of type KNA1-KUNNR i.e if we move the desired customer name to this
    structure(E_KUNNR) it will be shown in the field as the default value when we create the sales order.
    This function also contains a customer include ZXVVA04 . This include
    will be used to write our custom code .
      Double clicking on this include and it will prompt us that this include does not exists do you want to create this object ,select yes and the include will be created .In this include we can write our own code that will fill the field E_KUNNR.
    e.g. E_KUNNR = 301.
    Activate the include and Activate the project. Now when ever the SALES ORDER will be created , sold-to-party field will come up with a predefined
    customer .
    FIELD EXITS
      The field exits are managed,created,activated through program RSMODPRF. The field exit is associated with a data element existing in ABAP dictionary and hence to the screen field using that data element.
      The format of field exit is :
    FIELD_EXIT_dataelement_A-Z or 0-9
       If a particular screen and program name is not specified than the field exit will effect all the screens containing that data element.
       The function module associated with field exit shows two parameters
    INPUT and OUTPUT.  Input parameter contains the data passed to the field exit when the field exit was invoked by the R/3 , We can write our own code to change the output parameter depending upon our requirements.
        Before the field exit can have any effect the system profile parameter
    ABAP/FIELDEXIT in all the application servers should be set to YES
    ABAP/FIELDEXIT = YES.

Maybe you are looking for

  • Apps showing in library but not showing up in devices i pod- sync apps list. ...pls help

    apps showing in library but not showing up in devices i pod- sync apps list. ...pls help id: [email protected]

  • How to trace other user's session?

    Dear Experts, I would like to trace other user's session, I am on Oracle 10g R2 (10.2.0.4) on a Windows box. I did search on google and found tons of articles explaining about tracing techniques. But unfortunately, trace file is not getting generated

  • Screen cutting to black

    Hi, recently my iphone screen has been cutting to black at random, for example if i open photos, snapchats, videos, facebook the screen with just shut off but the backlight will still be on and im having to press the lock button to lock it then again

  • Tracing of QR code (png picture) into a vector

    Hello I'm using Illustrator CS5 and I would like to trace the QR code I have (72 dpi) into a vector shape. I tried to use the tracing option of illustrator, but at some points the lines are kind of rounded, and I'm afraid it won't be readable in QR c

  • Process chain Name (description)

    when i have transported my existing PC (added few processes at the end) from DEV to Q, the PC name (disappeared) in both DEV and Q. How this could happen ? the Technical name (object name) is there on rt side, but the desc is missing. Secondly, the p