SMARTFORMS,REPORTS

Hi all i have a couple of questions:
1) what is the difference in using JOINS and FOR ALL ENTRIES.Where to use them specifically?
2)How and where can i specify the no of copies to be output (suppose invoices ) in my print program.Is it in the FM SSF_FUNCTION_MODULE _NAME.
3)Wat all condituions  r necessary for using For All Entries.I know two of them
  a)the internal table should not be empty.
  b)The matcinhg fields in the where clause should be of same type.

Hi Abhi,
If you want to fetch data by combining more than 2 tables we use  joins.
If you want to fetch data from a table based on a selection made we go for for all entries .
FOR ALL ENTRIES is an effective way of doing away with using JOIN on two tables.
You can check the below code -
SELECT BUKRS BELNR GJAHR AUGDT
FROM BSEG
INTO TABLE I_BSEG
WHERE BUKRS = ....
SELECT BUKRS BELNR BLART BLDAT
FROM BKPF
INTO TABLE I_BKPF
FOR ALL ENTRIES IN I_BSEG
WHERE BUKRS = I_BSEG-BUKRS
AND BELNR = I_BSEG-BELNR
AND BLDAT IN SO_BLDAT.
*******************************8
look another example
what is the use of FOR ALL ENTRIES
1. INNER JOIN
DBTAB1 <----
> DBTAB2
It is used to JOIN two DATABASE tables
having some COMMON fields.
2. Whereas
For All Entries,
DBTAB1 <----
> ITAB1
is not at all related to two DATABASE tables.
It is related to INTERNAL table.
3. If we want to fetch data
from some DBTABLE1
but we want to fetch
for only some records
which are contained in some internal table,
then we use for alll entries.
1. simple example of for all entries.
2. NOTE THAT
In for all entries,
it is NOT necessary to use TWO DBTABLES.
(as against JOIN)
3. use this program (just copy paste)
it will fetch data
from T001
FOR ONLY TWO COMPANIES (as mentioned in itab)
4
REPORT abc.
DATA : BEGIN OF itab OCCURS 0,
bukrs LIKE t001-bukrs,
END OF itab.
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
itab-bukrs = '1000'.
APPEND itab.
itab-bukrs = '1100'.
APPEND itab.
SELECT * FROM t001
INTO TABLE t001
FOR ALL ENTRIES IN itab
WHERE bukrs = itab-bukrs.
LOOP AT t001.
WRITE :/ t001-bukrs.
ENDLOOP.
*****************inner join**********
table emp
empno name
a sasi
b xxx
c yyy
table sal
empno salary
a 1000
b 2000
Inner join
select eempno ename
s~sal
into table int_table
from emp as e
inner join sal
on
eempno = sempno.
if you made inner join between table a and b by emp no
the selection retrives only if the condition satisfy the output will be
a sasi 1000
b xxx 2000
Outer join
select eempno ename
s~sal into table int_table
from emp as e
LEFT OUTER JOIN sal
on
eempno = sempno.
if you made outer join (left /right ) the left table kept as it is the
if the condition satisfy the right table entries will fetch else leave it blank
the output will be
a sasi a 1000
b xxx b 2000
c yyy
Hope this helps!

