AP Invoice Performance

Hi,
I have a performance issue in AP invoice screen, and I found Doc id 1323990.1 where oracle support requests to apply patch 9691219.
the Patch will increase apsinreg.ldt file version to 115.18
BUT
In our Server, the files version of apsinreg.ldt is 115.9
My question:
Which version is the highest 115.9 or 115.18?
if the one in our server is the highest, will the patch overwrite the low file on the high file?
Regards,
Osamah Sarrawi

To decide on the highest version, you should read from left to right and compare the values between separators ....i.e.
Your Version is 115.9
Expected Version is 115.18
From left, the first seperator (decimal) value is 115, which is same for both .... so move on to second separator value which is 9 versus 18 .. hence 18 is the higher version....
In the given case, you are on the lower version, applying the patch would fix the known issues identified by Oracle. Applying the patch will override/replace the existing file with the new one. By any chance if you did any customizations on that, it would be lost ....
Regards,
Ivruksha

Similar Messages

  • AP invoice workbench performance issue.

    Hi Guys,
    We have a production system with RHEL 5 ,R12 12.0.6 and DB:10.2.0.4
    WE are facing Performance issue in Inovoice workbench were users when click on Inovoice  batches or Inovoices it takes a lot of time to open the invoice form.
    Also Validation of inovoices consumes a lot of time which is unaccepted .
    Request you please give some pointers or note id to followd already have locked an SR with oracle .
    This is urgent
    Regards,
    Milan

    Please see these docs.
    R12 Invoice Workbench Form Has A Performance Issue [ID 1072338.1]
    Bad Performance When Checking Funds In Invoice Workbench [ID 1091280.1]
    Bad Performance In Invoice Workbench (APXINWKB) Find Window When Searching By Purchase Order [ID 1195623.1]
    R12 AP Invoice Workbench Performance Issues [ID 957105.1]
    Poor Performance On Invoice Validation In The Invoice Workbench [ID 1130313.1]
    Invoice Workbench> Actions: Pay in Full Performance Issue [ID 983804.1]
    Invoice Workbench (APXINWKB) Performance Issue While Selecting The Self Assessment Check Box [ID 1210340.1
    Performance of Project Expenditure LOV At AP Invoice Header in Invoice Workbench [ID 1143943.1]
    R12.1.1 Performance Problem in AP Invoice Workbench [ID 861205.1]
    R12 Invoice Performance FAQs [ID 579737.1]
    Thanks,
    Hussein

  • Adding a field

    Dear Experts,
    I have to add one field at the last of the of a ALV. THe field name is ebeln.
    I have made modifiaction in the structure as well as in the fieldcat.
    please go through the complete  code below.
    Program name           : Z_Invoice                                   *
    Program Description    : The purpose of the report is to:            *
                               Give the details of open invoices for a     *
                             project.                                    *
                             Give details of cleared invoices for a      *
                             project                                     *
    Technical Object No    : NA                                          *
    Developer              : Priyanka Vasudeva,Jasleen Randhawa          *
    Level2 Analyst/FC      : Sanjay Arali                                *
    Company                : Satyam Computer Services Limited(SCSL)      *
    Start Date             : 12-05-2005                                  *
    End Date               : 18-05-2005                                  *
    Logical Database       : NA                                          *
    Function Modules       : HR_SEN_CALE_DAYS_DATE,                      *
                             REUSE_ALV_LIST_DISPLAY,                     *
                             HR_HK_DIFF_BT_2_DATES                       *
    Includes               : z_invoice_form - For forms                  *
                             z_invoice_top  - For data Declarations      *
                      C H A N G E      H I S T O R Y                     *
    *Version|    Developer     |   Date   |      Change Description        *
    V00  |Priyanka ,Jasleen |12/10/2004| New Development
    report z_invoice message-id znew.
    Include for the data declarations and selection screen
    include z_invoice_top.
    Include for the forms used
    include z_invoice_form.
                        I N I T I A L I Z A T I O N                      *
    initialization.
    Storing the report name
      v_repid = sy-repid.
                     A T   S E L E C T I O N - S C R E E N               *
    at selection-screen.
    For validating the Project number entered by the user
      perform f_validate_proj_number.
                     S T A R T - O F - S E L E C T I O N                 *
    start-of-selection.
    For creating the field catalog
      perform f_fieldcat.
    *For checking the project number in lowercse
      perform f_projectno_concatenate.
      if p_open = 'X'.
    *For open invoices
        perform f_invoice_open.
      elseif p_closed = 'X'.
    *For cleared invoices
        perform f_invoice_cleared.
      endif.
    For vendor details
      perform f_vendor_details.
    Display the Final Output in ALV
      perform f_alv_display.
                        E N D - O F - S E L E C T I O N                  *
    *Free all internal tables
      free: i_output1,
            i_fieldcat,
            i_bsak,
            i_bsik.
                            E N D   O F   R E P O R T                    *
    Program name           : Z_Invoice                                   *
    Program Description    : The purpose of the report is to:            *
                               Give the details of open invoices for a     *
                             project.                                    *
                             Give details of cleared invoices for a
                             project
    Technical Object No    : NA                                          *
    Developer              : Priyanka Vasudeva,Jasleen Randhawa
    Level2 Analyst/FC      : Sanjay Arali                                *
    Company                : Satyam Computer Services Limited(SCSL)      *
    Start Date             : 12-05-2005                                  *
    End Date               : 17-05-2005                                  *
    Logical Database       : NA                                          *
    Function Modules       : HR_SEN_CALE_DAYS_DATE,                      *
                             REUSE_ALV_LIST_DISPLAY,                     *
                             HR_HK_DIFF_BT_2_DATES                       *
    Includes               : z_invoice_form - For forms                  *
                             z_invoice_top  - For data Declarations      *
                      C H A N G E      H I S T O R Y                     *
    *Version|    Developer     |   Date   |      Change Description        *
    V00  |Priyanka ,Jasleen   |12/10/2004| New Development              *
      INCLUDE Z_INVOICE_TOP                                              *
    include <icon>.
    type-pools: slis.
                      D A T A B A S E    T A B L E S                     *
    tables: bsak,     "accounting:secondary index for vendors(cleared items)
            bsik,     "accounting:secondary index for vendors
            lfa1,     "vendor master
            proj.     "project definition
    I N T E R N A L    T A B L E S ***********************
    For the complete details to be shown on the output screen
    data: begin of i_output1 occurs 0,
          lifnr like lfa1-lifnr,          "vendor no
          name(70),                       "vendor name1
          belnr like bsak-belnr,          "document no
          bldat like bsak-bldat,          "document date
          dmbtr like bsak-dmbtr,          "amount in local currency
         waers LIKE bsak-waers,          "currency
          augdt like bsak-augdt,          "date paid
          zuonr like bsak-zuonr,          "assignment number
          due_date like bsik-zfbdt,       "due date
          status(4),                      "To set color
          g_days like p0347-scrdd,        "date paid
          end of i_output1.
    *For open invoices
    data: begin of i_bsak occurs 0,
          lifnr like bsak-lifnr,
          belnr like bsak-belnr,          "document no
          bldat like bsak-bldat,          "document date
          dmbtr like bsak-dmbtr,          "amount in local currency
         waers LIKE bsak-waers,          "currency
          augdt like bsak-augdt,          "date paid
          zuonr like bsak-zuonr,          "assignment number
          bukrs like bsak-bukrs,          "company code
          blart like bsak-blart,          "document type
          shkzg like bsak-shkzg,          "Type Credit Or Debit
          end of i_bsak.
    *For vendor details including vendor number and name
    data: begin of i_lfa1 occurs 0,
          lifnr like lfa1-lifnr,          "vendor no
          name1 like lfa1-name1,          "vendor name1
          name2 like lfa1-name2,          "vendor name2
          end of i_lfa1.
    *For closed invoices
    data: begin of i_bsik occurs 0,
          lifnr like bsik-lifnr,           "vendor no
          belnr like bsik-belnr,           "document no
          bldat like bsik-bldat,           "document date
          dmbtr like bsik-dmbtr,           "amount in local currency
         waers LIKE bsik-waers,           "currency
          blart like bsik-blart,           "document type
          zfbdt like bsik-zfbdt,           "baseline date for due date
          zbd1t like bsik-zbd1t,           "cash discount days1
          augdt like bsik-augdt,           "date paid
          zuonr like bsik-zuonr,           "assignment number
          bukrs like bsik-bukrs,           "company code
          shkzg like bsik-shkzg,           "Type Credit Or Debit
          end of i_bsik.
                    D A T A    D E C L A R A T I O N S                   *
    data: v_repid  type sy-repid,         "For the report name
          v_projno type bsak-zuonr,
          v_projno1(25) type c.
    T A B L E    T Y P E S *****************************
    Internal Table for Field Catalog
    data i_fieldcat type slis_t_fieldcat_alv.
    W O R K      A R E A S *************************
    Work Area for Field Catalog
    data wa_fieldcat type slis_fieldcat_alv.
                   S E L E C T I O N     S C R E E N                     *
    selection-screen skip 1.
    selection-screen begin of block input with frame title text-001.
    selection-screen skip 1.
    parameters: p_projno type proj-pspid obligatory.
    selection-screen skip 2.
    parameters: p_open radiobutton group inv,
                p_closed radiobutton group inv.
    selection-screen skip 1.
    selection-screen end of block input.
    Program name           : Z_Invoi  ce                                 *
    Program Description    : The purpose of the report is to:            *
                               Give the details of open invoices for a     *
                              project.                                   *
                            Give details of cleared invoices for a     *
                              project
    Technical Object No    : NA                                          *
    Developer              : Priyanka Vasudeva,Jasleen Randhawa
    Level2 Analyst/FC      : Sanjay Arali                                *
    Company                : Satyam Computer Services Limited(SCSL)      *
    Start Date             : 12-05-2005                                  *
    End Date               : 17-05-2005                                  *
    Logical Database       : NA                                          *
    Function Modules       : HR_SEN_CALE_DAYS_DATE,                      *
                             REUSE_ALV_LIST_DISPLAY,                     *
                             HR_HK_DIFF_BT_2_DATES                       *
    Includes               : z_invoice_form - For forms                  *
                             z_invoice_top  - For data Declarations      *
                      C H A N G E      H I S T O R Y                     *
    *Version|    Developer     |   Date   |      Change Description        *
    V00  |Priyanka ,Jasleen   |12/10/2004| New Development
    V01  |                  |          |                                *
      INCLUDE Z_INVOICE_FORM                                             *
            Form To Create a FieldCatalog                                *
    form f_fieldcat.
      clear wa_fieldcat.
    lifnr
      wa_fieldcat-ref_fieldname  = 'LIFNR'.
      wa_fieldcat-fieldname      = 'LIFNR'.
      wa_fieldcat-tabname        = 'I_OUTPUT1'.
      wa_fieldcat-seltext_m      = 'Vendor No'(004).
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    NAME
      wa_fieldcat-ref_fieldname  = 'NAME'.
      wa_fieldcat-fieldname      = 'NAME'.
      wa_fieldcat-tabname        = 'I_OUTPUT1'.
      wa_fieldcat-seltext_m      = 'Vendor Name'(005).
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    BELNR
      wa_fieldcat-ref_fieldname  = 'BELNR'.
      wa_fieldcat-fieldname      = 'BELNR'.
      wa_fieldcat-tabname        = 'I_OUTPUT1'.
      wa_fieldcat-seltext_m      = 'Document No'(006).
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    BLDAT
      wa_fieldcat-ref_fieldname  = 'BLDAT'.
      wa_fieldcat-fieldname      = 'BLDAT'.
      wa_fieldcat-tabname        = 'I_OUTPUT1'.
      wa_fieldcat-seltext_m      = 'Document Date'(007).
      wa_fieldcat-no_zero        = 'X'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    DMBTR
      wa_fieldcat-ref_fieldname  = 'DMBTR'.
      wa_fieldcat-ref_tabname    = 'BSIK'.
      wa_fieldcat-fieldname      = 'DMBTR'.
      wa_fieldcat-tabname        = 'I_OUTPUT1'.
      wa_fieldcat-just           = 'R'.
      wa_fieldcat-seltext_m      = 'Amount in LC'(008).
      wa_fieldcat-no_zero        = 'X'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    WAERS
    wa_fieldcat-ref_fieldname  = 'WAERS'.
    wa_fieldcat-fieldname      = 'WAERS'.
    wa_fieldcat-tabname        = 'I_OUTPUT1'.
    wa_fieldcat-seltext_m      = 'Currency'(009).
    wa_fieldcat-no_zero        = 'X'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.
      if p_open = 'X'.
    due date
        wa_fieldcat-fieldname     = 'DUE_DATE'.
        wa_fieldcat-tabname       = 'I_OUTPUT1'.
        wa_fieldcat-seltext_m     = 'Due Date'(010).
        wa_fieldcat-no_zero       = 'X'.
        append wa_fieldcat to i_fieldcat.
        clear wa_fieldcat.
    Status
        wa_fieldcat-fieldname     = 'STATUS'.
        wa_fieldcat-tabname       = 'I_OUTPUT1'.
        wa_fieldcat-seltext_m     = 'Status'.
        wa_fieldcat-just          = 'C'.
        wa_fieldcat-icon          = 'X'.
        append wa_fieldcat to i_fieldcat.
        clear wa_fieldcat.
    G_DAYS
        wa_fieldcat-fieldname     = 'G_DAYS'.
        wa_fieldcat-tabname       = 'I_OUTPUT1'.
        wa_fieldcat-seltext_m     = 'Days Past Due'(011).
        append wa_fieldcat to i_fieldcat.
        clear wa_fieldcat.
    *AUGDT
        wa_fieldcat-ref_fieldname  = 'AUGDT'.
        wa_fieldcat-fieldname      = 'AUGDT'.
        wa_fieldcat-tabname        = 'I_OUTPUT1'.
        wa_fieldcat-seltext_m      = 'Date Paid'(012).
        wa_fieldcat-no_zero        = 'X'.
        append wa_fieldcat to i_fieldcat.
        clear wa_fieldcat.
      elseif p_closed = 'X'.
      endif.
    endform.
    *&      Form  F_VALIDATE_Project_Number
          Form to validate the Project number entered by the user
    form f_validate_proj_number.
    Validation of Project numbers entered on the selection screen
      select single pspid
             from proj
                  into proj-pspid
                  where pspid = p_projno.
      if sy-subrc ne 0.
        message e100.
      endif.
    endform.
    *&      Form  F_projectno_conctenate
          Form to check for the project number.
    form f_projectno_concatenate.
      concatenate p_projno(1) '-' p_projno+1(23)
                                        into v_projno.
      v_projno1 = v_projno.
      translate v_projno1 to lower case.
    endform.
    *&      Form  F_invoice_open
          Form to get the details for open invoices
    form f_invoice_open.
      data:  l_dat type endda,
             l_date type begda,
             l_days type psen_duration_dec,
             l_outdate  like  p0347-scrdd,
             l_date1 type dats,
             l_date2 type dats,
             l_days1(6) type c,
             l_days2(6) type c.
      select lifnr                     "vendor no
              belnr                    "document no
               bldat                   "document date
                dmbtr                  "amount in LC
               waers                 "currency
                  blart                "document type
                   zfbdt               "baseline date for due date
                    zbd1t              "cash discount days1
                     augdt             "date paid
                      zuonr            "assignment number
                       bukrs           "company code
                        shkzg          "Type Credit or Debit
                            from bsik
                            into corresponding fields of table i_bsik
                            where ( zuonr = v_projno
                                 or zuonr = v_projno1 )
                                and bukrs = 'AIC'
                               AND ( blart = 'RE' OR blart = 'KZ' )
                                and umsks eq space.
      loop at i_bsik.
        i_output1-lifnr = i_bsik-lifnr.
        i_output1-belnr = i_bsik-belnr.
        i_output1-dmbtr = i_bsik-dmbtr.
        i_output1-bldat = i_bsik-bldat.
       i_output1-waers = i_bsik-waers.
        i_output1-zuonr = i_bsik-zuonr.
        l_days-caldd = i_bsik-zbd1t.
        l_date = i_bsik-zfbdt.
    *Modification for Account Payable
       if i_bsik-BLART = 'KZ'  .
        if i_bsik-shkzg = 'H'  .
          i_output1-dmbtr = 0 - i_bsik-dmbtr .
        endif.
    to add baseline date and accounts recievable days1
        call function 'HR_SEN_CALE_DAYS_DATE'
             exporting
                  id_date                  = l_date
                  id_operator              = '+'
                  is_duration              = l_days
             importing
                  ed_date                  = l_dat
             exceptions
                  conversion_not_specified = 1
                  conversion_not_possible  = 2
                  others                   = 3.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
                  with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.
        i_output1-due_date = l_dat.
        if sy-datum > l_dat.
          l_date1 = sy-datum.
          l_date2 = l_dat.
        else.
          l_date1 = l_dat.
          l_date2 = sy-datum.
        endif.
    *to calculate difference between the due date and currrent date
        call function 'HR_HK_DIFF_BT_2_DATES'
             exporting
                  date1                   = l_date1
                  date2                   = l_date2
                  output_format           = '02'
             importing
                  days                    = l_outdate
             exceptions
                  invalid_dates_specified = 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.
        l_days2 = l_outdate.
        if sy-datum le l_dat.
          i_output1-status = icon_green_light.
          concatenate '-' l_days2 into l_days1.
          i_output1-g_days = l_days1.
        elseif sy-datum gt l_dat.
          i_output1-status = icon_red_light.
          concatenate '+' l_days2 into l_days1.
          i_output1-g_days = l_days1.
        endif.
        append i_output1.
      endloop.
    endform.
    *&      Form  F_vendor_details
          Form to get the details of vendors
    form f_vendor_details.
    *to get vendor details
      loop at i_output1.
        select single lifnr                            "vendor no
                        name1                          " vendor name1
                          name2                        " vendor name2
                              from lfa1
                              into  i_lfa1
                              where lifnr = i_output1-lifnr.
        if sy-subrc = 0.
          i_output1-lifnr = i_lfa1-lifnr.
          concatenate i_lfa1-name1 i_lfa1-name2
                                          into i_output1-name
                                          separated by space.
          modify i_output1.
        endif.
      endloop.
    endform.
    *&      Form  F_invoice_cleared
          Form to get the details for cleared invoices
    form f_invoice_cleared.
      select lifnr                     "vendor no
              belnr                    "document no
               bldat                   "document date
                dmbtr                  "amount in LC
                waers                 "currency
                  augdt                "date paid
                   zuonr               "assignment number
                    bukrs              "company code
                     blart             "document type
    *Added for
                      shkzg          "Type Credit or Debit
                            from bsak
                            into table i_bsak
                            where ( zuonr = v_projno
                                 or zuonr = v_projno1 )
                                and bukrs = 'AIC'
                               AND ( blart = 'RE'
                               OR   blart = 'KZ' )
                                and umsks eq space.
      loop at i_bsak.
        i_output1-lifnr = i_bsak-lifnr.
        i_output1-belnr = i_bsak-belnr.
        i_output1-dmbtr = i_bsak-dmbtr.
        i_output1-bldat = i_bsak-bldat.
       i_output1-waers = i_bsak-waers.
        i_output1-augdt = i_bsak-augdt.
        i_output1-zuonr = i_bsak-zuonr.
    *Modification for Account Payable
       If i_BSAK-BLART = 'KZ'  .
        if i_bsak-shkzg = 'H'  .
          i_output1-dmbtr = 0 - i_bsak-dmbtr.
        endif.
        append i_output1.
      endloop.
    endform.
          FORM f_alv_display                                            *
    form f_alv_display.
      data:wa_layout type slis_layout_alv,
           v_title type lvc_title,
           wa_variant like disvariant.              "For default variant
      if p_open = 'X'.
        concatenate 'Open Invoices for Project:'(003) v_projno into
        v_title separated by space.
        wa_variant-variant = '/DEFAULT1'.
      else.
        concatenate 'Cleared Invoices for Project:'(002) v_projno into
          v_title separated by space.
        wa_variant-variant = '/DEFAULT'.
      endif.
      wa_layout-colwidth_optimize = 'X'.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program = v_repid
                is_layout          = wa_layout
                i_grid_title       = v_title
                it_fieldcat        = i_fieldcat[]
                i_save             = 'A'
                is_variant         = wa_variant
           tables
                t_outtab           = i_output1
           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.
    But after doing these changes as i mentioned above , i am not able to get the
    catalog in the ALV.
    Please help!!!
    i wanted to send you all the picture of ALV, But i am not able to paste it,
    can  i post picture inthis , if  possible pl tell.
    Thanks
    Neeraj

    Hello,
    to get it in ALV , there needs to be an append of EBELN to the field catalogue
    ebeln
    wa_fieldcat-fieldname = 'EBELN''.
    wa_fieldcat-tabname = 'I_OUTPUT1'.
    wa_fieldcat-seltext_m = 'EBELN'(009).
    append wa_fieldcat to i_fieldcat.
    clear wa_fieldcat.
    Please check if you have added it to the field catalog.......
    In addition to it,before calling the reuse_ALV function put a breakpoint and see if the internal table 'I_OUTPUT1' contains EBELN and all relevant data....
    Reward if useful and pls reply if you rectified the problem
    Regards
    Byju

  • PO with both service and material

    Dear all
    Can anyone give a structure of PO which invoves both Service and Material component and both are inseperable.
    Service tax is applicable on service portion and VAT is applicable on material.
    Thanks in advance

    hi,
    As per your requirement create PO with 2 line items
    Line Item 10  for service : item cat D, a/assignment K , material group etc
    select service master or text (at service details tab in item level)
    select relevant tax code with service tax. (invoice tab)
    line item 20
    here enter material master, price, plant etc.
    select appropriate tax code with VAT ( invoice tab)
    save
    say PO created 4500018024
    Now When you receive the service perform service entry sheet (ML81N) for 4500018024 item 10
    accept and save
    When you receive the material perform MIGO for 4500018024 item 20
    finally when you got the invoice
    Perform MIRO against PO no ( no need to enter item ) and select Goods/Service items
    It will select both line item simulate and post
    and if you want to Perform MIRO separately then
    in MIRO enter 4500018024 item 10
    and then 4500018024 item 20.
    that's it

  • Return to vendot fron SAP opening stock

    Hi Friends,
    We want to return few raw material with excise to the vendor, the problem is the receipts are made before the go-live and shown as opening stock in SAP. What will be the procedure to return to vendor and how to nullify the cenvat credits already availed.
    Pls reply asap.
    Ajit patro

    Hi,
    Since you have posted the EI (excise invoice), perform vendor returns (use transaction migo,select return delivery from the drop down) which creates a new material document and then post the EI again whose status will be set to 'In process'.
    Hope it suffices.
    Cheers,
    Satish

  • Bapi for FB70

    Hi !!!
    Someone knows what's the bapi that i can use as alternative by the transaction FB70 ( Customer Invoice ).
      Best Regards !!!

    sample code is:
    REPORT  zfb70.
    *-----Type pool declaration
    TYPE-POOLS: truxs.
    *-----Structure declaration
    TYPES : BEGIN OF ty_tab,
              col1(30)        TYPE c,  "Serial No
              col2(30)        TYPE c,  "Customer No
              col3(30)        TYPE c,  "Company Code
              col4(30)        TYPE c,  "Reference Document No
              col5(30)        TYPE c,  "Document date
              col6(30)        TYPE c,  "Posting Date
              col7(30)        TYPE c,  "Text
              col8(30)        TYPE c,  "Amount
              col9(30)        TYPE c,  "Currency
              col10(30)       TYPE c,  "G/L Account
              col11(30)       TYPE c,  "Company Code
              col12(50)       TYPE c,  "Amount in Doc.Currency
              col13(50)       TYPE c,  "Currency
              col14(50)       TYPE c,  "Profit center
              col15(50)       TYPE c,  "Item text
            END   OF ty_tab,
            BEGIN OF ty_header,
              col1(30)        TYPE c,  "Serial No
              col2(30)        TYPE c,  "Customer No
              col3(30)        TYPE c,  "Company Code
              col4(30)        TYPE c,  "Reference Document No
              col5(30)        TYPE c,  "Document date
              col6(30)        TYPE c,  "Posting Date
              col7(30)        TYPE c,  "Text
              col8(30)        TYPE c,  "Amount
              col9(30)        TYPE c,  "Currency
            END   OF ty_header,
            BEGIN OF ty_lineitem,
              col10(30)       TYPE c,  "G/L Account
              col11(30)       TYPE c,  "Company Code
              col12(50)       TYPE c,  "Amount in Doc.Currency
              col13(50)       TYPE c,  "Currency
              col14(50)       TYPE c,  "Profit center
              col15(50)       TYPE c,  "Item text
            END   OF ty_lineitem.
    *-----Internal table declarations
    DATA : it_tab             TYPE STANDARD TABLE OF ty_tab,
           it_raw             TYPE truxs_t_text_data,
           it_header          TYPE STANDARD TABLE OF ty_header,
           it_lineitem        TYPE STANDARD TABLE OF ty_lineitem,
           it_bapiaccr09      TYPE STANDARD TABLE OF bapiaccr09,
           it_bapiacgl09      TYPE STANDARD TABLE OF bapiacgl09,
           it_bapiacar09      TYPE STANDARD TABLE OF bapiacar09,
           it_bapiaccr09_temp TYPE STANDARD TABLE OF bapiaccr09,"#EC NEEDED
           return             LIKE bapiret2 OCCURS 0 WITH HEADER LINE,"#EC *
           return1            LIKE bapiret2 OCCURS 0 WITH HEADER LINE,"#EC *
    *-----Workarea declarations
           x_tab              LIKE LINE OF it_tab,
           x_header           LIKE LINE OF it_header,
           x_lineitem         LIKE LINE OF it_lineitem,
           x_invheader        TYPE bapiache09 OCCURS 0 WITH HEADER LINE,"#EC *
           x_bapiaccr09       LIKE LINE OF it_bapiaccr09,
           x_bapiacgl09       LIKE LINE OF it_bapiacgl09,
           x_bapiacar09       LIKE LINE OF it_bapiacar09,
           x_bapiaccr09_temp  LIKE LINE OF it_bapiaccr09,
    *-----Variables declarations
           v_str1(2)          TYPE c,
           v_str2(2)          TYPE c,
           v_str3(4)          TYPE c,
           v_doc_date         LIKE sy-datum,
           v_pstng_date       LIKE sy-datum,
           v_obj_key          TYPE bapiache09-obj_key,
           v_text             TYPE string,
           v_customer         TYPE bapiacar09-customer,
           v_gl_account       TYPE bapiacgl09-gl_account,
           v_itemno           TYPE bapiacgl09-itemno_acc,
           v_itemno_1         TYPE bapiacgl09-itemno_acc,
           v_amount(25)       TYPE c.
      SELECTION-SCREEN declaration                                       *
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 3(20) text-001 FOR FIELD p_fname.
    SELECTION-SCREEN POSITION 25.
    PARAMETERS: p_fname(128) TYPE c OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
      AT SELECTION-SCREEN ON VALUE-REQUEST                               *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
    *-----Calling function for selecting the local file
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
        IMPORTING
          file_name     = p_fname.
                    START-OF-SELECTION                                   *
    START-OF-SELECTION.
    *-----Uploading excel file into internal table
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
          i_line_header        = 'X'
          i_tab_raw_data       = it_raw
          i_filename           = p_fname
        TABLES
          i_tab_converted_data = it_tab[]
        EXCEPTIONS
          conversion_failed    = 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.
      LOOP AT it_tab INTO x_tab.
    *-----Checking for existing data in it_header
        READ TABLE it_header INTO x_header WITH KEY col1 = x_tab-col1
                                                    col2 = x_tab-col2
                                                    col3 = x_tab-col3
                                                    col4 = x_tab-col4
                                                    col5 = x_tab-col5
                                                    col6 = x_tab-col6
                                                    col7 = x_tab-col7
                                                    col8 = x_tab-col8
                                                    col9 = x_tab-col9.
        IF sy-subrc NE 0.
          IF x_header IS NOT INITIAL.
    *-----calling bapi for creating customer invoice
            PERFORM call_bapi.
            REFRESH : it_header, it_lineitem.
          ENDIF.
    *-----making header table
          x_header-col1    = x_tab-col1.
          x_header-col2    = x_tab-col2.
          x_header-col3    = x_tab-col3.
          x_header-col4    = x_tab-col4.
          x_header-col5    = x_tab-col5.
          x_header-col6    = x_tab-col6.
          x_header-col7    = x_tab-col7.
          x_header-col8    = x_tab-col8.
          x_header-col9    = x_tab-col9.
          x_lineitem-col10 = x_tab-col10.
          x_lineitem-col11 = x_tab-col11.
          x_lineitem-col12 = x_tab-col12.
          x_lineitem-col13 = x_tab-col13.
          x_lineitem-col14 = x_tab-col14.
          x_lineitem-col15 = x_tab-col15.
          APPEND x_header TO it_header.
          APPEND x_lineitem TO it_lineitem.
        ELSE.
          x_lineitem-col10 = x_tab-col10.
          x_lineitem-col11 = x_tab-col11.
          x_lineitem-col12 = x_tab-col12.
          x_lineitem-col13 = x_tab-col13.
          x_lineitem-col14 = x_tab-col14.
          x_lineitem-col15 = x_tab-col15.
          APPEND x_lineitem TO it_lineitem.
        ENDIF.
      ENDLOOP.
    *-----Calling BAPI for last set of data
      PERFORM call_bapi.
      REFRESH : it_header, it_lineitem.
                             Form  call_bapi                             *
    FORM call_bapi.
    *-----Formatting invoice date
      SPLIT x_header-col5 AT '.' INTO v_str1 v_str2 v_str3.
      IF STRLEN( v_str1 ) LT 2.
        CONCATENATE '0' v_str1 INTO v_str1.
      ENDIF.
      IF STRLEN( v_str2 ) LT 2.
        CONCATENATE '0' v_str2 INTO v_str2.
      ENDIF.
      IF STRLEN( v_str3 ) LT 4.
        CONCATENATE '20' v_str3 INTO v_str3.
      ENDIF.
      CONCATENATE v_str3 v_str1 v_str2 INTO v_doc_date.
      CLEAR : v_str1, v_str2, v_str3.
    *-----Formatting posting date
      SPLIT x_header-col6 AT '.' INTO v_str1 v_str2 v_str3.
      IF STRLEN( v_str1 ) LT 2.
        CONCATENATE '0' v_str1 INTO v_str1.
      ENDIF.
      IF STRLEN( v_str2 ) LT 2.
        CONCATENATE '0' v_str2 INTO v_str2.
      ENDIF.
      IF STRLEN( v_str3 ) LT 4.
        CONCATENATE '20' v_str3 INTO v_str3.
      ENDIF.
      CONCATENATE v_str3 v_str1 v_str2 INTO v_pstng_date.
      CLEAR : v_str1, v_str2, v_str3.
    *-----Making the Header
      x_invheader-obj_type   = 'BKPFF'.                  "Reference procedure
      x_invheader-obj_key    = '$'.                      "Object key
      CONCATENATE sy-sysid 'CLNT' sy-mandt INTO
      x_invheader-obj_sys.                               "Logical system of source document
      x_invheader-bus_act    = 'RFBU'.                   "Business Transaction
      x_invheader-username   = sy-uname.                 "User name
      x_invheader-header_txt = x_header-col7.            "Document Header Text
      x_invheader-comp_code  = x_header-col3.            "Company Code
      x_invheader-doc_date   = v_doc_date.               "Document Date in Document
      x_invheader-pstng_date = v_pstng_date.             "Posting Date in the Document
      x_invheader-doc_type   = 'DR'.                     "Reference Document Number
      x_invheader-ref_doc_no = x_header-col4.            "Reference Document Number
    *-----For ACCOUNTRECEIVABLE
      LOOP AT it_header INTO x_header.
        x_bapiacar09-itemno_acc = '1'.                   "Accounting Document Line Item Number
    *-----Filling zeros before Customer No
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = x_header-col2
          IMPORTING
            output = v_customer.
        x_bapiacar09-customer   = v_customer.            "Customer Number 1
        x_bapiacar09-comp_code  = x_header-col3.         "Company Code
        APPEND x_bapiacar09 TO it_bapiacar09.
      ENDLOOP.
    *-----For ACCOUNTGL
      LOOP AT it_lineitem INTO x_lineitem.
        IF it_bapiacgl09 IS INITIAL.
          v_itemno              = 2.
        ELSE.
          v_itemno              = v_itemno + 1.
        ENDIF.
        x_bapiacgl09-itemno_acc = v_itemno.              "Accounting Document Line Item Number
    *-----Filling zeros before G/L Account no
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = x_lineitem-col10
          IMPORTING
            output = v_gl_account.
        x_bapiacgl09-gl_account = v_gl_account.          "General Ledger Account
        x_bapiacgl09-comp_code  = x_lineitem-col11.      "Company Code
        x_bapiacgl09-profit_ctr = x_lineitem-col14.      "Profit Center
        x_bapiacgl09-item_text  = x_lineitem-col15.      "Item Text
        APPEND x_bapiacgl09 TO it_bapiacgl09.
      ENDLOOP.
    *-----Clearing variable
      CLEAR : v_itemno.
    *-----For CURRENCYAMOUNT
      LOOP AT it_header INTO x_header.
        x_bapiaccr09-itemno_acc = '0000000001'.          "Accounting Document Line Item Number
        x_bapiaccr09-curr_type  = '00'.                  "Currency type and valuation view
        x_bapiaccr09-amt_doccur = x_header-col8.         "Amount in document currency
        x_bapiaccr09-currency   = x_header-col9.         "Currency Key
        APPEND x_bapiaccr09 TO it_bapiaccr09.
      ENDLOOP.
      v_itemno_1 = 1.
      LOOP AT it_lineitem INTO x_lineitem.
        v_itemno_1 = v_itemno_1 + 1.
        x_bapiaccr09_temp-itemno_acc = v_itemno_1.       "Accounting Document Line Item Number
        x_bapiaccr09_temp-curr_type  = '00'.             "Currency type and valuation view
        CONCATENATE '-' x_lineitem-col12 INTO v_amount.
        x_bapiaccr09_temp-amt_doccur = v_amount.         "x_lineitem-col12. "Amount in document currency
        x_bapiaccr09_temp-currency   = x_lineitem-col13. "Currency Key
        APPEND x_bapiaccr09_temp TO it_bapiaccr09.
      ENDLOOP.
      CLEAR : v_itemno_1.
    *-----Calling BAPI for creating Customer Invoice
      CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
        EXPORTING
          documentheader    = x_invheader
        IMPORTING
          obj_key           = v_obj_key
        TABLES
          accountgl         = it_bapiacgl09
          accountreceivable = it_bapiacar09
          currencyamount    = it_bapiaccr09
          return            = return.
    *-----Check the return code for error message.
      LOOP AT return
        TRANSPORTING NO FIELDS
        WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
    *-----Generating errors (if any)
      IF sy-subrc = 0.
        WRITE : text-003, x_header-col1.                                                 "Serial No :
        WRITE :/ text-002. "Invoice Not Created Because :
        LOOP AT return.                                         "#EC *
          WRITE:/ "return-type,
                  return-message.
        ENDLOOP.
        ULINE :/(150).
      ELSE.
    *-----BAPI Commit
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait   = 'X'
          IMPORTING
            return = return1.
    *-----Displaying invoice no as Success message
        WRITE : text-003, x_header-col1.                                                 "Serial No :
        CONCATENATE 'Invoice No. ' v_obj_key+0(10) ' Created ' INTO v_text."#EC NOTEXT
        WRITE :/ v_text.
        ULINE :/(150).
      ENDIF.
    *-----Refreshing internal tables
      REFRESH : it_bapiaccr09, it_bapiacgl09, it_bapiacar09, it_bapiaccr09_temp, return.
    ENDFORM.                    " call_bapi

  • Function Module in SmartForm

    Hellow experts,
    Here i have one Function Module like ZSAMPLE1.
    I want to display it output in SmartForm.
    What should I do for this. Pls help me.
    with regards
    babu

    Hi look this code it will use ful to u
    report  zpsr3m_invoice_coversheet  no standard page heading
                                          message-id zps.
    tables: proj,
            prps,
            vbrk,
            vbrp,
            bseg,
            likp,
            pa0105,
            pa0002,
            t001,
            adrc,
            konv,
            tvzbt.
    -{ Type Definitions } -
    types: begin of typ_prps,
             pspnr  like  prps-pspnr,
           end of typ_prps,
           begin of typ_aufnr,
             aufnr  like  afko-aufnr,
           end of typ_aufnr,
           begin of typ_vbeln,
             vbeln  like  vbrk-vbeln,
           end of typ_vbeln,
           begin of typ_konv,
             knumv  like  konv-knumv,
             kposn  like  konv-kposn,
             kwert  like  konv-kwert,
           end of typ_konv.
    -{ Internal Tables } -
    data: gt_invitems like standard table of zpss_rrbinv_items
                      with header line,
          gt_pspnr     type standard table of typ_prps
                      with header line,
          gt_aufnr    type standard table of typ_aufnr
                      with header line,
          gt_vbeln    type standard table of typ_vbeln
                      with header line,
          gt_konv     type standard table of typ_konv
                      with header line.
    data: gt_mess_att like solisti1 occurs 0 with header line.
    -{ Work Areas } -
    data: gst_invheader like zpss_rrbinv_header,
          begin of gwa_bseg,
            bukrs like bseg-bukrs,
            belnr like bseg-belnr,
            gjahr like bseg-gjahr,
            txdat like bseg-txdat,
            filkd like bseg-filkd,
          end of   gwa_bseg.
    data: gst_control_parameters type ssfctrlop,
          gst_output_options     type ssfcompop,
          gt_job_output_info     type ssfcrescl,
          gt_output_options      type ssfcresop.
    constants: gc_formname type tdsfname value 'ZPS_INVOICE_COVERSHEET1',
             gc_usrty    like pa0105-usrty value '0001'.
    data: gv_fm_name  type rs38l_fnam,
          gv_pernr    like pa0105-pernr,
          gv_uname    like sy-uname.
    ranges: gr_pspnr for prps-pspnr,
            gr_aufnr for afko-aufnr.
    -{ Selection - Screen } -
    selection-screen begin of block blk1 with frame title text-001.
    parameters: gp_pspid like proj-pspid memory id psp,
                gp_vbeln like vbrk-vbeln.
    selection-screen end of block blk1.
    selection-screen begin of block blk2 with frame title text-002.
    parameters: gp_layut type tdsfname , "LIKE vbrp-arktx ,     "DEVK933900
               gp_logo  like rstxt-tdname default 'RRB_KBR_COLOR' .
    selection-screen end of block blk2.
    selection-screen begin of block blk3 with frame title text-009.
    parameters: gp_norm radiobutton group r1 default 'X',
                gp_pdf  radiobutton group r1 .
    selection-screen end of block blk3.
    -{AT SELECTION-SCREEN } -
    at selection-screen on gp_pspid.
      if gp_pspid is not initial.
        perform f_validate_project.
    ELSE.
       MESSAGE E000 WITH
       'Enter any Project definition...'(006).
      endif.
    at selection-screen on gp_vbeln.
      if gp_vbeln is not initial.
        perform f_validate_billing_doc.
      else.
        message e000 with
        'Enter Invoice Number.....'(005).
      endif.
    at selection-screen output.
      gp_pspid = gp_pspid.
    at selection-screen on value-request for gp_logo.
      perform f_get_logo changing gp_logo.
    at selection-screen on value-request for gp_vbeln.
      perform f_get_invoice changing gp_vbeln.
    -{ START-OF-SELECTION } -
    start-of-selection.
    Get the other data for the form.
      perform f_get_other_invoice_details.
    Call the SMART FORM to print the invoice.
      perform f_print_invoice_covsheet.
    *&      Form  F_GET_LOGO
          To get the Invoice LOGO to print in the SMART FORMS
         <--EV_LOGO  text
    form f_get_logo  changing ev_logo.
      ev_logo = 'RRB_KBR_COLOR'.
    endform.                    " F_GET_LOGO
    *&      Form  F_VALIDATE_PROJECT
          To validate the project definition entered
    form f_validate_project .
      select single *
        from proj
       where pspid = gp_pspid.
      if sy-subrc ne 0.
        message e000 with
        'Project definition not found..........'(003).
      endif.
    endform.                    " F_VALIDATE_PROJECT
    *&      Form  f_validate_billing_doc
          To validate the Billing document
    form f_validate_billing_doc .
    Get all the project elements
      perform f_get_project_data.
      if gp_pspid is not initial.
        if gr_pspnr[] is not initial or
           gr_aufnr[] is not initial.
    Check the billing document is from the current project only.
          select mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 matnr arktx vbeln posnr netwr
          vrkme
            into table gt_invitems
            from vbrp
           where vbeln eq gp_vbeln
             and ( ps_psp_pnr in gr_pspnr or
                   aufnr      in gr_aufnr ).
          if sy-subrc eq 0.
            select single vbeln bstnk_vf zterm stceg
                          bukrs waerk belnr gjahr
                          ernam knumv kunrg fkdat
              into (gst_invheader-vbeln,
                    gst_invheader-bstnk_vf,
                    gst_invheader-zterm,
                    gst_invheader-stceg,
                    gwa_bseg-bukrs,
                    gst_invheader-waerk,
                    gwa_bseg-belnr,
                    gwa_bseg-gjahr,
                    vbrk-ernam,
                    vbrk-knumv,
                    gst_invheader-kunrg,
                    vbrk-fkdat)
               from vbrk
              where vbeln = gp_vbeln.
          else.
            message e037 with gp_pspid.
    Invoice does not belong to any WBS/Netowrk of the project:
          endif.
        endif.
      else.
        select single vbeln bstnk_vf zterm stceg
                      bukrs waerk belnr gjahr
                      ernam knumv kunrg fkdat
          into (gst_invheader-vbeln,
                gst_invheader-bstnk_vf,
                gst_invheader-zterm,
                gst_invheader-stceg,
                gwa_bseg-bukrs,
                gst_invheader-waerk,
                gwa_bseg-belnr,
                gwa_bseg-gjahr,
                vbrk-ernam,
                vbrk-knumv,
                gst_invheader-kunrg,
                vbrk-fkdat)
           from vbrk
          where vbeln = gp_vbeln.
      endif.
    endform.                    " f_validate_billing_doc
    *&      Form  f_get_project_data
          text
    form f_get_project_data .
      clear: gt_pspnr, gt_pspnr[],
             gt_aufnr, gt_aufnr[],
             gr_pspnr, gr_pspnr[],
             gr_aufnr, gr_aufnr[].
    Get the project
      if gp_pspid is initial.
        get parameter id 'PSP' field gp_pspid.
      endif.
      check gp_pspid is not initial.
      select single *
        from proj
       where pspid = gp_pspid.
    First get all the wbs elements of the project
      select pspnr
        into table gt_pspnr
        from prps
       where psphi = proj-pspnr.
      if sy-subrc eq 0.
        loop at gt_pspnr.
          gr_pspnr-sign = 'I'.
          gr_pspnr-option = 'EQ'.
          gr_pspnr-low    = gt_pspnr-pspnr.
          append gr_pspnr.
        endloop.
      endif.
    Get all the networks.
      select distinct aufnr
        into table gt_aufnr
        from caufv
       where pronr eq proj-pspnr.
      if sy-subrc eq 0.
        loop at gt_aufnr.
          gr_aufnr-sign   = 'I'.
          gr_aufnr-option = 'EQ'.
          gr_aufnr-low    = gt_aufnr-aufnr.
          append gr_aufnr.
        endloop.
      endif.
    endform.                    " f_get_project_data
    *&      Form  f_get_invoice
          text
         <--EV_VBELN  text
    form f_get_invoice  changing ev_vbeln.
      data: lv_fieldname like help_info-fieldname,
            lv_tabname   like help_info-tabname,
            lv_value     like help_info-fldvalue,
            lv_index     like sy-tabix.
      data: lt_fields like help_value occurs 0 with header line,
            lt_dynpread like dynpread occurs 0 with header line.
      lt_dynpread-fieldname = 'GP_PSPID'.
      append lt_dynpread.
    Read the screen input first.
      call function 'DYNP_VALUES_READ'
        exporting
          dyname               = sy-repid
          dynumb               = sy-dynnr
        tables
          dynpfields           = lt_dynpread
        exceptions
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          invalid_parameter    = 7
          undefind_error       = 8
          double_conversion    = 9
          stepl_not_found      = 10
          others               = 11.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.
        read table lt_dynpread with key fieldname = 'GP_PSPID'.
        if sy-subrc eq 0.
          gp_pspid = lt_dynpread-fieldvalue.
        endif.
      endif.
      if gp_pspid is not initial.
    Get the project data first
        perform f_get_project_data.
    Get the invoice list now.
        if gr_pspnr[] is not initial.
          select distinct vbeln
            into table gt_vbeln
            from vbrp
           where ps_psp_pnr in gr_pspnr.
        endif.
        if gr_aufnr[] is not initial.
          select distinct vbeln
            appending table gt_vbeln
            from vbrp
           where aufnr      in gr_aufnr .
        endif.
      else.
        select vbeln
          into table gt_vbeln
          from vbrk.
      endif.
      if gt_vbeln[] is not initial.
        lt_fields-tabname     = lv_tabname   = 'VBRK'.
        lt_fields-fieldname   = lv_fieldname = 'VBELN'.
        lt_fields-selectflag  = 'X'.
        append lt_fields.
        call function 'HELP_VALUES_GET_NO_DD_NAME'
          exporting
            cucol                        = '5'
            curow                        = '5'
            selectfield                  = lv_fieldname
            titel                        = text-008 "'Select Any Value'
          importing
            ind                          = lv_index
            select_value                 = lv_value
          tables
            fields                       = lt_fields
            full_table                   = gt_vbeln
          exceptions
            full_table_empty             = 1
            no_tablestructure_given      = 2
            no_tablefields_in_dictionary = 3
            more_then_one_selectfield    = 4
            no_selectfield               = 5
            others                       = 6.
        if sy-subrc <> 0.
          message s000 with
          'No Invoices found for the project definition..'(007).
        else.
          clear gt_vbeln.
          read table gt_vbeln index lv_index.
          ev_vbeln = gt_vbeln-vbeln.
        endif.
      else.
        message s000 with
          'No Invoices found for the project definition..'(007).
      endif.
    endform.                    " f_get_invoice
    *&      Form  F_PRINT_INVOICE_COVSHEET
          text
    form f_print_invoice_covsheet .
    Call the function module to get the name of the
    function module name which will be generated dynamically for
    the layout
      call function 'SSF_FUNCTION_MODULE_NAME'
        exporting
         formname           = gc_formname
           formname          = gp_layut
        importing
          fm_name            = gv_fm_name
        exceptions
          no_form            = 1
          no_function_module = 2
          others             = 3.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    Set up the output options for the smart form
      clear gst_output_options.
    GST_OUTPUT_OPTIONS-tddest   = sy-pdest.
      gst_output_options-tddest   = 'FWIN'.             "Frontend printer
      gst_output_options-tdnewid  = sy-prnew.
      gst_output_options-tdimmed  = 'X'.
      gst_output_options-tddelete = sy-prrel.
      clear gst_control_parameters.
    Setup to generate OTF internal table
      gst_control_parameters-no_dialog = 'X'.
      gst_control_parameters-getotf    = 'X'.
      gst_control_parameters-preview   = 'X'.       "Deactivate preview!
      if gp_norm is not initial.
    Call the original function module.
        call function gv_fm_name
          exporting
            inv_header       = gst_invheader
          tables
            inv_data         = gt_invitems
          exceptions
            formatting_error = 1
            internal_error   = 2
            send_error       = 3
            user_canceled    = 4.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
                  with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.
      else.
    Call the original function module.
        call function gv_fm_name
          exporting
            control_parameters = gst_control_parameters
            output_options     = gst_output_options
            inv_header         = gst_invheader
          importing
            job_output_info    = gt_job_output_info
            job_output_options = gt_output_options
          tables
            inv_data           = gt_invitems
          exceptions
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
                  with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.
    Display PDF Preview Screen
        perform pdf_preview     using    gt_job_output_info-otfdata.
      endif.
    endform.                    " F_PRINT_INVOICE_COVSHEET
    *&      Form  f_get_other_invoice_details
          text
    form f_get_other_invoice_details .
      data: lv_index     like sy-tabix,
            lwa_invitems like gt_invitems.
      data: lt_invitems  like gt_invitems occurs 0 with header line,
            lt_invitems1 like gt_invitems occurs 0 with header line.
    Get the prepared by person name.
      if gst_invheader-ernam is not initial.
        select single pernr
          into pa0105-pernr
          from pa0105
         where usrty = gc_usrty
           and usrid = gst_invheader-ernam.
        select nachn vorna
          up to 1 rows
          into (pa0002-nachn, pa0002-vorna)
          from pa0002
         where pernr = pa0105-pernr.
        endselect.
        condense: pa0002-nachn, pa0002-vorna.
        concatenate  pa0002-nachn          pa0002-vorna
               into  gst_invheader-ernam
       separated by  space.
      endif.
    Get logo
      move gp_logo to gst_invheader-logo.
    Write the date as required.
      if vbrk-fkdat is not initial and
         vbrk-fkdat ne '00000000'.
        perform f_write_date changing gst_invheader-txdat.
      endif.
    Get the description for Payment terms
      select single *
        from tvzbt
       where spras eq sy-langu
         and zterm eq gst_invheader-zterm.
      if sy-subrc eq 0.
        condense: tvzbt-vtext, gst_invheader-zterm.
        concatenate gst_invheader-zterm '-' tvzbt-vtext
               into gst_invheader-zterm.
      endif.
    Get the billing address.
      select adrnr
        up to 1 rows
        into gst_invheader-adrnr
        from vbpa
       where vbeln = gst_invheader-vbeln
         and parvw = 'RE'.
      endselect.
      if sy-subrc ne 0.
        message i000 with
        'Billing Party address of Customer is not maintained..'(009).
        stop.
      endif.
    Get the company code address (Registered Address).
      select single adrnr
        into t001-adrnr
        from t001
       where bukrs = gwa_bseg-bukrs.
      if sy-subrc eq 0.
        select name1 street city1 post_code1
               region country
               up to 1 rows
          into (adrc-name1, adrc-street, adrc-city1, adrc-post_code1,
                adrc-region, adrc-country)
          from adrc
         where addrnumber = t001-adrnr
           and date_from le sy-datum.
        endselect.
        if sy-subrc eq 0.
          condense: adrc-name1, adrc-street, adrc-city1,
                    adrc-post_code1, adrc-region, adrc-country.
          concatenate adrc-name1 ',  ' adrc-street
                 into gst_invheader-zzregoff_line1.
          concatenate adrc-city1 ',  '  adrc-region ',  '
                      adrc-country ' ' adrc-post_code1
                 into gst_invheader-zzregoff_line2.
        endif.
      endif.
      gv_uname = vbrk-ernam.
    Get the Prepared by Person name.
      call function 'CRIF_GET_EMPLOYEE_FOR_USER'       "just like this
        exporting
          user_name               = gv_uname
          begindate               = sy-datum
          enddate                 = sy-datum
        importing
          employeenumber          = gv_pernr
        exceptions
          no_employeenumber_found = 1
          subtype_not_available   = 2
          others                  = 3.
      if sy-subrc eq 0.
        select single *
          from pa0002
         where pernr = gv_pernr
          and begda le sy-datum
          and endda ge sy-datum.
        concatenate pa0002-vorna pa0002-nachn into
                    gst_invheader-ernam separated by space.
      endif.
    Get the  Invoice items
      if gt_invitems[] is initial.
        select mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 matnr arktx vbeln posnr netwr
          into table gt_invitems
          from vbrp
         where vbeln eq gp_vbeln.
        if sy-subrc eq 0.
          sort gt_invitems by mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 arktx matnr.
        endif.
      endif.
    Get the VAT on the billing items through condition
    type 'MWST'.
      if gt_invitems[] is not initial.
        select knumv kposn kwert
          into table gt_konv
          from konv
          for all entries in gt_invitems
         where knumv = vbrk-knumv
           and kposn = gt_invitems-posnr
           and kschl = 'MWST'.
        if sy-subrc eq 0.
    Now loop through the condition value table and modify the invoice item
    table.
          sort gt_konv by knumv kposn.
          loop at gt_invitems.
            lv_index = sy-tabix.
            read table gt_konv with key knumv = vbrk-knumv
                                        kposn = gt_invitems-posnr
                                        binary search.
            if sy-subrc eq 0.
              gt_invitems-kwert = gt_konv-kwert.
              modify gt_invitems index lv_index transporting kwert.
            endif.
            lt_invitems = gt_invitems.
            at end of arktx.
              sum.
              move: gt_invitems-netwr to lt_invitems-netwr,
                    gt_invitems-kwert to lt_invitems-kwert.
              collect lt_invitems.
            endat.
          endloop.
    Take the summarized table for display in the output.
          clear gt_invitems[].
          gt_invitems[] = lt_invitems[].
          clear lt_invitems[].
          free lt_invitems[].
        else.
          loop at gt_invitems.
            lt_invitems = gt_invitems.
            clear: lt_invitems-vbeln, lt_invitems-posnr.
            at end of arktx.
              sum.
              move: gt_invitems-netwr to lt_invitems-netwr,
                    gt_invitems-kwert to lt_invitems-kwert.
              collect lt_invitems.
            endat.
          endloop.
    Take the summarized table for display in the output.
          clear gt_invitems[].
          gt_invitems[] = lt_invitems[].
          clear lt_invitems[].
          free lt_invitems[].
        endif.
    sort the table.
        lt_invitems1[] = gt_invitems[].
        delete lt_invitems1 where mvgr1 ne space or
                                  mvgr2 ne space or
                                  mvgr3 ne space or
                                  mvgr4 ne space or
                                  mvgr5 ne space.
        delete gt_invitems where mvgr1 = space and
                                 mvgr2 = space and
                                 mvgr3 = space and
                                 mvgr4 = space and
                                 mvgr5 = space.
        sort gt_invitems by mvgr1 mvgr2 mvgr3 mvgr4 mvgr5.
    Now, construct the output table with mat grp descriptions
        loop at gt_invitems.
          lwa_invitems = gt_invitems.
          clear: lt_invitems-arktx,
                 lt_invitems-netwr,
                 lt_invitems-kwert.
    Material group 1
          at new mvgr1.
            if lwa_invitems-mvgr1 is not initial.
              select single bezei from tvm1t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr1 = lwa_invitems-mvgr1.
              append lt_invitems.
            endif.
          endat.
    Material group 2
          clear: lt_invitems-arktx,
                 lt_invitems-netwr,
                 lt_invitems-kwert.
          at end of mvgr2.
            if lwa_invitems-mvgr2 is not initial.
              select single bezei from tvm2t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr2 = lwa_invitems-mvgr2.
              if lt_invitems-mvgr3 is initial and
                 lt_invitems-mvgr4 is initial and
                 lt_invitems-mvgr5 is initial.
                sum.
                move: gt_invitems-netwr to lt_invitems-netwr,
                      gt_invitems-kwert to lt_invitems-kwert.
              endif.
              concatenate '->' lt_invitems-arktx into lt_invitems-arktx.
              append lt_invitems.
            endif.
          endat.
    Material group 3
          clear: lt_invitems-arktx,
                 lt_invitems-netwr,
                 lt_invitems-kwert.
          at end of mvgr3.
            if lwa_invitems-mvgr3 is not initial.
              select single bezei from tvm3t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr3 = lwa_invitems-mvgr3.
              if lt_invitems-mvgr4 is initial and
                 lt_invitems-mvgr5 is initial.
                sum.
                move: gt_invitems-netwr to lt_invitems-netwr,
                      gt_invitems-kwert to lt_invitems-kwert.
              endif.
              concatenate '-->' lt_invitems-arktx into lt_invitems-arktx.
              append lt_invitems.
            endif.
          endat.
    Material group 4
          clear: lt_invitems-arktx,
                 lt_invitems-netwr,
                 lt_invitems-kwert.
          at end of mvgr4.
            if lwa_invitems-mvgr4 is not initial.
              select single bezei from tvm4t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr4 = lwa_invitems-mvgr4.
              if lt_invitems-mvgr5 is initial.
                sum.
                move: gt_invitems-netwr to lt_invitems-netwr,
                      gt_invitems-kwert to lt_invitems-kwert.
              endif.
              concatenate '--->' lt_invitems-arktx into lt_invitems-arktx.
              append lt_invitems.
            endif.
          endat.
    Material group 5
          clear: lt_invitems-arktx,
                 lt_invitems-netwr,
                 lt_invitems-kwert.
          at end of mvgr5.
            if lwa_invitems-mvgr5 is not initial.
              select single bezei from tvm5t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr5 = lwa_invitems-mvgr5.
              sum.
              move: gt_invitems-netwr to lt_invitems-netwr,
                    gt_invitems-kwert to lt_invitems-kwert.
              concatenate '---->' lt_invitems-arktx into lt_invitems-arktx.
              append lt_invitems.
            endif.
          endat.
    Material group 1
          at end of mvgr1.
            if lwa_invitems-mvgr1 is not initial.
              select single bezei from tvm1t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr1 = lwa_invitems-mvgr1.
              concatenate 'Total ' lt_invitems-arktx into lt_invitems-arktx
                               separated by space.
              if lt_invitems-mvgr2 is initial and
                 lt_invitems-mvgr3 is initial and
                 lt_invitems-mvgr4 is initial and
                 lt_invitems-mvgr5 is initial.
                sum.
                move: gt_invitems-netwr to lt_invitems-netwr,
                      gt_invitems-kwert to lt_invitems-kwert.
              endif.
              append lt_invitems.
            endif.
          endat.
        endloop.
    Now keep all the records with non material groups.
        sort lt_invitems1 by arktx.
        loop at lt_invitems1.
          lwa_invitems = lt_invitems1.
          at end of arktx.
            lt_invitems = lwa_invitems.
            sum.
            move: lt_invitems1-netwr to lt_invitems-netwr,
                  lt_invitems1-kwert to lt_invitems-kwert.
            append lt_invitems.
          endat.
        endloop.
      endif.
    Take the summarized table for display in the output.
    if gp_layut <> 'ZPS_INVOICE_COVERSHEET3'.
      clear gt_invitems[].
      gt_invitems[] = lt_invitems[].
      clear lt_invitems[].
      free lt_invitems[].
    endif.
    endform.                    " f_get_other_invoice_details
    Form:  pdf_preview
    Desc:  Preview PDF Debit/Credit memo
    form pdf_preview  using      iv_otfdata    type tsfotf.
    PREVIEW PDF Credit Memo
      call function 'SSFCOMP_PDF_PREVIEW'
        exporting
          i_otf                    = iv_otfdata
        exceptions
          convert_otf_to_pdf_error = 1
          cntl_error               = 2
          others                   = 3.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    endform.                    "pdf_preview
    *&      Form  f_write_date
          To write the date in format
         <--CV_date  date
    form f_write_date  changing cv_date.
      data: lv_date like sy-datum.
      lv_date = vbrk-fkdat.
      clear cv_date.
      case lv_date+4(2).
        when '01'.
          write '-Jan-' to cv_date.
        when '02'.
          write '-Feb-' to cv_date.
        when '03'.
          write '-Mar-' to cv_date.
        when '04'.
          write '-Apr-' to cv_date.
        when '05'.
          write '-May-' to cv_date.
        when '06'.
          write '-Jun-' to cv_date.
        when '07'.
          write '-Jul-' to cv_date.
        when '08'.
          write '-Aug-' to cv_date.
        when '09'.
          write '-Sep-' to cv_date.
        when '10'.
          write '-Oct-' to cv_date.
        when '11'.
          write '-Nov-' to cv_date.
        when '12'.
          write '-Dec-' to cv_date.
      endcase.
      condense cv_date.
      concatenate lv_date6(2) cv_date lv_date0(4)
             into cv_date.
    endform.                    " f_write_date
    thanks
    suresh

  • Perform custom validation on invoices created via iSupplier portal in R12

    Hello,
    It seems that since R12, invoices created on iSupplier portal are no longer loaded via Payables open interface tables (while ASBN's still are). It is nice that they are loaded immediately but now we do not have any way to perform custom validation that we normally do via AP_INTERFACE_WORKFLOW_PKG.do_custom_validation procedure.
    Is there any way to modify how iSupplier portal inserts Invoice data into AP tables? In particular we would like to choose specific document category for certain suppliers.
    Many thanks in advance,
    Kamil

    Hi Friends,
    Apologies to have put this in SCM-Costing Category. I just posted the same thing in Financials Category.
    Please ignore this, if found irrelevant under this category.
    Thanks,
    AAR

  • How to c heck if exicse invoice is executed for performa invoice ,

    how to c heck if exicse invoice is executed for performa invoice , cos u cannot see the excise invoice in doc flow where exactly can i see the excise num against the proforma,,, pls help

    Hi,
    Go to J1IIN->Excise Invoice>Change
    Select Alternate Selection-->Enter the Billing Document and Press Document Flow..
    Here u can see the full document flow
    Thanks,
    Sam

  • Single performa invoice from multiple delivery

    Dear sir,
    my client requirement is they are doing one delivery and creating one performa invoice in export scnario while selling from plant and while doing export issue they have to take refrence performaa invoive .
    so they want to create as ingle performa invoice from multiple delivery for which already respective performa invoices have been created.so i want a single performa invoice from multiple delivery so tell me how to do it?
    thanks
    Debesh

    Go to VTFL and maintain as follows:-
    At Header
    Copying requirements:::::::::009
    At Item
    Copying requirements:::::::010
    Data VBRK/VBRP::::::::::::003
    thanks
    G. Lakshmipathi

  • Invoice Number and Performa invoice number

    Hi all
      I want to get the combination of invoice Number and Performa invoice number, I have got the VBFA Table, but it’s very slow, any alternative program or function please help me
    Thanks
    Kanishka

    Try AC_DOCUMENT_RECORD. It returns all kind of accounting documents.

  • Wrong Incoterms during creation of intercompany performa invoice

    The incoterm in the sales order is indeed DSA , at the time of creation of  "Intercompany" proforma invoice (ZF8V type)  the incoterms comes as ddl which is the proforma invoice between the company owning the stock (1010) and the "selling" company code (2010).
    Customer 1010 in sales area 3020 - 04 - 99 has incoterm DDL
    at the time of creation of F2 invoice the incoterms comes same as as on the order but in performa invoice its comes different from sales order
    Kindly suggest

    Hi,
    Inco terms are always customer specific.
    Inco terms selected at the billing document are from the Sales Order and at Sales Order from Customer Master.
    As sales order Customer is your actual customer hence billing happened to the actual customer will pick the same Inco terms.
    At the time of Intercompany Billing Your ordering Sales-Organizations becomes the customer.
    If your ordering Sales-Organization Customer has different Inco terms, system will by default pick the same.
    Thank You,
    RB.

  • Can we create a PO then post invoice prior to GRN being performed

    Can you please advise if there is a way to make the following scenario possible:
    Using t-code ME21N we create a PO for goods or services with limits (using po type NB)
    We would like to post the invoice and match it to the PO when it arrives even if the manager who raised the PO has not yet performed a GRN (goods receipt) in MIGO.
    We have tried to do this but system will not allow us to post the invoice before the GRN has been done.
    The invoice will remain blocked for payment until the GRN action has been done.
    Thanks for any tips or advice.  Points awarded for successful resolution.
    Regards
    Steve.

    Hi,
    During ME21N - Creation of PO,
    Do not activate "GR-based IV" under "Invoice" Tab at Item Details level.
    During MIRO - LIV (Before GR i.e. MIGO)
    System will not show any value under quantity and amount fields, you have to input these details manually and then Simulate and Post.
    Note: - After "Simulation" do not post directly if it is correct, come to "Payment" tab page and Remove "Payment Block" and make it "free for payment'.
    Even if it is blocked then release it in MRBR

  • How to stop creating mutiple performa invoice from delivery document

    case -
    i am creating stock transfer performa invoice on the basis of stock trf purchase order and delivery document. i want to stop creating multiple performa invoice.
    Mukesh Kumar

    If your requirement is to generate a certain output automatically only once for a certain document, you can set it for the output type in  transaction NACE (for example - NACE --> select the application --> "Output types").
    There's a "Multiple issuing" indicator (VN_T685B-MEHRF) through which you can control the desired behaviour.
    Edited by: Csaba Szommer on Jul 28, 2010 1:40 PM
    Sorry, I misunderstood your question...please neglect the suggestions above...
    As per SAP online help there's no limitation how many proforma invoices can be created from one delivery / sales order:
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/dd/5610c9545a11d1a7020000e829fd11/frameset.htm
    If you want to restrict this, I think you should follow KC's suggestion and modify your copy control routine.
    Since in standard system this function does not exists you won't find suitable copy routine. That's why - in my opinion - you should use the same copy routine which has been set till now - you just have to modify it (add an ABAP code to check whether proforma invoice is already created or not; maybe you can check the entries in table VBFA)
    Edited by: Csaba Szommer on Jul 28, 2010 1:46 PM

  • Excise entries for Performa Invoice

    Hi Experts,
    My client wants to have EXCISE entries to get posted automatically to the G/L Accounts maintained in VKOA whenever Performa Invoice is created. i.e. only for Excise condition types JEXP,JCEP,JA1X maintained in Pricing Procedure.
    Please suggest how to go about it.
    Should I ask ABAPER for the same? If yes the suggest how and where we need to change.
    Thanks in Advance.

    Hello Deepak,
    Excise Duties are charged (Accounting Entries passed) in Books of Accounts at the time of removal of goods from your Plant.
    A Proforma Invoice does not involve actual goods movement & it is issue only for information purpose (to open LC or arrrange for funds, etc).
    Try to explain to your client that Excise entries cannot be passed while creating Proforma Invoice as it is legally invalid.
    Hope this clarifies,
    Thanks,
    Jignesh Mehta

Maybe you are looking for

  • How do I add a "Print this page" button (not just a "Print" button) to a PDF?

    I am creating a multipage PDF in Acrobat Pro 8 for a client and it includes a linked table of contents with several sections and also several forms sprinkled throughout. I need to be able to add buttons that allow the user to print specific page numb

  • Portrait landscape mystery switch

    photos in my iPhoto library have mysteriously gone from one orientation to the other. maybe related background --- This mystery was preceeded by an error when syncing my iPhone that said "the following image was not copied to your iPhone because it c

  • Comparison of Salaries

    Hello All, I would like to get what is the basic salary of each employee on 31.12.2010 and 01.01.2011 (increased). Please note that SAP payroll run has started from 01.01.2011, but 2010 salary record is in the system (seen when we overview from PA30)

  • RoboHelp 7 Takes 30 minutes to Load Project

    I am working on a large project and I'm finding that since upgrading to version 7 my project is taking 10 times longer to load. When I select teh project I want to work on it takes half an hour for the program to be ready for me to get to work. Is th

  • SLD Datasupplier - Technical System Sychronization

    I understand that SLD 7.0 and 7.1 employ "automatic forwarding" that updates all data supplier targets with new system information.  But, is there a nightly synchronization job between the master and slave SLDs that synchronizes technical systems bet