Smartform in background

Dear Abapers,
      I need to print the form using smartform , and need to process it in background. How can we see the result of smartform while executing in the backgound.
Thanx in advance.
by
Mohan ram

Hi Mohan,
hope, you know the options in control parameters & output options.
Just in case of background job, just create a spool instead of preview or printout.
you can do check whether a job is  background job or not using the system variable sy-batch (= 0).
Regards,
Selva K.

Similar Messages

  • Submitting of smartforms in background

    Hi all,
    Can any one explain me how to submit smartform in background. Explain me in details.
    Thanks In Advance
    Ramana Prasad

    hi
    u can schedule it in backgroud by creating a job in SM36.
    but we need to consider whether this program will be triggered by using OUTPUT TYPE or we can run this using SE38 in foreground.
    if u can run this in forgroung using the print progam then we can run this in backgrounfd also by creating a JOB in SM36.
    i think u r doubt could be... about the dailog which will be displayed before printin.. if it is u doubt---we can avoid this dailog screen by changing the value of output_option.. of the form ... output_options-nodialog = 'X'.
    if have any doubts please let us know
    Please Close this thread.. when u r problem is solved. Reward if Helpful
    Regards
    Naresh Reddy K

  • Run smartforms in background mode

    Hi
       Can anybody tell me, can we execute smartforms in background mode. Please tell me. Can we take printout from the spool.
    Smartform have driver program.
    Thanks
    Murali Papana.

    hi,
    Use
    You can not only evaluate queries online, but also print them in the background. In the Reporting Agent of the Administrator Workbench, you can define the display of the query data as the setting for background printing. You can make as many various settings as you want for printing a query in the background. The settings are then brought together in scheduling packets and scheduled for background printing.
    Prerequisites
    You have defined a query in the Business Explorer Analyzer that you now want to print in the background. You have called up the Administrator Workbench to do this.
    You can only print out queries with key figures in structures. If you have defined a query with a key figure in the filter and want to print this query, you must change the definition of the query so that the key figure is in a structure to be printed.
    You can only schedule queries with entered variables for background printing if the required variable entry/entries have been saved as query variants.
    Procedure
    Defining Reporting Agent Settings for Printing in the Background
    Choose the Reporting Agent from the Administrator Workbench.
    Navigate in the left-hand tree to the query you want, and, using the right mouse button, choose New Setting. You get to the "New Reporting Agent Setting" dialog box.
    Enter a technical name and a description.
    Choose Print in the background from the General tabstrip.
    Choose the tabstrip Print Settings from the newly added tabstrips.
    Determine the print settings that you want to make. See also: Print Settings
    Choose the Print Layout tabstrip.
    Decide how you want to set the following print areas:
    Cover sheet
    Page header
    Table header
    Table
    Page footer
    Last page
    See also:
    Defining the Print Layout
    Choose Activate.
    Creating Scheduling Packets and Assigning Reporting Agent Settings for Printing in the Background
    Once you have made the Reporting Agent setting for printing in the background, you have to assign your setting to a scheduling packet for the background run.
    Creating a scheduling packet
    Go back to the Reporting Agent Scheduler, and, in the right-hand Scheduling packets tree, choose the Change pushbutton.
    Select the Print in the background node, and choose Create new packet from the context menu (right mouse button). You get to the Create Scheduling Packet dialog box.
    Specify a name and a description, and choose Save.
    Assigning Reporting Agent Settings for Printing in the Background
    Navigate in the left-hand tree, Reporting Agent Settings, to the Reporting Agent setting you want to use for printing in the background.
    Using drag-and-drop, drag the Reporting Agent setting that you want to use into the right-hand tree, and assign it to the corresponding scheduling packet.
    If the Reporting Agent setting refers to a query with variables, then you need to assign a variant:
    Select the Reporting Agent setting.
    Using the right mouse button, choose Assign variants from the context menu. A dialog box containing the variants for this query appears.
    Choose the variant you want to use.
    Choose Continue.
    You have the option of maintaining variants in the Reporting Agent (in both the left and right-hand trees).
    Select the Reporting Agent setting you want to use.
    Choose Maintain variants from the context menu (right mouse button).
    Note that you always assign Reporting Agent settings for printing in the background to a corresponding scheduling packet for printing in the background.
    To avoid confusion with Reporting Agent settings for exception reporting, you are able to filter according to these two functions in the left-hand menu. The symbols for Exception and Print, in the left-hand tree, also identify the settings.
    Scheduling a Packet as a Job
    In the right-hand tree, select the scheduling packet you want to use.
    Using the right mouse-button, choose Schedule from the context menu. You get to the Change Job RA (name of the scheduling packet) dialog box.
    The name of the job is made up of RA for Reporting Agent, and the name of the scheduling packet.
    Specify the start date and the repetition period for the job.
    See also:
    Scheduling Background Jobs in the documentation for the BC Computing Center Management System.
    If you want to check the status of the scheduled background job, choose the Jobs pushbutton above the right-hand tree in the Reporting Agent Scheduler.
    Hope this helps, Do reward.

  • Smartform in background task

    Hi,
    I have the following code which is a copy of standard program /bev1/vd_bew_lief_background:
    IF nast-vsztp = 4.
    CALL FUNCTION 'ZUAM_FMDELNOTE' IN BACKGROUND TASK AS SEPARATE UNIT
    ELSEIF sy-tcode = VL71 OR
    sy-tcode = VL02N OR
    sy-tcode = VL03N.
    CALL FUNCTION 'ZUAM_FMDELNOTE'
    ELSE.
    CALL FUNCTION 'ZUAM_FMDELNOTE' IN BACKGROUND TASK AS SEPARATE UNIT
    And inside this FM I have a call to print a smartform. When it goes in the second if block there is no problem, the smartform gets triggered. But when it goes to the 1st or 2nd, the one with in background task, the smartform is not triggered.
    Is smartform allowed to be called in background processing?
    Or there other things that I should check?
    Thanks.

    Does your smartform has a Dialog pop up?
    If yes, you have to suppress it, as dialog and background don't go together.
    You have set cetrain parameters in the Smartfrms function module in order not to get the pop up dialog.
    REgards,
    Ravi

  • Print smartform from background

    Dear Experts,
    I have requirement to create delivery then create bill automatically so i open background job from program (A) and submit the creating program for bill (B) via this job what happened is the delivery creating is ok, the delivery printing is ok and the billing creation is ok but the billing printing program (C) is not ok where the spool is creating with status waiting so can any body help how to print from background job??
    program (A) (Create backgroundjob and submit program via it)
    FORM USEREXIT_SAVE_DOCUMENT.
    DATA: jobcount TYPE tbtcjob-jobcount,
          new_time type TBTCJOB-SDLSTRTTM.
    data : p_vbeln TYPE likp-vbeln.
    DATA : v_JOB_WAS_RELEASED LIKE  BTCH0000-CHAR1.
    break rurik.
    if T180-TRTYP = 'H'
      and ( likp-lfart = 'ZDCF'
    or    likp-lfart = 'ZDCI'
      or    likp-lfart = 'ZDCO'
      or    likp-lfart = 'ZDCP'
      or    likp-lfart = 'ZDCR'
      or    likp-lfart = 'ZDOB'
      or    likp-lfart = 'ZDOT'
      or    likp-lfart = 'ZDQT'
    or    likp-lfart = 'ZDRE' - Ian
      or    likp-lfart = 'ZDSO').
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname               = 'SD_AUTOMATION'
      SDLSTRTDT             = NO_DATE
      SDLSTRTTM             = NO_TIME
      JOBCLASS              =
    IMPORTING
       JOBCOUNT               = jobcount
    CHANGING
      RET                   =
    EXCEPTIONS
       CANT_CREATE_JOB        = 1
       INVALID_JOB_DATA       = 2
       JOBNAME_MISSING        = 3
       OTHERS                 = 4.
    SUBMIT zsd_create_billing_document
            with vbeln EQ LIKP-VBELN
            AND RETURN
            VIA JOB 'SD_AUTOMATION'
            NUMBER jobcount.
    new_time = sy-uzeit + 10.  "short delay
    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        jobcount                         = jobcount
        jobname                          = 'SD_AUTOMATION'
       STRTIMMED                       = 'X'
        SDLSTRTDT                        = sy-datum
        SDLSTRTTM                        = new_time
    IMPORTING
        JOB_WAS_RELEASED                 = v_JOB_WAS_RELEASED
    EXCEPTIONS
       CANT_START_IMMEDIATE              = 1
       INVALID_STARTDATE                 = 2
       JOBNAME_MISSING                   = 3
       JOB_CLOSE_FAILED                  = 4
       JOB_NOSTEPS                       = 5
       JOB_NOTEX                         = 6
       LOCK_FAILED                       = 7
       INVALID_TARGET                    = 8
       OTHERS                            = 9
    ENDIF.
    ENDFORM.
    Program B (Creat bill)
    REPORT zsd_create_billing_document
           NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES: vbup, vbak, vbuk.
    DATA:   bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
    DATA done(1).
    PARAMETERS vbeln TYPE likp-vbeln.
    DATA  sal_vbeln TYPE vbeln..
    DATA  messtab LIKE TABLE OF bdcmsgcoll WITH HEADER LINE.
    DATA   billing_doc TYPE vbeln.
    DATA  messagetext(200).
    MESSAGE s002(zsd).
    WRITE: / vbeln.
    DATA :  v_print TYPE i.
    CALL FUNCTION 'ENQUEUE_EVVBLKE'
    EXPORTING
      MODE_LIKP            = 'E'
      MANDT                = SY-MANDT
       vbeln                = vbeln
      X_VBELN              = ' '
      _SCOPE               = '2'
        _wait                = 'X'
    " _wait                 = space
      _COLLECT             = ' '
    EXCEPTIONS
       foreign_lock         = 1
       system_failure       = 2
       OTHERS               = 3
    MESSAGE s005(zsd).
    *In case ZSOT automatic billing once we create delivery and post goods issue manual.
    SELECT SINGLE vbelv
      FROM vbfa
      INTO sal_vbeln
      WHERE vbeln = vbeln
      AND   vbtyp_v = 'C'.
    SELECT SINGLE *
      FROM vbak
      WHERE vbeln = sal_vbeln.
    import v_print to v_print FROM MEMORY id 'PRINTFLAG'.
    IF vbak-auart EQ 'ZSOT'.
    IF v_print eq '1'.
        PERFORM create_document USING vbeln
                              CHANGING sy-subrc.
    ENDIF.
    ELSE.
    *Other than ZSOT Post Goods issue from ZPGI2 and from there automatic billing.
    ENDIF.
    *&      Form  CREATE_DOCUMENT
          text
         -->P_VBELN    text
    FORM create_document USING p_vbeln
                         CHANGING sysubrc.
      PERFORM bdc_dynpro      USING 'SAPMV60A' '0102'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'KOMFK-VBELN(01)'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM bdc_field       USING 'KOMFK-VBELN(01)'
                                    p_vbeln."'1130010202'.
      PERFORM bdc_dynpro      USING 'SAPMV60A' '0104'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'VBRK-FKART'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=SICH'.
      CALL FUNCTION 'DEQUEUE_EVVBLKE'
       EXPORTING
          MODE_LIKP       = 'E'
          MANDT           = SY-MANDT
            vbeln           = vbeln
          X_VBELN         = ' '
          _SCOPE          = '3'
          _SYNCHRON       = ' '
          _COLLECT        = ' '
      CALL TRANSACTION 'VF01' USING bdcdata
                       MODE   'N'
                       UPDATE 'S'
                       MESSAGES INTO messtab.
      READ TABLE messtab WITH KEY msgtyp = 'E'.
      IF sy-subrc EQ 0.
        sysubrc = 4.
      ELSE.
        sysubrc = 0.
      ENDIF.
      LOOP AT messtab.
        sy-msgty = messtab-msgtyp.
        sy-msgid = messtab-msgid.
        sy-msgno = messtab-msgnr.
        sy-msgv1 = messtab-msgv1.
        sy-msgv2 = messtab-msgv2.
        sy-msgv3 = messtab-msgv3.
        sy-msgv4 = messtab-msgv4.
        CALL FUNCTION '/SAPTRX/GET_MESSAGE_TEXT'
          EXPORTING
            msgid                = sy-msgid
            msgno                = sy-msgno
            msgv1                = sy-msgv1
            msgv2                = sy-msgv2
            msgv3                = sy-msgv3
            msgv4                = sy-msgv4
          IMPORTING
            messagetext          = messagetext
          EXCEPTIONS
            no_message_retrieved = 1
            OTHERS               = 2.
        WRITE: / messagetext.
        CLEAR messagetext.
      ENDLOOP.
    *... refresh tables
      REFRESH: messtab, bdcdata.
    ENDFORM.                    "CREATE_DOCUMENT
    *&      Form  BDC_DYNPRO
          text
         -->PROGRAM    text
         -->DYNPRO     text
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field                                                  *
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    "BDC_FIELD
    *&      Form  change_status
          text
    -->  p1        text
    <--  p2        text
    FORM change_status .
    *Change status if delivery and the billing document has been created
      SELECT  *
        FROM vbup
        WHERE vbeln = vbeln
        AND   fksta NE 'C'.
        vbup-fksta = 'C'.
       vbup-gbsta = 'C'.
        MODIFY vbup.
      ENDSELECT.
      UPDATE vbuk
      SET fkstk = 'C'
         gbstk = 'C'
      WHERE vbeln = vbeln.
    ENDFORM.                    " change_status
    Program C (Print Bill)
    REPORT  z_sdps_invoice.
    *&    <Module>:  SD Smart Forms.
    *& Type       : Executable
    *& Request No.:
    *& Author/Co. : Ahmed Al Eryani
    *& Created On : 26.02.2007
    *& Finished   : 24.2007
    *& Description:
    *&                    MODIFICATION LOG
    *& Modified by  :
    *& Request No.  :
    *& Dev. Class   :
    *& Date Modified:
    *& Description  :
    TABLES: vbrk, kna1, vbrp, makt, konv, vbkd.
    SELECTION-SCREEN BEGIN OF BLOCK a.
    PARAMETER: p_vbeln LIKE vbrp-vbeln OBLIGATORY MATCHCODE OBJECT vmcf. "Billing document No
    "SELECT-OPTIONS s_bukrs FOR bkpf-bukrs. "Company Code
    SELECTION-SCREEN END OF BLOCK a.
    *itab is object of our smart form structre
    DATA: itab TYPE zsd_invoice OCCURS 0 WITH HEADER LINE.
    DATA: wa_footer TYPE zsd_invv1.
    DATA: t_items TYPE zsd_inv WITH HEADER LINE,
          w_items TYPE LINE OF zsd_inv,
          it_footer TYPE zsd_inv1,
          w_footer TYPE LINE OF zsd_inv1.
    DATA: amountspell LIKE spell.
    DATA: g_fm_name TYPE rs38l_fnam.
    DATA: mnumvflag(10) TYPE c.
    DATA: coun TYPE i,
          totalforitems TYPE kwert,
          lasttotal(8) TYPE p DECIMALS 2,
          lasttotalc(11) TYPE c,
          firstpart(11) TYPE c,
          secondpart(2) TYPE c.
    DATA: currency TYPE waerk.
    DATA: currtxet(50) TYPE c.
    *Header internal table
    DATA: BEGIN OF t_header OCCURS 0,
      vbeln LIKE vbrk-vbeln,"Document no
      name1 LIKE kna1-name1,"Customer Name
      adrnr LIKE kna1-adrnr,"Customer Address
      bstkd LIKE vbkd-bstkd,"
      kunnr LIKE kna1-kunnr,"Customer Account no
      waerk LIKE vbrk-waerk, "currency key
      aubel LIKE vbrp-aubel,
      kunrg LIKE vbrk-kunrg,
      street LIKE adrc-street,
      fkart LIKE vbrk-fkart,
      lgort LIKE lips-lgort,"Stord bin
      lgobe LIKE t001l-lgobe,
      ktokd LIKE kna1-ktokd,
      PSTYV LIKE vbrp-PSTYV,
      orgbil LIKE vbfa-vbelv,
    END OF t_header.
    *detail internal table
    DATA: BEGIN OF t_items1 OCCURS 0,
      matnr LIKE vbrp-matnr,"Material Number
      posnr LIKE vbrp-posnr,
      vgpos LIKE vbrp-vgpos,
      maktx LIKE makt-maktx,"Material Description
      lgort LIKE vbrp-lgort,"Storage location
      fkimg LIKE vbrp-fkimg,"
      knumv LIKE vbrk-knumv,"
      unitprice LIKE konv-kawrt,
      total LIKE konv-kawrt,
      waers LIKE konv-waers,
      kkurs LIKE konv-kkurs,
      vgbel LIKE vbrp-vgbel,
      lgpbe LIKE lips-lgpbe,
      vgtyp LIKE vbrp-vgtyp,
    END OF t_items1.
    DATA: v_belnr TYPE belnr_d.
    *Unit price internal table
    DATA: BEGIN OF t_untprice OCCURS 0,
      kschl LIKE konv-kschl,"condition type
      kawrt LIKE konv-kawrt,"unit price
    END OF t_untprice.
    *Condition(spcial deduction)
    DATA: BEGIN OF t_spcialcnd OCCURS 0,
      kschl LIKE konv-kschl,"condition type
      kwert LIKE konv-kwert,"Deduction value
    END OF t_spcialcnd.
    DATA: t_tax LIKE TABLE OF t_spcialcnd WITH HEADER LINE,
          v_tax LIKE konv-kwert.
    DATA: BEGIN OF t_curtxt OCCURS 0,
      ltext LIKE tcurt-ltext,
    END OF t_curtxt.
    DATA :return_code TYPE i," VALUE 999,
          us_screen TYPE c. "VALUE 'X'.
    declaration of data
    INCLUDE rlb_invoice_data_declare.
    definition of forms
    INCLUDE rlb_invoice_form01.
    INCLUDE rlb_print_forms.
    START-OF-SELECTION.
      "IF p_vbeln IS NOT INITIAL.
        PERFORM entry USING return_code us_screen.
      "ENDIF.
          FORM ENTRY
    FORM entry USING return_code us_screen.
      DATA: lf_retcode TYPE sy-subrc.
      CLEAR retcode.
      xscreen = us_screen.
    perform processing using us_screen
                        changing lf_retcode.
    if lf_retcode ne 0.
       return_code = 1.
    else.
       return_code = 0.
    endif.
      IF p_vbeln IS INITIAL.
        p_vbeln = nast-objky.
      ENDIF.
      "get header data
      SELECT SINGLE vbrk~vbeln vbrk~waerk vbrp~aubel vbrk~kunrg vbrk~fkart vbrp~lgort vbrp~PSTYV
      INTO (t_header-vbeln, t_header-waerk, t_header-aubel, t_header-kunrg, t_header-fkart,
        t_header-lgort, t_header-PSTYV)
      FROM vbrk JOIN vbrp ON vbrp~vbeln = vbrk~vbeln
                JOIN kna1 ON vbrk~kunrg = kna1~kunnr
      WHERE vbrk~vbeln = p_vbeln.
      IF t_header-PSTYV = 'ZREN'.
        SELECT SINGLE VBELV
          INTO t_header-orgbil
          FROM vbfa
          WHERE vbeln = p_vbeln
          and VBTYP_V = 'M'.
      ENDIF.
      SELECT SINGLE t001l~lgobe
        INTO t_header-lgobe
        FROM t001l
        WHERE t001l~lgort = t_header-lgort.
      SELECT SINGLE kna1~name1 kna1~adrnr kna1~kunnr kna1~ktokd
        INTO (t_header-name1, t_header-adrnr, t_header-kunnr, t_header-ktokd)
      FROM  kna1 "ON vbrk~kunrg = kna1~kunnr
      WHERE kna1~kunnr = t_header-kunrg
        AND spras = 'AR'.
      IF t_header-name1 IS INITIAL.
        SELECT SINGLE kna1~name1 kna1~adrnr kna1~kunnr kna1~ktokd
          INTO (t_header-name1, t_header-adrnr, t_header-kunnr, t_header-ktokd)
        FROM  kna1 "ON vbrk~kunrg = kna1~kunnr
        WHERE kna1~kunnr = t_header-kunrg
          AND spras = 'EN'.
      ENDIF.
      IF t_header-ktokd = 'ZONE'.
        SELECT SINGLE belnr
          INTO v_belnr
        FROM bkpf
        WHERE xblnr = p_vbeln.
        SELECT SINGLE name1
        INTO t_header-name1
        FROM bsec
        WHERE belnr = v_belnr.
      ENDIF.
      SELECT SINGLE adrc~street
        INTO t_header-street
        FROM adrc
        WHERE addrnumber = t_header-adrnr
        AND langu = 'AR'.
      IF t_header-street IS INITIAL.
        SELECT SINGLE adrc~street
          INTO t_header-street
          FROM adrc
          WHERE addrnumber = t_header-adrnr
          AND langu = 'EN'.
      ENDIF.
      "get details data
      SELECT vbrp~matnr vbrp~posnr vbrp~vgpos vbrp~fkimg
             vbrk~knumv vbrp~matnr vbrp~vgbel vbrp~vgtyp"makt~maktx
      INTO CORRESPONDING FIELDS OF TABLE t_items1
      FROM vbrp "JOIN makt ON vbrp~matnr = makt~matnr
                JOIN vbrk ON vbrp~vbeln = vbrk~vbeln
                "join konv on vbrk~knumv = konv~knumv
      WHERE vbrp~vbeln = p_vbeln
        AND vbrp~fkimg NE '0.000'.
      "AND makt~spras = 'E'.
      break arasmy.
      LOOP AT t_items1.
        SELECT SINGLE lips~lgpbe
          INTO t_items1-lgpbe
          FROM lips
          WHERE vbeln = t_items1-vgbel
          AND posnr = t_items1-vgpos.
        SELECT SINGLE makt~maktx
        INTO  t_items1-maktx
        FROM  makt
        WHERE matnr = t_items1-matnr
        AND   makt~spras = 'EN'.
        SELECT SINGLE konv~kbetr konv~kwert konv~waers konv~kkurs
          INTO (t_items1-unitprice, t_items1-total, t_items1-waers,
          t_items1-kkurs)
        FROM konv
        WHERE konv~kschl = 'NETW'"'ZSPC'                               "'ZSP1'
        AND   konv~knumv = t_items1-knumv
        AND   kposn      = t_items1-posnr.
        t_items1-unitprice = ( t_items1-total / t_items1-fkimg ) * t_items1-kkurs.
        MODIFY t_items1.
        mnumvflag = t_items1-knumv."Number of the document condition
      ENDLOOP.
    *get the deduction value for the document condiotion no
      SELECT konvkschl konvkwert
      INTO CORRESPONDING FIELDS OF TABLE t_spcialcnd
      FROM konv
      WHERE konv~kschl IN ('ZSSD', 'ZSCD', 'ZSDD', 'ZSPD', 'ZSWD', 'ZMW1', 'ZSGS', 'ZMW2')
      AND  konv~knumv = mnumvflag.
    Get tax 10%
        SELECT konvkschl konvkwert
        APPENDING CORRESPONDING FIELDS OF TABLE t_tax
        FROM konv
        WHERE konv~kschl = 'MWST'
        AND  konv~knumv = mnumvflag.
      itab-invn  = t_header-vbeln.
      itab-orgbil  = t_header-orgbil.
      itab-cusna = t_header-name1.
      itab-addr  = t_header-street.
      itab-custn = t_header-kunrg.
      itab-sord  = t_header-aubel.
      itab-fkart = t_header-fkart.
      itab-lgort = t_header-lgort.
      itab-lgobe = t_header-lgobe.
      itab-PSTYV = t_header-PSTYV.
      currency   = t_header-waerk.
      LOOP AT t_items1.
        w_items-matn   = t_items1-matnr.
        w_items-matdes = t_items1-maktx.
        w_items-stloc  = t_items1-lgpbe."lgort.
        w_items-qunt   = t_items1-fkimg.
        w_items-total  = t_items1-total.
        totalforitems  = totalforitems + w_items-total.
        COLLECT w_items INTO t_items.
      endloop.
      LOOP AT t_items1.
        LOOP AT t_items WHERE matn = t_items1-matnr.
          t_items-prc = t_items1-unitprice.
          MODIFY t_items.
        ENDLOOP.
      ENDLOOP.
      LOOP AT t_items.
          coun = coun + 1.
          t_items-itmn = coun.
          MODIFY t_items.
      ENDLOOP.
        w_footer-totalforitems = totalforitems.
        LOOP  AT t_spcialcnd.
          CASE t_spcialcnd-kschl.
            WHEN 'ZSSD'.
              w_footer-spdisc    = w_footer-spdisc      + t_spcialcnd-kwert.
            WHEN 'ZSCD'.
              w_footer-comdisc   = w_footer-comdisc     + t_spcialcnd-kwert.
            WHEN 'ZSDD'.
              w_footer-DIFMAT    = w_footer-DIFMAT      + t_spcialcnd-kwert.
            when 'ZSPD'.
              w_footer-trgtdisc  = w_footer-trgtdisc    + t_spcialcnd-kwert.
            WHEN 'ZMW2'.
              w_footer-comindisc = w_footer-comindisc   + t_spcialcnd-kwert.
            WHEN 'ZSWD'.
              w_footer-cshdisc   = w_footer-cshdisc     + t_spcialcnd-kwert.
            WHEN 'ZSGS'.
              w_footer-stampsdisc = w_footer-stampsdisc + t_spcialcnd-kwert.
          ENDCASE.
          w_footer-ttldisc = w_footer-spdisc + w_footer-comdisc + w_footer-trgtdisc
                           + w_footer-cshdisc + w_footer-DIFMAT + w_footer-stampsdisc.
        ENDLOOP.
        w_footer-aftrdiscnts = w_footer-totalforitems + w_footer-ttldisc.
        LOOP AT t_tax WHERE kwert NE '0.00'.
          w_footer-saltax = w_footer-saltax + t_tax-kwert.
        ENDLOOP.
        w_footer-totalaftrtax = w_footer-aftrdiscnts + w_footer-saltax.
        w_footer-total = w_footer-totalaftrtax + w_footer-comindisc.
        lasttotal = w_footer-total.
      APPEND w_footer TO it_footer.
      SELECT tcurt~ltext
      INTO CORRESPONDING FIELDS OF TABLE t_curtxt
      FROM   tcurt
      WHERE tcurt~spras = 'AR'
      AND   tcurt~waers = currency.
      LOOP AT  t_curtxt.
        currtxet = t_curtxt-ltext.
      ENDLOOP.
      itab[] = t_header[].
      lasttotalc = lasttotal.
      SPLIT lasttotalc AT '.' INTO firstpart secondpart.
      lasttotal = firstpart / 100.
      CALL FUNCTION 'SPELL_AMOUNT'
        EXPORTING
          amount    = lasttotal
          currency  = ''"CURRENCY
          filler    = space
          language  = 'A'
        IMPORTING
          in_words  = amountspell
        EXCEPTIONS
          not_found = 1
          too_large = 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.
    --split amount--
    BREAK radha.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname                 = 'Z_INVOICE_PARTS2'
    VARIANT                  = ' '
    DIRECT_CALL              = ' '
       IMPORTING
         fm_name                  = g_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.
      DATA : control_parameters    TYPE  ssfctrlop,
             print_options         TYPE  ssfcompop.
      DATA : document_output_info  TYPE  ssfcrespd,
             job_output_info       TYPE  ssfcrescl,
             job_output_options    TYPE  ssfcresop.
      DATA : count TYPE i.
      control_parameters-langu = 'AR'.
      control_parameters-no_dialog = 'X'."Don't show Dialog
    print_options-tdarmod = '1'.
    print_options-tdcopies = '001'.
    print_options-tddest = 'LP02'.
    print_options-tdprinter = 'ZARSWIN'.
       print_options-tdimmed = 'X'.
    print_options-tddelete = 'X'.
    print_options-tdlifetime = '8'.
       print_options-tddest = 'LP03'."nast-ldest.
      "print_options-tddest = nast-ldest.
      "print_options-tdcopies = pv_copies.
    print_options-tddelete = 'X'.
      print_options-tdfinal = 'X'.
    print_options-tdnewid = 'X'.
    WHILE count ne 1.
       IF job_output_info-outputdone ne 'X'.
         CALL FUNCTION g_fm_name
          EXPORTING
        ARCHIVE_INDEX             =
        ARCHIVE_INDEX_TAB         =
        ARCHIVE_PARAMETERS        =
           control_parameters       = control_parameters
        MAIL_APPL_OBJ             =
        MAIL_RECIPIENT            =
        MAIL_SENDER               =
            output_options          = print_options
            user_settings           = space
            header                  = itab
            amountspell             = amountspell
            currtxt                 = currtxet
            secondpart              = secondpart
         wa_footer                = w_footer
       IMPORTING
         DOCUMENT_OUTPUT_INFO       = document_output_info
         JOB_OUTPUT_INFO            = job_output_info
         JOB_OUTPUT_OPTIONS         = job_output_options
          TABLES
            it_items                = t_items
            it_footer               = it_footer
       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.
    ENDFORM.                    "ENTRY

    Hi,
    lw_control_param-device = 'PRINTER'.
    lw_control_param-getotf = c_x.
    lw_control_param-no_dialog = c_x.
    lw_composer_param-tdnoprev = c_x.
    <b>*lw_composer_param-tddest = 'LONSC0P310'.</b>
    <b>lw_composer_param-tddest = 'XXXX'.</b> <b>"Four digits</b>
    <i>lw_composer_param-tdnewid = c_x.
    lw_composer_param-tdfinal = c_x.</i> --> Not required
    In place of 'XXXX', replace it by a 4 digit value. It would be available in transaction SPAD->Output Devices->Double click your output device. On the right hand side there would be a field Short Name. Replace 'XXXX' with that value.
    Best regards,
    Prashant

  • Generate spool smartforms in background

    Dear friends,
    How to generate direct spool in background without showing any popups
    Regards,
    Praveen Lobo

    Hi
    DO like this as per sample code:
        CONCATENATE sy-cprog sy-datum sy-uzeit
                    INTO jobname SEPARATED BY '_'.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname          = jobname
          IMPORTING
            jobcount         = jobcount
          EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
          IMPORTING
            out_archive_parameters = arc_params
            out_parameters         = print_params
            valid                  = valid
          EXCEPTIONS
            archive_info_not_found = 1
            invalid_print_params   = 2
            invalid_archive_params = 3
            OTHERS                 = 4.
        IF valid = chk.
          SUBMIT Yreport
                          WITH s_kunnr IN s_kunnr                     
                          AND RETURN
                          USER               sy-uname
                          VIA JOB            jobname
                          NUMBER             jobcount
                          TO SAP-SPOOL
                          SPOOL PARAMETERS   print_params
                          ARCHIVE PARAMETERS arc_params
                          WITHOUT SPOOL DYNPRO.
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              jobcount             = jobcount
              jobname              = jobname
              strtimmed            = 'X'
            EXCEPTIONS
              cant_start_immediate = 1
              invalid_startdate    = 2
              jobname_missing      = 3
              job_close_failed     = 4
              job_nosteps          = 5
              job_notex            = 6
              lock_failed          = 7
              invalid_target       = 8
              OTHERS               = 9.
          IF sy-subrc <> 0.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ELSE.
            MESSAGE i029 WITH jobname.
          ENDIF.
        ELSE.
          MESSAGE s000 WITH text-003.
          STOP.
        ENDIF.
    Regards
    Anji

  • Smartform output in the background

    Hello all,
    Now I met a problem about smartform output in the background:
    The default printer is LP01. When I execute the program which calls this smartform in background, I change the printer to LP03.
    Then I use the t-code:SP02 and find the printer is LP01 not LP03.
    (But if I use the hardcode 'LP03', the printer is changed to LP03)
    What can i do change the printer to LP03?
    ---part of my code:
    DATA: ls_pri_params         TYPE pri_params,
          ls_control_parameters TYPE ssfctrlop,
          lv_print              TYPE sypdest,
          lv_valid              TYPE bool,
          ls_output             TYPE ssfcompop,
          lv_repid              TYPE syrepid.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          mode                   = 'BATCH'
          report                 = lv_repid
        IMPORTING
          out_parameters         = ls_pri_params
          valid                  = lv_valid.
      lv_print = ls_pri_params-pdest.
      ls_output-tddest = lv_print.
    ls_output-tddest = 'LP03'.
      CALL FUNCTION '/1BCDWB/SF00000004'
        EXPORTING
          output_options     = ls_output
          user_settings      = space.
    Thanks in advance!

    Hi Nina,
    You can use sy-batch. See the following codes:
    IF SY-BATCH = 'X'. "means program is executed in the background.
       ls_output-tddest = 'LP03'.
    ELSE.
       ls_output-tddest = lv_print.
    ENDIF.
    Regards,
    Hendy

  • Problem with gray background in SmartForms

    Hi all
    I have uploaded a logo via SE78. The logo have white background both in windows and in the print preview in SAP (SE78). When I insert the logo in my SmartForm the background gets gray, not white. I have tried just to upload a picture that is only white, but I get the same problem here. It is white in the print preview in SAP SE78, but in SmartForms it gets gray background. If I upload it as a black and white picture it gets white background, but I need it to be a colored logo.
    Any one got input on this issue?

    Hii Johan ,
    The problem is the sap conversion,
    it converts every image imported into the system to
    <b>256 colors</b>, converting white (RGB 255.255.255 to 252.240.240 )
    so using <b>Microsoft Photo Editor</b>,
    make the white font transparent and
    then save it as bmp (discharging the transparent converts it to true white)
    define  the graphic in color or black/white. You could define also the dpi .
    also check it by taking print in other printers ..it could as well be drivers problem .
    Reward points if helpful
    Revert back for more help
    Regards
    Naresh

  • SPOOL not generated while smartform is executed in Background

    Hi
    I have issue while creating spool for smartform in background.Its works fine in foreground and i m able to view the outpt.
    But in background it should generate a spool but it is not generating?
    I have given the ouput options to supress the dialog but it still it is not generating the spool.
         control-preview = 'X'.
          control-no_dialog = 'X'.
          control-device = 'PRINTER'.
          control-no_dialog = 'X'.
          control-GETOTF = 'X'.
          OUTPUT_OPTIONS-TDDEST = 'LP01'.
          OUTPUT_OPTIONS-TDNOPRINT = 'X'.
    Any suggestions??
    Thanks & Regards
    Jyo

    Hi Jyotheswar,
    When the smartform is generated in background create a new spool by using following code
          output_options-no_dialog = 'X'.
          output_options-tdarmod = 1.
          output_options-tdcopies = 001.
          output_options-tddest = 'LP01'.
          output_options-tdprinter = 'SWIN'.
          output_options-tdlifetime = 1.
          output_options-tdnewid = 'X'.
    tdnewid is the field used to create a new spool request.  You can get the new spool request number in job_output_info-spoolids.
    Regards,
    Birendra

  • Smartform output problem

    Hello all,
         Now I met a problem about smartform output:
         The default printer is LP01. When I execute the program which calls this smartform in background, I change the printer to LP03.
    Then I use the t-code:SP02 and find the printer is LP01 not LP03. What can i do change the printer to LP03?
    ---part of my code:
    DATA:
      ls_output TYPE ssfcompop.
      ls_output-tddest = 'LP03'.
    CALL FUNCTION '/1BCDWB/SF00000004'
    EXPORTING
       OUTPUT_OPTIONS             = ls_output
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
    Thanks in advance!

    Hai
    try with the following F.M
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING MODE                  = 'BATCH'
                  REPORT                = 'MYREPORT'
      IMPORTING OUT_PARAMETERS        = PARAMS
                  VALID                 = VALID.
    look into this link
    http://help.sap.com/saphelp_nw04/helpdata/en/d5/6243ea8a4111d4b605006094192fe3/content.htm
    You need to set the USER_SETTINGS perameter in your SmartForm to SPACE
    Regards
    Sreeni

  • Reg SMARTFORM emailing n fax options?

    hi friends
    i have to run my smartform in background mode and there is a requirement to fax and emailing
    the output. how to make my form run in background , email n fax ?
    thanks & regards
    thirupai
    Edited by: rafi md on Dec 20, 2008 1:32 PM

    HI
    you may use the FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF' to convert the fom
    into PDF.
    But first to get the printed form from the spool, use FUNCTION
    'RSPO_FIND_SPOOL_REQUESTS'.
    Then you may send it to your PC, email, fax, etc by reading the record in
    the lines of table IT_PDF_OUTPUT.
    Note: You may also use program RSTXPDFT4 as a reference to get code
    examples which uses different functions to perform the creation of PDFand
    download the form to the PC,etc.
    An example:
    CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
    EXPORTING
    RQOWNER = SY-UNAME
    TABLES
    SPOOLREQUESTS = SPOOL_REQUESTS.
    READ TABLE SPOOL_REQUESTS INDEX 1.
    GD_SPOOL_NR = SPOOL_REQUESTS-RQIDENT.
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    SRC_SPOOLID = GD_SPOOL_NR
    NO_DIALOG = C_NO
    IMPORTING
    PDF_BYTECOUNT = GD_BYTECOUNT
    PDF_SPOOLID = PDFSPOOLID
    BTC_JOBNAME = JOBNAME
    BTC_JOBCOUNT = JOBCOUNT
    TABLES
    PDF = IT_PDF_OUTPUT
    EXCEPTIONS
    ERR_NO_OTF_SPOOLJOB = 1
    ERR_NO_SPOOLJOB = 2
    ERR_NO_PERMISSION = 3
    ERR_CONV_NOT_POSSIBLE = 4
    ERR_BAD_DSTDEVICE = 5
    USER_CANCELLED = 6
    ERR_SPOOLERROR = 7
    ERR_TEMSEERROR = 8
    ERR_BTCJOB_OPEN_FAILED = 9
    ERR_BTCJOB_SUBMIT_FAILED = 10
    ERR_BTCJOB_CLOSE_FAILED = 11.
    CHECK SY-SUBRC = 0.
    Hope this will help send you in the right direction
    Regards
    Alok

  • Smartforms logos

    Hello all,
    I am trying to add 2 sets of logos to a smartform.
    It works fine but the background of the picture (the logo is a text) is not white. When I view the picture localy on my PC it is white, and print preview in SE78 it is also white. But when previewing the smartform the background colour is changed.
    Is there a special way smartform editor interprets the colours? Or any other suggestions of errors you might think of... don't be shy.

    Julius Bussche wrote:>
    > >
    Manas k Mishra wrote:
    > > Hello manav,
    > >
    > Tricky stuff this ponits-gaming, heh? ;-)
    Manav means human, Now he is no more a manav,  will be your Guest :-).
    Edited by: Vijay Babu Dudla on Jun 25, 2009 6:43 AM

  • HOW TO UPLOAD BACKGROUND IMAGES IN SMARTFORMS

    HI
    HOW TO UPLOAD BACKGROUND IMAGES IN SMARTFORMS

    Hi, 
       goto se78 -> in the menubar click graphic  and import to select ur images from ur system .. then click transport button .. it automatically gets into the smartform graphic image list.. then get into transaction smartform and use the image u imported into that..
    U can import anykind  of image which u have stored in ur pc through se78..
    Regards,
    Priya.

  • Black background in pdf smartform

    Hi Experts,
    My smartform has a black background. I mean to say that the text is all surrounded by a black back ground.. How do i change the color to white?
    Regards
    Abdullah

    hi can you please tell me how u have solved... so that it can help the members in the future

  • Background Text in Smartforms

    Hi,
    How to insert a text or a company name at the background in a smart forms and scripts.
    Thanks

    Hello Deepti,
    Use Microsoft Paint to draw your company name or logo then save it in .BMP format.
    GOTO tcode SE78. upload the logo with the details needed there.
    Now go to your smartform double click on the page where you want this as backgroud.
    Now click on TAB "Background Picture" there and add the photo.
    Hope your issue is solved.
    Cheers,
    Suvendu

Maybe you are looking for

  • ASA 5510 VPN profiles question

    Hi! I wonder if it is possible to let users connect to our firewall with anyconnect ( vpn.customer.se ) and get three profiles from the droplist to chose from. One for economy,development and public.   The three departments are located at different i

  • Why do I not get artwork for imported cds on a windows 7 pc?

    Can anyone tell me why since upgrading from windows XP to Windows 7 I do not seem to be able to retrieve any artwork automatically from itunes when importing CDs?

  • SPD Workflow - Update a hidden/read only field

    Hi there, I have a list with a hidden/read only field (ie Status).  So the user cannot update this field using the form or datasheet ...etc. I have an SPD workflow that I was hoping would modify the value of the Status field.  But it appears as thoug

  • When I use my home phone, my internet turns off.

    whenever anyone uses any hom ephones in my home, the internet shuts off. why is that? any help is greatly appreciated.

  • Photoshop Camera Raw 7

    I just purchased Photoshop CS6 and the entire Cloud Creative Service. The first thing I noticed is that I'm getting an error which states... "There was an error installing this update. Please try again later or contact customer support. (u44m1l216).