Similar Messages

  • Convert SMARTFORM report to PDF and send as an email attachment

    Hi
    I am using the CONVERT_OTF function module to convert a SMARTFORM report in the "spool" to a PDF file. When I use the DOWNLOAD function module, the resulting file can be opened in acrobat.
    I would like to email the report in PDF format as an attachment. I am using the function module SO_NEW_DOCUMENT_ATT_SEND_API1 to create an attachment however the attached file is not being created correctly and When try to open, it gives 'File is damaged and could not be repaired' error message. I believe that somehow I am not using the SO_NEW_DOCUMENT_ATT_SEND_API1 function module correctly.
    Please help me to correct this
    Thanks
    Rohitha
    see my code below,
    I_OTF[] = W_RETURN-OTFDATA[].
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
          MAX_LINEWIDTH         = 132
        IMPORTING
          BIN_FILESIZE          = V_LEN_IN
        TABLES
          OTF                   = I_OTF
          LINES                 = I_TLINE
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          OTHERS                = 4.
      IF SY-SUBRC <> 0.
      ENDIF.
      LOOP AT I_TLINE.
        TRANSLATE I_TLINE USING '~'.
        CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
      ENDLOOP.
      TRANSLATE WA_BUFFER USING '~'.
      DO.
        I_RECORD = WA_BUFFER.
        APPEND I_RECORD.
        SHIFT WA_BUFFER LEFT BY 132 PLACES.
        IF WA_BUFFER IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
      REFRESH:  I_RECLIST,
                I_OBJTXT,
                I_OBJBIN,
                I_OBJPACK.
      CLEAR WA_OBJHEAD.
      I_OBJBIN[] = I_RECORD[].
      I_OBJTXT = 'PDF Attachment'.
      APPEND I_OBJTXT.
      DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
      READ TABLE I_OBJTXT INDEX V_LINES_TXT.
      WA_DOC_CHNG-OBJ_NAME = 'Smartform_to_PDF'.
      WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
      WA_DOC_CHNG-OBJ_DESCR = 'Smartform to PDF'.
      WA_DOC_CHNG-SENSITIVTY = 'F'.
      WA_DOC_CHNG-DOC_SIZE = STRLEN( I_OBJTXT ) + ( ( V_LINES_TXT - 1 ) * 255 ) .
      CLEAR  I_OBJPACK-TRANSF_BIN.
      I_OBJPACK-HEAD_START = 1.
      I_OBJPACK-HEAD_NUM = 0.
      I_OBJPACK-BODY_START = 1.
      I_OBJPACK-BODY_NUM = V_LINES_TXT.
      I_OBJPACK-DOC_TYPE = 'RAW'.
      APPEND I_OBJPACK.
      I_OBJPACK-TRANSF_BIN = 'X'.
      I_OBJPACK-HEAD_START = 1.
      I_OBJPACK-HEAD_NUM = 1.
      I_OBJPACK-BODY_START = 1.
      DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
      READ TABLE I_OBJBIN INDEX V_LINES_BIN.
      I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
      I_OBJPACK-BODY_NUM = V_LINES_BIN.
      I_OBJPACK-DOC_TYPE = 'PDF'.
      I_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
      I_OBJPACK-OBJ_DESCR = 'test'.
      APPEND I_OBJPACK.
      CLEAR I_RECLIST.
      I_RECLIST-RECEIVER = 'my email address u2019.
      I_RECLIST-REC_TYPE = 'U'.
      APPEND I_RECLIST.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = WA_DOC_CHNG
          PUT_IN_OUTBOX              = 'X'
          COMMIT_WORK                = 'X'
        TABLES
          PACKING_LIST               = I_OBJPACK
          OBJECT_HEADER              = WA_OBJHEAD
          CONTENTS_BIN               = I_OBJBIN
          CONTENTS_TXT               = I_OBJTXT
          RECEIVERS                  = I_RECLIST
        EXCEPTIONS
          TOO_MANY_RECEIVERS         = 1
          DOCUMENT_NOT_SENT          = 2
          DOCUMENT_TYPE_NOT_EXIST    = 3
          OPERATION_NO_AUTHORIZATION = 4
          PARAMETER_ERROR            = 5
          X_ERROR                    = 6
          ENQUEUE_ERROR              = 7
          OTHERS                     = 8.
      IF SY-SUBRC <> 0.
        WRITE:/ 'Error ', SY-SUBRC.
      ELSE.
        WRITE:/ 'Mail sent'.
      ENDIF.

    Hi rohitha.wijewardena ,
    Please find the below code which i followed and succeed ,
    CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
        EXPORTING
          pi_nast       = nast
          pi_country    = lv_dlv-land
          pi_addr_key   = lv_addr_key
          pi_repid      = sy-repid
          pi_screen     = lc_x
        IMPORTING
          pe_returncode = gv_retcode
          pe_itcpo      = lv_itcpo
          pe_device     = lv_device
          pe_recipient  = lv_recipient
          pe_sender     = lv_sender.
      IF gv_retcode = 0.
    *moving the data to composer and control parameters for output
        MOVE-CORRESPONDING lv_itcpo TO lv_composer_param.
        lv_control_param-device      = lv_device.
        lv_control_param-no_dialog   = lc_x.
        lv_control_param-preview     = lc_x.
        lv_control_param-getotf      = lv_itcpo-tdgetotf.
        lv_control_param-langu       = nast-spras.
        lv_composer_param-tdnoprint = space.
      ENDIF.
    *Getting the Smartform Function module using Standard Function module
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname                 = lv_formname           "Smartform Name
       IMPORTING
         fm_name                  = lv_fm_name
       EXCEPTIONS
         no_form                  = 1
         no_function_module       = 2
         OTHERS                   = 3
      IF sy-subrc <> 0.
        gv_retcode = sy-subrc.
        PERFORM protocol_update.
        PERFORM add_smfrm_prot.
      ENDIF.
    **Smartform function module to get the output
      CALL FUNCTION lv_fm_name
        EXPORTING
       control_parameters         = lv_control_param
       mail_recipient             = lv_recipient
       mail_sender                = lv_sender
         output_options             = lv_composer_param
         user_settings              = ' '
          is_bil_invoice             = lv_bil_invoice
          gt_header                  = gt_header
       IMPORTING
         job_output_info            = gv_job_output
        TABLES
          gt_item                    = gt_item
       EXCEPTIONS
         formatting_error           = 1
         internal_error             = 2
         send_error                 = 3
         user_canceled              = 4
         OTHERS                     = 5
      IF sy-subrc <> 0.
        gv_retcode = sy-subrc.
        PERFORM protocol_update.
        PERFORM add_smfrm_prot.
      ENDIF.
      IF nast-nacha = lc_mail.
        gt_otfdata[] = gv_job_output-otfdata[].
    *           Converting Smartform to PDF                          *
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = lc_pdf
            max_linewidth         = 10
          IMPORTING
            bin_filesize          = gv_binfilesize
            bin_file              = gv_pdf_xstring
          TABLES
            otf                   = gt_otfdata[]
            lines                 = gt_pdftab[]
          EXCEPTIONS
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            err_bad_otf           = 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.
    *           Sending PDF to Email  using Class                     *
        IF NOT lv_email IS INITIAL .
          TRY.
             gv_send_request = cl_bcs=>create_persistent( ).
              gv_pdf_content = cl_document_bcs=>xstring_to_solix( gv_pdf_xstring ).
              gv_document = cl_document_bcs=>create_document(
                    i_type    = lc_pdf
                    i_hex     = gv_pdf_content
                    i_length  = gv_pdf_size
                    i_subject = lc_subject ).            "Subject for Email
              gv_send_request->set_document( gv_document ).
             gv_recipient = cl_cam_address_bcs=>create_internet_address( lv_email ).
              gv_send_request->add_recipient( gv_recipient ).
              gv_sent_to_all = gv_send_request->send( i_with_error_screen = lc_x ).
              COMMIT WORK.
              IF gv_sent_to_all IS INITIAL.
                MESSAGE i500(sbcoms) WITH lv_email.
              ELSE.
                MESSAGE s022(so).
              ENDIF.
            CATCH cx_bcs INTO gv_bcs_exception.
              MESSAGE i865(so) WITH gv_bcs_exception->error_type.
          ENDTRY.
        ENDIF.

  • Start Workflow for Smartform report

    Hi
    My ABAP program creates a Smartform report that I am able to send to the SAP Business Workplace inbox documents folder.  In development, I'm sending it to myself, but in production the report will be sent to a particular user.
    I need to send the report as a pdf attachment to a workflow item so that the workflow log can track the fact that the user accepts (or rejects) the report details (audit requirement).
    What workflow object type and event should be used in the workflow, and how do I start the workflow after the report has been generated?
    Thanks for your help.
    Ron Knoll

    Answered the question myself.

  • How to Provide Zoom-in/out Facility in SmartForms Report?

    hi all,
    can someone tell me how to provide Zoom-in/out facility in a smartforms report? We have a report with very small font and we hardly read contents in preview screen. can someone provide some help on this?
    thanks in advance,
    sid

    This will take in your spool request and download a PDF file to your PC where you can view it in Acrobat:
    REPORT zpdf MESSAGE-ID zc LINE-SIZE 255 NO STANDARD PAGE HEADING.
    PARAMETERS: spoolid LIKE tsp01-rqident OBLIGATORY.
    DATA BEGIN OF pdf_table OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA END   OF pdf_table.
    DATA pdf_fsize TYPE i.
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
         EXPORTING
              src_spoolid   = spoolid
              no_dialog     = 'X'
         IMPORTING
              pdf_bytecount = pdf_fsize
         TABLES
              pdf           = pdf_table
         EXCEPTIONS
              OTHERS        = 0.
    CALL FUNCTION 'DOWNLOAD'
         EXPORTING
              bin_filesize = pdf_fsize
              filetype     = 'BIN'
         TABLES
              data_tab     = pdf_table.
    Rob

  • Problem in Smartform report

    Hi All,
    we have developed a smartform report. This is a production report of various units/shops. In the report format, left most side are the fixed units/shops. There are some fixed heading parameters. For each unit/shop the values for each unit will appear.
    User wants the format to be in blocks..like there are units in the left side...A,B.C,D,E..
    Format will be..in the left side units A,B,C will be in a block...& D,E will be in a separate block. this two blocks will be separated by a line..values for units A,B,C,D etc will appear in rows.
    Can anybody pls help....

    The thread is closed

  • Smartform report generation error

    Hi,
    I have a problem with a report calling a smartform. The report works perfectly on the 1 system but on the other system there is a generation error. I found that the problem lies with the following declaration:
    data: otf_info type SSFCRESCL. 
    I compared the structures on the different systems and they are identical. The only difference is the Support Package levels. The error occurs on the system with the higher support package - SAPKB64015 (basis and aba) whereas the other system is still at level 12 (SAPKB64012).
    Any ideas what is causing the generation error and what could be done to fix it?
    Regards
    Liza-Marie

    Hi ,
    I think there may be some errors in function group errors.
    Try the following :
    T/Code : SMARTFORMSEnter the name of the form> Test--> This will leads to function module --> Utilities(Menubar)-=-> Repair function group --> Repair.
    After repairing the function group --> Save and Activate.
    Then transport the Smartform to other system .
    Regards,
    Lanka

  • Smartform Report Issue

    Hi friends,
    I'm new to smartforms. I have created a smartform for customer outstanding Report. but have some issues.
    That is,
    I want to categorize all rows in reports to,
    - Unsettled Invoices (Condition is -> BSID-BLART = 'RV' AND BSID-BLART = 'SA')
    - Unsettled Advances/Credit Notes (Condition is -> BSID-BLART = 'DZ' AND BSID-BLART = 'DG' AND BSID-UMSKZ = 'A')
    - Unsettled return Cheques (Condition is -> BSID-BLART = 'DZ' AND BSID-UMSKZ = 'D' AND BSID-XBLNR = 'R')
    for example the output is like this:
    Date invoice No Amount No of Days Balance Less30 Over30 Over60 Over90 Over120
    Unsettled Invoices
    15/03/2010 HHIN00023952 100000 100 750
    15/03/2010 HHIN00023952 100000 100 750
    15/03/2010 HHIN00023952 100000 100 750
    Unsettled Advances/Credit Notes
    15/03/2010 HHIN00023952 100000 100 750
    15/03/2010 HHIN00023952 100000 100 750
    Total 500000
    Unsettled Return Cheques
    15/03/2010 HHIN00023952 100000 100 750
    15/03/2010 HHIN00023952 100000 100 750
    Total 200000
    This is the download link to my smartform - https://rapidshare.com/files/785255519/zcusrep.xml
    please help me someone. Thanks

    Thanks for your reply, Can you clarify your solution more? cuz i don't have any idea of adding identifier to those conditions in internal table
    this is my se38 program for it,
    REPORT  ZCUSTREP2.
    TABLES : KNVP, KNVV.
    types : begin of ty_knvp,
            kunnr type knvp-kunnr,
            pernr type knvp-pernr,
            end of ty_knvp.
    data : wa_knvp type ty_knvp,
           it_knvp type table of ty_knvp.
    types : begin of ty_knvv,
            kunnr type knvv-kunnr,
            vkorg type knvv-vkorg,
            end of ty_knvv.
    data : wa_knvv type ty_knvv,
           it_knvv type table of ty_knvv.
    types : begin of ty_final,
            kunnr type knvp-kunnr,
            pernr type knvp-pernr,
            vkorg type KNVv-vkorg,
            end of ty_final.
    data : wa_final type ty_final,
           it_final type table of ty_final.
    Selections **********************
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_PERNR for knvp-PERNR matchcode OBJECT ZREP_CODE. "repcode
    SELECT-OPTIONS : S_VKORG  for KNVv-VKORG no intervals no-extension OBLIGATORY. "company code
    SELECTION-SCREEN END OF BLOCK B1.
    Selections **********************
    end-of-selection.
      select kunnr pernr
        into table it_knvp
        from knvp
        where PERNR in S_PERNR
        and pernr ne '00000000'.
      select kunnr vkorg
       into table it_knvv
       from knvv
       where vkorg in S_VKORG.
    loop at it_knvp into wa_knvp.
        read table it_knvv into wa_knvv with key kunnr = wa_knvp-kunnr.
        if sy-subrc = 0.
          wa_final-kunnr = wa_knvp-kunnr.
          wa_final-pernr = wa_knvp-pernr.
          wa_final-vkorg = wa_knvv-vkorg.
          append wa_final to it_final.
        endif.
      endloop.
      CALL FUNCTION '/1BCDWB/SF00000052'
    *EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
        TABLES
          ITAB                     = it_final
    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.

  • Report on Smartform..To make it efficient by removing SELECT ,ENDSELECT

    To make a smartform report efficient by removing all occurs & modify internal table statements.
    What i have been given to do is to select all data from respective tables put them into one internal table & then finally making tab2 or tab3 in the report to be the final table.I am not sure which among these two i can make final table.
    THE CODE is:
    REPORT  zgr_note.
    TABLES : mseg,  "Document Segment : Material
             prps,  "WBS element master data
             proj,  "Project Definition
             mkpf,  "Header : Material Document
             lfa1,  "Vendor Master
             makt,  "Material Description
             aufk,  "Order Master Data
             afvc.  "Operation within an order
    DATA : fname LIKE rs38l-name. "Name of Function Module
    DATA: lf_fm_name            TYPE rs38l_fnam.
    DATA: ls_control_param      TYPE ssfctrlop.
    DATA: ls_composer_param     TYPE ssfcompop.
    DATA: ls_recipient          TYPE swotobjid.
    DATA: ls_sender             TYPE swotobjid.
    DATA: lf_formname           TYPE tdsfname.
    DATA: ls_addr_key           LIKE addr_key.
    DATA: ls_dlv_land           LIKE vbrk-land1.
    DATA: ls_job_info           TYPE ssfcrescl.
    DATA: ls_otpt_opt           TYPE ssfcompop.
    DATA: retcode TYPE sy-subrc.
    DATA: cntr TYPE i VALUE 0.
    DATA: cntr1 TYPE i .
    DATA: number TYPE SSFCRESCL-SPOOLIDS. " OCCURS 0 WITH HEADER LINE.
    DATA: TSP01 type TABLE OF TSP01_SP0R.
    DATA : BEGIN OF itab OCCURS 0.
            INCLUDE STRUCTURE mseg.
    DATA : post1 LIKE proj-post1,           "Project Definition
           pspnr LIKE proj-pspnr,           "WBS element
           maktx LIKE makt-maktx,           "Material Description
           name1 LIKE lfa1-name1,           "Name of the supplier
           budat LIKE mkpf-budat,           "Posting date
           bldat LIKE mkpf-bldat,           "Document date
           cpudt LIKE mkpf-cpudt,           "Date on which account document was entered
           psphi LIKE prps-psphi,           "Current number of project
           post2 LIKE prps-post1,           "WBS Definition
           xblnr LIKE mkpf-xblnr,           "Reference number( in this case challan number)
           bktxt LIKE mkpf-bktxt,           "Header text
           ort01 LIKE lfa1-ort01,           "vendor city
           ktext LIKE aufk-ktext,           "network description
           ltxa1 LIKE afvc-ltxa1.           "operation short text
    DATA : END OF itab.
    DATA : BEGIN OF jtab OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA : END OF jtab.
    DATA : itab1 LIKE itab OCCURS 0
          WITH HEADER LINE.
    DATA :itab2 LIKE itab OCCURS 0
          WITH HEADER LINE.
    DATA: itab3 LIKE itab OCCURS 0 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text_001.
    SELECT-OPTIONS : gr_num FOR mseg-mblnr . "no INTERVALS.
    PARAMETERS : gr_note LIKE itemset-xopsel RADIOBUTTON GROUP rad1.
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS : mat_num FOR mseg-mblnr . "no INTERVALS.
    PARAMETERS : mat_slip LIKE itemset-xopsel RADIOBUTTON GROUP rad1.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN SKIP.
    CASE 'X'.
      WHEN gr_note.
        PERFORM gr_display.
      WHEN mat_slip.
        PERFORM mat_display.
    ENDCASE.
    FORM gr_display .
    *break developer1.
      SELECT mblnr mjahr matnr werks lgort lifnr menge meins
             erfmg bpmng ebeln ps_psp_pnr zeile lsmng erfme
      FROM mseg
      INTO CORRESPONDING FIELDS OF TABLE itab
       WHERE mblnr IN gr_num.
      LOOP AT itab.
        SELECT pspnr psphi post1 INTO CORRESPONDING FIELDS OF itab1
          FROM prps WHERE pspnr = itab-ps_psp_pnr.
          itab-psphi = itab1-psphi.
          itab-pspnr = itab1-pspnr.
          itab-post2 = itab1-post1.
          MODIFY itab TRANSPORTING psphi pspnr post2.
        ENDSELECT.
        SELECT post1 FROM proj INTO CORRESPONDING FIELDS OF itab2
        WHERE pspnr = itab-psphi.
          itab-post1 = itab2-post1.
          MODIFY itab TRANSPORTING post1.
        ENDSELECT.
        REFRESH itab2.
        SELECT maktx FROM makt INTO CORRESPONDING FIELDS OF itab2
          WHERE matnr = itab-matnr.
          itab-maktx = itab2-maktx.
          MODIFY itab TRANSPORTING maktx.
        ENDSELECT.
        REFRESH itab2.
        SELECT name1 ort01 FROM lfa1 INTO CORRESPONDING FIELDS OF itab2
          WHERE lifnr = itab-lifnr.
          itab-name1 = itab2-name1.
          itab-ort01 = itab2-ort01.
          MODIFY itab TRANSPORTING name1 ort01.
        ENDSELECT.
        REFRESH itab2.
        SELECT budat bldat cpudt xblnr bktxt FROM mkpf
          INTO CORRESPONDING FIELDS OF itab2
          WHERE mblnr = itab-mblnr.
          itab-budat = itab2-budat.
          itab-bldat = itab2-bldat.
          itab-cpudt = itab2-cpudt.
          itab-xblnr = itab2-xblnr.
          itab-bktxt = itab2-bktxt.
          MODIFY itab TRANSPORTING budat bldat cpudt xblnr bktxt.
        ENDSELECT.
      ENDLOOP.
      LOOP AT itab .
        ON CHANGE OF itab-mblnr.
          itab3-mblnr = itab-mblnr.
          itab3-post1 = itab-post1.
          itab3-post2 = itab-post2.
          itab3-name1 = itab-name1.
          itab3-ort01 = itab-ort01.
          itab3-bldat = itab-bldat.
          APPEND itab3.
          CLEAR itab3.
        ENDON.
      ENDLOOP.
      jtab-mblnr = itab-mblnr.
      jtab-xblnr = itab-xblnr.
      jtab-budat = itab-budat.
      jtab-bktxt = itab-bktxt.
      jtab-lsmng = itab-lsmng.
      jtab-erfmg = itab-erfmg.
      jtab-erfme = itab-erfme.
      jtab-matnr = itab-matnr.
      jtab-maktx = itab-maktx.
      jtab-zeile = itab-zeile.
      APPEND jtab.
      LOOP AT itab3.
        CLEAR: itab2,itab2[].
        LOOP AT itab WHERE mblnr = itab3-mblnr.
          MOVE-CORRESPONDING itab TO itab2.
          APPEND itab2.
          CLEAR itab2.
        ENDLOOP.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname                 = 'ZMM_GOODS_RECEIPT1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
         IMPORTING
           fm_name                  = fname
    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.
    *break developer1.
    PERFORM print_parameters.
        CALL FUNCTION fname
          EXPORTING
           control_parameters         = ls_control_param
           output_options             = ls_otpt_opt
           user_settings              = 'X'
           gr_mseg_hdr                = itab3
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
          TABLES
            gr_mseg                    = itab2
         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.
      ENDLOOP.
    ENDFORM.                    " GR_DISPLAY
    FORM mat_display .
      SELECT mblnr mjahr matnr werks lgort lifnr menge meins
             erfmg bpmng ebeln ps_psp_pnr zeile lsmng erfme
             mat_pspnr nplnr aufpl aplzl
      FROM mseg
      INTO CORRESPONDING FIELDS OF TABLE itab
       WHERE mblnr IN mat_num.
      LOOP AT itab.
        SELECT ltxa1 FROM afvc INTO CORRESPONDING FIELDS OF itab1
          WHERE aufpl = itab-aufpl AND aplzl = itab-aplzl.
          itab-ltxa1 = itab1-ltxa1.
          MODIFY itab TRANSPORTING ltxa1.
        ENDSELECT.
        REFRESH itab1.
        SELECT ktext FROM aufk INTO CORRESPONDING FIELDS OF itab1
          WHERE aufnr = itab-nplnr.
          itab-ktext = itab1-ktext.
          MODIFY itab TRANSPORTING ktext.
        ENDSELECT.
        REFRESH itab1.
        SELECT pspnr psphi post1 INTO CORRESPONDING FIELDS OF itab1
          FROM prps WHERE pspnr = itab-mat_pspnr.
          itab-psphi = itab1-psphi.
          itab-pspnr = itab1-pspnr.
          itab-post2 = itab1-post1.
          MODIFY itab TRANSPORTING psphi pspnr post2.
        ENDSELECT.
        SELECT post1 FROM proj INTO CORRESPONDING FIELDS OF itab2
        WHERE pspnr = itab-psphi.
          itab-post1 = itab2-post1.
          MODIFY itab TRANSPORTING post1.
        ENDSELECT.
        REFRESH itab2.
        SELECT maktx FROM makt INTO CORRESPONDING FIELDS OF itab2
          WHERE matnr = itab-matnr.
          itab-maktx = itab2-maktx.
          MODIFY itab TRANSPORTING maktx.
        ENDSELECT.
        REFRESH itab2.
        SELECT name1 ort01 FROM lfa1 INTO CORRESPONDING FIELDS OF itab2
          WHERE lifnr = itab-lifnr.
          itab-name1 = itab2-name1.
          itab-ort01 = itab2-ort01.
          MODIFY itab TRANSPORTING name1 ort01.
        ENDSELECT.
        REFRESH itab2.
        SELECT budat bldat cpudt xblnr bktxt FROM mkpf
          INTO CORRESPONDING FIELDS OF itab2
          WHERE mblnr = itab-mblnr.
          itab-budat = itab2-budat.
          itab-bldat = itab2-bldat.
          itab-cpudt = itab2-cpudt.
          itab-xblnr = itab2-xblnr.
          itab-bktxt = itab2-bktxt.
         break developer1.
          MODIFY itab TRANSPORTING budat bldat cpudt xblnr bktxt.
        ENDSELECT.
      ENDLOOP.
      LOOP AT itab.
        ON CHANGE OF itab-mblnr.
          itab3-mblnr = itab-mblnr.
          itab3-budat = itab-budat.
          itab3-bldat = itab-bldat.
          itab3-post1 = itab-post1.
          itab3-ktext = itab-ktext.
          APPEND itab3.
          CLEAR itab3.
        ENDON.
      ENDLOOP.
      LOOP AT itab3.
        CLEAR: itab2, itab2[].
        LOOP AT itab WHERE mblnr EQ itab3-mblnr.
          MOVE-CORRESPONDING itab TO itab2.
          APPEND itab2.
          CLEAR itab2.
        ENDLOOP.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname                 = 'ZMM_MAT_ISSUE_SLIP'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
         IMPORTING
           fm_name                  = fname
    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.
        ls_control_param-no_dialog = 'X'.
    *ls_control_param-preview = 'X'.
    *ls_control_param-getotf = 'X'.
       ls_otpt_opt-tdnoprev = 'X'.
        ls_otpt_opt-tdnewid = ''.
        ls_otpt_opt-tdimmed = 'X'.
        ls_otpt_opt-tddest  = 'LP01'.
        CALL FUNCTION fname
          EXPORTING
        ARCHIVE_INDEX              =
        ARCHIVE_INDEX_TAB          =
        ARCHIVE_PARAMETERS         =
           control_parameters         = ls_control_param
        MAIL_APPL_OBJ              =
        MAIL_RECIPIENT             =
        MAIL_SENDER                =
           output_options             = ls_otpt_opt
           user_settings              = 'X'
            mat_slip_hdr               = itab3
       IMPORTING
        DOCUMENT_OUTPUT_INFO       =
         JOB_OUTPUT_INFO            = ls_job_info
        JOB_OUTPUT_OPTIONS         =
          TABLES
            mat_slip                   = itab2
      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.
      ENDLOOP.
    ENDFORM.

    Hello Saswat,
    There are a couple of criteria to make a SmartForm report efficient, i.e. to achieve a better performance:
    - provide the best possible interface to the temporary FM (fname). When you do so, SmartForm itself has not to perform so much programming stuff by itself.
    - The Driver program (zgr_note) has to be designed and coded well. What mean the performance of the Driver has to be optimized. In your case there should be a couple of performance improvements:
    -- adjust your program declaration to the new ABAP syntax, i.e. don't use OCCURS clauses and do not use HEADER LINE. Instead, implement TYPES and use them. Here is an example:
    TYPES: BEGIN OF ty_itab.
                 INCLUDE STRUCTURE mseg.
    TYPES: post1 LIKE proj-post1, "Project Definition
                 pspnr LIKE proj-pspnr, "WBS element
                 maktx LIKE makt-maktx, "Material Description
                 name1 LIKE lfa1-name1, "Name of the supplier
                 budat LIKE mkpf-budat, "Posting date
                 bldat LIKE mkpf-bldat, "Document date
                 cpudt LIKE mkpf-cpudt, "Date on which account document was entered
                 psphi LIKE prps-psphi, "Current number of project
                 post2 LIKE prps-post1, "WBS Definition
                 xblnr LIKE mkpf-xblnr, "Reference number( in this case challan number)
                 bktxt LIKE mkpf-bktxt, "Header text
                 ort01 LIKE lfa1-ort01, "vendor city
                 ktext LIKE aufk-ktext, "network description
                 ltxa1 LIKE afvc-ltxa1, "operation short text
                 END OF ty_itab.
    * Declare your internal tables and the corresponding working structures
    DATA: itab1 type standard table of ty_itab,
               itab2 type standard table of ty_itab,
               itab3 type standard table of ty_itab,
               jtab  type standard table of ty_itab,
              wa_itab1 type ty_itab,
              wa_itab2 type ty_itab,
              wa_itab3 type ty_itab,
              wa_jtab   type ty_itab.
    -- Don't use
    LOOP at itab.
      SELECT ...... WHERE pspnr = itab-ps_psp_pnr.
      ENDSELECT.
      SELECT * ...
      ENDSELECT
      SELECT * .....
      ENDSELECT
    ENDLOOP.
    Instead try to populate itab, itab1, itab2 each in ONE select statement using FOR ALL ENTRIES clause. After that you have to perform the LOOP runs using LOOP at itab INTO wa_itab. The more redundant SELECTs, the slower the program! When you perform a LOOP run, let say over itab1 and you need a corresponding record from table itab2 the use READ <itab> with key.
    One additional, very important hint: Using internal tables w/o header line the CLEAR statement has another functionality than with HEADER LINE
    CLEAR with HEADER LINE clears the HEADER line only
    CLEAR w/o HEADER LINE clears the entire table. CLEAR does the same as REFRESH.
    Another performance improvement is (when itab contains a lot of records) using FIELD-SYMBOLS.
    A simple example is
    FIELD-SYMBOLS: <fs> type itab.
    LOOP at itab assigning <fs>.
      wa_itab3-post1 = <fs>-post1.
      wa_itab3-post2 = <fs>-post2.
      APPEND wa_itab3 to itab.
    ENDLOOP.
    In this case no data values have to be transfered to a working field. The values are taken directly from the current line of the internal table.
    -- For better readability disign some events like START-OF-SELECTION, END-OF-SELECTION, INITIALIZATION and others.
    Try to gather all in SmartForms needed fields and pop them into table itab3.
    I hope this helps improving zgr_note's efficiency.
    Good luck,
    Heinz

  • Report on smartform.Replace select endselect with something to efficient it

    To make a smartform report efficient by removing all occurs & modify internal table statements.
    What i have been given to do is to select all data from respective tables put them into one internal table & then finally making tab2 or tab3 in the report to be the final table.I am not sure which among these two i can make final table.
    THE CODE is:
    REPORT  zgr_note.
    TABLES : mseg,  "Document Segment : Material
             prps,  "WBS element master data
             proj,  "Project Definition
             mkpf,  "Header : Material Document
             lfa1,  "Vendor Master
             makt,  "Material Description
             aufk,  "Order Master Data
             afvc.  "Operation within an order
    DATA : fname LIKE rs38l-name. "Name of Function Module
    DATA: lf_fm_name            TYPE rs38l_fnam.
    DATA: ls_control_param      TYPE ssfctrlop.
    DATA: ls_composer_param     TYPE ssfcompop.
    DATA: ls_recipient          TYPE swotobjid.
    DATA: ls_sender             TYPE swotobjid.
    DATA: lf_formname           TYPE tdsfname.
    DATA: ls_addr_key           LIKE addr_key.
    DATA: ls_dlv_land           LIKE vbrk-land1.
    DATA: ls_job_info           TYPE ssfcrescl.
    DATA: ls_otpt_opt           TYPE ssfcompop.
    DATA: retcode TYPE sy-subrc.
    DATA: cntr TYPE i VALUE 0.
    DATA: cntr1 TYPE i .
    DATA: number TYPE SSFCRESCL-SPOOLIDS. " OCCURS 0 WITH HEADER LINE.
    DATA: TSP01 type TABLE OF TSP01_SP0R.
    DATA : BEGIN OF itab OCCURS 0.
            INCLUDE STRUCTURE mseg.
    DATA : post1 LIKE proj-post1,           "Project Definition
           pspnr LIKE proj-pspnr,           "WBS element
           maktx LIKE makt-maktx,           "Material Description
           name1 LIKE lfa1-name1,           "Name of the supplier
           budat LIKE mkpf-budat,           "Posting date
           bldat LIKE mkpf-bldat,           "Document date
           cpudt LIKE mkpf-cpudt,           "Date on which account document was entered
           psphi LIKE prps-psphi,           "Current number of project
           post2 LIKE prps-post1,           "WBS Definition
           xblnr LIKE mkpf-xblnr,           "Reference number( in this case challan number)
           bktxt LIKE mkpf-bktxt,           "Header text
           ort01 LIKE lfa1-ort01,           "vendor city
           ktext LIKE aufk-ktext,           "network description
           ltxa1 LIKE afvc-ltxa1.           "operation short text
    DATA : END OF itab.
    DATA : BEGIN OF jtab OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA : END OF jtab.
    DATA : itab1 LIKE itab OCCURS 0
          WITH HEADER LINE.
    DATA :itab2 LIKE itab OCCURS 0
          WITH HEADER LINE.
    DATA: itab3 LIKE itab OCCURS 0 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text_001.
    SELECT-OPTIONS : gr_num FOR mseg-mblnr . "no INTERVALS.
    PARAMETERS : gr_note LIKE itemset-xopsel RADIOBUTTON GROUP rad1.
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS : mat_num FOR mseg-mblnr . "no INTERVALS.
    PARAMETERS : mat_slip LIKE itemset-xopsel RADIOBUTTON GROUP rad1.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN SKIP.
    CASE 'X'.
      WHEN gr_note.
        PERFORM gr_display.
      WHEN mat_slip.
        PERFORM mat_display.
    ENDCASE.
    FORM gr_display .
    *break developer1.
      SELECT mblnr mjahr matnr werks lgort lifnr menge meins
             erfmg bpmng ebeln ps_psp_pnr zeile lsmng erfme
      FROM mseg
      INTO CORRESPONDING FIELDS OF TABLE itab
       WHERE mblnr IN gr_num.
      LOOP AT itab.
        SELECT pspnr psphi post1 INTO CORRESPONDING FIELDS OF itab1
          FROM prps WHERE pspnr = itab-ps_psp_pnr.
          itab-psphi = itab1-psphi.
          itab-pspnr = itab1-pspnr.
          itab-post2 = itab1-post1.
          MODIFY itab TRANSPORTING psphi pspnr post2.
        ENDSELECT.
        SELECT post1 FROM proj INTO CORRESPONDING FIELDS OF itab2
        WHERE pspnr = itab-psphi.
          itab-post1 = itab2-post1.
          MODIFY itab TRANSPORTING post1.
        ENDSELECT.
        REFRESH itab2.
        SELECT maktx FROM makt INTO CORRESPONDING FIELDS OF itab2
          WHERE matnr = itab-matnr.
          itab-maktx = itab2-maktx.
          MODIFY itab TRANSPORTING maktx.
        ENDSELECT.
        REFRESH itab2.
        SELECT name1 ort01 FROM lfa1 INTO CORRESPONDING FIELDS OF itab2
          WHERE lifnr = itab-lifnr.
          itab-name1 = itab2-name1.
          itab-ort01 = itab2-ort01.
          MODIFY itab TRANSPORTING name1 ort01.
        ENDSELECT.
        REFRESH itab2.
        SELECT budat bldat cpudt xblnr bktxt FROM mkpf
          INTO CORRESPONDING FIELDS OF itab2
          WHERE mblnr = itab-mblnr.
          itab-budat = itab2-budat.
          itab-bldat = itab2-bldat.
          itab-cpudt = itab2-cpudt.
          itab-xblnr = itab2-xblnr.
          itab-bktxt = itab2-bktxt.
          MODIFY itab TRANSPORTING budat bldat cpudt xblnr bktxt.
        ENDSELECT.
      ENDLOOP.
      LOOP AT itab .
        ON CHANGE OF itab-mblnr.
          itab3-mblnr = itab-mblnr.
          itab3-post1 = itab-post1.
          itab3-post2 = itab-post2.
          itab3-name1 = itab-name1.
          itab3-ort01 = itab-ort01.
          itab3-bldat = itab-bldat.
          APPEND itab3.
          CLEAR itab3.
        ENDON.
      ENDLOOP.
      jtab-mblnr = itab-mblnr.
      jtab-xblnr = itab-xblnr.
      jtab-budat = itab-budat.
      jtab-bktxt = itab-bktxt.
      jtab-lsmng = itab-lsmng.
      jtab-erfmg = itab-erfmg.
      jtab-erfme = itab-erfme.
      jtab-matnr = itab-matnr.
      jtab-maktx = itab-maktx.
      jtab-zeile = itab-zeile.
      APPEND jtab.
      LOOP AT itab3.
        CLEAR: itab2,itab2[].
        LOOP AT itab WHERE mblnr = itab3-mblnr.
          MOVE-CORRESPONDING itab TO itab2.
          APPEND itab2.
          CLEAR itab2.
        ENDLOOP.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname                 = 'ZMM_GOODS_RECEIPT1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
         IMPORTING
           fm_name                  = fname
    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.
    *break developer1.
    PERFORM print_parameters.
        CALL FUNCTION fname
          EXPORTING
           control_parameters         = ls_control_param
           output_options             = ls_otpt_opt
           user_settings              = 'X'
           gr_mseg_hdr                = itab3
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
          TABLES
            gr_mseg                    = itab2
         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.
      ENDLOOP.
    ENDFORM.                    " GR_DISPLAY
    FORM mat_display .
      SELECT mblnr mjahr matnr werks lgort lifnr menge meins
             erfmg bpmng ebeln ps_psp_pnr zeile lsmng erfme
             mat_pspnr nplnr aufpl aplzl
      FROM mseg
      INTO CORRESPONDING FIELDS OF TABLE itab
       WHERE mblnr IN mat_num.
      LOOP AT itab.
        SELECT ltxa1 FROM afvc INTO CORRESPONDING FIELDS OF itab1
          WHERE aufpl = itab-aufpl AND aplzl = itab-aplzl.
          itab-ltxa1 = itab1-ltxa1.
          MODIFY itab TRANSPORTING ltxa1.
        ENDSELECT.
        REFRESH itab1.
        SELECT ktext FROM aufk INTO CORRESPONDING FIELDS OF itab1
          WHERE aufnr = itab-nplnr.
          itab-ktext = itab1-ktext.
          MODIFY itab TRANSPORTING ktext.
        ENDSELECT.
        REFRESH itab1.
        SELECT pspnr psphi post1 INTO CORRESPONDING FIELDS OF itab1
          FROM prps WHERE pspnr = itab-mat_pspnr.
          itab-psphi = itab1-psphi.
          itab-pspnr = itab1-pspnr.
          itab-post2 = itab1-post1.
          MODIFY itab TRANSPORTING psphi pspnr post2.
        ENDSELECT.
        SELECT post1 FROM proj INTO CORRESPONDING FIELDS OF itab2
        WHERE pspnr = itab-psphi.
          itab-post1 = itab2-post1.
          MODIFY itab TRANSPORTING post1.
        ENDSELECT.
        REFRESH itab2.
        SELECT maktx FROM makt INTO CORRESPONDING FIELDS OF itab2
          WHERE matnr = itab-matnr.
          itab-maktx = itab2-maktx.
          MODIFY itab TRANSPORTING maktx.
        ENDSELECT.
        REFRESH itab2.
        SELECT name1 ort01 FROM lfa1 INTO CORRESPONDING FIELDS OF itab2
          WHERE lifnr = itab-lifnr.
          itab-name1 = itab2-name1.
          itab-ort01 = itab2-ort01.
          MODIFY itab TRANSPORTING name1 ort01.
        ENDSELECT.
        REFRESH itab2.
        SELECT budat bldat cpudt xblnr bktxt FROM mkpf
          INTO CORRESPONDING FIELDS OF itab2
          WHERE mblnr = itab-mblnr.
          itab-budat = itab2-budat.
          itab-bldat = itab2-bldat.
          itab-cpudt = itab2-cpudt.
          itab-xblnr = itab2-xblnr.
          itab-bktxt = itab2-bktxt.
         break developer1.
          MODIFY itab TRANSPORTING budat bldat cpudt xblnr bktxt.
        ENDSELECT.
      ENDLOOP.
      LOOP AT itab.
        ON CHANGE OF itab-mblnr.
          itab3-mblnr = itab-mblnr.
          itab3-budat = itab-budat.
          itab3-bldat = itab-bldat.
          itab3-post1 = itab-post1.
          itab3-ktext = itab-ktext.
          APPEND itab3.
          CLEAR itab3.
        ENDON.
      ENDLOOP.
      LOOP AT itab3.
        CLEAR: itab2, itab2[].
        LOOP AT itab WHERE mblnr EQ itab3-mblnr.
          MOVE-CORRESPONDING itab TO itab2.
          APPEND itab2.
          CLEAR itab2.
        ENDLOOP.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname                 = 'ZMM_MAT_ISSUE_SLIP'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
         IMPORTING
           fm_name                  = fname
    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.
        ls_control_param-no_dialog = 'X'.
    *ls_control_param-preview = 'X'.
    *ls_control_param-getotf = 'X'.
       ls_otpt_opt-tdnoprev = 'X'.
        ls_otpt_opt-tdnewid = ''.
        ls_otpt_opt-tdimmed = 'X'.
        ls_otpt_opt-tddest  = 'LP01'.
        CALL FUNCTION fname
          EXPORTING
        ARCHIVE_INDEX              =
        ARCHIVE_INDEX_TAB          =
        ARCHIVE_PARAMETERS         =
           control_parameters         = ls_control_param
        MAIL_APPL_OBJ              =
        MAIL_RECIPIENT             =
        MAIL_SENDER                =
           output_options             = ls_otpt_opt
           user_settings              = 'X'
            mat_slip_hdr               = itab3
       IMPORTING
        DOCUMENT_OUTPUT_INFO       =
         JOB_OUTPUT_INFO            = ls_job_info
        JOB_OUTPUT_OPTIONS         =
          TABLES
            mat_slip                   = itab2
      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.
      ENDLOOP.
    ENDFORM.

    Hi saswat mohanty ,
    Welcome to SDN.  Ya your program takes lot of time to give the output becauase of more select endselects in  a loop.
    You are hitting as  many times as the records in the ITAB.
    Instead use "for all entries"   clause for fetching the complete data from a table atonce.
    Example: your itab is there.
    Select *  from  xyz
       into table itab2
       for all entries in itab
    where  field1 eq itab-field1
        and field2 eq itab-field2.
    After fetching the data you can populate the final table by looping through ITAB  and itab2.
    This is best procedure to reduce the load on database.
    Implement this in your program to improve performance.
    REWARD POINTS IF USEFUL.
    Venkat.

  • Purchase order in SmartForms

    hi,
    I am getting an error in ABAP program for smartform of Purchase order
    In Purchase order screen (ME21N) for any field I Pressed F1 and from technical details I got the TABLE name and field name, but when I put in Smartform report it gives me the below error.....
    "MEPO1211 is not define in ABAP Dictionary as a table, projection view or database view".
    in SE16
    "MEPO1211 is a strucute, not a table".
    I wanna to know how to use structure in report instead of table.
    like we use MARA table as
    TABLES : MARA,
    I need to print some data from the MEPO1211,
    plz help me
    Thanx in advance

    Hi,
    Goto form interface double  click on it and you will
    find
    ZXEKKO     TYPE     EKKO
    in tables tab strip you will get these itabs
    L_XEKPO     LIKE     EKPO
    L_XEKPA     LIKE     EKPA
    L_XPEKPO     LIKE     PEKPO
    L_XEKET     LIKE     EKET
    L_XTKOMV     LIKE     KOMV
    L_XEKKN     LIKE     EKKN
    L_XEKEK     LIKE     EKEK
    L_XKOMK     LIKE     KOMK
    use these and dont use the fields which are used in ME21N or 22N  or 23N. this is being handled   by print program you are calling
    Regards
    Shiva

  • How to adjust lines in smartform

    i am working on a smartform report, my requirement is i have to get data as below
    Name : _____________   Designation : __________
    I am getting the output correctly . However when i dont have data in Designation or i dont have
    the full data  in the designation Field i.e the designation size 40 character and i have the designation
    for ex: Manager--- it is only 7 character there by iam getting  in the ouput for Designation with Manager
    but the line not getting fully  i.e till the end of the right side of the page , iam not able to adjust when less data is there)  . Please help on this .
    regards
    madhuri

    Hi,
    we have the option of the adjusting the space between lines in the style.
    Select the style that is applied to Form. Once u double click the paragraph that is assigned. You will be able to tab for Spacing ..
    Change  the Line Spacing ..
    Please close the thread, if solved
    Regards,
    Aditya

  • Display my report instead of standard report

    Hi,
    How can I display my smartform report for PO in PO transaction. Currently it shows standard report.
    Also, please tell me how to develop PDF report for PO and display that in PO transaction.
    Plz help.
    Regards,
    Sriram

    this is done thru Customizing, Materials Management, Purchasing, Messages, Assign Form and Output Program for Purchase Order ([OMFE|https://forums.sdn.sap.com/search.jspa?threadID=&q=OMFEpurchaseordersmartforms+pdf&objID=&dateRange=all&numResults=15&rankBy=10001])
    You should also look for [SAP Best Practices|http://help.sap.com/bestpractices]. (/SMB40/MMPO_A and /SMB40/MMPO_L)
    Regards
    Raymond

  • SmartForms Dynamic Columns

    Hi, Can I in a SmartForms Report add dynamic columns?. It is this possible???
    Similarly as they grow in row I can grow in columns my report.
    Thank u.

    If you are trying to vary the number of columns, this may not be possible. You may have fixed number of columns and change the contents (and heading) of the same in a pre-determined manner.

  • Comma is showing in place of  decimal point  ( smartform)

    Dear All
    When i try to display quantity or amount field with decimals in smartform report,  system is displaying comma instead of decimal point. for e.g 1200.50 is displayed as 1200,50.
    Please advice.
    Ravindra Suvarna

    posting part of the code for your verification. Pls let me know is you need any further information.
    Form Interface
    IS_BIL_INVOICE     TYPE     LBBIL_INVOICE
    IS_NAST          TYPE     NAST
    IS_REPEAT     TYPE     NA_REPET
    Global Definitions
    WA_EXCISE     TYPE     LBBIL_HD_KOND-KWERT
    WA_CESS          TYPE     LBBIL_HD_KOND-KWERT
    WA_CST          TYPE     LBBIL_HD_KOND-KWERT
    WA_TCS          TYPE     LBBIL_HD_KOND-KWERT
    WA_FREIGHT     TYPE     LBBIL_HD_KOND-KWERT
    WA_INVVAL     TYPE     LBBIL_HD_KOND-KWERT
    WA_ITMVAL     TYPE     LBBIL_HD_KOND-KWERT
    WA_RATE          TYPE     LBBIL_HD_KOND-KWERT
    WA_EX_WORDS     TYPE     CHAR_200
    WA_IN_WORDS     TYPE     CHAR_200
    WA_NUM_CHR     TYPE     CHAR_18
    WA_VTTK          TYPE     S_VTTK
    TOT_NETWT     TYPE     PNUM
    TOT_GRSWT     TYPE     PNUM
    T_NETWT          TYPE     PNUM
    initialization
      PERFORM CHECK_INVOICE USING  IS_BIL_INVOICE
                            CHANGING WA_EXCISE
                                     WA_CESS
                                     WA_CST
                                     WA_TCS
                                     WA_FREIGHT
                                     WA_INVVAL
                                     WA_ITMVAL.
    Form Routines
    FORM check_invoice USING is_bil_invoice TYPE lbbil_invoice
                       CHANGING wa_excise   TYPE lbbil_hd_kond-kwert
                               wa_cess     TYPE lbbil_hd_kond-kwert
                               wa_cst      TYPE lbbil_hd_kond-kwert
                               wa_tcs      TYPE lbbil_hd_kond-kwert
                               wa_freight  TYPE lbbil_hd_kond-kwert
                               wa_invval   TYPE lbbil_hd_kond-kwert
                               wa_itmval   TYPE lbbil_hd_kond-kwert.
      DATA : wa_kond TYPE lbbil_hd_kond.
      DATA : wa_ikond TYPE  lbbil_it_kond.
      CLEAR wa_excise.
      CLEAR wa_cess.
      CLEAR wa_cst.
      CLEAR wa_tcs.
      CLEAR wa_freight.
      CLEAR wa_invval.
      CLEAR wa_itmval.
      LOOP AT  is_bil_invoice-hd_kond INTO wa_kond. "header sub total
        CASE wa_kond-kschl.
          WHEN 'JEXP'.
            wa_excise = wa_excise + wa_kond-kwert.
            wa_invval = wa_invval + wa_kond-kwert.
          WHEN 'JECP'.
            wa_cess   = wa_cess   + wa_kond-kwert.
            wa_invval = wa_invval + wa_kond-kwert.
          WHEN 'JLST' OR 'JCST' OR 'JIVC' OR 'JIVP'.
            wa_cst    = wa_cst + wa_kond-kwert.
            wa_invval = wa_invval + wa_kond-kwert.
          WHEN 'ZTCS' OR 'ZTCX' OR 'ZENT' .
            wa_tcs    = wa_tcs + wa_kond-kwert.
            wa_invval = wa_invval + wa_kond-kwert.
          WHEN 'ZFRC'.
            wa_freight = wa_freight + wa_kond-kwert.
            wa_invval = wa_invval + wa_kond-kwert.
        ENDCASE.
      ENDLOOP.
      LOOP AT is_bil_invoice-it_kond INTO wa_ikond. "item value
        wa_itmval = wa_itmval + wa_ikond-kwert.
      ENDLOOP.
      wa_invval = wa_invval + wa_itmval.
      IF wa_invval NE  is_bil_invoice-hd_gen-bil_netwr.
        MESSAGE e002(sy) WITH 'Invoice total Error. Pls Check the Pricing Conditions'.
      ENDIF.
    ENDFORM.                    "check_invoice
    Display
    &WA_ITMVAL(11.2)&
    &WA_EXCISE(11.2)&
    &WA_CESS(11.2)&
    &WA_CST(11.2)&

  • Pdf document into smartform

    Dear Freinds,
    I need to get a pdf from DMS and print that to a smartform report, can any one suggest what to do ...
    currently i am able to print the bitmap file . but i need to workout  with pdf file ..
    Thanks in advance
    Deepak

    Florian Kemmer ,
    We have some graphix as pdf format into our DMS. to achive this we have already done the following steps
    1. With the help of 'BAPI_DOCUMENT_CHECKOUTVIEWX'  , we have downloaded the file into my local machine .
    2.if files are in bitmap format then we are using
                          PERFORM import_bitmap_bds
                          IN PROGRAM saplstxbitmaps
           to upload that file into the smartrom .
    3. but in case if the file is in pdf format (as most of the graphix is in PDF bcoz of size constraint)
       i am unable to upload that to smartform.
    hope now u will understanding my problem..
    Deepak

Maybe you are looking for

  • Database got halted while inserting rows

    I have a 9i database running on solaris not restarted for 15 days.It just got halted or hanged while inserting rows in a table.When restarted everything is just fine and those rows have been inserted in no time!!What might be the reason?Dont tell me

  • Processing options for EDI vendor Invoices

    I'm trying to get a better understanding of what my options are for processing EDI vendor invoices and would appreciate some help.  I'm using  message type INVOIC02 with process code INVL and in configuration I've set the processing option in table T

  • HT201303 Why is the only computer I have used now not being recognized by the App Store

    I recently downloaded an App from the App Store, and then received an email stating the computer used "had not previously been associated with that Apple ID.".  This is the only computer associated with my apple ID what is going on?

  • Illustrator CS4 to PDF, text characters lost?!

    This sounds weird to me even as i type it. but i have converted a cs4 illustrator doc to a pdf and it is missing a character in one of the words. Lost during conversion?? is this some sort of fluke?? Heather

  • My itunes is not connecting to the itunes store.

    my itunes suddenly is not connecting to the itunes stores. the meaasge is '' networkconnections was reset. nobody did any resetting. why is this so