Convert Dimensionless UOM

Is it possible to convert a dimensionless UOM from the shopping cart to the RFX and PO? Example, EA in shopping cart, then ST in RFX and PO? I get an error when creating the PO. Error is "buffer table not up to date". We implemented sap note 1369693 but this did not solve the problem. Thanks!

Hi
Why you can request the item via BOX itself in the cart.
I believe it is describe procurement right.
If it is a product master it would have picked from UOM w.r.t material.
Does your business allow this or not?
is it allow the system to change the UOM in the BIDs?  i never tried.
for eg. what we ask the supplier has to give right
for examaple
we need one pen but supplier is trying to give 12 pens in one box.Why? control is from our side.
BR
Muthu

Similar Messages

  • Unable to determine factor for converting from UoM DR to UoM L

    Hi gurus,
    I ran into an GTS block for inbound delivery which states 'Unable to determine factor for converting from UoM DR to UoM L.'  Actually the PO linked to this inbound delivery was transferred succesfully.
    Per above error log, I checked product master, conversion rate for DR and L was maintained.   Could you shed lights where should I maintain for above error log?
    Thank you,
    Ryan

    Hello Ryan,
    There is one bug recently detected in the contex of IBD transfer, the problem is that the conversion factor isn't taken into account during the interface mapping in ERP side, SAP will provide a Note for this issue. To be more sure that you run into the exact same issue, please check wether cvqdp_flt in item of the inbound delivery is empty(/SAPSLL/CUIT-CVQDP_FLT).
    Thanks,
    Derek

  • SAP Function Module Converting Stock UoM to the Billing UoM of the material

    Hi Guys,
    I'm looking for an SAP Function Module that can handle the automatic conversion of a material's Stock Unit of Measure into its Billing Unit of Measure.
    Any idea? 
    Thank you in advance.
    -allex

    Hi,
         Check this Function module
    OIU_QCI_CALC_BILLING_QUANTTIES
    Regards
    Bala Krishna

  • Question about UoM conversion

    I'm trying to implement the UoM conversion that is now standard in BI 7.0.  I think I have all the backend work done, but I'm having trouble converting the UoM on the front end when running a query.
    Here's what I did on the backend to set it up.
    1- I went to 0MATERIAL (BEx Explorer tab) and entered 0BASE_UOM as the Unit field. 
    2 - I then generated the conversion ODS.
    3 - I created transformation to the ODS using 0MAT_UNIT_ATTR.  I did have to use a master data lookup for the BASE_UOM field (using the values in 0MATERIAL) since the 0MAT_UNIT_ATTR didn't have the Base Unit of Measure, just the conversion one.
    4 - Loaded the ODS for 1 material (test material 1 EA = 1 EA and 1 KIT = 20 EA)
    5 - Defined a Converstion type (trans RSUOM).  I used Dynamic Option 3 (InfoObject, then T006 tables).  I set the Source UoM = DataRecord, and Target is set to "Selection during Conversion"
    Here's what I did on the query:
    1. For my key figure, I went to the conversions tab.  I selected my Conversion type.
    2. I created a user entry variable with a default value of "EA".
    When I run my report, I enter KITS on the selection screen, but the report still shows eaches.  I can navigate to the Currency conversion on the report via the menus, but I can't find anywhere for Units.
    Any ideas?
    Thanks,
    Rudy

    First, is there any particular reason why you used:
    Integer a = Integer.valueOf(1);while I used
    Integer a = 1; //boxing
    Just to get rid of boxing conversion as a possible issue--which it shouldn't be, but might as well keep it simple.
    Integer a = Integer.valueOf(1);
    Comparable<String> cs1 = a; // errorbecause we are assigning to a Comparable<String> an
    Integer value, and that's illegal, since String and
    Integer are not in a subtype relation (?)Something like that, yes. I'm not sure of the exact clause of the JLS that forbids it.
    >
    Comparable<Integer> ci = a; // ok
    Comparable<String> cs2 = ci; // errorbecause we are assigning to a Comparable<String> a
    Comparable<Integer>, and again, String and Integer
    are not in a subtype relation (?)Yep.
    Comparable<String> cs3 = c1; // warning
    Comparable<String> cs4 = c2; // warningit's what I believe is called 'heap pollution' I forget what that term means, and am too lazy to look it up, so I'll take your word for it.
    and I
    believe that on first use a ClassCastException will
    be thrown Sounds right. Run it and see for yourself.
    (although the compiler behaves correctly by
    flagging an unchecked warning, for compatibility with
    legacy systems, etc)Right.

  • UOM Conversion while sending IDOC's using EDI

    Hi ,
      We are sending PO's using EDI and we want to convert the UOM while sending IDOC.
      EX:-   FT = FOT, VOL = VO
      Is there any config.
    Thanks in advace,

    No.. I am using the standard function module.
    We can cretae converion rule using SALE transaction for ALE.
    SALE> Modeling and Implementing Bus Procc> Convert Data Between Sender and Receiver..-->
    Like this do u we have any Config.. or shall I handle the conversion in the Customer exit ..

  • Converting Unit of Measure (not quantity)

    Hello All,
    I have an interesting issue that I am not sure how to address.  I have done some searching online and through the forums on how to convert unit of measure.  Nearly all of the returned entries pertained to converting FT to LB, and scenarios like that.
    My issue deals with the data in the EORD table.  I created a custom program to create/update numerous source lists using a BDC for transaction ME01.  This way the user can enter numerous materials and plants into one program one time, rather than create each source list individually.  One such source list has a value in field MEINS as GAL (Gallon).  However this is the converted value, this can be viewed in SE16n.  If I use SE16, or debug the program, I can see the value in MEINS as GLL.  This is the unconverted value.  Thus when I create the source list I get an error.
    I was wondering if there was a function module I could use to convert the UoM.  I know I could create logic to check the value of UoM and if it is incorrect to change it using a custom FM or even in the logic of the enhancement itself.  But this could change over time, meaning more units could be added requiring more logic changes.  If there was a standard FM I could use, I could implement it once and be done with it.
    So does anyone have any advice or know of an FM I could use?  I will continue to search for an answer and if I find one I will post.  If my question is confusing please let me know and I will clear up anything I can.
    Thanks for your help in advance.
    Regards,
    C.

    There is a conversion exit on unit of measure, "CUNIT" (via table T006A) use
    CONVERSION_EXIT_CUNIT_INPUT    Conversion exit for commercial (3-char) measurement unit INPUT
    CONVERSION_EXIT_CUNIT_OUTPUT   Conversion exit for commercial (3-char) measurement unit OUTPUT
    Regards

  • UOM Converion using converison type

    I have a scenario wherein I have to convert to UOM from the data record to CS based on the Material.
    Below are the steps i performed.
    1.) In the BEx tab of 0MATERIAL entered 0BASE_UOM for Base Unit of measure and also created UOM0MATE  DSO.
    2.) Loaded the UOM0MATE with 0MAT_UNIT_ATTR.
    3.) Developed a Conversion type with the following option..
         a.) Conversion Factors --- Using Reference Info Object -- 0MATERIAL
         b.) Source UOM --- UOM from the Data Record.
         c.) Target UOM --- Fixed UOM -
    CS
    4.) Devloped a Key Figure ZOR_CASE with CS as unit.
    5.) In trasformation for ZOR_CASE provided the source key figure and its unit and also give the conversion type.
    Now the problem is that when ever i load data the data load fails with an error "Conversion not possible".
    Could you please help me if I have missed some steps or doing something wrong.
    Thanks,
    Kapil

    Chandni,
    A very similar code like yours is working for me,. Please validate if 'BOX' exist in your T006 table (i presume it should exist).
      DATA: s_headerdata TYPE bapimathead.
      DATA: it_unitsofmeasure TYPE STANDARD TABLE OF bapi_marm.
      DATA: it_unitsofmeasurex TYPE STANDARD TABLE OF bapi_marmx.
      DATA: wa_unitsofmeasure TYPE bapi_marm.
      DATA: wa_unitsofmeasurex TYPE bapi_marmx.
      DATA: s_return TYPE bapiret2.
      s_headerdata-material = 'ZTEST'.
      s_headerdata-basic_view = 'X'.
      wa_unitsofmeasure-alt_unit = 'BOX'.
      wa_unitsofmeasure-denominatr = '1'.
      wa_unitsofmeasure-numerator = '6'.
      APPEND wa_unitsofmeasure TO it_unitsofmeasure.
      wa_unitsofmeasurex-alt_unit = 'BOX'.
      wa_unitsofmeasurex-denominatr = 'X'.
      wa_unitsofmeasurex-numerator = 'X'.
      APPEND wa_unitsofmeasurex TO it_unitsofmeasurex.
      CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
          headdata        = s_headerdata
        IMPORTING
          return          = s_return
        TABLES
          unitsofmeasure  = it_unitsofmeasure
          unitsofmeasurex = it_unitsofmeasurex.
      IF sy-subrc = 0.
      ENDIF.

  • UOM Conversion

    I have a scenario wherein I have to convert to UOM from the data record to CS based on the Material.
    Below are the steps i performed.
    1.) In the BEx tab of 0MATERIAL entered 0BASE_UOM for Base Unit of measure and also created UOM0MATE DSO.
    2.) Loaded the UOM0MATE with 0MAT_UNIT_ATTR.
    3.) Developed a Conversion type with the following option..
    a.) Conversion Factors --- Using Reference Info Object -- 0MATERIAL
    b.) Source UOM --- UOM from the Data Record.
    c.) Target UOM --- Fixed UOM -
    CS
    4.) Devloped a Key Figure ZOR_CASE with CS as unit.
    5.) In trasformation for ZOR_CASE provided the source key figure and its unit and also give the conversion type.
    Now the problem is that when ever i load data the data load fails with an error "Conversion not possible".
    Could you please help me if I have missed some steps or doing something wrong.
    Thanks,
    Kapil

    Krish,
    Thanks for your reply...
    I thought the flow would be like this..
    1.) When the data records comes in the sytem picks the source quantity and unit..
    2.) it goes to the conversion type.. and checks the DSO for 0MATERIAL.
    3.) then it picks the conversion factors based on the target unit and material no.
    4.) system converts the quantity based on the factor and the target unit..
    If we have to use the function module to convert the quantity field then whats the use of refernce object in conversion type...
    I am little confuse.. help me understand this..
    Thanks,
    Kapil

  • Material UOM function module in BW

    Is there a function module similar to MD_CONVERT_MATERIAL_UNIT in BW?  I need to convert some UOM in my start routine.
    thanks

    I do not think we have one in BW.
    We generally use factor value from T006 table and use them.

  • UOM conversion within a query

    Hello Experts,
    Is there anyway to convert the UOM within a report. I can see you can do currency conversion under query properties but I cannot see anything similar for UOM. Currently we have various UOM being reported for Stock on Hand our users want the flexibility of showing this in say Litres or Tons etc. at the time of reporting.
    Regards
    Fiona

    Hello Fiona,
    You can have the users select via the query variable window at runtime the target UOM that you wish to examine.
    For more information please see: http://help.sap.com/saphelp_nw04s/helpdata/en/43/03731ddc696e97e10000000a11466f/frameset.htm
    Thanks,
    Nick

  • Currency problem in BAPI_MATERIAL_SAVEDATA while uploading valuation class

    Hello Experts,
    I am uploading valuation class using BAPI_MATERIAL_SAVEDATA.
    While uploading it is showing runtime error "Unable to interpret KG as a number".
    I have used the FM CONVERSION_EXIT_CUNIT_INPUT to convert the UOM from the file to Field symbol.
    still the same. please guide me.
    I have pasted my code below.
    Kindly go through and help would be highly appreciated.
    *& Report  ZPRI_MAT_PRICE_UPLOAD
    REPORT  ZPRI_MAT_PRICE_UPLOAD no standard page heading line-size 150.
    tables : mbew,      " Material valuation
             makt,      " Material description
             mara.      " General material master
    data : begin of t_matvclass occurs 0,
           material type matnr,     " Material
           ind_sec type mbrsh,      " Industry sector
           mat_typ type mtart,      " Material type
           val_class type BKLAS,    " Valuation class
           MOV_PR TYPE VERPR,       " MOVING PRISE
           STD_PR TYPE STPRS,       " STANDARD PRISE
           base_uom like mara-meins,     " Material unit
           mat_desc type maktx,     " Material description - MAKTX
           plant type werks,        " Plant
           langu(2),
           end of t_matvclass.
    data : wa like line of t_matvclass.
    data: begin of it_makt occurs 0.
          include structure bapi_makt.
          data end of it_makt.
    data :bapi_head like bapimathead,     " Header Segment with Control Info
          bapi_clientdata like bapi_mara,    " Material Data at Client Level
          bapi_clientdatax like bapi_marax,  "Checkbox Structure
          bapi_valclass like BAPI_MBEW,      " Valuation class
          bapi_valclassx like BAPI_MBEWX,    " Checkbox Structure
    *      BAPI_MOVING_PR LIKE BAPI_MBEW,     "MOVING PRISE
    *      BAPI_MOVING_PRX LIKE BAPI_MBEWX,   "MOVING PRISE
    *      BAPI_STD_PRISE LIKE BAPI_MBEW,     "STANDARD PRISE
    *      BAPI_STD_PRISEX LIKE BAPI_MBEWX,   "STANDARD PRISE
          bapi_return like bapiret2,         " Bapi return structrue
          returnm type table of bapi_matreturn2 with header line.
    data : it_excel type alsmex_tabline occurs 0 with header line.
    data: begin of it_ret occurs 0.
           include structure bapiret2.
          data end of it_ret.
    * Data objects for exception handling.
    data : lv_converr type ref to CX_SY_CONVERSION_ERROR,
           lv_dynerr type ref to CX_SY_DYN_CALL_ERROR.
    data : txt_converr type string,
           txt_converr_l type string,
           txt_dynerr type string,
           txt_dynerr_l type string.
    data : char_uom(4) type c.    " Global UOM after conversion
    * Declaring selection screen for selecting a data file
    * for uploading valuation class
    selection-screen begin of block b1 with frame title text-001.
    parameter : file_nam type rlgrap-filename obligatory default
                  'C:\master data UPDATED_test.xls'.
    parameter : p_begcol type i default 1,        " no-display,
                p_begrow type i default 2,        "   no-display,
                p_endcol type i default 9,        " no-display,
                p_endrow type i default 267.      " no-display.
    *parameters: p_valare type mbew-bwkey obligatory.    " Valuation area
    selection-screen end of block b1.
    at selection-screen on value-request for file_nam.
    perform F_get_file using file_nam.
    start-of-selection.
    perform F_xls_itab using file_nam changing it_excel.
    perform F_move_data.
    *perform F_get_data.
    perform F_Display_data.
    *&      Form  F_xls_itab
    *       text
    *      -->P_FILE_NAM  text
    *      <--P_IT_EXCEL  text
    form F_xls_itab  using    p_file_nam changing p_it_excel.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file_nam
        i_begin_col                   = p_begcol
        i_begin_row                   = p_begrow
        i_end_col                     = p_endcol
        i_end_row                     = p_endrow
      tables
        intern                        = it_excel
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 2
       OTHERS                        = 3.
    endform.                    " F_xls_itab
    *&      Form  F_get_file
    *     Subroutine to get the file on F4
    *      -->P_FILE_NAM  text
    form F_get_file  using    p_file_nam.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
       PROGRAM_NAME        = SYST-REPID
       DYNPRO_NUMBER       = SYST-DYNNR
    *   FIELD_NAME          = ' '
    *   STATIC              = ' '
    *   MASK                = ' '
      CHANGING
        file_name           = file_nam
    EXCEPTIONS
       MASK_TOO_LONG       = 1
       OTHERS              = 2.
    endform.                    " F_get_file
    *&      Form  F_Display_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form F_Display_data .
    skip 2.
    *write:/2 'Valuation area :', p_valare.
    *write:/2 'Standard price :', p_stdprc.
    skip 2.
      write:/29 sy-uline(120).
      write:/29 sy-vline,
             30 'Material' color 1,               " Material - MATNR
             50 sy-vline, 'Ind_sector' color 1,   " Industry sector  - MBRSH
             62 sy-vline, 'Mat_typ' color 1,   " Material type - MTART
             75 sy-vline, 'Valuation class' color 1,  " Valuation class
             85 sy-vline, 'Base UOM' color 1,          " Base UOM
             95 sy-vline, 'Material Decp' color 1,     " Material descp
             120 sy-vline, 'Mov Price',                 " Moving price
             130 sy-vline, 'Std Price',                 " Standard price
             140 sy-vline, 'Plant',                     " Plant
             150 sy-vline.
      write:/29 sy-uline(120).
    loop at t_matvclass into wa.
      write:/29 sy-vline,
             30 wa-material color 2,               " Material - MATNR
             50 sy-vline,
             55 wa-ind_sec color 2 right-justified, " Industry sector
             62 sy-vline,
             66 wa-mat_typ color 2,                " Material type - MTART
             75 sy-vline,
             78 wa-val_class color 2 right-justified, " Valuation class
             85 sy-vline,
             88 wa-base_uom color 2 right-justified,  " Base UOM
             95 sy-vline,
             98 wa-mat_desc color 2 left-justified,  " Material Desc
             120 sy-vline, wa-MOV_PR,                 " Standard price
             130 sy-vline, wa-STD_PR,                 " Moving price
             140 sy-vline, wa-plant,                     " Plant
             150 sy-vline.
    endloop.
    write:/29 sy-uline(64).
    endform.                    " F_Display_data
    *&      Form  F_move_data
    *      Subroutine to move data from excel to internal table
    *  -->  p1        text
    *  <--  p2        text
    form F_move_data .
    data : lv_index type i.
    field-symbols <fs>.
    * Sorting the internal table
    sort it_excel by row col.
    clear it_excel.
    loop at it_excel.
      move it_excel-col to lv_index.
    * Assigning each record to the internal table row.
      assign component lv_index of structure wa to <fs>.
    * Assigning the field value to a field symbol
    if lv_index eq 5.
    CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
      EXPORTING
        INPUT                = it_excel-value
       LANGUAGE             = SY-LANGU
    IMPORTING
       OUTPUT               = char_uom.
    ** Moving the converted UOM to  field symbol
    move char_uom to <fs>.
    else.
       move it_excel-value to <fs>.
    endif.
      at end of row.
      append wa to t_matvclass.
      clear wa.
      endat.
    endloop.
    endform.                    " F_move_data
    *&      Form  F_get_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form F_get_data .
    loop at t_matvclass into wa.
    try.
    * BAPIHEAD --- > Header Segment with Control Information
    bapi_head-material = wa-material.
    bapi_head-ind_sector = wa-ind_sec.
    bapi_head-matl_type = wa-mat_typ.
    bapi_head-account_view = 'X'.
    * For Clien Data
    bapi_clientdata-BASE_UOM = wa-base_uom.
    bapi_clientdatax-base_uom = 'X'.
    bapi_clientdatax-base_uom_iso = 'X'.
    * For Valuation Class.
    bapi_valclass-val_area = wa-plant.
    bapi_valclass-val_class = wa-val_class.
    bapi_valclass-std_price = wa-STD_PR.
    bapi_valclass-MOVING_PR = wa-MOV_PR.
    * For Valuation Class control checkbox.
    bapi_valclassx-val_area = wa-plant.
    bapi_valclassx-val_class = 'X'.
    bapi_valclassx-std_price = 'X'.
    bapi_valclass-MOVING_PR = 'X'.
    refresh it_makt.
    wa-langu = SY-LANGU.
    it_makt-langu = wa-langu.
    it_makt-matl_desc = wa-mat_desc.
    append it_makt.
    clear it_ret.
    refresh it_ret.
    if t_matvclass[] is initial.
      write:/ 'Cannot be updated'.
    else.
    perform F_call_bapi.
    endif.
    catch CX_SY_CONVERSION_ERROR into lv_converr.
       txt_converr = lv_converr->get_text( ).
       txt_converr_l = lv_converr->get_longtext( ).
       write:/ 'Error:', txt_converr color 5.
       write:/ 'Error:', txt_converr_l color 3.
    endtry.
    endloop.
    endform.                    " F_get_data
    *&      Form  F_bapi_commit
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form F_bapi_commit.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    * EXPORTING
    *   WAIT          =
    * IMPORTING
    *   RETURN        =
    if sy-subrc eq 0.
      write:/2 ' Transaction commited' color 4.
    else.
      write:/2 'Unable to commit the transaction' color 4.
    endif.
    endform.                    " F_bapi_commit
    *&      Form  F_call_bapi
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form F_call_bapi .
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
        headdata                  = bapi_head
        CLIENTDATA                 = bapi_clientdata
        CLIENTDATAX                = bapi_clientdatax
        VALUATIONDATA              = bapi_valclass
        VALUATIONDATAX             = bapi_valclassx
    IMPORTING
       RETURN                     = it_ret
    TABLES
       MATERIALDESCRIPTION        =  it_makt
       RETURNMESSAGES        =  returnm.
       IF it_ret-type eq 'E' or it_ret-TYPE eq 'S'.
         Write:/1 it_ret-type,
                8 it_ret-id,
                30 it_ret-number,
                38 it_ret-message,
                190 it_ret-parameter,
                210 it_ret-row,
                220 it_ret-field.
       endif.
    endform.                    " F_call_bapi
    Regards,
    Ranjith N

    resloved.
    issue with the internal table structrue.

  • Cross-company stock transfer with delivery function!

    Dear friends:
          I have a problem to borther u,I create stock transfer order with type 'NB',and then create delivery by T-CODE:VL10B with reference to the transfer order,but the log show the following error message:
       1030000484 000010 Sales unit  is not valid for item 000010
       Diagnosis
        The sales unit is not allowed for the material in item
        000010.
    System Response
        The system does not allow further processing of this item.
    Procedure
        Check your entry.
        Select a sales unit which is defined for the material in the
        material master record. Normally the sales unit will be
        determined immediately from the master master record.
    I really don't know how to deal it.
    thanks.

    UOM is in which stocks of the material are managed. The system converts all the quantities you enter in other units of measure to the base unit of measure.
    In the material master [MM02] check as to what is the base unit of measurement in the Sales Org1 tab and Purchasing tab. It seems that both these would be different as the system is not able to convert the UOM from Purchsing unit to the sales unit.
    Next, click the button for 'Additional data' [CTRL+F6], tab Unit of measure and enter the conversion for the UOM.
    For more details refer to the link below.
    <a href="http://help.sap.com/saphelp_46c/helpdata/en/ff/516a6749d811d182b80000e829fbfe/frameset.htm">UOM Details</a>
    In the link, follow the path Material Master Records-Additional Data-Units of measure.
    Regards,
    Gauravjit.
    Reward points if the solution is helpful

  • Error in Inbound IDoc processing

    Hi all,
    While processing Inbound delivery IDocs(Status 64), we are getting an error "Cannot convert Dimensionless Units".
    Please help.
    Regards,
    SP.

    Hi Vijay,
    The IDoc is a Delivery IDoc. The OSS Note that you have sent is for a similar error but is related to APO systems and hence I don't think it is related.
    Has anyone encountered this error before...?
    It says 'Conversion of dimensionless units is not possible'....
    Regards,
    SP.

  • Check boxes in ALV report

    Can any one please give me any test program for displaying checkboxes in the ALV Report Layout .
    Points will be rewarded even for helpfull answers.
    Thanks ,
    Veerendranath Maddula.

    Hi Veerendranath,
    below is the sample code for that,
    TYPES:
           BEGIN OF TY_VB_AKAP,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             POSNR      TYPE POSNR_VA,                       "Item Number
             MATNR      TYPE MATNR,                          "Material Number
             PMATN      TYPE PMATN,                          "Pricing Reference Material/Newly Created Material
             KWMENG     TYPE KWMENG,                         "Cumulative Order Qty. in Sales Units
             VRKME      TYPE VRKME,                          "Sales Unit
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             VKAUS      TYPE ABRVW,                          "Usage Indicator
             WAERK      TYPE WAERK,                          "SD Document Currency
           END   OF TY_VB_AKAP,
           BEGIN OF TY_MARA,
             MATNR      TYPE MATNR,                          "Material Number
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
           END   OF TY_MARA,
           BEGIN OF TY_MVKE,
             MATNR      TYPE MATNR,                          "Material Number
             VKORG      TYPE VKORG,                          "Sales Organization
             VTWEG      TYPE VTWEG,                          "Distribution Channel
             KONDM      TYPE KONDM,                          "Material Pricing Group
    *--Begin of changes for the change request 2007096--26th July 2007--
             VRKME      TYPE VRKME,                          "Sales Unit according to the Material Master
    *--End   of changes for the change request 2007096--26th July 2007--
           END   OF TY_MVKE,
           BEGIN OF TY_VBKD,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             POSNR      TYPE POSNR_VA,                       "Item Number
             BSTKD_E    TYPE BSTKD_E,                        "Used to capture New Material Number
           END   OF TY_VBKD,
           BEGIN OF TY_IHEADER,
             SELECT(1)  TYPE C,                              "Check Box
             VBELN      TYPE VBELN,                          "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to Party
           END   OF TY_IHEADER,
           BEGIN OF TY_MESSAGE1,
            VKORG     TYPE VKORG,                            "Sales Organization
            VTWEG     TYPE VTWEG,                            "Distribution Channel
            KUNNR     TYPE KUNAG,                            "Customer number
            KONDM     TYPE KONDM,                            "Material pricing group
            ZCOUNT(2) TYPE N,                                "Zcount
            MSGTYP(1) TYPE C,                                "Message type
            TEXT      TYPE STRING,                           "Message text
           END   OF TY_MESSAGE1,
    *--Begin of changes for the change request 2007106--25th July 2007--
           BEGIN OF TY_MESSAGE1_2,
            VKORG     TYPE VKORG,                            "Sales Organization
            VTWEG     TYPE VTWEG,                            "Distribution Channel
            KUNNR     TYPE KUNAG,                            "Customer number
            KONDM     TYPE KONDM,                            "Material pricin
            MSGTYP(1) TYPE C,                                "Message type
            TEXT      TYPE STRING,                           "Message text
           END   OF TY_MESSAGE1_2,
    *--End   of changes for the change request 2007106--25th July 2007--
           BEGIN OF TY_MESSAGE2,
            VKORG     TYPE VKORG,                            "Sales Organization
            VTWEG     TYPE VTWEG,                            "Distribution Channel
            KUNNR     TYPE KUNAG,                            "Customer number
            MATNR     TYPE MATNR,                            "Material Number
            MSGTYP(1) TYPE C,                                "Message type
            TEXT      TYPE STRING,                           "Message text
           END   OF TY_MESSAGE2,
           BEGIN OF TY_IFINAL,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KWMENG     TYPE KWMENG,                         "Cumulative Order Qty. in Sales Units
             POSNR      TYPE POSNR_VA,                       "Item Number
             KUNNR      TYPE KUNAG,                          "Sold-to party
             MATNR      TYPE MATNR,                          "Material Number
             VRKME      TYPE VRKME,                          "Sales Unit
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             VKAUS      TYPE ABRVW,                          "Usage Indicator
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             PMATN      TYPE PMATN,                          "Pricing Reference Material/Newly Created Material
             KONDM      TYPE KONDM,                          "Material Pricing Group
    *--Begin of changes for the change request 2007096--26th July 2007--
             WAERK      TYPE WAERK,                          "SD Document Currency
    *--End   of changes for the change request 2007096--26th July 2007--
           END   OF TY_IFINAL,
           BEGIN OF TY_ACC1,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             KONDM      TYPE KONDM,                          "Material Pricing Group
             ZCOUNT(2)  TYPE N,                              "ZCount indicator
             KSTBM      TYPE KSTBM,                          "Quantity
             VRKME      TYPE VRKME,                          "Sales Unit
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             ERROR(1)   TYPE N,                              "Error Field
    *--Begin of changes for the change request 2007096--26th July 2007--
             WAERK      TYPE WAERK,                          "SD Document Currency
    *--End   of changes for the change request 2007096--26th July 2007--
           END   OF TY_ACC1,
    Important Note : Earlier there were only three accesses and hence this below type was coded as TY_ACC2 depicting
    the type for internal table as a holder of data for second access sequence, but later a new access sequence was
    introduced and was introduced as the second access by itself and hence the sequence which was previously considered
    as second access is going to be third access sequence in reality. The naming standards that are going to be followed
    for the newly introduced access sequence would be XXX_1_2. (For Change request 2007106)
           BEGIN OF TY_ACC2,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             MATNR      TYPE MATNR,                          "Material Number
             KSTBM      TYPE KSTBM,                          "Cumulative Order Qty. in Sales Units
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             VRKME      TYPE VRKME,                          "Sales Unit
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             ERROR(1)   TYPE N,                              "Error field
    *--Begin of changes for the change request 2007096--26th July 2007--
             WAERK      TYPE WAERK,                          "SD Document Currency
    *--End   of changes for the change request 2007096--26th July 2007--
           END   OF TY_ACC2,
    *--Begin of changes for the change request 2007106--24th July 2007--
           BEGIN OF TY_ACC1_2,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             KONDM      TYPE KONDM,                          "Material Pricing Group
             KSTBM      TYPE KSTBM,                          "Quantity
             VRKME      TYPE VRKME,                          "Sales Unit
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             ERROR(1)   TYPE N,                              "Error field
    *--Begin of changes for the change request 2007096--26th July 2007--
             WAERK      TYPE WAERK,                          "SD Document Currency
    *--End   of changes for the change request 2007096--26th July 2007--
           END   OF TY_ACC1_2,
    *--End   of changes for the change request 2007106--24th July 2007--
    *--Begin of changes for the change request 2007096--26th July 2007--
           BEGIN OF TY_T006,
             MSEHI      TYPE MSEHI,                          "Unit of Measurement
             ZAEHL      TYPE DZAEHL,                         "Numerator for conversion to SI unit
             NENNR      TYPE NENNR,                          "Denominator for conversion into SI unit
           END   OF TY_T006,
    *--End   of changes for the change request 2007096--26th July 2007--
    *--Begin of changes for the change request xxx--2nd Aug 2007--
    *Types of MARM table
           BEGIN OF TY_MARM,
             MATNR TYPE MATNR,                               " Material Number
             MEINH TYPE LRMEI,                               " Alternative Unit of Measure
             UMREZ TYPE UMREZ,                               " Numerator for Conversion to Base UOM
             UMREN TYPE UMREN,                               " Denominator for Conversion to Base UOM
           END   OF TY_MARM.
    *--End   of changes for the change request xxx--2nd Aug 2007--
       D A T A                                                           *
    Internal Table Declarations
    DATA: T_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,           "Fieldcatalog IT
          T_EVENTS       TYPE SLIS_T_EVENT,                  "Event IT
          T_HEADER       TYPE SLIS_T_LISTHEADER,             "Header IT
          T_VB_AKAP      TYPE STANDARD TABLE OF TY_VB_AKAP,  "To hold records from VBAK & VBAP Table
          T_MARA         TYPE STANDARD TABLE OF TY_MARA,     "To hold records from MARA Table
          T_MVKE         TYPE STANDARD TABLE OF TY_MVKE,     "To hold records from MVKE Table
          T_VBKD         TYPE STANDARD TABLE OF TY_VBKD,     "To hold records from VBKD Table
          T_IHEADER      TYPE STANDARD TABLE OF TY_IHEADER,  "To hold records from VBAK Table
          T_IFINAL       TYPE STANDARD TABLE OF TY_IFINAL,   "To hold cumulative data for ALV
          T_BDCDATA      TYPE STANDARD TABLE OF BDCDATA,     "IT for bdcdata
          T_BDCMSGCOLL   TYPE STANDARD TABLE OF BDCMSGCOLL,  "IT for error messages
          T_MESSAGE1     TYPE STANDARD TABLE OF TY_MESSAGE1, "IT for conditions1 messages
    *--Begin of changes for the change request 2007106--25th July 2007--
          T_MESSAGE1_2   TYPE STANDARD TABLE OF TY_MESSAGE1_2,"ITfor conditions1_2 messages
    *--End   of changes for the change request 2007106--25th July 2007--
          T_MESSAGE2     TYPE STANDARD TABLE OF TY_MESSAGE2, "IT for conditions2 messages
          T_ACC2         TYPE STANDARD TABLE OF TY_ACC2,     "IT for holding data for Second Access Sequence Processing
          T_ACC1         TYPE STANDARD TABLE OF TY_ACC1,     "IT for holding data for First Access Sequence Processing
          T_SELECT       TYPE STANDARD TABLE OF RSPARAMS,    "IT for holding data related to the selection screen
    *--Begin of changes for the change request 2007106--24th July 2007--
          T_ACC1_2       TYPE STANDARD TABLE OF TY_ACC1_2,   "IT for holding data for new intermediate Access Sequence
    *--End   of changes for the change request 2007106--24th July 2007--
    *--Begin of changes for the change request 2007096--26th July 2007--
          T_T006         TYPE STANDARD TABLE OF TY_T006,     "IT for holding T006 Entries
    *--End   of changes for the change request 2007096--26th July 2007--
    *--Begin of changes for the change request xxx--2nd Aug 2007--
          T_MARM         TYPE STANDARD TABLE OF TY_MARM,     "IT for holding entries from MARM
    *--End   of changes for the change request xxx--2nd Aug 2007--
    Work area Declarations
          W_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV,             "Fieldcatalog WA
          W_EVENT        TYPE SLIS_ALV_EVENT,                "Event WA
          W_HEADER       TYPE SLIS_LISTHEADER,               "Header WA
          W_LAYOUT       TYPE SLIS_LAYOUT_ALV,               "Layout WA
          W_KEYINFO      TYPE SLIS_KEYINFO_ALV,              "Key Information WA
          W_VB_AKAP      TYPE TY_VB_AKAP,                    "To hold records from T_VB_AKAP
          W_MARA         TYPE TY_MARA,                       "To hold records from T_MARA
          W_MVKE         TYPE TY_MVKE,                       "To hold records from T_MVKE
          W_VBKD         TYPE TY_VBKD,                       "To hold records from T_VBKD
          W_IHEADER      TYPE TY_IHEADER,                    "To hold records from T_IHEADER
          W_IFINAL       TYPE TY_IFINAL,                     "To hold records from T_IFINAL
          W_PARAMS       TYPE CTU_PARAMS,                    "CTU Params
          W_BDCDATA      TYPE BDCDATA,                       "Work Area for BDCDATA
          W_BDCMSGCOLL   TYPE BDCMSGCOLL,                    "Work Area to collect BDC Messages
          W_MESSAGE1     TYPE TY_MESSAGE1,                   "WA for price conditions1 messages
    *--Begin of changes for the change request 2007106--25th July 2007--
          W_MESSAGE1_2   TYPE TY_MESSAGE1_2,                 "WA for price conditions1_2 messages
    *--End   of changes for the change request 2007106--25th July 2007--
          W_MESSAGE2     TYPE TY_MESSAGE2,                   "WA for price conditions2 messages
          W_ACC2         TYPE TY_ACC2,                       "WA for holding records from T_ACC2
          W_ACC1         TYPE TY_ACC1,                       "WA for holding records from T_ACC1
    *--Begin of changes for the change request 2007106--24th July 2007--
          W_ACC1_2       TYPE TY_ACC1_2,                     "WA for holding records from T_ACC1_2
    *--End   of changes for the change request 2007106--24th July 2007--
    *--Begin of changes for the change request 2007096--26th July 2007--
          W_T006         TYPE TY_T006,                       "WA for holding T_T006 Entries
    *--End   of changes for the change request 2007096--26th July 2007--
    *--Begin of changes for the change request xxx--2nd Aug 2007--
          W_MARM         TYPE TY_MARM,                       "WA for holding entries of T_MARM
    *--End   of changes for the change request xxx--2nd Aug 2007--
    Variable declarations
          G_VKORG       TYPE VKORG,                          "Sales Organization
          G_VTWEG       TYPE VTWEG,                          "Distribution Channel
          G_AUDAT       TYPE AUDAT,                          "Document Date (Date Received/Sent)
          G_VBELN       TYPE VBELN_VA,                       "Sales Document
          G_KUNNR       TYPE KUNAG,                          "Sold-to party
          G_MATNR       TYPE MATNR,                          "Material Number
          G_REPID       TYPE SY-REPID,                       "Program Name
          G_MESSAGE(73) TYPE C,                              "To Capture Message
          G_FLAG1(1)    TYPE C,                              "Flag
          G_ANSWER(1)   TYPE C,                              "Optional Button
    *--Begin of changes for the change request 2007096--26th July 2007--
          G_NUM_SOURCE  TYPE DZAEHL,                         "Holds Numerator value for Source Unit of Measure
          G_NUM_TARGET  TYPE DZAEHL,                         "Holds Numerator value for Target Unit of Measure
          G_DEN_SOURCE  TYPE NENNR,                          "Holds Denominator value for Source Unit of Measure
          G_DEN_TARGET  TYPE NENNR.                          "Holds Denominator value for Target Unit of Measure
    *--End   of changes for the change request 2007096--26th July 2007--
    Constant declarations
    CONSTANTS:
          C_A(1)         TYPE C VALUE 'A',                    "Constant Value A
          C_S(1)         TYPE C VALUE 'S',                    "Constant Value S
          C_U(1)         TYPE C VALUE 'U',                    "Constant Value U
          C_X(1)         TYPE C VALUE 'X',                    "Constant Value X
          C_E(1)         TYPE C VALUE 'E',                    "Constant Value E
          C_I(1)         TYPE C VALUE 'I',                    "Constant Value I
          C_R(1)         TYPE C VALUE 'R',                    "Constant Value R
          C_B(1)         TYPE C VALUE 'B',                    "Document Category is Quotation
          C_HTNAME(10)   TYPE C VALUE 'T_IHEADER',            "Internal table for Header Data
          C_ITNAME(10)   TYPE C VALUE 'T_IFINAL',             "Internal Table with processed data
          C_Q2(2)        TYPE C VALUE 'Q2',                   "Constant Order Reason Q2
          C_100(3)       TYPE C VALUE '100',                  "Popup screen
          C_25(2)        TYPE C VALUE '25',                   "Popup screen
          C_5(1)         TYPE C VALUE '5',                    "Popup screen
          C_1            TYPE I VALUE  1,                     "Value 1 for Error Denotion
          C_2            TYPE I VALUE  2,                     "Value 2 for Error Denotion
          C_3            TYPE I VALUE  3,                     "Value 3 for BDC Error Denotion
          C_1000(4)      TYPE N VALUE 1000,                     "Value 1000
          C_01(2)        TYPE N VALUE '01',                   "Value 01 for Zcount
          C_VK11(4)      TYPE C VALUE 'VK11',                 "Transaction VK11
          C_DYNBEGIN(1)  TYPE C VALUE 'X',                    "Indicator
          C_UPDATE(1)    TYPE C VALUE 'S',                    "Update
          C_DISMODE(1)   TYPE C VALUE 'N',                    "Display
          C_Q3(2)        TYPE C VALUE 'Q3',                   "Quotation Approved
          C_ZBPR(4)      TYPE C VALUE 'ZBPR',                 "Condition Type ZBPR
    *--Begin of changes for the change request xxx--2nd Aug 2007--
          C_ZBPN(4)      TYPE C VALUE 'ZBPN',                 "Condition Type ZBPN
    *--End   of changes for the change request xxx--2nd Aug 2007--
          C_ERROR(5)     TYPE C VALUE 'ERROR'.                "Error screen title
       S E L E C T   O P T I O N S  &  P A R A M E T E R S               *
    Selection-screen Block 1
    SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
    PARAMETERS:     P_VKORG TYPE VKORG OBLIGATORY,           "Sales Organization
                    P_VTWEG TYPE VTWEG OBLIGATORY,           "Distribution Channel
                    P_SPART TYPE SPART DEFAULT '00'.         "Division
    SELECTION-SCREEN END OF BLOCK BLK1.
    SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS: S_AUDAT FOR G_AUDAT,                     "Document Date (Date Received/Sent)
                    S_VBELN FOR G_VBELN,                     "Sales Document
                    S_KUNNR FOR G_KUNNR,                     "Sold-to party
                    S_MATNR FOR G_MATNR.                     "Material Number
    PARAMETERS:     P_VKAUS(2) TYPE N.                       "Usage Indicator
    SELECTION-SCREEN END OF BLOCK BLK2.
      I N I T I A L I Z A T I O N                                        *
    INITIALIZATION.
      CLEAR : G_REPID.                                       "Program Name
      G_REPID = SY-REPID.                                    "Program Name
      A T   S E L E C T I O N   S C R E E N                              *
      CLEAR: G_VKORG,
             G_VTWEG.
    AT SELECTION-SCREEN ON P_VKORG.
      SELECT SINGLE VKORG INTO G_VKORG
                          FROM TVKO
                          WHERE VKORG EQ P_VKORG.
      IF SY-SUBRC NE 0.
        MESSAGE E000(ZS) WITH TEXT-021.
      ENDIF.
    AT SELECTION-SCREEN ON P_VTWEG.
      SELECT SINGLE VTWEG INTO G_VTWEG
                          FROM TVKOV
                          WHERE VKORG EQ P_VKORG
                            AND VTWEG EQ P_VTWEG.
      IF SY-SUBRC NE 0.
        MESSAGE E000(ZS) WITH TEXT-022.
      ENDIF.
      CLEAR: G_VKORG,
             G_VTWEG.
      S T A R T   O F   S E L E C T I O N                                *
    START-OF-SELECTION.
    Data Selection
      PERFORM DATA_RETRIEVAL.
    Build Field Catalog
      PERFORM BUILD_FIELDCATALOG.
    Bulid layout
      PERFORM BUILD_LAYOUT.
    Build Events
      PERFORM BUILD_EVENTS.
    Captures the Values of Selection Screen
      PERFORM CAPTURE_SCREEN.
      E N D   O F   S E L E C T I O N                                    *
    END-OF-SELECTION.
    Display List
      PERFORM DISPLAY_ALV_REPORT.
      F O R M S                                                          *
    *&      Form  DATA_RETRIEVAL
          Retrieves Data for ALV Display
    *--Begin of changes for the change request 2007106--25th July 2007--
    *--End   of changes for the change request 2007106--25th July 2007--
    FORM DATA_RETRIEVAL .
      DATA : L_VKAUS   TYPE VKAUS.            "Variable to hold Usage Indicator
      CLEAR L_VKAUS.
      SELECT VBELN
             KUNNR
        INTO CORRESPONDING FIELDS OF TABLE T_IHEADER
        FROM VBAK
        WHERE VBELN IN S_VBELN
          AND KUNNR IN S_KUNNR
          AND VKORG EQ P_VKORG
          AND AUDAT IN S_AUDAT
          AND VTWEG EQ P_VTWEG
          AND SPART EQ P_SPART
          AND AUGRU EQ C_Q2
          AND VBTYP EQ C_B.
      IF NOT T_IHEADER IS INITIAL.
        IF NOT P_VKAUS IS INITIAL.
    *--Begin of changes for the change request 2007106--25th July 2007--COMMENTED FROM HERE---
         IF P_VKAUS EQ C_1.    "IF Zcount is given as 1 then quotation without zcount should be picked
           "for whom Material Pricing Group should be given.
           SELECT A~VBELN
                  A~KUNNR
                  B~POSNR
                  B~MATNR
                  B~PMATN
                  B~KWMENG
                  B~VRKME
                  B~KZWI1
                  B~VKAUS
            INTO  TABLE T_VB_AKAP
            FROM  VBAK AS A
            JOIN  VBAP AS B
              ON  AVBELN EQ BVBELN
            FOR ALL ENTRIES IN T_IHEADER
            WHERE A~VBELN EQ T_IHEADER-VBELN
              AND B~MATNR IN S_MATNR.
         ELSE.
    *--End   of changes for the change request 2007106--25th July 2007--COMMENTED TILL HERE---
          CONCATENATE 'C' P_VKAUS INTO L_VKAUS.
          SELECT A~VBELN
                 A~KUNNR
                 B~POSNR
                 B~MATNR
                 B~PMATN
                 B~KWMENG
                 B~VRKME
                 B~KZWI1
                 B~VKAUS
    *--Begin of changes for the change request 2007096--26th July 2007--
                 A~WAERK
    *--End   of changes for the change request 2007096--26th July 2007--
           INTO  TABLE T_VB_AKAP
           FROM  VBAK AS A
           JOIN  VBAP AS B
             ON  AVBELN EQ BVBELN
           FOR ALL ENTRIES IN T_IHEADER
            WHERE A~VBELN EQ T_IHEADER-VBELN
              AND B~MATNR IN S_MATNR
              AND B~VKAUS EQ L_VKAUS.
         ENDIF.
        ELSE.
          SELECT A~VBELN
                 A~KUNNR
                 B~POSNR
                 B~MATNR
                 B~PMATN
                 B~KWMENG
                 B~VRKME
                 B~KZWI1
                 B~VKAUS
    *--Begin of changes for the change request 2007096--26th July 2007--
                 A~WAERK
    *--End   of changes for the change request 2007096--26th July 2007--
           INTO  TABLE T_VB_AKAP
           FROM  VBAK AS A
           JOIN  VBAP AS B
             ON  AVBELN EQ BVBELN
           FOR ALL ENTRIES IN T_IHEADER
           WHERE A~VBELN EQ T_IHEADER-VBELN
             AND B~MATNR IN S_MATNR.
        ENDIF.
        IF NOT T_VB_AKAP IS INITIAL.
          SELECT  VBELN
                  POSNR
                  BSTKD_E
             INTO TABLE T_VBKD
             FROM VBKD
             FOR ALL ENTRIES IN T_VB_AKAP
             WHERE VBELN EQ T_VB_AKAP-VBELN
               AND POSNR EQ T_VB_AKAP-POSNR.
        ENDIF.
        SORT T_VBKD BY VBELN POSNR.
        CLEAR W_VB_AKAP.
      After much of coding was completed, Usage of PMATN was dropped and
      the first eighteen characters of the field BSTKD was proposed for usage
      Hence PMATN is overwritten by BSTKD value in the below loop
        LOOP AT T_VB_AKAP INTO W_VB_AKAP.
          CLEAR: W_VBKD,
                 W_VB_AKAP-PMATN.
          READ TABLE T_VBKD INTO W_VBKD
                            WITH KEY VBELN = W_VB_AKAP-VBELN
                                     POSNR = W_VB_AKAP-POSNR
                            BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_VB_AKAP-PMATN = W_VBKD-BSTKD_E+0(18).
          ENDIF.
          MODIFY T_VB_AKAP FROM W_VB_AKAP TRANSPORTING PMATN.
          CLEAR W_VB_AKAP.
        ENDLOOP.
        IF NOT T_VB_AKAP IS INITIAL.
        Collecting all Material Numbers along with their Technical Spec data for all the materials available in T_VB_AKAP.
          SELECT    MATNR
                    ZZTECHSPEC
            INTO    TABLE T_MARA
            FROM    MARA
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-MATNR.
          IF SY-SUBRC EQ 0.
            SORT T_MARA BY MATNR.
          ENDIF.                     "Checking SY-SUBRC for T_MARA
          SELECT    MATNR
                    ZZTECHSPEC
            APPENDING TABLE T_MARA
            FROM    MARA
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-PMATN.
          IF SY-SUBRC EQ 0.
            SORT T_MARA BY MATNR.
          ENDIF.                     "Checking SY-SUBRC for T_MARA
    *--Begin of changes for the change request xxx--2nd Aug 2007--
        Collecting information into T_MARM for all the available materials so that it could be used for conversion into Alternate UOM
          SELECT MATNR                          " Material Number
                 MEINH                          " Alternate UOM
                 UMREZ                          " Numerator for conversion
                 UMREN                          " Denominator for conversion
            FROM MARM
            INTO TABLE T_MARM
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE MATNR EQ T_VB_AKAP-MATNR.
          IF SY-SUBRC = 0.
            SORT T_MARM BY MATNR MEINH.
          ENDIF.                     "Checking SY-SUBRC for T_MARM
          SELECT MATNR                          " Material Number
                 MEINH                          " Alternate UOM
                 UMREZ                          " Numerator for conversion
                 UMREN                          " Denominator for conversion
            FROM MARM
            APPENDING TABLE T_MARM
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE MATNR EQ T_VB_AKAP-PMATN.
          IF SY-SUBRC = 0.
            SORT T_MARM BY MATNR MEINH.
          ENDIF.                     "Checking SY-SUBRC for T_MARM
    *--End   of changes for the change request xxx--2nd Aug 2007--
          SELECT    MATNR
                    VKORG
                    VTWEG
                    KONDM
    *--Begin of changes for the change request 2007096--26th July 2007--
                    VRKME
    *--End   of changes for the change request 2007096--26th July 2007--
            INTO    TABLE T_MVKE
            FROM    MVKE
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-PMATN.
          IF SY-SUBRC EQ 0.
            SORT T_MVKE BY MATNR VKORG VTWEG.
          ENDIF.                     "Checking SY-SUBRC for T_MVKE
          SELECT    MATNR
                    VKORG
                    VTWEG
                    KONDM
    *--Begin of changes for the change request 2007096--26th July 2007--
                    VRKME
    *--End   of changes for the change request 2007096--26th July 2007--
            APPENDING TABLE T_MVKE
            FROM    MVKE
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-MATNR.
          IF SY-SUBRC EQ 0.
            SORT T_MVKE BY MATNR VKORG VTWEG.
          ENDIF.                     "Checking SY-SUBRC for T_MVKE
    *--Begin of changes for the change request 2007096--26th July 2007--
          SELECT    MSEHI
                    ZAEHL
                    NENNR
             INTO   TABLE T_T006
             FROM   T006
             FOR ALL ENTRIES IN T_VB_AKAP
             WHERE  MSEHI EQ T_VB_AKAP-VRKME.
          IF SY-SUBRC EQ 0.
            SORT T_T006 BY MSEHI.
          ENDIF.                     "Checking SY-SUBRC for T_T006
          IF NOT T_MVKE IS INITIAL.
            SELECT MSEHI
                   ZAEHL
                   NENNR
            APPENDING TABLE T_T006
            FROM   T006
            FOR ALL ENTRIES IN T_MVKE
            WHERE MSEHI EQ T_MVKE-VRKME.
            IF SY-SUBRC EQ 0.
              SORT T_T006 BY MSEHI.
            ENDIF.                  "Checking SY-SUBRC for T_T006
          ENDIF.                     "Checking for Initial status of internal table T_MVKE
    *--End   of changes for the change request 2007096--26th July 2007--
        ENDIF.                    " FOR T_VB_AKAP NOT INITIAL.
      ENDIF.                    " FOR T_IHEADER NOT INITIAL.
      CLEAR: W_VB_AKAP,
             W_IFINAL.
      LOOP AT T_VB_AKAP INTO W_VB_AKAP.
        W_IFINAL-VBELN  = W_VB_AKAP-VBELN.
        W_IFINAL-KUNNR  = W_VB_AKAP-KUNNR.
        W_IFINAL-POSNR  = W_VB_AKAP-POSNR.
        W_IFINAL-MATNR  = W_VB_AKAP-MATNR.
        W_IFINAL-PMATN  = W_VB_AKAP-PMATN.
        W_IFINAL-KWMENG = W_VB_AKAP-KWMENG.
        W_IFINAL-VRKME  = W_VB_AKAP-VRKME.
        W_IFINAL-KZWI1  = ( W_VB_AKAP-KZWI1 / W_VB_AKAP-KWMENG ) * 1000.
        W_IFINAL-VKAUS  = W_VB_AKAP-VKAUS.
    *--Begin of changes for the change request 2007096--26th July 2007--
        W_IFINAL-WAERK  = W_VB_AKAP-WAERK.
    *--End   of changes for the change request 2007096--26th July 2007--
      Populating Material Pricing Group from New Material Group, if such Group doesn't exist
      Population of Material Pricing Group from Material Number is tried.
      Similar condition does suit for Tech Spec too.
        SORT: T_MVKE BY MATNR VKORG VTWEG,
              T_MARA BY MATNR.
        IF NOT W_VB_AKAP-PMATN IS INITIAL.
          CLEAR W_MVKE.
          READ TABLE    T_MVKE
               INTO     W_MVKE
               WITH KEY MATNR = W_VB_AKAP-PMATN
                        VKORG = P_VKORG
                        VTWEG = P_VTWEG
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-KONDM = W_MVKE-KONDM.
    *--Begin of changes for the change request 2007096--26th July 2007--
            IF ( W_IFINAL-VRKME NE W_MVKE-VRKME ) AND ( NOT W_MVKE-VRKME IS INITIAL ).
    *--Begin of changes for the change request xxx--2nd Aug 2007--
              CLEAR: W_MARM,
                     G_NUM_SOURCE,
                     G_DEN_SOURCE,
                     G_NUM_TARGET,
                     G_DEN_TARGET.
              READ TABLE T_MARM INTO W_MARM
                                WITH KEY MATNR = W_IFINAL-PMATN
                                MEINH = W_IFINAL-VRKME
                                BINARY SEARCH.
              IF SY-SUBRC EQ 0.
                G_NUM_SOURCE = W_MARM-UMREZ.
                G_DEN_SOURCE = W_MARM-UMREN.
                CLEAR W_MARM.
                READ TABLE T_MARM INTO W_MARM
                                  WITH KEY MATNR = W_IFINAL-PMATN
                                  MEINH = W_MVKE-VRKME
                                  BINARY SEARCH.
                IF SY-SUBRC EQ 0.
                  G_NUM_TARGET = W_MARM-UMREZ.
                  G_DEN_TARGET = W_MARM-UMREN.
                  CLEAR W_MARM.
                  W_IFINAL-KWMENG = W_IFINAL-KWMENG * ( G_NUM_SOURCE / G_DEN_SOURCE ) * ( G_DEN_TARGET / G_NUM_TARGET ).
                  CLEAR W_IFINAL-KZWI1.
                  W_IFINAL-KZWI1   = ( W_VB_AKAP-KZWI1 / W_IFINAL-KWMENG ) * 1000.
                  W_IFINAL-VRKME = W_MVKE-VRKME.
                ENDIF.              "Check SY-SUBRC for W_MARM using W_MVKE-VRKME (Sales UOM)
              ELSE.
    *--End   of changes for the change request xxx--2nd Aug 2007--
                CLEAR: W_T006,
                       G_NUM_SOURCE,
                       G_DEN_SOURCE,
                       G_NUM_TARGET,
                       G_DEN_TARGET.
                READ TABLE T_T006 INTO W_T006 WITH KEY MSEHI = W_IFINAL-VRKME
                                              BINARY SEARCH.
                IF SY-SUBRC EQ 0.
                  G_NUM_SOURCE = W_T006-ZAEHL.          "Numerator to convert specified UOM to SI UOM
                  G_DEN_SOURCE = W_T006-NENNR.          "Denominator to convert specified UOM to SI UOM
                  CLEAR W_T006.
                  READ TABLE T_T006 INTO W_T006 WITH KEY MSEHI = W_MVKE-VRKME
                                                BINARY SEARCH.
                  IF SY-SUBRC EQ 0.
                    G_NUM_TARGET = W_T006-ZAEHL.            "Numerator to convert specified UOM to SI UOM
                    G_DEN_TARGET = W_T006-NENNR.            "Denominator to convert specified UOM to SI UOM
                    CLEAR W_T006.
                    W_IFINAL-KWMENG = W_IFINAL-KWMENG * ( G_NUM_SOURCE / G_DEN_SOURCE ) * ( G_DEN_TARGET / G_NUM_TARGET ).
                    CLEAR W_IFINAL-KZWI1.
                    W_IFINAL-KZWI1   = ( W_VB_AKAP-KZWI1 / W_IFINAL-KWMENG ) * 1000.
                    W_IFINAL-VRKME = W_MVKE-VRKME.
                  ENDIF.          "Check for SY-SUBRC for READ TABLE T_T006 using W_MVKE-VRKME (Sales UOM)
                ENDIF.            "Check for SY-SUBRC for READ TABLE T_T006 using W_IFINAL-VRKME (Quotation UOM)
              ENDIF.              "Check SY-SUBRC for W_MARM using W_IFINAL-VRKME (Quotation UOM)
            ENDIF.              "Check for ( W_IFINAL-VRKME NE W_MVKE-VRKME ) AND ( NOT W_MVKE-VRKME IS INITIAL )
    *--End   of changes for the change request 2007096--26th July 2007--
          ENDIF.
          READ TABLE     T_MARA
               INTO      W_MARA
               WITH KEY  MATNR = W_VB_AKAP-PMATN
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-ZZTECHSPEC = W_MARA-ZZTECHSPEC.
          ENDIF.    

  • 1 MATERIAL 2 PRICES

    HI
    1) My client has PRODUCT 12345
    IT CAN BE SOLD AS A LOOSE I MEAN IN PIECES OF EACH
    IT CAN ALSO BE SOLD AS A BOX PACKED ITEM
    AND THE PRICE IS DIFFERENT FOR BOTH
    IF LOOSE IS PRICED AT 100 RS
    PACKED IS SOLD AT  150
    HOW TO MAINTAIN THIS IN CONDITION RECORDS?
    I HAVE AN IDEA THAT IN MATERIAL MASTER IF I USE THE FIELD "SALES UNIT" WHERE I WILL CONVERT THE UOM INTO SALES UNIT
    1 BOX=10 EACH
    WHILE MAINTAINING CONDITION RECORDS FOR BASIC PRICE IF I USE "SALES UNIT" ALSO AS A FIELD DOES THIS SOLVE THE ISSUE?
    I AM ASKING JUST OPINION I HAVE NOT TRIED IT COZ I DONT HAVE ACCESS TO SAP RIGHT NOW
    REGARDS
    Edited by: rithvika on Feb 10, 2009 7:14 AM

    Hi Rithvika
    It can be done
    You can creatively use material price group or price list for this.
    Create 4 material price group as 100/200/300/400 or price lists
    Now create your access sequence as material/Material price group.or material/Material price list
    Maintain condition records for this combination say
    Material X Price group 100 - price 100 or price lists
    Material X Price group 200 - price 200 etc.
    Say price list A the material X price is Rs 100
    Say price list B the same  material X price is Rs 120
    (condition records can be maintained like that provided you have the field price list in your condition table)
    So in the sales order material price will be picked as Rs 100 if the price list as A or material price will be picked as Rs 120 if the price list as B
    Now in the sales order at the item level in the sales B tab, you can manually choose the material price group or price list of the material and the appropriate price would be selected.
    In this case there is every chance that the user will forget to fill up the data from the price group/ or price list
    So in the incompletion log you have to add this and make a tick in the incomplete messages in the order type in VOV8 so that the user necessarily fills your price list/ price group and the price is fetched accordingly
    This is an idea striking my mind  and this has worked out well for my requirements and how suitably it works for your scenario you have to explore it out
    Regards
    Raja

Maybe you are looking for