Regarding building a purchase order smart form

hi guys,
i got to design a  purchase order smart form  which consists of 3 pages and i need to enclose " terms and conditions " on the back side of every page. To be more elaborative on first page purchase order details and back side of it " terms and conditions " and same way on other 2 pages.
how do i do it, can any one help me with this.
thank you very much
     pavan

Hi
If the smartform purchase order is not available in your system
means you can download the form IDES and you can upload the form in ur ecc 6.0 system.we faced a similar kind of problem in our system and we did as i said.
Once you uploaded the things you can easily view the form interface and rest of the things related to smartforms.
Thanks and Regards
Arun Joseph

Similar Messages

  • Purchase order smart forms

    i have copied the purchase order smart form and activated it and know i have the function moudule which need to be used in program but i am not shure how to do that can any one tell me how i need to write the coding for simple purchae order and then pass on the data to the smart form so that it displays the output.

    What you do for inserting lines is to select line one of the screen table and then click the insert button.
    Do this for each line in your BDC and then you only have to worry about line one of the table:
    Code:
    Form Add_Item_Line Tables t_Item_Data
                        using pu_program     type Program_Name
                              pu_screen      like sy-dynnr
                              pu_insert_line like sy-ucomm
                              pu_insert_at   like sy-tabix
                              pu_werks       like Zorder_Header-Dwerk.
         Data: t_characteristics type Order_Lines,
               w_Characteristic like Zorder_Line.
         Perform Zbdc_Screen using pu_Program pu_Screen.
         Perform Zbdc_Field  using c_OkCode pu_insert_line.           <----
         Perform Zbdc_Screen using pu_Program pu_Screen.
         Loop at t_Item_Data into w_Characteristic.
            Is this actually part of the item line or is it a
            Characteristic ?
              Translate w_Characteristic-AtNam to Upper Case.
              Case w_Characteristic-AtNam.
                   When 'MATNR'.              " Material
                        Perform Zbdc_Subscript using 'VBAP-MATNR'
                                                     pu_insert_at
                                                     W_Characteristic-AtWrt.
                        Perform Zbdc_Subscript using 'VBAP-WERKS'
    Looking at it from a modification point of view, the aim will be always to bring the line of the table that you're interested in to line one of the table
    so again you only need to handle line one of the screen table. Some of the codes for this are 'POPO' in Purchase order processing, and 'SORT' in CO02:
    Code:
    Now loop round the P/O and delete all of those that we don't want
       Loop at t_ekpo.
          Keep this P/O Line item ?
            MOVE SY-TABIX TO W_POPO.
            PERFORM ZBDC_SCREEN USING 'SAPMV50A'   '0270'.
            PERFORM ZBDC_FIELD  USING 'BDC_OKCODE' '=POPO'.
            PERFORM ZBDC_SCREEN USING 'SAPMV50A'   '0111'.
            PERFORM ZBDC_FIELD  USING 'RV50A-POSNR' W_POPO.
            PERFORM ZBDC_FIELD  USING 'BDC_OKCODE' '/00'.
            Read Table t_vl31_asn with key ebeln = t_ekpo-ebeln
                                           ebelp = t_ekpo-ebelp.
            If sy-subrc <> 0.
             Not found - discard this one.
               PERFORM ZBDC_SCREEN USING 'SAPMV50A'   '0270'.
               PERFORM ZBDC_FIELD  USING 'RV50A-LIPS_SELKZ(01)' 'X'.
            ELSE.
             Change the quantity....
               WRITE T_VL31_ASN-MENGE TO W_MENGE UNIT T_VL31_ASN-LMEIN.
               CONDENSE W_MENGE NO-GAPS.
               PERFORM ZBDC_SCREEN USING 'SAPMV50A' '0270'.
               PERFORM ZBDC_FIELD  USING 'LIPS-LFIMG(01)' W_MENGE.
            EndIf.
       EndLoop.
    Hope this helps.
    Award points if found usefull.
    Cheers,
    Chandra Sekhar.

  • Purchase order smart forms and scripts

    i need to create a smart form and script in simple purchase order there is no requirements has given to me, can any one tell me in detail how i need to do and what are the procedures i need to follow, example code will be usefull and steps to build it.

    Hi,
    Go through the links mentioned below.
    http://www.****************/Tutorials/Smartforms/SFMain.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    http://www.sapmaterial.com/smartform_example.html
    Re: Hands on SAP Smart Forms
    smartforms
    A Simple Smartform Tutorial
    SAP Smartforms can be used for creating and maintaining forms for mass printing in SAP Systems. The output medium for Smartforms support printer, fax, e-mail, or the Internet (by using the generated XML output).
    According to SAP, you need neither have any programming knowledge nor use a Script language to adapt standard forms. However, basic ABAP programming skills are required only in special cases (for example, to call a function module you created or for complex and extensive conditions).
    1. Create a new smartforms
    Transaction code SMARTFORMS
    Create new smartforms call ZSMART
    2. Define looping process for internal table
    Pages and windows
    First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
    Here, you can specify your title and page numbering
    &SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
    Main windows -> TABLE -> DATA
    In the Loop section, tick Internal table and fill in
    ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
    3. Define table in smartforms
    Global settings :
    Form interface
    Variable name Type assignment Reference type
    ITAB1 TYPE Table Structure
    Global definitions
    Variable name Type assignment Reference type
    ITAB2 TYPE Table Structure
    4. To display the data in the form
    Make used of the Table Painter and declare the Line Type in Tabstrips Table
    e.g. HD_GEN for printing header details,
    IT_GEN for printing data details.
    You have to specify the Line Type in your Text elements in the Tabstrips Output options.
    Tick the New Line and specify the Line Type for outputting the data.
    Declare your output fields in Text elements
    Tabstrips - Output Options
    For different fonts use this Style : IDWTCERTSTYLE
    For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
    5. Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Additional Fonts for your SMARTFORMS
    You can create additional fonts and style with transaction SMARTSTYLES
    This can then be define in the paragraph and character formats, which you can then be assign to texts and fields in the Smart Form.
    The character formats includes effects such as superscript, subscript, barcode and font attributes.
    Also, you can refer to the below link for the explanation:
    http://help.sap.com/saphelp_46c/helpdata/en/4b/83fb42df8f11d3969700a0c930660b/frameset.htm
    Reward if helpful.
    Regards,
    Harini.S

  • Creating a Purchase Order Smart Form (Form Interface)

    After reading up on all the posts about making a PO smart form I know this:
    - An SAP script "medruck" is the current output
    - A smartform exists for PO's named "/SMB40/MMPO_L" or "/SMB40/MMPO_A"
    - You need to install an update to get those smartforms if you are using ECC 6.0
    So my dilemma is that the SAP administrator is on vacation for a week, so I can't install the update to our system.  I'm trying to just create it from scratch using the medruck SAP script as a reference, but I am a little confused.
    Basically all I need to know is what form interface parameters do I pass in?  Meaning how do I find out what structures and tables are imported into the function module when print preview is called from t-code ME22N?  Can you please provide proper syntax for form interface solution or instructions on how to determine imported variables into the smartform?

    Hi
    If the smartform purchase order is not available in your system
    means you can download the form IDES and you can upload the form in ur ecc 6.0 system.we faced a similar kind of problem in our system and we did as i said.
    Once you uploaded the things you can easily view the form interface and rest of the things related to smartforms.
    Thanks and Regards
    Arun Joseph

  • Purchase order smart form - Version number and link to RFQ

    Hi I am making enhancements to the purchase order smartform and wanted to print the version number (ekko-revno) on the print layout.
    The structure for ekko which is being filled in at runtime from print program ZMMS_640FM06P has the field 'revno' blank. It is filling in the rest all fields. When I go into the ekko table I can see a value in this field. Does anyone know why this field is NOT being filled. I do not want to do a select on this field again in my smart form.
    I would also like to know if there is a any way you can track back the RFQ number for a particular PO.
    Thanks in advance..

    I hope It wil be there in table, check the entry & check teh work area entry.
    Quotation will be available in PO item data. Keep  a break point in Table and workarea.
    Tx
    Parthi
    If helpful, reward points.

  • Modificatin in standard Purchase order smart forms

    Hi all,
       i m facing a prob.plz give guidelines to solve this problem.
       I m copying standard smartform /SMB11/MMPO_L  in a Prog. I want to add one colom in main window and in header window (WINHEADER and MAIN window) when ever i m adding one colum in header window (WINHEADER ) header window is disappeared in print preview . I m doing Following Steps .
    1) adding one col. in line type of Table structure T_HEADER by adjusting the total length 19.50 .
    2) add one text element in table structure .
    3) modifying their line indexes .
    after activating the samrtform , when i run it header is not displayed in the print preview .
    when i revert back these changes then header is again not displayed in Print Preview .

    HI i check all this all is correct . i have tried one more option
    first I add a coloumn in winheader table templet and adjust their length and indexes . Then activate it and with out running. i remove all the changes made and then again activate it and run it. Then header is  also not  displayed. while i revert all changes made.
    so help me to sort out this problem .
    Thanks & Regards
    Nitin

  • Purchase order smart form - e-mail smartform output and item attachments

    Hi,
    Our release is ECC5.0. By configuration the PO smartform can be e-mailed to vendor as PDF attachment by standard output medium,external send. And this already works. However, the additional functionality required is:
    1.) The documents attached to the actual PO line items should also be e-mailed as attachments to the vendor.
    How can I accomplish this?
    Do I need to write addition logic in my print program to retrieve these attachments by PO number and send them as a seperate e-mail with attachment? OR
    Is there any way to send these attachments on the same e-mail where the PO is sent as a PDF attachment. OR
    Can this be done by configuration?
    Regards,
    K..

    Hi Ahmad ,
    I got the same problem with a little more complexity because the mail can b send to several mails adresses ( some in copy ).
    For the requirement to send also the document linked in PO's item , there's no standard solution . So you need to write a specific program for this .
    You can have a look at this Sending DMS documents  as Email attachments , you will find information on how to retrieve the content of the document.
    Let me know if you need more explanation.
    Best regards.

  • How to get the Purchase Order sample form to have 2 detail regions?

    I would like to use the "Purchase Order" sample form as the base, and add one more "detail header" and "detail" subform to it.
    So I copy and paste the "detail header" + "detail" subforms, and position them right beneath the first "detail" subform.
    It works to certain extend.  I can click the "Add Item" button(s), and it would expand the respective "detail" region.
    The problem comes when things get expanded to the 2nd page.
    Say, I first add 5 rows to the 2nd "detail" region, everything still fits in one page;
    then I keep adding rows to the 1st "detail" region, and it begins to expand to the 2nd page....
    everything in the first "detail" region can still fit in the first page,
    the rows in the 2nd "detail" region should get pushed to the 2nd page...
    but when I look at the 2nd page of the form, the "detail header" on the 2nd page is that of the "FIRST" detail header, not the 2nd detail header!!
    So, when you look at the entire form, you have
    First Detail Header
    some First Detail Rows
    2nd Detail Header
    some 2nd Detail rows
    --- end of page 1---
    --- page 2---
    First Detail Header
    some detail rows (can't tell if they belong to the first detail region or 2nd detail region)
    This obviously is not right.
    So, how do I fix it such that the Detail Header on the 2nd page is that of the 2nd Detail header???

    an update:
    I have found out that the detail rows on the 2nd page are all that of the 2nd detail region.
    so, it's like this:
    when you look at the entire form, you have
    First Detail Header
    all the First Detail Rows
    2nd Detail Header
    some 2nd Detail rows
    --- end of page 1---
    --- page 2---
    First Detail Header
    some 2nd detail rows

  • Please send me fm regarding to get purchase order and change purchase order

    Hi,
    Please send me fm regarding to get purchase order and change purchase order .
    Regards,
    Gurprit Bhatia

    Hi,
    Function module to get the purchase order details:
    BAPI_PO_GETDETAIL.
    data: po_items type table of bapiekpo with header line.
    parameters: p_ebeln type ekko-ebeln.
    call function 'BAPI_PO_GETDETAIL'
      exporting
        purchaseorder                    = p_ebeln
      ITEMS                            = 'X'
      ACCOUNT_ASSIGNMENT               = ' '
      SCHEDULES                        = ' '
      HISTORY                          = ' '
      ITEM_TEXTS                       = ' '
      HEADER_TEXTS                     = ' '
      SERVICES                         = ' '
      CONFIRMATIONS                    = ' '
      SERVICE_TEXTS                    = ' '
      EXTENSIONS                       = ' '
    IMPORTING
      PO_HEADER                        =
      PO_ADDRESS                       =
    tables
      PO_HEADER_TEXTS                  =
       po_items                         = po_items
      PO_ITEM_ACCOUNT_ASSIGNMENT       =
      PO_ITEM_SCHEDULES                =
      PO_ITEM_CONFIRMATIONS            =
      PO_ITEM_TEXTS                    =
      PO_ITEM_HISTORY                  =
      PO_ITEM_HISTORY_TOTALS           =
      PO_ITEM_LIMITS                   =
      PO_ITEM_CONTRACT_LIMITS          =
      PO_ITEM_SERVICES                 =
      PO_ITEM_SRV_ACCASS_VALUES        =
      RETURN                           =
      PO_SERVICES_TEXTS                =
      EXTENSIONOUT                     =
    check sy-subrc  = 0.
    loop at po_items.
      write:/ po_items.
    endloop.
    Check this program too:
    RFFMFG_INV_CANC_ALL for BAPi_PO_GET_DETAIL.
    Hope it helps you.
    Regards,
    Anjali

  • Purchase order summary form

    Hi
    In purchase order summary form i query the purchase order with release number it is showing some amount in the headers summary form ,
    Now i want to know the how this amount filed is return value.based on which values it is calculated.
    ex:-My po_num:-11177 and release_num=5 once i query combination of this in the purchase order summary form it is showing in the headers amount filed is 32,054.25,
    But i query from back end based this po_number po_headers_all table showing BLANKET_TOTAL_AMOUNT=3953444.9
    Now i need help how amount filed calculated in the purchase order form .
    thank's
    Narendra

    Hi Narendra,
    blanket amount is SUM of amount for all releases under that Blanket.
    Release amount is SUM of amount for all shipments for that release i.e. SUM (quantity x price) for all shipments under that release.
    e.g. you have a blanket with 2 releases for the same item with unit price $ 1000.
    Release 1: Quantity = 3. So here the release amount will be $ 3000 (3 x 1000).
    Release 2: Quantity = 5. So here the release amount will be $ 5000 (5 x 1000).
    And the blanket amount will be $ 8000 (3000 + 5000)
    When you are querying using the blanket number and release number in PO summary the system is showing only the release record and corresponding amount for that. As per above example you'll see $ 3000 for 1st release and $ 5000 for 2nd release.
    Now query in PO summary with blanket number and without any release number. Check the 'View Releases' checkbox and press find. You'll see the blanket and all associated releases. There the release amount will add up the total blanket amount.
    Thanks
    - Supro

  • Purchase order Adobe form

    Hi,
      Is there a standard adobe form for Purchase order.
      If it is there how do i configure the standard form to trigger on
      Print preview of a purchase order and also how do I attach it
      to the standard output type NEU.
    Regards

    Hi,
    In ECC 6 it seem's to be a SAP Template for P.O .
    Also SAP Modify the print program to add a new entry for Adobe foms .
    So in transaction NACE for output type NEU set the form_entry to the new one ( i don't remember the name sorry ) , put the form with the adobe forms name and in the last colum set ti to adobe forms .
    Hope it's help you .
    regards.

  • Regarding fields for Purchase order

    can any body help what are the fields reqiured to develop a p.o report to display the change date,user name,time,p.o name and vendor code.

    Hi
    see the sample report for the fieldnames and other logic
    all the PO info is there here.
    *& Report  ZMM_PO_REPORT
    REPORT  ZMM_PO_REPORT message-Id yb
           NO STANDARD PAGE HEADING
           LINE-COUNT 60(1)
           LINE-SIZE 230.
           D A T A B A S E  T A B L E S   D E C L A R A T I O N
    TABLES: lfa1,           " Vendor Master
            t161,           " PO Doc Types
            t024,           " Purchase Groups
            ekko.           " PO Header
                   T Y P E S  D E C L A R A T I O N S
    Purchase Orders Main Structure
    TYPES: BEGIN OF s_po,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            bstyp TYPE bstyp,           " PO Category
            bukrs TYPE bukrs,           " Company Code
            bsart TYPE bbsrt,           " PO Type
            lifnr TYPE lifnr,           " Vendor No
            ekgrp TYPE bkgrp,           " Purchase Group
            waers TYPE waers,           " Currency
            bedat TYPE etbdt,           " PO Date
            txz01 TYPE txz01,           " Material Text
            werks TYPE ewerk,           " Plant
            lgort TYPE lgort_d,         " Storage Location
            matkl TYPE matkl,           " Material Group
            menge TYPE bamng,           " PR Quantity
            meins TYPE bamei,           " UOM
            bprme TYPE bbprm,           " Price Unit
            netpr TYPE netpr,           " Net price
            peinh TYPE peinh,           " Price Unit UOM
            pstyp TYPE pstyp,           " Item Category
            knttp TYPE knttp,           " Account Assignment Category
           END OF s_po.
    Purchase Orders History Structure
    TYPES: BEGIN OF s_account,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            gjahr TYPE mjahr,           " Fiscal Year
            belnr TYPE mblnr,           " PO Invoice No
            menge TYPE menge_d,         " PR Quantity
            wrbtr TYPE wrbtr,           " Price in Local Currency
            dmbtr TYPE dmbtr,           " Price in Foreign Currency
            waers TYPE waers,           " Currency
            shkzg TYPE shkzg,           " Dr/Cr Indicator
           END OF s_account.
    Purchase Orders History Structure(Item Sum)
    TYPES: BEGIN OF s_inv_sum,
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            menge TYPE menge_d,         " PR Quantity
            wrbtr TYPE wrbtr,           " Price in Foreign Currency
            waers TYPE waers,           " Currency
           END OF s_inv_sum.
    Purchase Orders Main Structure
    TYPES: BEGIN OF s_rep,
            lifnr TYPE lifnr,           " Vendor No
            ebeln TYPE ebeln,           " PO No.
            ebelp TYPE ebelp,           " PO Item
            bstyp TYPE bstyp,           " PO Category
            bsart TYPE bbsrt,           " PO Type
            ekgrp TYPE bkgrp,           " Purchase Group
            waers TYPE waers,           " Currency
            bedat TYPE etbdt,           " PO Date
            txz01 TYPE txz01,           " Material Text
            werks TYPE ewerk,           " Plant
            lgort TYPE lgort_d,         " Storage Location
            matkl TYPE matkl,           " Material Group
            menge TYPE bamng,           " PR Quantity
            meins TYPE bamei,           " UOM
            bprme TYPE bbprm,           " Price Unit
            netpr TYPE netpr,           " Net price
            peinh TYPE peinh,           " Price Unit UOM
            pstyp TYPE pstyp,           " Item Category
            knttp TYPE knttp,           " Account Assignment Category
            name1 TYPE name1,           " Plant
            orewr TYPE netpr,           " To be Invoiced Price
            curr  TYPE waers,           " Inv Doc Currency
           END OF s_rep.
               D A T A  D E C L A R A T I O N S
    DATA: gv_title1 TYPE sylisel,            " Report title
          gv_dial.                           " Color flag
                C O N S T A N T S  D E C L A R A T I O N S
    CONSTANTS: c_x                VALUE 'X',   " Flag X
               c_h                VALUE 'H',   " Debit
               c_vgabe TYPE vgabe VALUE '2'.   " Transaction Type
         I N T E R N A L  T A B L E S  D E C L A R A T I O N S
    DATA: i_po    TYPE STANDARD TABLE OF s_po WITH HEADER LINE,
                                 " Purchase Order
          i_inv   TYPE STANDARD TABLE OF s_inv_sum WITH HEADER LINE,
                                         " PO Invoice Values
          i_rep   TYPE STANDARD TABLE OF s_rep WITH HEADER LINE,
                                     " PO Invoice Values
          i_ekbe  TYPE STANDARD TABLE OF s_account WITH HEADER LINE.
                               " PO Invoice Values
                     S E L E C T I O N  S C R E E N                      *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr MATCHCODE OBJECT kred,
                    s_ebeln FOR ekko-ebeln MATCHCODE OBJECT mekk,
                    s_bsart FOR t161-bsart,
                    s_ekgrp FOR t024-ekgrp,
                    s_bedat FOR ekko-bedat.
    SELECTION-SCREEN END OF BLOCK b1.
                      I N I T I A L I Z A T I O N                        *
    INITIALIZATION.
                  A T  S E L E C T I O N - S C R E E N                   *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_screen.
                   S T A R T - O F - S E L E C T I O N                   *
    START-OF-SELECTION.
    Fetch main data
      PERFORM fetch_data.
                   T O P - O F - P A G E                                 *
    TOP-OF-PAGE.
    Header of the List
      PERFORM header.
                   E N D - O F - P A G E                                 *
    Footer
    END-OF-PAGE.
      ULINE.
                   E N D - O F - S E L E C T I O N                       *
    END-OF-SELECTION.
    Display the Report Output data
      PERFORM display_data.
    At Line-Selection
    AT LINE-SELECTION.
    When double clicked on EBELN display the details of Purchase Doc
      PERFORM line_sel.
    *&      Form  validate_screen
    Validation of Selection Screen fields
    FORM validate_screen .
    Validation of Vendor Number
      CLEAR lfa1-lifnr.
      IF NOT s_lifnr[] IS INITIAL.
        SELECT lifnr UP TO 1 ROWS
            INTO lfa1-lifnr
            FROM lfa1
            WHERE lifnr IN s_lifnr.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Vendor'(002).
        ENDIF.
      ENDIF.
    Validation of PO Number
      CLEAR ekko-ebeln.
      IF NOT s_ebeln[] IS INITIAL.
        SELECT ebeln UP TO 1 ROWS
            INTO ekko-ebeln
            FROM ekko
            WHERE ebeln IN s_ebeln.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Document Number'(003).
        ENDIF.
      ENDIF.
    Validation of PO Document Type
      CLEAR t161-bsart.
      IF NOT s_bsart[] IS INITIAL.
        SELECT bsart UP TO 1 ROWS
            INTO t161-bsart
            FROM t161
            WHERE bsart IN s_bsart.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Purchase Document Type'(004).
        ENDIF.
      ENDIF.
    Validation of Purchasing Group
      CLEAR t024-ekgrp.
      IF NOT s_ekgrp[] IS INITIAL.
        SELECT ekgrp UP TO 1 ROWS
            INTO t024-ekgrp
            FROM t024
            WHERE ekgrp IN s_ekgrp.
        ENDSELECT.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'Invalid Purchasing Group'(005).
        ENDIF.
      ENDIF.
    ENDFORM.                    " validate_screen
    *&      Form  fetch_data
    Fetching the PO related data from Database Tables
    FORM fetch_data .
      CLEAR i_po.
      REFRESH i_po.
      SELECT a~ebeln            " PO No.
             b~ebelp            " PO Item
             a~bstyp            " PO Category
             a~bukrs            " Company Code
             a~bsart            " PO Type
             a~lifnr            " Vendor No
             a~ekgrp            " Purchase Group
             a~waers            " Currency
             a~bedat            " PO Date
             b~txz01            " Material Text
             b~werks            " Plant
             b~lgort            " Storage Location
             b~matkl            " Material Group
             b~menge            " PR Quantity
             b~meins            " UOM
             b~bprme            " Price Unit
             b~netpr            " Net price
             b~peinh            " Price Unit UOM
             b~pstyp            " Item Category
             b~knttp            " Account Assignment Category
        INTO TABLE i_po
        FROM ekko AS a JOIN ekpo AS b
        ON a~ebeln = b~ebeln
        WHERE a~ebeln IN s_ebeln AND
              a~lifnr IN s_lifnr AND
              a~ekgrp IN s_ekgrp AND
              a~bsart IN s_bsart AND
              a~bedat IN s_bedat.
      SORT i_po BY ebeln ebelp.
      break-point.
      IF NOT i_po[] IS INITIAL.
    Fetch the PO History/Invoice Details from EKBE Table
        CLEAR i_ekbe.
        REFRESH i_ekbe.
        SELECT ebeln           " PO No.
               ebelp           " PO Item
               gjahr           " Fiscal Year
               belnr           " PO Invoice No
               menge           " PR Quantity
               wrbtr           " Price in Local Currency
               dmbtr           " Price in Foreign Currency
               waers           " Currency
               shkzg           " Dr/Cr Indicator
         INTO TABLE i_ekbe
         FROM ekbe
         FOR ALL ENTRIES IN i_po
         WHERE ebeln = i_po-ebeln AND
               ebelp = i_po-ebelp AND
               vgabe = c_vgabe.
        IF sy-subrc = 0.
          SORT i_ekbe BY ebeln ebelp.
          LOOP AT i_ekbe.
            IF i_ekbe-shkzg = c_h.
              i_ekbe-wrbtr = i_ekbe-wrbtr * -1.
            ENDIF.
            MODIFY i_ekbe.
          ENDLOOP.
      break-point.
    Sum up the Item wise Invoice totals
          LOOP AT i_ekbe.
            AT END OF ebelp.
              READ TABLE i_ekbe INDEX sy-tabix.
              SUM.
              MOVE-CORRESPONDING i_ekbe TO i_inv.
              APPEND i_inv.
            ENDAT.
            CLEAR i_inv.
          ENDLOOP.
          SORT i_inv BY ebeln ebelp.
            break-point.
        ENDIF.
      ENDIF.
    Move the Vendor Name and Invoice Values to I_rep Internal Table
      LOOP AT i_po.
        MOVE-CORRESPONDING i_po TO i_rep.
        CLEAR i_inv.
        READ TABLE i_inv WITH KEY ebeln = i_po-ebeln
                                  ebelp = i_po-ebelp.
        IF sy-subrc = 0.
          i_rep-orewr = ( i_po-menge - i_inv-menge ) * i_po-netpr.
          i_rep-curr  = i_inv-waers.
        ELSE.
          i_rep-orewr = i_po-menge * i_po-netpr.
          i_rep-curr  = i_po-waers.
        ENDIF.
      break-point.
    Get the Vendor Name
        CLEAR lfa1-name1.
        SELECT SINGLE name1 FROM lfa1 INTO lfa1-name1
          WHERE lifnr = i_po-lifnr.
        IF sy-subrc = 0.
          i_rep-name1  = lfa1-name1.
        ENDIF.
        APPEND i_rep.
        CLEAR  i_rep.
          break-point.
      ENDLOOP.
      SORT i_rep BY lifnr ebeln ebelp.
      DELETE i_rep WHERE orewr LE 0.
      break-point.
    ENDFORM.                    " fetch_data
    *&      Form  display_data
    Display the Report Output data
    FORM display_data .
      DATA: lv_flag,               " New Flag
            lv_rec TYPE i.         " No of Records
      CLEAR lv_rec.
      IF i_rep[] IS INITIAL.
        MESSAGE e000 WITH 'No Data found'(022).
      ELSE.
        LOOP AT i_rep.
    Toggle Color
          PERFORM toggle_color.
          IF lv_flag <> space.
            NEW-LINE.
          ENDIF.
    At New Purchase Document
          AT NEW ebeln.
            WRITE:/1 sy-vline, 2(10) i_rep-ebeln INTENSIFIED OFF.
            lv_flag = c_x.
            lv_rec = lv_rec + 1.
          ENDAT.
          WRITE: 1 sy-vline,
                12 sy-vline,13(4)   i_rep-bsart,
                17 sy-vline,18(10)  i_rep-lifnr,
                28 sy-vline,29(35)  i_rep-name1,
                64 sy-vline,65(4)   i_rep-ekgrp,
                69 sy-vline,70(10)  i_rep-bedat,
                80 sy-vline,81(5)   i_rep-ebelp,
                86 sy-vline,87(40)  i_rep-txz01,
               127 sy-vline,128(9)  i_rep-matkl,
               137 sy-vline,138(1)  i_rep-pstyp,
               139 sy-vline,140(1)  i_rep-knttp,
               141 sy-vline,142(4)  i_rep-werks,
               146 sy-vline,147(4)  i_rep-lgort,
               151 sy-vline,152(13) i_rep-menge UNIT i_rep-meins,
               165 sy-vline,166(3)  i_rep-meins,
               169 sy-vline,170(15) i_rep-netpr CURRENCY i_rep-waers,
               185 sy-vline,186(4)  i_rep-waers,
               190 sy-vline,191(5)  i_rep-peinh,
               196 sy-vline,197(4)  i_rep-bprme,
               201 sy-vline,202(15) i_rep-orewr CURRENCY i_rep-curr,
               217 sy-vline,218(4)  i_rep-curr,
               222 sy-vline,223(7)  i_rep-bstyp centered,
               230 sy-vline.
          NEW-LINE.
          hide: i_rep-ebeln.
        ENDLOOP.
        ULINE.
        FORMAT COLOR OFF.
        WRITE : /2 'Total Number of Purchasing Documents:'(025) COLOR 3,
                    lv_rec COLOR 3.
      ENDIF.
    ENDFORM.                    " display_data
    *&      Form  header
    Write the Report Header
    FORM header .
      FORMAT RESET.
    header
      WRITE:/1(230) 'LIST OF PURCHASE DOCUMENTS PER VENDOR'(006) CENTERED.
      SKIP.
      FORMAT COLOR COL_HEADING.
      ULINE.
      WRITE:/1 sy-vline,2(10)   'Pur.Doc.No'(006) CENTERED,
            12 sy-vline,13(4)   'Type'(007),
            17 sy-vline,18(10)  'Vendor'(008) CENTERED,
            28 sy-vline,29(35)  'Name'(009) CENTERED,
            64 sy-vline,65(4)   'PGrp'(010) CENTERED,
            69 sy-vline,70(10)  'Doc.Date'(012) CENTERED,
            80 sy-vline,81(5)   'Item'(011),
            86 sy-vline,87(40)  'Material Short Text'(024) CENTERED,
           127 sy-vline,128(9)  'Mat.Group'(013),
           137 sy-vline,138(1)  'I',
           139 sy-vline,140(1)  'A',
           141 sy-vline,142(4)  'Plnt'(014),
           146 sy-vline,147(4)  'SLoc'(015),
           151 sy-vline,152(13) 'Quantity'(016) CENTERED,
           165 sy-vline,166(3)  'UoM'(017),
           169 sy-vline,170(15) 'Net Value'(018) CENTERED,
           185 sy-vline,186(4)  'Curr'(019),
           190 sy-vline,191(5)  'Per'(020),
           196 sy-vline,197(4)  'Unit'(021),
           201 sy-vline,202(15) 'To be Invoiced'(023) CENTERED,
           217 sy-vline,218(4)  'Curr'(019),
           222 sy-vline,223(7)  'Doc.Cat'(026),
           230 sy-vline.
      ULINE.
    ENDFORM.                    " header
    *&      Form  toggle_color
    This routine alters the color of the records in the list
    FORM toggle_color.
      IF gv_dial = space.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        gv_dial = c_x.
      ELSE.
        FORMAT COLOR 1 INTENSIFIED OFF.
        CLEAR gv_dial.
      ENDIF.
    ENDFORM.                    " toggle_color
    *&      Form  LINE_SEL
    *When double clicked on EBELN field display the details of Purchase Doc
    FORM line_sel.
      CASE sy-lsind.
        WHEN '1'.
          DATA: lv_field(20),
                lv_value(10),
                lv_bstyp like i_rep-bstyp.
          clear: lv_bstyp,lv_value, lv_field.
          GET CURSOR FIELD lv_field VALUE lv_value.
          IF lv_field = 'I_REP-EBELN'.
            IF NOT lv_value IS INITIAL.
              READ LINE sy-index FIELD VALUE i_rep-bstyp
                                       INTO  lv_bstyp.
             READ CURRENT LINE FIELD VALUE i_rep-bstyp INTO lv_bstyp.
              if lv_bstyp = 'F'.
                SET PARAMETER ID 'BES' FIELD lv_value.
                CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
              elseif ( lv_bstyp = 'K' or lv_bstyp = 'L' ).
                SET PARAMETER ID 'VRT' FIELD lv_value.
                CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.
              elseif lv_bstyp = 'A'.
                SET PARAMETER ID 'ANF' FIELD lv_value.
                CALL TRANSACTION 'ME43' AND SKIP FIRST SCREEN.
              endif.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " line_sel
    Regards
    Anji

  • Regarding printing multiple PO using Smart forms

    Hi Abap Gurus,
                             i have to print the multiple purchase order in smart form such that first purchase order number details in first page. second purchase order in second page. how can i acheive this solution. i searched in sdn but not found a proper solution.

    hi,
    use this function module
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZTEST_SMARTFORM'
    IMPORTING
    fm_name = fm_name.
    it passes the function module name generated....
    then call that function module..
    CALL FUNCTION FM_NAME
    EXPORTING
    control_parameters = wa_control_par
    output_options = wa_output_options
    IMPORTING
    job_output_info = it_otf_data
    TABLES
    it_nfal = it_nfal_final.

  • How to create purchase order report  form MM function module

    Dear All,
                  i need customized purchase order report with logo and grand total.
    regards,
    krishna

    hi,
    When you are using the outline agreement for the PR and then shd use for the PO...from where this RFQ comes in the scene??
    Also PR is already asigned to the source as outline agreement...
    Regards
    Priyanka.P
    Edited by: Priyanka Paltanwale on Nov 7, 2008 6:03 AM

  • Regarding material wise purchase order creation with reference to pr

    Dear sir
    I have a scenario depending on the  material wise pos creation
    I have two type of material
    1) raw material
    2) consumables
    When user will create purchase order for raw material, system should ask purchase requisition. ( i.e with out purchase requisition for raw material , system should not allow to create the purchase order)
    Where as for all consumables materials system should allow to create the purchase order
    Without purchase requisition also, for user.
    Regards
    Jrp.

    You have to create two different document type for purchase order.
    1) Raw Material Purchase
    2) Consumables Purchase
    You can create two different document type for purchase order with below mention path: -
    SPRO >> Materials Management >> Purchasing >> Purchase Order >> Define Document Types.
    After define two different document type, You can change field status for two different document type with below mention path.
    SPRO >> Materials Management >> Purchasing >> Purchase Order >> Define Screen Layout at Document Level.
    Select document type and change field status of purchase requisition.
    Regards,
    Mahesh Wagh

Maybe you are looking for

  • Getting error in Access Manager

    Hi All, We have 2 Access Manager Box in prod. We have intalled Access manager component on both box and its working fine. At the time of installation I forgot to configure the Basic over LDAP authentication, so I have reconfigure the Basic Over LDAP

  • OTA Download and HTTP Status Codes

    Hi there, i am planning to check the http status code of an OTA download. Even if I interupt the download process, the server still responds with status 200. Does anbody have an idea, how to implement this process? Thanx, Simone

  • PS3 and NAT 2

    I am having a nightmare of a time trying to get my PS3 into NAT 2. My PS3 is wired to my AEBS, and my AEBS runs to the motorola DSL modem. I have tried the equivalent of putting the PS3 into a DMZ on the airport, and I have tried opening all the prop

  • Where should files be located?

    Should files to be saved go to the backup or shared area on the drive? Just got this and hard to tell what to do. I have only connected the drive not the internet at this point since I am not at home. Just trying to store some files to get the hang o

  • Photosmart C4780 - Prints extra page even after HP driver update installed

    With Mavericks (OS X 10.9.4) installed, I have noticed that completed print jobs remain in the print queue for my HP Photosmart C4780 when printing from Safari and Preview.  If I want to print another (different page), I usually have to delete the pr