Pricing in SD module.

HI,
  explain pricing.
kathir.

Hi,
In SD, the steps to configure Pricing procedure are as under:
Step 1:
Condition table: If existing condition table meets the requirement, we need not create a new condition table. Considering the requirement for new condition table, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Condition Table (select the required fields combination, which will store condition record).
Step 2:
Access Sequence: If existing access sequence meets the requirement, we need not create a new access sequence. Considering the requirement for new sequence, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Access Sequence (Access sequence is made up of Accesses (Tables) & the order of priority in which it is to be accessed. Here we assign the condition table to access sequence.
Step 3:
Condition Type: If existing condition type meets the requirement, we need not create a new condition type. Considering the requirement for new condition type, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Condition Type. It is always recommended to copy an existing similar condition type & make the neccessary changes. Here we assign Access sequence to Condition type.
Step 4:
a. Pricing Procedure: It is recommended to copy a similar pricing procedure & make the neccesary changes in new pricing procedure. Pricing Procedure is a set of condition type & arranged in the sequence in which it has to perform the calculation. Considering the requirement for new Pricing Procedure, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Pricing Procedure --> Maintain Pricing Procedure.
b. Pricing Procedure: After maintaining the pricing procedure the next step will be determination of pricing procedure. Configuration for determining pricing procedure in SPRO is as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Pricing Procedure --> Determine Pricing Procedure.
5. Condition record: Condition record is a master data, which is required to be maintained by Core team / person responsible from the client. During new implementation, the condition records can be uploaded using tools like SCAT, LSMW, etc.
Reward points if useful
Regards,
Amrish Purohit

Similar Messages

  • Interview Questions and Answers for Pricing and Shipping Modules!!!!

    Please let me know the Interview Questions and Answers for Pricing and Shipping Modules?

    http://www.google.co.in/#hl=en&tbo=d&sclient=psy-ab&q=interview+questions+in+oracle+pricing+and+shipping&oq=interview+questions+in+oracle+pricing+and+shipping&gs_l=hp.3..33i21.1169.38878.0.39096.61.45.10.6.6.4.4004.21813.2-21j9j6j3j2j1j1j1.44.0.les%3B..0.0...1c.1.jEq3EQIj8vA&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.&bvm=bv.1357700187,d.bmk&fp=cedcde5e8e6bc792&biw=1280&bih=619
    HTH
    Mahendra

  • Pricing for assortment modules

    hi gurus
    i want to link each Assortment Module in value contract to specific Price and accordingly each item within the assortment module will use the specified price when creating sales order with reference to the contract

    Check this -
    Pricing in sales order
    Regards.

  • Pricing subtotal Fn.module

    Hello all,
    I'm using Fn.module RV_PRICE_PRINT_HEAD to get the Pricing conditions but I'm not getting  the subtotals.Is there any Fn.module to get this.
    Thanks for any answers..
    Edited by: John G on Feb 5, 2008 11:09 PM

    Hi John,
    Search SDN before posting your Question.
    You can go through this link
    using of RV_PRICE_PRINT_ITEM  in smartforms

  • Modules included is APS Purchase

    There are four modules listed as part of the Oracles APS Solution: Demand planning, Global ATP Server; Manufacturing Planning; Advanced Supply Chain Planning.
    When buying the Oracle APS solution do these modules come packaged as one product or are they priced separately. If priced seperately, which modules are required.

    The Oracle APS modules include the following and can be purchased separately.
    1. Advanced Supply Chain Planning (ASCP)
    1a. Constraint Based Planning Option
    1b. Global ATP Server
    2. Demand Planning
    3. Manufacturing Scheduling
    The only dependencies are that you must purchase ASCP in order to use either the Constraint Based Planning Option or the Global ATP Server. Both Demand Planning and Manufacturing Scheduling can be purchased and used independently.

  • How to maintain different  price

    Dear Gurus,
    For one matrial how we can maintain differnnt selling price.
    For example:
    paint as a one material code, and it has 30 differnet shades,
    for this they have different selling price,
    like same material code with diff shade diff price.
    but in SAP how to map it,
    Example: Distemper, has 15 shades
    Distemper red : 50/kg
    Distemper blue: 45/kg
    Distemper white: 40/kg
    By using Variant configuration we will get the different material codes,
    but this they dont want,
    now how we will maintain the 30 different prices,
    is there any provision in sap,
    Please give your valuable inputs.
    Regards,
    HRISHI

    Hi HRISHIKESH N,
    The best solution for this secnario is Make to Order Sales Order with variant configured material.  According to the selection of characteristics, the sales order standard cost estimate is created. Then through the pricing through SD Module, you can charge the customer a price which includes overhead and profit over and above the cost estimate. We can do wonders in SAP.
    In the following thread you can able to understand the variant configuration.
    http://www.sap-img.com/sap-sd/steps-for-sd-variant-configuration.htm
    Hope this answers your query!

  • Screen capturing method for InDesign files

    Does anyone know the best method for taking screen captures for an InDesign file. I've tried a number of ways but am not please with the resolution I'm getting. The way I've done it thus far is capture the screen (with Print Screen), then crop off what I don't need in Photoshop. Then I save it as a .GIF and place it into InDesign. The .GIF ends up becoming twice the size of what it was as a .psd and the resolution isn't there. Do I need to use Snag It instead of what I'm doing? Would that help any?
    Any help would be greatly appreciated.
    Thanks,
    Robyn

    A while back I needed a good OCR scanning program so I bought ABBYY Reader. With this program they included a program called ABBYY Screenshot reader. I believe you can buy this as a standalone program if you do not need the OCR reader.
    The screenshot capture can be used to capture any portion of a screen. It sits on top of whatever page you have open and you just use the tool and draw a frame around anything you wish to capture. Then you can choose several options on what format you want to sve it as. Like .pdf, .jpg, .tiff, .doc, .xls and several more. If you have the OCR program you can also save it as an editable screenshot. The OCR in ABBYY reader is probably one of the best in the world if not THE best.
    I believe you can get a free trial to see how it works and also get lower pricing on specific modules depending on what you need.

  • IF statement in Standard function module PRICING

    Hi,
    In standard function module PRICING
    I found one if statement like this.
    if  xkomv-kntyp na '1$' .
    Plz tell me the meaning of thai '1$' value.
    Regards,
    Upender Verma.

    Hi,
         NA means Contains Not Any ..
         if xkomv-kntyp na '1$'  means .. xkomv-kntyp does not contain '1' or '$'.
         Read help on comparision operator 'NA'
    Regards,
    Srini.

  • IPC Pricing with AP 7.00 Database Access/Call function module user-exit

    Hi experts,
    we are running SAP ECO on SAP ECC 6.0 with IPC Pricing AP 7.00 running in the VMC.
    I'm facing a new requirement. In an user-exit for requirements the access to the ABAP database is needed.
    (I know that the SAP recommendation is, don't have access to database. But we need this functionality)
    In ABAP it looks like:
    select single * from  a590
          into     LH_674_a590
          where    kappl  = 'V'
          and      kschl  = 'ZSPR'
          and      kunnr  = komk-kunnr
          and      matnr  = komp-matnr
          and      datbi  >= komk-prsdt
          and      datab  =< komk-prsdt.
    Is there a possibility to implement the same SELECT in the Java-User-Exit?
    Is there maybe the alternative to call a function module instead?
    The database exits on the same application server on which the VMC runs.
    If there is a possiblity can anyone provide me with sample coding or give an advice where to find samle coding?
    I would prefer to call a functions module.
    Thanks in adcance
    Karl-Wilhelm

    Hi Shanto & Sumit,
    Thanks for the inputs.
    as per my understanding of the log
    java.lang.IncompatibleClassChangeError: com.sap.leasing.pricing.tools.LeasingPricingTools: method getPricingConditionByConditionTypeName(Lcom/sap/spe/pricing/transactiondata/userexit/IPricingItemUserExit;Ljava/lang/String;)Lcom/sap/spe/pricing/transa ctiondata/IPricingCondition; used to be stati
    error is thrown by the SAP standard user exit and because of which execution is failing in customer user exits and surprisingly we have not made any changes in both of them.
    this was working earlier before upload.could this be because of the jar packaging.
    how i can download the standard user exit com.sap.leasing.pricing.tools.LeasingPricingTools from crm
    for further investigation.
    Thanks,
    Siddharth

  • About Function module 'PRICING'

    Hi experts,
    Now My requirement is get all contract condition data. If I don't want to create a new contract to get these condition data, I can use Function module 'PRICING' to get all condition data. But the question is the parameter COMM_ITEM_I is a structure, it only can store a record(single material). If the contract has many item, eg Service + Goods............ How to process this scenario? If you have experience in this, please give me any idea. Thanks in advance!
    function pricing.
    ""Globale Schnittstelle:
    *"  IMPORTING
    *"     VALUE(CALCULATION_TYPE) LIKE  KOMV-KSTEU DEFAULT 'A'
    *"     VALUE(COMM_HEAD_I) LIKE  KOMK STRUCTURE  KOMK
    *"     VALUE(COMM_ITEM_I) LIKE  KOMP STRUCTURE  KOMP
    *"     VALUE(PRELIMINARY) TYPE  C DEFAULT ' '
    *"     VALUE(NO_CALCULATION) TYPE  C DEFAULT ' '
    *"  EXPORTING
    *"     VALUE(COMM_HEAD_E) LIKE  KOMK STRUCTURE  KOMK
    *"     VALUE(COMM_ITEM_E) LIKE  KOMP STRUCTURE  KOMP
    *"  TABLES
    *"      TKOMV STRUCTURE  KOMV
    *"      SVBAP STRUCTURE  VBAPU OPTIONAL
    *"  CHANGING
    *"     VALUE(REBATE_DETERMINED) TYPE  C DEFAULT ' '

    Hi,
    I guess contracts will be found in EKKO, not in VBAK. Correct me if I am wrong.
    If I am correct, you can use the BAPI "BAPI_PO_GETDETAIL1". POCONDHEADER and POCOND inporting tables will retrieve pricing information.
    Regards,
    Ganga

  • Function module to get Pricing conditions of billing document

    Hi All,
    Please help me getting the pricing condition values for a billing document.  I got values from KONV table against perticular Condition type. but i need to get the values against step number maintained in Conditions for my billing item. is there any function module to get all condition data maintained in document with totals and discounts aswell.
    Please help me.  if required i will give tou full details what i required.
    Kumar.

    Hi Kumar,
    Please check below mentioned Function Module for details:
    RV_PRICE_PRINT_GET_BUFFER
    RV_PRICE_PRINT_GET_MODE
    RV_PRICE_PRINT_HEAD    (Header)
    RV_PRICE_PRINT_HEAD_BUFFER
    RV_PRICE_PRINT_ITEM       (Item)
    RV_PRICE_PRINT_ITEM_BUFFER
    RV_PRICE_PRINT_REFRESH
    Regards,
    Tutun

  • Function module to change the value for pricing condition type

    Hello experts,
    I want to change the value for pricing condition type for an item in the transaction CRMD_ORDER.
    I used many function modules but none are working.
    Please kindly suggest a function module that will change the value for a condition type .
    I have used the following function module but its not working, please correct the coding if anything needs to be changed or added. Please help me .
    Thank you.
    CLEAR PRCD_COND.
         SELECT SINGLE * FROM PRCD_COND WHERE KPOSN = WA_ORDERADM_I-GUID AND
                                              KSCHL = COND_TY.
      IF SY-SUBRC = 0.
    *    MOVE-CORRESPONDING PRCD_COND TO L_COND_CHG.
    *    CLEAR L_COND_CHG-KBETR.
        L_COND_CHG-STUNR = PRCD_COND-STUNR.
        L_COND_CHG-KBETR = COND_PRC.
    *    L_COND_CHG-KSCHL = COND_TY.
        INSERT L_COND_CHG INTO TABLE T_COND_CHG.
    L_HEAD_GUID = CRMD_ORDERADM_H-GUID.
    L_ITEM_GUID = WA_ORDERADM_I-GUID.
    INSERT L_HEAD_GUID INTO TABLE HEAD_GUID.
    INSERT L_ITEM_GUID INTO TABLE ITEM_GUID.
        CALL FUNCTION 'CRM_ORDER_READ'
         EXPORTING
           IT_HEADER_GUID                    = HEAD_GUID
           IT_ITEM_GUID                      = ITEM_GUID
         IMPORTING
           ET_ORDERADM_H                     = LT_ORDERADM_H
           ET_ORDERADM_I                     = LT_ORDERADM_I
           ET_PRIDOC                         = IT_PRIDOC_RD
           ET_DOC_FLOW                       = T_DOC_FLOW
    *     CHANGING
    *       CV_LOG_HANDLE                     =
    *     EXCEPTIONS
    *       DOCUMENT_NOT_FOUND                = 1
    *       ERROR_OCCURRED                    = 2
    *       DOCUMENT_LOCKED                   = 3
    *       NO_CHANGE_AUTHORITY               = 4
    *       NO_DISPLAY_AUTHORITY              = 5
    *       NO_CHANGE_ALLOWED                 = 6
    *       OTHERS                            = 7
        IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    MOVE-CORRESPONDING LS_PRIDOC_RD TO L_PRI_COND.
    INSERT L_PRI_COND INTO TABLE PRI_COND.
    LOOP AT IT_PRIDOC_RD INTO LS_PRIDOC_RD.
    MOVE-CORRESPONDING LS_PRIDOC_RD TO L_PRIDOC_CHG.
    L_PRIDOC_CHG-PRIC_COND = PRI_COND.
    L_PRIDOC_CHG-REF_GUID = LS_PRIDOC_RD-GUID.
    L_PRIDOC_CHG-COND_CHANGE = T_COND_CHG.
    INSERT L_PRIDOC_CHG INTO TABLE PRIDOC_CHG.
    ENDLOOP.
    LOOP AT LT_ORDERADM_H INTO LS_ORDERADM_H .
    MOVE-CORRESPONDING LS_ORDERADM_H TO L_HEADER.
    INSERT L_HEADER INTO TABLE HEADER.
    ENDLOOP.
    LOOP AT LT_ORDERADM_I INTO LS_ORDERADM_I.
    MOVE-CORRESPONDING LS_ORDERADM_I TO L_ITEM.
    INSERT L_ITEM INTO TABLE ITEM.
    ENDLOOP.
    L_FIELD-FIELDNAME = 'STUNR'.
    INSERT L_FIELD INTO TABLE FIELD.
    L_FIELD-FIELDNAME = 'KBETR'.
    L_FIELD-CHANGEABLE = 'X'.
    INSERT L_FIELD INTO TABLE FIELD.
    L_INPUT-FIELD_NAMES = FIELD.
    L_INPUT-REF_KIND = 'E'.
    L_INPUT-REF_GUID = LS_PRIDOC_RD-GUID.
    L_INPUT-OBJECTNAME = 'PRIDOC'.
    INSERT L_INPUT INTO TABLE INPUT.
        CALL FUNCTION 'CRM_ORDER_MAINTAIN'
         EXPORTING
           IT_PRIDOC                     = PRIDOC_CHG
         IMPORTING
           ET_EXCEPTION                  = EXCEPT
         CHANGING
           CT_INPUT_FIELDS               = INPUT.
        IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    REFRESH EXCEPT.
    CALL FUNCTION 'CRM_ORDER_SAVE'
      EXPORTING
        IT_OBJECTS_TO_SAVE         = HEAD_GUID
    *   IV_UPDATE_TASK_LOCAL       = FALSE
    *   IV_SAVE_FRAME_LOG          = FALSE
    *   IV_NO_BDOC_SEND            = FALSE
    *   IT_ACTIVE_SWITCH           =
    IMPORTING
       ET_SAVED_OBJECTS           = SAVED
       ET_EXCEPTION               = EXCEPT
       ET_OBJECTS_NOT_SAVED       = UNSAVED
    * CHANGING
    *   CV_LOG_HANDLE              =
    * EXCEPTIONS
    *   DOCUMENT_NOT_SAVED         = 1
    *   OTHERS                     = 2
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    COMMIT WORK AND WAIT.

    Hi,,
    To be able to call a function module in an update work process, you must flag it in the Function Builder. When you create the function module, set the Process Type attribute to Update with immediate start
    Alternatively u can use this function module.
    CRM_STATUS_DATA_SAVE_DB
    BAPI_CUSTOMERCRM_CHANGE (If u wish to use a bapi for this).
    Also , Let me know what error you got when implementing other function module.Does the function module didnt return any error but still the value is not changed for pricing condition type?

  • Function Module to change pricing condition in Agreement

    Hi Experts ,
    While creating purchase agreement (ME31L) BDC i want to change the pricing condition in the document at item level .
    Planing to use function modules to change the pricing condition after document is created .
    Any help in function module which will change the pricing condition in Agreement will be appreciated .
    Any other suggestion are also welcome (-: .
    Thank You .

    how to change the pricing consition in  agreement(ME31L)

  • Function module to pricing procedure calculation

    hi,
    I want to know whether any function modules available to get as I see in  Invoice ->
    select item level conditions.
    Where i can see the basic price ,discount, etc as defined in the corresponding pricing procedure.
    i have tried with
    RV_INVOICE_PRICE_PBO
    PRICING_SUBSCREEN_SET_DATA
    here i get only the records which have condition type,
    similarly for P.O. we have
    ME_SWP_SIC_GET_PRICING_INFO
    regards,
    Prabhu
    Points assured.

    REPORT  zmm_pvr.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     TYPE-POOLS                                          *
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TYPE-POOLS slis.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                       TABLES                                            *
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TABLES: mara,                         " General Material Data
            marc,                         " Plant Data for Material
            ekko,                         " Purchasing Document Header
            ekpo,                         " Purchasing Document Item
            lfa1,                         " Vendor Master (General Section)
            konv,                         " Conditions (Transaction Data)
            mbew,                         " Material Valuation
            makt.                         " Material Descriptions
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    DATA DECLARATION                                     *
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    DATA: BEGIN OF i_mat OCCURS 1,
            matnr LIKE mara-matnr,
            mtart LIKE mara-mtart,
            werks LIKE marc-werks,
            abcin LIKE marc-abcin,
          END OF i_mat.
    DATA: BEGIN OF itab OCCURS 1,
            ebeln LIKE ekko-ebeln,
            bedat LIKE ekko-bedat,
            lifnr LIKE ekko-lifnr,
            waers LIKE ekko-waers,
            bukrs LIKE ekko-bukrs,
            ekorg LIKE ekko-ekorg,
            name1 LIKE lfa1-name1,
            werks LIKE ekpo-werks,
            menge LIKE ekpo-menge,
            meins LIKE ekpo-meins,
            netpr LIKE ekpo-netpr,
            netwr LIKE ekpo-netwr,
            menge1(16),
            netpr1(16),
            menge2  TYPE string,
            netpr2 TYPE string,
            lrate TYPE p DECIMALS 2,
            stax LIKE ekpo-netwr,
            exbed LIKE ekpo-netwr,
            dcost LIKE konv-kwert,
            nomvl LIKE ekpo-netwr,
            nomrt LIKE ekpo-netwr,
            zplp1 LIKE mbew-zplp1,
            verpr LIKE mbew-verpr,
            bgval LIKE ekpo-netwr,
            varnc LIKE ekpo-netwr,
            maktx LIKE makt-maktx,
            knumv LIKE ekko-knumv,
            ebelp LIKE ekpo-ebelp,
            matnr LIKE ekpo-matnr,
            matkl LIKE ekpo-matkl,
            mtart LIKE ekpo-mtart,
            bprme LIKE ekpo-bprme,
            txz01 LIKE ekpo-txz01,
            mwskz LIKE ekpo-mwskz,
            prdat LIKE ekpo-prdat,
          END OF itab.
    DATA: wtab LIKE itab.
    DATA: v_steuc TYPE marc-steuc.
    DATA: v_brsch TYPE lfa1-brsch.
    DATA: wa_komk TYPE komk.
    DATA: wa_komp TYPE komp.
    DATA: it_komv TYPE TABLE OF komv.
    DATA: wa_komv TYPE komv.
    DATA : wa_fieldcat TYPE  slis_fieldcat_alv,
           gt_fieldcat TYPE  slis_t_fieldcat_alv,
           wa_layout   TYPE  slis_layout_alv,
           lt_sort     TYPE  slis_t_sortinfo_alv,
           i LIKE sy-tabix.
    DATA: gt_events     TYPE slis_t_event.
    DATA: gd_prntparams TYPE slis_print_alv.
    DATA: it_color TYPE   slis_t_specialcol_alv.
    DATA: wa_color TYPE   slis_specialcol_alv.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          Begin Of Selection Screen                      *
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    SELECTION-SCREEN BEGIN OF BLOCK pas WITH FRAME TITLE text-001.
    SELECT-OPTIONS s_matnr FOR  ekpo-matnr.
    SELECT-OPTIONS s_werks FOR  ekpo-werks.
    SELECT-OPTIONS s_bedat FOR  ekko-bedat.
    PARAMETERS     p_abcin LIKE marc-abcin OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK pas.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                           INITIALIZATION                                *
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    INITIALIZATION.
      IF sy-datum+4(2) GE 4.
        s_bedat-low+6(2) = 01.
        s_bedat-low+4(2) = 04.
        s_bedat-low(4) = sy-datum(4).
      ENDIF.
      IF sy-datum+4(2) LT 4.
        s_bedat-low+6(2) = 01.
        s_bedat-low+4(2) = 04.
        s_bedat-low(4) = sy-datum(4) - 1.
      ENDIF.
      s_bedat-high   = sy-datum.
      APPEND s_bedat.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        AT Selection Screen Output                       *
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    AT SELECTION-SCREEN.
    Check for Material Type
      SELECT amatnr amtart bwerks babcin INTO CORRESPONDING FIELDS OF TABLE i_mat
      FROM mara AS a INNER JOIN marc AS b
           ON amatnr = bmatnr
      WHERE a~matnr IN s_matnr
        AND ( amtart = 'IRAM' OR amtart = 'IPAM' OR amtart = 'PRAM' OR amtart = 'PPAM' )
        AND b~werks IN s_werks
        AND b~abcin = p_abcin.
      SORT i_mat BY matnr werks.
      CHECK NOT i_mat[] IS INITIAL.
      READ TABLE i_mat INDEX 1.
      IF sy-subrc <> 0.
        MESSAGE e006(zmm).
        LEAVE LIST-PROCESSING.
      ENDIF.
    Check for Date
      IF ( s_bedat-low IS INITIAL AND s_bedat-high IS INITIAL ).
        s_bedat-sign   = 'I'.
        s_bedat-option = 'BT'.
        IF sy-datum+4(2) GE 4.
          s_bedat-low+6(2) = 01.
          s_bedat-low+4(2) = 04.
          s_bedat-low(4) = sy-datum(4).
        ENDIF.
        IF sy-datum+4(2) LT 4.
          s_bedat-low+6(2) = 01.
          s_bedat-low+4(2) = 04.
          s_bedat-low(4) = sy-datum(4) - 1.
        ENDIF.
        s_bedat-high   = sy-datum.
      ELSEIF ( s_bedat-low IS NOT INITIAL AND s_bedat-high IS INITIAL ).
        s_bedat-low6(2) = s_bedat-low6(2).
        s_bedat-low4(2) = s_bedat-low4(2).
        s_bedat-low(4)   = s_bedat-low(4).
      ELSEIF ( s_bedat-low IS NOT INITIAL AND s_bedat-high IS NOT INITIAL ).
        s_bedat-sign   = 'I'.
        s_bedat-option = 'BT'.
        s_bedat-low6(2) = s_bedat-low6(2).
        s_bedat-low4(2) = s_bedat-low4(2).
        s_bedat-low(4)   = s_bedat-low(4).
        s_bedat-high6(2) = s_bedat-high6(2).
        s_bedat-high4(2) = s_bedat-high4(2).
        s_bedat-high(4)   = s_bedat-high(4).
      ENDIF.
      APPEND s_bedat.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            START OF SELECTION                           *
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    START-OF-SELECTION.
    *----- Get all PO for given selection criteria.
    LOOP AT i_mat.
      SELECT
        aebeln abedat alifnr aknumv awaers abukrs a~ekorg
        bebelp bmatnr bmatkl bnetpr bbprme btxz01 bwerks bmenge bmeins bnetwr bmtart bmwskz b~prdat
      FROM ( ekko AS a INNER JOIN ekpo AS b ON  amandt = bmandt AND aebeln = bebeln )
      INTO CORRESPONDING FIELDS OF TABLE itab
      FOR ALL ENTRIES IN i_mat
      WHERE a~bedat IN s_bedat
       AND  a~loekz = ''
       AND  b~matnr = i_mat-matnr
       AND  b~werks = i_mat-werks
       AND  b~loekz = ''
       AND  b~pstyp = '0'
       AND  b~bstyp = 'F'
       AND  b~knttp = ''.
    ENDLOOP.            " END OF i_mat
      CHECK NOT itab[] IS INITIAL.
      SORT itab BY ebeln ebelp.
    *----- Calculating The DCOST -- Delivery Cost
      DATA: BEGIN OF i_konv OCCURS 0,
             knumv LIKE konv-knumv,
             kposn LIKE konv-kposn,
             stunr LIKE konv-stunr,
             zaehk LIKE konv-zaehk,
             kschl LIKE konv-kschl,
             kbetr LIKE konv-kbetr,
             kwert LIKE konv-kwert,
           END OF i_konv.
      SELECT knumv kposn stunr zaehk kschl kbetr kwert
      FROM konv
      INTO CORRESPONDING FIELDS OF TABLE i_konv
      FOR ALL ENTRIES IN itab
      WHERE knumv = itab-knumv
       AND kposn = itab-ebelp
        AND ( kschl   = 'ZFC3' OR kschl   = 'ZQIQ'
           OR kschl   = 'ZQIV' OR kschl   = 'ZFA3'
           OR kschl   = 'ZFB3' OR kschl   = 'ZPF2'
           OR kschl   = 'ZPQ2' OR kschl   = 'ZPV2'
           OR kschl   = 'ZOCP' OR kschl   = 'ZOCQ'
           OR kschl   = 'ZOCV' OR kschl   = 'ZMT1'
           OR kschl   = 'ZIN2' OR kschl   = 'ZIQ2'
           OR kschl   = 'ZIV2' OR kschl   = 'ZBK1'
           OR kschl   = 'ZBKQ' OR kschl   = 'ZBKV' ).
      SORT i_konv BY knumv kposn stunr zaehk kschl .
      DELETE ADJACENT DUPLICATES FROM i_konv.
      DELETE i_konv WHERE kbetr = 0.
      DATA: BEGIN OF i_knumv OCCURS 0,
              knumv LIKE konv-knumv,
              kwert LIKE konv-kwert,
            END OF i_knumv.
      LOOP AT i_konv.
        MOVE i_konv-knumv TO i_knumv-knumv.
        MOVE i_konv-kwert TO i_knumv-kwert.
        COLLECT i_knumv.
      ENDLOOP.
      CLEAR i_konv.
      CLEAR i_knumv.
      LOOP AT itab INTO wtab.
        READ TABLE i_knumv WITH KEY knumv = wtab-knumv.
        IF sy-subrc = 0.
          wtab-dcost = i_knumv-kwert.
          MODIFY itab FROM wtab.
        ENDIF.
      ENDLOOP.
      CLEAR i_knumv.
      CLEAR itab.
    *----- Get the vendor name.
      LOOP AT itab.
        SELECT SINGLE name1 FROM lfa1 INTO itab-name1
                                        WHERE lifnr = itab-lifnr.
        MODIFY itab INDEX sy-tabix TRANSPORTING name1.
      ENDLOOP.
    *----- Calculate Excise Duty, Educat. cess, Sec edu. cess, sales tax
      CLEAR: wa_komk, wa_komp.
    Selecting The Value Of STEUC (Controlling Code)
      CLEAR itab.
      LOOP AT itab.
        SELECT SINGLE steuc
          FROM marc
          INTO v_steuc
         WHERE matnr = itab-matnr
           AND werks = itab-werks.
    Selecting The Value Of BRSCH (Industry key)
        SELECT SINGLE brsch
          FROM lfa1
          INTO v_brsch
         WHERE lifnr = itab-lifnr.
    Filling KOMK (Header Structure)
        wa_komk-kappl     = 'TX'.
        wa_komk-kalsm     = 'TAXINN'.
        wa_komk-lifnr     = itab-lifnr.
        wa_komk-waerk     = itab-waers.
        wa_komk-aland     = 'IN'.
        wa_komk-hwaer     = 'INR'.
        wa_komk-bukrs     = itab-bukrs.
        wa_komk-brsch     = v_brsch.
        wa_komk-prsdt     = itab-bedat.
        wa_komk-ekorg     = itab-ekorg.
        wa_komk-mwskz     = itab-mwskz.
    Filling KOMP (Details Structure)
        wa_komp-kposn     = itab-ebelp.
        wa_komp-matnr     = itab-matnr.
        wa_komp-werks     = itab-werks.
        wa_komp-matkl     = itab-matkl.
        wa_komp-meins     = itab-meins.
        wa_komp-vrkme     = itab-bprme.
        wa_komp-netwr     = itab-netwr.
        wa_komp-wrbtr     = itab-netwr.
        wa_komp-mwskz     = itab-mwskz.
        wa_komp-netpr     = itab-netpr.
        wa_komp-mtart     = itab-mtart.
        wa_komp-kursk_dat = itab-prdat.
        wa_komp-steuc     = v_steuc.
        wa_komp-mgame     = itab-menge.
        wa_komp-mglme     = itab-menge.
        FREE it_komv.
    Calling The Pricing Function To Get GR EXCISE, GR ECES, GR VAT/CST
        CALL FUNCTION 'PRICING'
          EXPORTING
            calculation_type = 'B'
            comm_head_i      = wa_komk
            comm_item_i      = wa_komp
          TABLES
            tkomv            = it_komv.
    Calculating The Excise --excise duty
        DATA: l_kbetr        TYPE komv-kbetr.
        DATA: l_gr_excise    TYPE ekpo-brtwr.
        DATA: l_basic_gr_val TYPE ekpo-netpr.
        l_basic_gr_val = itab-netwr.
        CLEAR: l_kbetr, l_gr_excise.
        LOOP AT it_komv INTO wa_komv WHERE kschl = 'JMOP'
                                        OR kschl = 'JAOP'
                                        OR kschl = 'JMIP'
                                        OR kschl = 'JAOQ'.
          l_kbetr     = ( wa_komv-kbetr / 10 ).
          l_gr_excise = ( l_kbetr * l_basic_gr_val ) / 100.
        ENDLOOP.
        LOOP AT it_komv INTO wa_komv WHERE kschl = 'JAIP'
                                        OR kschl = 'JAIQ'
                                        OR kschl = 'JMIQ'
                                        OR kschl = 'JMOQ'.
          l_gr_excise = ( wa_komv-kbetr * l_basic_gr_val ).
        ENDLOOP.
    Calculating The ECES -- Educational Cess
        DATA l_gr_eces      TYPE ekpo-netpr.
        CLEAR: l_kbetr, l_gr_eces.
        LOOP AT it_komv INTO wa_komv WHERE kschl = 'ZECE'
                                        OR kschl = 'ZECN'.
          l_kbetr     = ( wa_komv-kbetr / 10 ).
          l_gr_eces   = ( l_kbetr * l_gr_excise ) / 100.
        ENDLOOP.
    Calculating The SECES -- Sec. Educational Cess
        DATA l_gr_secs      TYPE ekpo-netpr.
        CLEAR: l_kbetr, l_gr_secs.
        LOOP AT it_komv INTO wa_komv WHERE kschl = 'JSEP'
                                        OR kschl = 'JSEI'.
          l_kbetr     = ( wa_komv-kbetr / 10 ).
          l_gr_secs   = ( l_kbetr * l_gr_excise ) / 100.
        ENDLOOP.
    Calculating The VAT/CST --Sales Tax
        DATA l_gr_vatcst    TYPE ekpo-netpr.
        CLEAR: l_kbetr, l_gr_vatcst.
        LOOP AT it_komv INTO wa_komv WHERE kschl = 'JVRN'
                                        OR kschl = 'JVRD'
                                        OR kschl = 'JVCS'
                                        OR kschl = 'JVCD'
                                        OR kschl = 'JVCN'
                                        OR kschl = 'JIPS'
                                        OR kschl = 'JIPC'
                                        OR kschl = 'JIPL'.
          l_kbetr     = ( wa_komv-kbetr / 10 ).
          l_gr_vatcst = ( ( l_basic_gr_val + l_gr_excise + l_gr_eces + l_gr_secs ) * l_kbetr ) / 100.
        ENDLOOP.
    Calculating The NOMVL & NOMVR -- NOM Value (Setoff / Inventory ) & NOM Rate
        DATA: l_netpr TYPE ekpo-netpr,
              l_menge TYPE ekpo-menge,
              l_dcost TYPE ekpo-netwr,
              l_nomvl TYPE ekpo-netwr,
              l_nomrt TYPE ekpo-netwr.
        l_netpr = itab-netpr.
        l_menge = itab-menge.
        l_dcost = itab-dcost.
        CLEAR: l_nomvl, l_nomrt.
        LOOP AT it_komv INTO wa_komv WHERE kschl = 'JMOP'                        "------setoff
                                        OR kschl = 'ZECE'
                                        OR kschl = 'JSEP'.
          l_nomvl = ( l_netpr * l_menge ) + l_gr_vatcst + l_dcost - ( l_gr_excise + l_gr_eces + l_gr_secs ).
          l_nomrt =  l_nomvl / l_menge.
        ENDLOOP.
        LOOP AT it_komv INTO wa_komv WHERE kschl = 'JMIP'                        "-------inventory
                                        OR kschl = 'ZECN'
                                        OR kschl = 'JSEI'.
          l_nomvl = ( l_netpr * l_menge ) + l_gr_vatcst + l_dcost.
          l_nomrt =  l_nomvl / l_menge.
        ENDLOOP.
        itab-exbed = l_gr_excise + l_gr_eces + l_gr_secs.
        itab-stax  = l_gr_vatcst.
        itab-nomvl = l_nomvl.
        itab-nomrt = l_nomrt.
        MODIFY itab .
        CLEAR itab.
      ENDLOOP.           " end of itab
      LOOP AT itab WHERE exbed = 0.
        itab-nomvl = ( itab-netpr * itab-menge ) + itab-stax + itab-dcost.
        itab-nomrt = itab-nomvl / itab-menge.
        MODIFY itab INDEX sy-tabix TRANSPORTING nomvl nomrt.
      ENDLOOP.
    *----- Calculating The Budget Rate, Moving Average Price, Landed Rate & Material Description
      DATA: verp(15).
      DATA: matdes(40).
      LOOP AT itab.
        SELECT SINGLE zplp1 FROM mbew INTO itab-zplp1
                                        WHERE matnr = itab-matnr AND bwkey = itab-werks.
        SELECT SINGLE verpr FROM mbew INTO itab-verpr
                                        WHERE matnr = itab-matnr AND bwkey = itab-werks.
        itab-lrate = itab-netwr / itab-menge.
        SELECT SINGLE maktx FROM makt INTO itab-maktx
                                        WHERE matnr = itab-matnr AND spras = 'EN'.
        MODIFY itab INDEX sy-tabix TRANSPORTING zplp1 verpr lrate maktx.
        verp = itab-verpr.
        matdes = itab-maktx.
      ENDLOOP.
    *----- Calculating The Budget Value & Variance
      LOOP AT itab.
        itab-bgval = itab-zplp1 * itab-menge.
        itab-varnc = itab-bgval - itab-nomvl.
        MODIFY itab INDEX sy-tabix TRANSPORTING bgval varnc.
      ENDLOOP.
    *------ Calculating Total of Quantity
      DATA: BEGIN OF i_quan OCCURS 1,
               quant LIKE ekpo-menge,
               unit LIKE ekpo-meins,
               nomvl LIKE ekpo-netwr,
               curr LIKE ekko-waers,
               varnc LIKE ekpo-netwr,
               bgval LIKE ekpo-netwr,
             END OF i_quan.
      LOOP AT itab.
        MOVE itab-menge TO i_quan-quant.
        MOVE itab-meins TO i_quan-unit.
        MOVE itab-nomvl TO i_quan-nomvl.
        MOVE itab-waers TO i_quan-curr.
        MOVE itab-varnc TO i_quan-varnc.
        MOVE itab-bgval TO i_quan-bgval.
        COLLECT i_quan.
      ENDLOOP.
      CLEAR itab.
      CLEAR i_quan.
      DATA: qty(15).
      DATA: unt(3).
      DATA: wtd TYPE p DECIMALS 2.
      DATA: wtd2(15).
      DATA: cur(3).
      DATA: var(15).
      DATA: nomvl(15).
      DATA: bgval(15).
      DATA: bgv TYPE p DECIMALS 2.
      DATA: bgv2(15).
      LOOP AT i_quan.
        qty = i_quan-quant.
        unt = i_quan-unit.
        cur = i_quan-curr.
        var = i_quan-varnc.
        bgval = i_quan-bgval.
        nomvl = i_quan-nomvl.
        wtd = nomvl / qty.
        bgv = bgval / qty.
      ENDLOOP.
      CLEAR i_quan.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          DATA DISPLAY                                   *
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      wa_fieldcat-fieldname  = 'EBELN'.
      wa_fieldcat-seltext_l  = 'Purchase Order'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 1.
      APPEND wa_fieldcat TO gt_fieldcat.
      wa_fieldcat-fieldname  = 'BEDAT'.
      wa_fieldcat-seltext_l  = 'PO Date'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 2.
      APPEND wa_fieldcat TO gt_fieldcat.
      wa_fieldcat-fieldname  = 'NAME1'.
      wa_fieldcat-seltext_l  = 'Vendor Name'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 3.
      APPEND wa_fieldcat TO gt_fieldcat.
      wa_fieldcat-fieldname  = 'WERKS'.
      wa_fieldcat-seltext_l  = 'Plant'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 4.
      APPEND wa_fieldcat TO gt_fieldcat.
    wa_fieldcat-fieldname  = 'MENGE2'.
      wa_fieldcat-fieldname  = 'MENGE'.
      wa_fieldcat-seltext_l  = 'Quantity'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 5.
      wa_fieldcat-do_sum     = 'X'.
      APPEND wa_fieldcat TO gt_fieldcat.
    wa_fieldcat-fieldname  = 'NETPR2'.
      wa_fieldcat-fieldname  = 'NETPR'.
      wa_fieldcat-seltext_l  = 'Basic Rate'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 6.
      wa_fieldcat-do_sum     = ' '.
      APPEND wa_fieldcat TO gt_fieldcat.
    wa_fieldcat-fieldname  = 'EXBED'.
    wa_fieldcat-seltext_l  = 'Excise'.
    wa_fieldcat-tabname    = 'ITAB'.
    wa_fieldcat-row_pos    = 1.
    wa_fieldcat-col_pos    = 7.
    APPEND wa_fieldcat TO gt_fieldcat.
      wa_fieldcat-fieldname  = 'STAX'.
      wa_fieldcat-seltext_l  = 'Sale Tax'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 7.
      APPEND wa_fieldcat TO gt_fieldcat.
      wa_fieldcat-fieldname  = 'DCOST'.
      wa_fieldcat-seltext_l  = 'Delivery Cost'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 8.
      APPEND wa_fieldcat TO gt_fieldcat.
      wa_fieldcat-fieldname  = 'NETWR'.
      wa_fieldcat-seltext_l  = 'Landed Value'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 9.
      wa_fieldcat-do_sum     = 'X'.
      APPEND wa_fieldcat TO gt_fieldcat.
      wa_fieldcat-fieldname  = 'LRATE'.
      wa_fieldcat-seltext_l  = 'Landed Rate'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 10.
      wa_fieldcat-do_sum     = ' '.
      APPEND wa_fieldcat TO gt_fieldcat.
    wa_fieldcat-fieldname  = 'NOMVL'.
    wa_fieldcat-seltext_l  = 'NOM Value'.
    wa_fieldcat-tabname    = 'ITAB'.
    wa_fieldcat-row_pos    = 1.
    wa_fieldcat-col_pos    = 12.
    wa_fieldcat-do_sum     = 'X'.
    APPEND wa_fieldcat TO gt_fieldcat.
    wa_fieldcat-fieldname  = 'NOMRT'.
    wa_fieldcat-seltext_l  = 'NOM Rate'.
    wa_fieldcat-tabname    = 'ITAB'.
    wa_fieldcat-row_pos    = 1.
    wa_fieldcat-col_pos    = 13.
    wa_fieldcat-do_sum     = ' '.
    APPEND wa_fieldcat TO gt_fieldcat.
      wa_fieldcat-fieldname  = 'BGVAL'.
      wa_fieldcat-seltext_l  = 'Budget Value'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 11.
      wa_fieldcat-do_sum     = 'X'.
      APPEND wa_fieldcat TO gt_fieldcat.
      wa_fieldcat-fieldname  = 'ZPLP1'.
      wa_fieldcat-seltext_l  = 'Budget Rate'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 12.
      wa_fieldcat-do_sum     = ' '.
      APPEND wa_fieldcat TO gt_fieldcat.
      wa_fieldcat-fieldname  = 'VARNC'.
      wa_fieldcat-seltext_l  = 'Variance'.
      wa_fieldcat-tabname    = 'ITAB'.
      wa_fieldcat-row_pos    = 1.
      wa_fieldcat-col_pos    = 13.
      wa_fieldcat-do_sum     = 'X'.
      APPEND wa_fieldcat TO gt_fieldcat.
      wa_layout-colwidth_optimize = 'X'.
      wa_layout-zebra = ' '.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = gt_events[].
      READ TABLE gt_events WITH KEY name =  slis_ev_end_of_page
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE 'END_OF_PAGE' TO ls_event-form.
        APPEND ls_event TO gt_events.
      ENDIF.
      READ TABLE gt_events WITH KEY name =  slis_ev_end_of_list
                             INTO ls_event.
      IF sy-subrc = 0.
        MOVE 'END_OF_LIST' TO ls_event-form.
        APPEND ls_event TO gt_events.
      ENDIF.
      gd_prntparams-reserve_lines = '7'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
                i_callback_program        = sy-repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
           i_callback_top_of_page            = 'TOP-OF-PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      i_callback_html_end_of_list           = 'END_OF_LIST_HTML'
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
                is_layout                 = wa_layout
                it_fieldcat               = gt_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
             i_default                    = 'X'
             i_save                       = 'X'
      IS_VARIANT                        =
       it_events                         = gt_events
      IT_EVENT_EXIT                     =
      is_print                          = gd_prntparams
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = itab
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *&      Form  top-of-page
          text
    -->  p1        text
    <--  p2        text
    FORM top-of-page .
    ALV Header Declarations
      DATA: t_header TYPE slis_t_listheader,
            wa_header  TYPE slis_listheader,
           wa_header1 TYPE slis_listheader,
           wa_header2 TYPE slis_listheader,
           wa_header3 TYPE slis_listheader,
            wa_header4 TYPE slis_listheader.
    Title
      wa_header-typ = 'H'.
      wa_header-info = 'Purchase Variance Report'.
      APPEND wa_header TO t_header.
      CLEAR wa_header.
    Material
    SHIFT p_matnr LEFT DELETING LEADING '0'.
    wa_header1-typ = 'S'.
    wa_header1-info = ' '.
    CONCATENATE 'Material : ' p_matnr matdes INTO wa_header1-info SEPARATED BY space.
    APPEND wa_header1 TO t_header.
    CLEAR wa_header1.
    Plant
    IF ( s_werks-low IS NOT INITIAL AND s_werks-high IS NOT INITIAL ).
       wa_header2-typ = 'S'.
       wa_header2-info = ' '.
       CONCATENATE 'Plant : ' s_werks-low 'to' s_werks-high INTO wa_header2-info SEPARATED BY space.
       APPEND wa_header2 TO t_header.
       CLEAR wa_header2.
    ELSEIF ( s_werks-low IS NOT INITIAL AND s_werks-high IS INITIAL ).
       wa_header2-typ = 'S'.
       wa_header2-info = ' '.
       CONCATENATE 'Plant : ' s_werks-low INTO wa_header2-info SEPARATED BY space.
       APPEND wa_header2 TO t_header.
       CLEAR wa_header2.
    ELSEIF ( s_werks-low IS INITIAL AND s_werks-high IS INITIAL ).
       EXIT.
    ENDIF.
    Period
      IF ( s_bedat-low IS NOT INITIAL AND s_bedat-high IS INITIAL ).
        wa_header4-typ = 'S'.
        wa_header4-info = ' '.
        CONCATENATE 'Period : '
                    s_bedat-low+6(2) '.'
                    s_bedat-low+4(2) '.'
                    s_bedat-low(4) INTO wa_header4-info SEPARATED BY space.
        APPEND wa_header4 TO t_header.
        CLEAR wa_header4.
      ELSE.
    IF ( s_bedat-low IS INITIAL AND s_bedat-high IS INITIAL ).
        wa_header4-typ = 'S'.
        wa_header4-info = ' '.
        CONCATENATE 'Period : '
                    s_bedat-low+6(2) '.'
                    s_bedat-low+4(2) '.'
                    s_bedat-low(4)
                    'to'
                    s_bedat-high+6(2) '.'
                    s_bedat-high+4(2) '.'
                    s_bedat-high(4) INTO wa_header4-info SEPARATED BY space.
        APPEND wa_header4 TO t_header.
        CLEAR wa_header4.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_header.
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.                    " top-of-page
    *&      Form  end_of_list_html
          output at the end of the list - not in printed output       *
    FORM end_of_list_html USING end TYPE REF TO cl_dd_document.
      DATA: ls_text TYPE sdydo_text_element,
            l_grid     TYPE REF TO cl_gui_alv_grid,
            f(14) TYPE c VALUE 'SET_ROW_HEIGHT'.
      DATA: qty1 TYPE sdydo_text_element.
      DATA: unt1 TYPE sdydo_text_element.
      DATA: wtd1 TYPE sdydo_text_element.
      DATA: cur1 TYPE sdydo_text_element.
      DATA: var1 TYPE sdydo_text_element.
      DATA: verp1 TYPE sdydo_text_element.
      DATA: bgv1 TYPE sdydo_text_element.
      qty1 = qty.
      unt1 = unt.
      wtd1 = wtd.
      cur1 = cur.
      var1 = var.
      verp1 = verp.
      bgv1 = bgv.
      ls_text = 'SUMMARY'.
      CALL METHOD end->add_text
        EXPORTING
          text         = ls_text
          sap_emphasis = 'strong'.
    Total Qty Bought (start new line)
      CALL METHOD end->new_line.
      CALL METHOD end->add_text
        EXPORTING
          text = 'Total Qty Bought : '.
      CALL METHOD end->add_text
        EXPORTING
          text = qty1.
      CALL METHOD end->add_text
        EXPORTING
          text = unt1.
    Wtd. Avg. Purchase Rate
      CALL METHOD end->new_line.
      CALL METHOD end->add_text
        EXPORTING
          text = 'Wtd. Avg. Purchase Rate : '.
      CALL METHOD end->add_text
        EXPORTING
          text = cur1.
      CALL METHOD end->add_text
        EXPORTING
          text = wtd1.
    Wtd. Avg. Budget Rate
      CALL METHOD end->new_line.
      CALL METHOD end->add_text
        EXPORTING
          text = 'Wtd. Avg. Budget Rate : '.
      CALL METHOD end->add_text
        EXPORTING
          text = cur1.
      CALL METHOD end->add_text
        EXPORTING
          text = bgv1.
    Gain / Loss
      CALL METHOD end->new_line.
      CALL METHOD end->add_text
        EXPORTING
          text = 'Gain / Loss : '.
      CALL METHOD end->add_text
        EXPORTING
          text = cur1.
      CALL METHOD end->add_text
        EXPORTING
          text = var1.
    MAP ( Moving Average Price )
      CALL METHOD end->new_line.
      CALL METHOD end->add_text
        EXPORTING
          text = 'Mov Avg Price : '.
      CALL METHOD end->add_text
        EXPORTING
          text = cur1.
      CALL METHOD end->add_text
        EXPORTING
          text = verp1.
    ENDFORM. "end_of_list_html.
    *&      Form  END_OF_PAGE
    FORM end_of_page.
      DATA: listwidth TYPE i,
            ld_pagepos(10) TYPE c,
            ld_page(10)    TYPE c.
      wtd2 = wtd.
      bgv2 = bgv.
      CONDENSE qty.
      CONDENSE unt.
      CONDENSE wtd2.
      CONDENSE bgv2.
      CONDENSE var.
      CONDENSE verp.
      SKIP.
      WRITE:/ 'SUMMARY:'.
    write:/ sy-uline(7).
      WRITE:/ 'Total Qty Bought        : ', qty, unt.
      WRITE:/ 'Wtd. Avg. Purchase Rate : ', wtd2, cur.
      WRITE:/ 'Wtd. Avg. Budget Rate   : ', bgv2, cur.
      WRITE:/ 'Gain / Loss             : ', var, cur.
      WRITE:/ 'Mov Avg Price           : ', verp, cur.
    ENDFORM.                    "END_OF_PAGE
    *&      Form  END_OF_LIST
    FORM end_of_list.
      DATA: listwidth TYPE i,
            ld_pagepos(10) TYPE c,
            ld_page(10)    TYPE c.
      wtd2 = wtd.
      bgv2 = bgv.
      CONDENSE qty.
      CONDENSE unt.
      CONDENSE wtd2.
      CONDENSE bgv2.
      CONDENSE var.
      CONDENSE verp.
      SKIP.
      WRITE:/ 'SUMMARY:'.
    write:/ sy-uline(7).
      WRITE:/ 'Total Qty Bought        : ', qty, unt.
      WRITE:/ 'Wtd. Avg. Purchase Rate : ', wtd2, cur.
      WRITE:/ 'Wtd. Avg. Budget Rate   : ', bgv2, cur.
      WRITE:/ 'Gain / Loss             : ', var, cur.
      WRITE:/ 'Mov Avg Price           : ', verp, cur.

  • Header Pricing conditions in BAPI function module

    I am using BAPI function module BAPI_SALESDOCU_CREATEFROMDATA1 to create sales orders through program.
    It is working fine with item level pricing conditions.
    But my requirement is ... I need to update few pricing conditon types in item level and one in header level.
    Could you please help me where I need to pass header pricing conditions. Please help me.
            CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
              EXPORTING
                SALESDOCUMENT             = SALESDOCUMENT
                SALES_HEADER_IN           = SALES_HEADER_IN
              SALES_HEADER_INX          =
              SENDER                    =
                BINARY_RELATIONSHIPTYPE   = 'VORL'
              INT_NUMBER_ASSIGNMENT     = ' '
              IMPORTING
                SALESDOCUMENT_EX          = SALESDOCUMENT_EX
              TABLES
                RETURN                    = RETURN
                SALES_ITEMS_IN            = SALES_ITEMS_IN
              SALES_ITEMS_INX           =
                SALES_PARTNERS            = SALES_PARTNERS
                SALES_SCHEDULES_IN        = SALES_SCHEDULES_IN
              SALES_SCHEDULES_INX       =
                SALES_CONDITIONS_IN       = SALES_CONDITIONS_IN.
              SALES_CFGS_REF            =
              SALES_CFGS_INST           =
              SALES_CFGS_PART_OF        =
              SALES_CFGS_VALUE          =
              SALES_CFGS_BLOB           =
              SALES_CCARD               =
              KEY_TABLE                 =
    Thanks in advance.
    Raghu

    If the correct configuration allows for manual entry of the condition type you want to populate, You can map your value using
    ' ORDER_CONDITIONS_IN'  . If item level map line number, cond step number of the condition type in your pricing procedure, your condition type you are using,  condition value you are sending into the system,  currency, and cond unit. If it is a header condition, then send in 000000 as the item number.   You can also consider using BAPI_SALESORDER_CREATEFROMDAT2

Maybe you are looking for