Fixed Footer for Invoice, PO, Etc

I have been unable to locate a solution to forcing a fixed footer position. So after the detail lines print, depending on how much detail there is, the footer can be pushed so part of it prints on a subsequent page. This is unacceptable. Footers may include totals and other information that needs to be grouped on the same page.
It is ok to print the footer on a 2nd page, but not ok to split the footer between pages.
Any samples that can be provided to me would be very helpful. I can be emailed @ ira,[email protected]
Thank you,
Ira D, Kleiner, MS, MBA

Corrected Email.
[email protected]

Similar Messages

  • Can anyone out there recommend a program for invoices, etc for a small business?

    Hi,
    I am a small business owner, and used in the past PC programs. I am about to start a new business, but I now have an iMac (intel) and I am finding it very hard to find a decent program for invoicing, tax, etc for a small business.
    I am based in UK so I need something which I can use here.
    Can anyone , preferably a small business owner or someone who uses such a program, please recommend a good one??
    Thanks
    Paul

    There are countless invoicing apps,I'd recommend opening the Mac App Store and do a search for Invoicing to see at least 7 or 8.

  • Printing fixed number of  Invoice Line in rtf template with level two group

    Hi,
    I have to print fixed number of invoice lines on a page. Invoce tempalte design has a table with header and summary(Invoice , tax and shiping totals) at each page in table footer. The table should repeate at each page with header and footer. I need to print specific number of rows or number of rows wihich page can accumulate in table body on each page.
    I checked few blogs giving solution for fixed number of rows printing say
    "Anatomy of a Template I - Fixed Row Enumeration"(http://blogs.oracle.com/xmlpublisher/2007/03/27/)
    and
    http://oracle.anilpassi.com/xml-publisher-developing-reports-printed-on-pre-printed-stationary-2.html
    Above two blogs explanation has only one group at line level. but in my case there are two groups (Parent and child) at line level. I am able to count rows in parent group but it is not counting lines in child group.
    Edited by: Bhanu Yadav on Apr 19, 2011 2:10 AM

    Will it be possible for you to move the 1st and 3rd sections to header/footer?
    So that if the 2nd section spills over to next page too, starting position of 3rd section wont be affected.

  • GR notnot required for invoice

    Hello All,
    Which are the scenarios where GR is not required for invoice verification> for eg, In Blanket POs , standrad SAP suggests no GR. Similar scenarios.
    regards
    N Banu

    Hi,
    GR is basically not required when u have to do the Invoice Planning.e.g. suppose u have broadband connection for validity period of 3 month and for one month charges are Rs 100.
    Now u raise a blanket service PO for 3 months and rate fixed as Rs 100 per month.
    Now service provider can send u invoice of Rs 90 for a month. In this case no GR/SES is required....u just simply go by Invoice verification as per ur invoive planning.
    2. For PIPE material, there is no PO raised in the system and no GR is required and neither it is a stock material in store. How much you use, pay for that one either Daily, fortnightly or monthly etc.
    Hope Clear U !
    Regards,
    pardeep Malik

  • Regarding Tolerance Keys for Invoice Block For Payment in MIRO

    Hi all,
    In customizing, I have defined Tolerance Keys for Invoice Block for Payment. I have defined all tolerance keys for my company code ...... with Absolute as well as Percentage Limits. But whenever I am doing MIRO & testing for my Block Codes effectiveness, i am finding that everytime my Invoice gets Blocked by Tolerance Key PP(Price Variance) or by date......but not by any other like BD, BW, KW etc. Can anyone help me as how I should check for this. I even tried to study the documentation part available in customizing, but was unable to understand the term like Order Price Quantity units.......Can anyone help me in understanding this thing ........
    Regards.....

    Hi Ganesh,
    below is the user exit where you can check the tolarance and put the Block according to the your requirment.
    User Exit name - MM08R002 -User exit for tolerance checks
    in the above user exit you have to use  the below Function exit.
    1) EXIT_SAPLMRMC_001
    2) EXIT_SAPLMRMP_001
    we implemented the above user exit to put the payment block based on the checks.
    You can find the documentation of the above exit in the system.
    Thanks
    Naresh

  • BAPI or FM for Invoice made for sales order...

    Hi Experts,
    Is there any BAPI / FM for Invoices made for sales order for the month or date wise, party wise, etc.
    I want to make a report invoices made during the given period for sales order.
    Yusuf.

    check this BAPI to get invoice details
    BAPI_BILLINGDOC_GETDETAIL.
    see the documentation to know how to use.
    Regards
    Peram

  • Fixed Date for Payment term

    Hi,
    We have a customer with three fixed date of payment depending on the invoice date, but we do not know how to customize payment terms with fixed date. It seems it is not possible with OBB8...
    Thank you very much,
    Ariana

    Hi Ariana,
    Yes it is very much possible using OBB8 to have fixed date of payment.You have to make use of the field Day Limit (which is just below the payment tem field) and Fixed Day and Additional month (Which you will find in the tab for baseline date calculation) in OBB8
    Lets say the you want the TOP (Terms of Payment) like
    1) For invoicing up to 10th of the month the baseline date is 30th of the current month
    2) For invoicing up to 20th of the month the baseline date is 15th of the next month
    3) For invoicing up to 30st of the month the baseline date is 30th of the next month
    Hence when lets say u create a TOP say TEST in OBB8 you will make the configuration as below
    1) Payment Term: TEST, Day Limit: 10, Fixed Day:30, Additional Month: 0
    2) Payment Term: TEST, Day Limit: 20, Fixed Day:15, Additional Month: 1
    3) Payment Term: TEST, Day Limit: 30, Fixed Day:30, Additional Month: 1
    Hope this helps you
    Reagrds
    Pratiksha
    *Assign points if helpful

  • Aprroval for Invoice have due date greater than 100 days

    Hi all!
    I would like to create query to approve for Invoice have due date greater than 100 days.
    SELECT 'true' from OINV  where max(datediff(day, OINV.docduedate, getdate()))>100 and OINV.docstatus ='O' and  cardcode = $[$4.0.0] group by cardcode
    It's not working. Can you help me!
    Thanks!

    Hi Tien,
    Hopefully not trying to teach you how to suck eggs here, but it looks like the query is doing too much. There shouldn't be a need to perform a "GROUP BY" in a query to dictate if an approval is to be triggered or not, only the criterai to make it happen.
    For examle, the following code will send a transaction for approval if the customers code equals a specific reference.....
    SELECT 'TRUE' FROM ORDR T0 WHERE ${ORDR.CardCode} = 'ABC001'
    If you're wanting a query to just return a boolean answer based on the date criteria, you might want to try adapting your query to something like.......
    SELECT 'true' from OINV where max(datediff(day, ${OINV.docduedate}, getdate()))>100 and ${OINV.docstatus} ='O' and  cardcode = ${$4.0.0}
    (As an additional tip, in order to test a query that you're wanting to use as either a formatted search or approval type selection, when in the transaction, if you locate the relevant saved query under "Tools > Queries > User Queries" etc, where you have references to specific fields e.g. ${ORDR.CardCode}, this will pick up the values from the current record and give you a what if scenario. I tend to have just a "Temp" query I use for WIP type queries of this nature.)
    Note - You need to replace the bracket's "{}" with square ones, I've used the others as the forum posts as a http reference.
    Hope this helps!
    Julian

  • Fixed amounts for wagetypes

    Hi Guys,
    Can you help me with this one?
    I was asked to change fixed amounts for two wagetypes related to shiftwork in China.
    I did that in table T510J. The new values work for all pers. areas.
    However, customer would like to have different values for different PA's. I've spent hours on this already and I am not sure if and how this can be done.
    It seems to me the system looks at the MOLGA not pers. areas while choosing wagetype values.
    Does anybody know if the values can be assigned to PA's?
    Thanks,
    Monika.

    Monika,
    When you created your entries in T510J, you entered some values per WT and for specific payroll modifiers.
    Well, you can differentiate values for the same WT's and different payroll modifiers in this table.
    So, in your example, where you want to default different values for the same WT and different PA's, what you have to do is the following:
    Copy rule XMOD into a customer rule. Change the rule to default a different payroll modifier value for each personnel area by using MODIF 2.
    Example: make a decision based on personnel area. FOr personnel area xxxx default MODIF 2=01. For personnle area yyyy default MODIF 2=02.
    In table t510J enter WT AAAA for each modifier. You will have one entry for modifier 01 with value x and one entry for modifier 02 with value y.
    The system will then calculate a different fixed rate for each personnel area and same WT.
    Please be careful when you change the rule and ensure you don't affect the other modifiers in the rule (A, C, D etc)./ Also the rule has to be maintained for hourly, salaried etc ESG for PCR>
    Hope this helps

  • Footer for ALV

    Hi,
    how we can create and display Footer for ALV Grid ,
    pls give me with some example

    Hi Chaaya,
    Here is the example.
    In the below code, TOP_OF_PAGE is used... similarly in your case END_OF_PAGE should be used. The way you define the event and handle it is similat to that of TOP_OF_PAGE event handled in the below code.
    * Description   : Automatic Condition records generation from Quotation*
    * Packages      : ZSPR                                                 *
    * Table Updates : VBAK, KONP and KONM                                  *
    * Parameters    : P_VKORG, P_VTWEG, P_SPART and P_VKAUS                *
    * Select Option : S_AUDAT, S_VBELN, S_KUNNR and S_MATNR                *
    * Input         : NA                                                   *
    * Output        : NA                                                   *
    * Return Codes  : SY-SUBRC                                             *
    * Special Logic : NA                                                   *
    * Includes      : NA                                                   *
    *             H I S T O R Y   O F   R E V I S I O N S                  *
    *  Date          Programmer      Request #        Description          *
    REPORT  ZSPRENH069 LINE-SIZE 1023 NO STANDARD PAGE HEADING.
    TYPE-POOLS : SLIS.                            "Global Type for ALV      
    *    T Y P E S                                                         *
    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_C(1)         TYPE C VALUE 'C',                    "Constant Value C
          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  A~VBELN EQ B~VBELN
    *         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_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  A~VBELN EQ B~VBELN
           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  A~VBELN EQ B~VBELN
           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.
          CLEAR W_MARA.
          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.                              " SY-SUBRC FOR READ TABLE T_MARA
        ELSE.
          CLEAR W_MVKE.
          READ TABLE     T_MVKE
               INTO      W_MVKE
               WITH KEY  MATNR = W_VB_AKAP-MATNR
                         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-MATNR
                                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-MATNR
                                  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.
          CLEAR W_MARA.
          READ TABLE     T_MARA
               INTO      W_MARA
               WITH KEY  MATNR = W_VB_AKAP-MATNR
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-ZZTECHSPEC = W_MARA-ZZTECHSPEC.
          ENDIF.                              " SY-SUBRC FOR READ TABLE T_MARA
        ENDIF.                              " IS INITIAL CHECK FOR W_MVKE-KONDM
    *-----------------Begin of changes for the change request 2007106------25th July 2007------COMMENTED FROM HERE-----
    **   This logic is written to avoid records without Material Pricing group whose
    **   Zcount is selected as 1.
    *    IF P_VKAUS EQ C_1.
    *      IF NOT W_IFINAL-KONDM IS INITIAL AND W_IFINAL-VKAUS IS INITIAL.
    *        APPEND W_IFINAL TO T_IFINAL.
    *      ENDIF.
    *    ELSE.
    *-----------------End   of changes for the change request 2007106------25th July 2007------COMMENTED TILL HERE-----
        APPEND W_IFINAL TO T_IFINAL.
    *    ENDIF.              Commented for the change request 2007106-----25th July 2007
        CLEAR: W_VB_AKAP,
               W_IFINAL.
      ENDLOOP.
      SORT T_IFINAL BY VBELN POSNR.
    *  Checking whether if there are any header quotations which does not have items against them in item internal table
    *  if such records exist then, ensuring that such records gets deleted from header too, so that inconsitency is removed.
      CLEAR W_IHEADER.
      LOOP AT T_IHEADER INTO W_IHEADER.
        CLEAR W_IFINAL.
        READ TABLE T_IFINAL INTO W_IFINAL
                            WITH KEY VBELN = W_IHEADER-VBELN
                            BINARY SEARCH.
        IF SY-SUBRC NE 0.
          W_IHEADER-SELECT = C_X.
          MODIFY T_IHEADER FROM W_IHEADER TRANSPORTING SELECT.
        ENDIF.
      ENDLOOP.
      DELETE T_IHEADER WHERE SELECT = C_X.
      SORT T_IFINAL BY VBELN POSNR.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  build_layout
    *       To build ALV Layout
    FORM BUILD_LAYOUT.
      CLEAR  : W_LAYOUT.
      W_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
      W_LAYOUT-BOX_TABNAME       = C_HTNAME.      "tabname for checkbox
      W_LAYOUT-BOX_FIELDNAME     = 'SELECT'.      "fieldname for checkbox
      CLEAR  : W_KEYINFO.
      W_KEYINFO-HEADER01 = 'VBELN'.               "Header1 key information
      W_KEYINFO-ITEM01   = 'VBELN'.               "Item1 key information
    *  W_LAYOUT-no_min_linesize = C_X.
    *         W_LAYOUT-min_linesize  = 80.
    *         W_LAYOUT-max_linesize  = 400.
    ENDFORM.                                      "build_layout
    *&      Form  build_events
    *       To build ALV Events
    FORM BUILD_EVENTS.
      CONSTANTS: C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE     = 1
        IMPORTING
          ET_EVENTS       = T_EVENTS
        EXCEPTIONS
          LIST_TYPE_WRONG = 1
          OTHERS          = 2.
      IF SY-SUBRC = 0.
        CLEAR W_EVENT.
        READ TABLE T_EVENTS INTO W_EVENT
                            WITH KEY NAME = C_TOP_OF_PAGE.
        IF SY-SUBRC = 0.
          MOVE C_TOP_OF_PAGE TO W_EVENT-FORM.
          MODIFY T_EVENTS INDEX SY-TABIX
                          FROM  W_EVENT
                          TRANSPORTING FORM.
        ENDIF.
      ELSE.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                                      "build_events
    *&      Form  top_of_page
    *       To display top of page in ALV Report
    FORM TOP_OF_PAGE.                                           "#EC CALLED
      DATA :
        L_VKORG(35) TYPE C,                        "Sales Organization
        L_VTWEG(35) TYPE C,                        "Distribution Channel
        L_SPART(35) TYPE C.                        "Division
    * Sales Organization
      CLEAR W_HEADER.
      W_HEADER-TYP  = C_S.
      CONCATENATE TEXT-004 P_VKORG INTO L_VKORG.
      W_HEADER-INFO = L_VKORG.
      APPEND W_HEADER TO T_HEADER.
    * Distribution Channel
      CLEAR W_HEADER.
      W_HEADER-TYP  = C_S.
      CONCATENATE TEXT-005 P_VTWEG INTO L_VTWEG.
      W_HEADER-INFO = L_VTWEG.
      APPEND W_HEADER TO T_HEADER.
    * Division
      CLEAR W_HEADER.
      W_HEADER-TYP  = C_S.
      CONCATENATE TEXT-006 P_SPART INTO L_SPART.
      W_HEADER-INFO = L_SPART.
      APPEND W_HEADER TO T_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = T_HEADER.
    ENDFORM.                                      "top_of_page
    *&      Form  pf_status
    *       To set PF-Status (user interface)
    *      -->EXTAB     The excluding table (function codes)
    FORM PF_STATUS                                              "#EC CALLED
              USING T_EXTAB TYPE SLIS_T_EXTAB.
      REFRESH T_EXTAB.
      SET PF-STATUS 'ZSTANDARD_FULLSCREEN' EXCLUDING T_EXTAB.
    ENDFORM.                                      "pf_status
    *&      Form  display_alv_report
    *       To display ALV report
    FORM DISPLAY_ALV_REPORT.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = G_REPID
          I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          IS_LAYOUT                = W_LAYOUT
          IT_FIELDCAT              = T_FIELDCATALOG
          I_DEFAULT                = C_X
          I_SAVE                   = C_A
          IT_EVENTS                = T_EVENTS[]
          I_TABNAME_HEADER         = 'T_IHEADER'
          I_TABNAME_ITEM           = 'T_IFINAL'
          IS_KEYINFO               = W_KEYINFO
        TABLES
          T_OUTTAB_HEADER          = T_IHEADER
          T_OUTTAB_ITEM            = T_IFINAL
        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.
    ENDFORM.                                      "display_alv_report
    *&      Form  BUILD_FIELDCATALOG
    *       To build ALV Field Catalog
    FORM BUILD_FIELDCATALOG .
      DATA: L_COUNT TYPE I VALUE 0.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_HTNAME.
      W_FIELDCATALOG-FIELDNAME   = 'SELECT'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C01.
      W_FIELDCATALOG-CHECKBOX    =  C_X.
      W_FIELDCATALOG-EDIT        =  C_X.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_HTNAME.
      W_FIELDCATALOG-FIELDNAME   = 'VBELN'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C02.
      W_FIELDCATALOG-KEY         =  C_X.   "Fixes the column for no-scroll
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS 

  • Document types for invoice docements

    Dear Experts,
    whenever I am printing Invoices and subsequent debit documents  it is showing the heading as Credit Memo .
    My user wants that when he will print normal invoice it should show Invoice and should show Credit Memo  when he posts subsequent debit documents. I am trying it with my ABAPER but i am not finding any difference in document type etc. hw should i do changes in customizing so that i wil able to print both the documents differantly.
    Regards,
    Mehul

    Hi Ramesh,
    In the field XRECH in the table RBKP,
    For Invoices the value is X
    For debit Memo it doesn't get updated
    But for Credit Memo also the value is X. and i want to differentiate Invoice and credit memo what should i do?
    Regards
    Mehul

  • GOODS MOVEMENT HISTORY FOR INVOICE REGISTRATION

    Hi all,
    I use the BAPI BAPI_INCOMINGINVOICE_CREATE to register invoices.
    The BAPI wants as input parameter the list of goods movement.
    Thus, I need a remote component (BAPI, RFC, Function Module, etc.) to get the goods movement history for a certain purchase order.
    Note that I do NOT need the goods movement (BAPI BAPI_GOODSMVT_GETDETAIL).
    I need a component with the same behaviour of the MIRO transaction, which displays, for a certain Purchase Order, the goods movements "available for invoice registration".
    Thank you very much in advance.
    Mauro
    Message was edited by: Mauro De Santis

    Message was edited by: Mauro De Santis

  • Allow posting to previous period only for invoices (only invoices).

    Hi gurus,
    We want to cancel invoice document s(MR8M) with the same date that the invoice was created (previous period). We know that we can use MMRV transaction for this but MMRV will posting of all MM documents, whereas we need to restrict posting  to previous period only for invoices.
    It´s possible? Can you please help on this with complete steps?
    thanks!!!

    I don´t know if there is a better way to do that, but you could flag the field "Allow Posting to Previous Period" in MMRV and configure the posting date in all the transaction (MIGO, MIRO, MB1A,MB1B, etc) for only display except MR8M transaction.

  • Exchange Rate for invoice matching IR = GR exchange rate

    Hi Gurus
    u2022     Exchange Rate for invoice matching IR ( at Feb at 2.10 ) should be similar to GRN ( Jan at 2.00 exchange rate ). Customer does not want to fix the exchange rate during the PO .
    u2022     They want to pick up the exchange rate when the GR is being executed .Is there any automatic setting to enable this, they want to avoid manually changing the exchange rate during IR.
    Best Regards
    Wai Meng

    Hi
    Try this
    LIV- incoming invoice - how exchange rate differences are treated - for your company code check the indicator as N - then if exchange rate is different then it will be posted to PRD.
    But it is not possible to fix exchange rate based on GR, either you need to enter invoice date same as GR date then same rate will be maintained.
    Thanks

  • HT201210 Ipad 4 rebooted automatically numerous times...froze up...hard restarted using home and power...put itself into restore mode "connect to iTunes"...I did this but I get error '1600' and can't perform restore...i've exhausted all fix options for '1

    Hi folks as in the title:
    My Ipad 4 froze up and rebooted automatically numerous times.
    It then immediately froze up completely and didn't try and reboot itself.
    I then hard restarted the device using the home and power buttons simultaneously.
    I got the Apple logo and saw my desktop for a moment and then it froze up.
    Hard rebooted again only this time I saw "connect to iTunes".
    I connected the device to my MBP and iTunes where I was told it was in restore mode.
    I followed the on-screen instructions in iTunes to restore the device.
    I spent 15minutes downloading the necessary files etc only for the restore to fail through error code '1600'.
    I explored this error code in Apple support and followed all Apple's suggestions, and subsequently tried the restore each time.
    I have now exhausted all fix options for '1600'...and I can't even get 'connect to iTunes message' on my iPad device now.
    Any suggestions would be welcome please?
    Kind regards.

    Thanks for the response Demo.
    Unfortunately I don't have another computer with which to try a restore from.
    I've tried to reboot the iPad again using the sleep and home buttons (whilst it is unplugged from my MBP) and it remains completely lifeless. I know there is 80% battery life in the device as I had it charging when it malfunctioned.
    I've tried recovery mode through iTunes in excess of 15 times now all yielding the same and inevitable result of 'error 1600'.
    I think it's time to get to know the team at my local Apple store...

Maybe you are looking for

  • Printing in Classic

    I have a G4/350 w/ OS10.3.9 and an Epson CX6400 printer/Scanner. I have no problem printing in OS 10 or in OS 9. However when trying to print an OS 9 app in Classic I can only print to a PDF and then print from that. Also, I cannot Scan in Classic. T

  • Keyboard animation problem.

    Im having various problems after 2.2 update. I was posting a message and suddenly the keyboard animation just stopped. A minute later i lost internet connection and had to reset the phone. Holding the backspace button for 2 seconds results in whole m

  • Not able to display the Installation Base of once it unassigned from upper level Installation IBase.

    Hi All I am working on IBase scenario for my client, I am new to the IBase scenario. Here we are creating installation base for two to five levels of product. Once we create IBase for lower level then this IBase is inserted in upper level IBase. Like

  • Artwork Issue (newbie question)

    Hi guys, I have just submitted my first ever podcast but have a couple of questions re: the arwork. the feed is at http://www.new-images.com/podcasts/feed.xml the link to the podcast in the store is at http://itunes.apple.com/WebObjects/MZStore.woa/w

  • RE:BAPI for Create Material Serial Number

    Can anybody please suggest me any function module or BAPI available to Create Material Serial Number (transaction IQ04), and later Change Material Serial Number (transaction IQ02) for updating its class type, class and characteristic description?