C:import, c:param

Hi All,
I'm trying the following:
<c:import url="header.jsp">
<c:param name="test" value="hello" />
</c:import>
and trying to output the param value in header.jsp but it displays nothing.
Help is greatly appreciated.
Thanks,
Greeshma.

Thanks for your replies. I have the taglib at the top
of my JSP.
I'am attaching the 2 jsp's that I'm using.
JSP that includes header.jsp:
<%@ taglib uri="http://java.sun.com/jstl/core"
prefix="c"%>
<html>
<body topmargin="0" leftmargin="0">
<div id="container">
<div id="header">
<c:import url="header.jsp">
     <c:param name="test" value="test" />
</c:import>
</div>
</div>
ody>
</html>
and header.jsp
<%@ taglib uri="http://java.sun.com/jstl/core"
prefix="c"%>
<html>
     <body>
          <c:out value="${test}"/>
          <c:set var="hi" value="hi" />
          <c:out value="${hi}" />
     </body>
</html>
Only hi is displayed in the JSP.
Help is greatly appreciated.
Thanks,
Greeshma.um, what do you expect that code to do?? looks like it's working fine to me. it's done exactly what you asked

Similar Messages

  • Import-PfxCertificate question

    Powershell newb here.  Trying to use Import-PfxCertificate in my powershell script to import SSL cert and then bind in IIS on Windows server 2008R2 OS's.
    Here is the code:
    param(
    [string]$certFilePath = $(throw "-certFilePath is required."),
    [string]$certPassword = $(throw "-certPassword is required.")
    #ConvertTo-SecureString http://technet.microsoft.com/en-us/library/hh849818.aspx
    $securePassword = ConvertTo-SecureString -String $certPassword -Force –AsPlainText
    Import-PfxCertificate -FilePath $certFilePath -CertStoreLocation cert:\LocalMachine\My -Exportable -Password $securePassword
    write-host "Import Complete";
    Import-PfxCertificate blows up with this error:
    "The term 'Import-PfxCertificate' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
    I am guessing that my OS is to old to support this ps function.  Is that correct?  If so, where can I grab the powershell code on Windows 2012 for porting to Window 2008?
    scott_m

    Hi Scott_m,
    Based on my research, the cmdlet Import-PfxCertificate is applied to server 2012 and newer, if you want to importing Certificate into a trusted root store on server 2008 R2, please refer to the script below:
    function Import-PfxCertificate {
    param([String]$certPath,[String]$certRootStore = “localmachine”,[String]$certStore = “My”,$pfxPass = $null)
    $pfx = new-object System.Security.Cryptography.X509Certificates.X509Certificate2
    if ($pfxPass -eq $null) {$pfxPass = read-host "Password" -assecurestring}
    $pfx.import($certPath,$pfxPass,"Exportable,PersistKeySet")
    $store = new-object System.Security.Cryptography.X509Certificates.X509Store($certStore,$certRootStore)
    $store.open("MaxAllowed")
    $store.add($pfx)
    $store.close()
    Import-PfxCertificate "C:\filepath" "LocalMachine" "My"
    Reference from:
    How to import a certificate to IIS 7
    or 8 with powershell
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support

  • Index in .chm file is incorrect

    Hi,
    I'm using RoboHelp X5 with Windows XP SP3. I have an index that is correct in RoboHelp but not in the .chm file. In RoboHelp, I have General Ledger as a keyword and several sub-keywords. However, in the .chm file, the sub-keywords show up under General Ledger Journal instead of General Ledger. I've attached screen shots of both at the bottom of this post, and I've pasted the applicable section of the project's .hhk file. (The .hhk file is really long, so I didn't want to insert the whole thing.)
    While troubleshooting this issue, my coworker changed the keyword from General Ledger to General edger, and that fixed the problem, but obviously we can't keep it that way.
    I tried the following:
    Compared that section of the HHK file to others. I may have missed something, but it looked OK to me.
    Started the project, deleted the HHK file, and then saved a change to the index so RH regenerated the HHK file.
    Deleted the .cpd file.
    Deleted and reentered all of the keywords.
    When the issue first started, the General Ledger subkeywords appeared under Future Periods instead of General Ledger Journal - I'm not sure what I did to change that, but I think it was when I deleted and then reentered the Future Periods keyword.
    Unfortunately, none of these worked.I saw another thread with a similar issue where the solution was to create a second index and copy the keywords to it, but I don't think X5 allows a second index.
    Any suggestions will be greatly appreciated.
      <li><object type="text/sitemap">
        <param name="Name" value="General Ledger Journal">
        <param name="Name" value="General Ledger Journal">
        <param name="Local" value="GLOverviews\GLJournal_Overview.htm">
      </object>
      <ul>
        <li><object type="text/sitemap">
          <param name="Name" value="overview">
          <param name="Name" value="General Ledger Journal">
          <param name="Local" value="GLOverviews\GLJournal_Overview.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="fields">
          <param name="Name" value="General Ledger Journal - Fields">
          <param name="Local" value="GLFields\GLJournal_Fields.htm">
        </object>
        </ul>
      <li><object type="text/sitemap">
        <param name="Name" value="General Ledger">
      </object>
      <ul>
        <li><object type="text/sitemap">
          <param name="Name" value="account record layout">
          <param name="Name" value="Account Segments Record Layout">
          <param name="Local" value="GLConcepts\Account_Segments_Record_Layout.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="adding account groups">
          <param name="Name" value="Add or Change General Ledger Account Groups">
          <param name="Local" value="GLProcedures\Add_a_General_Ledger_Account_Group.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="adding accounts">
          <param name="Name" value="Add or Change General Ledger Accounts">
          <param name="Local" value="GLProcedures\Add_or_Change_a_General_Ledger_Account.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="daily activities flowchart">
          <param name="Name" value="General Ledger Daily Activities Flowchart">
          <param name="Local" value="GLFlowcharts\GL_Daily_Activities_Flowchart.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="data, limiting export of">
          <param name="Name" value="Limit Export of General Ledger Data by Account Number">
          <param name="Local" value="GLProcedures\Limit_Export_of_General_Ledger_Data_by_Account_Number.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="deleting accounts">
          <param name="Name" value="Delete General Ledger Accounts">
          <param name="Local" value="GLProcedures\Delete_General_Ledger_Accounts.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="exporting information">
          <param name="Name" value="Export General Ledger Information">
          <param name="Local" value="GLProcedures\Export_General_Ledger_Information.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="features">
          <param name="Name" value="General Ledger Overview">
          <param name="Local" value="GLConcepts\accounts_receivable_overview.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="flowcharts">
          <param name="Name" value="General Ledger Maintenance Flowchart">
          <param name="Local" value="GLFlowcharts\General_Ledger_Maintenance_Flowchart.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="history, purging">
          <param name="Name" value="Purge General Ledger History">
          <param name="Local" value="GLProcedures\Purge_General_Ledger_History.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="import utilities">
          <param name="Name" value="General Ledger Import Utilities">
          <param name="Local" value="GLConcepts\General_Ledger_Import_Utilities.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="importing information">
          <param name="Name" value="Import General Ledger Information">
          <param name="Local" value="GLProcedures\Import_General_Ledger_Information.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="integrating with Accounts Payable">
          <param name="Name" value="General Ledger Overview">
          <param name="Local" value="GLConcepts\accounts_receivable_overview.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="integrating with Accounts Receivable">
          <param name="Name" value="General Ledger Overview">
          <param name="Local" value="GLConcepts\accounts_receivable_overview.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="integrating with Advanced Consolidations">
          <param name="Name" value="General Ledger Overview">
          <param name="Local" value="GLConcepts\accounts_receivable_overview.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="integrating with Cash Management">
          <param name="Name" value="General Ledger Overview">
          <param name="Local" value="GLConcepts\accounts_receivable_overview.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="integrating with Inventory Management">
          <param name="Name" value="General Ledger Overview">
          <param name="Local" value="GLConcepts\accounts_receivable_overview.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="integrating with Multicurrency Management">
          <param name="Name" value="General Ledger Overview">
          <param name="Local" value="GLConcepts\accounts_receivable_overview.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="integrating with Purchase Order">
          <param name="Name" value="General Ledger Overview">
          <param name="Local" value="GLConcepts\accounts_receivable_overview.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="overview">
          <param name="Name" value="General Ledger Overview">
          <param name="Local" value="GLConcepts\accounts_receivable_overview.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="multicurrency reports">
          <param name="Name" value="Multicurrency Reports for General Ledger">
          <param name="Local" value="GLConcepts\Multicurrency_Reports_for_General_Ledger.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="period-end flowchart">
          <param name="Name" value="General Ledger Period End Flowchart">
          <param name="Local" value="GLFlowcharts\General_Ledger_Period_End_Flowchart.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="Registers">
          <param name="Name" value="General Ledger Registers">
          <param name="Local" value="GLConcepts\General_Ledger_Registers.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="reprinting transaction registers">
          <param name="Name" value="Reprint a General Ledger Transaction Register">
          <param name="Local" value="GLProcedures\Reprint_a_General_Ledger_Transaction_Register.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="transactions record layout">
          <param name="Name" value="General Ledger Transactions Record Layout">
          <param name="Local" value="GLConcepts\GL_Transactions_Record_Layout.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="using reports as auditing tools">
          <param name="Name" value="General Ledger Reports as Auditing Tools">
          <param name="Local" value="GLConcepts\General_Ledger_Reports_as_Auditing_Tools.htm">
        </object>
        <li><object type="text/sitemap">
          <param name="Name" value="viewing account information">
          <param name="Name" value="View General Ledger Account Information">
          <param name="Local" value="GLProcedures\View_General_Ledger_Account_Information.htm">
        </object>
        </ul>
      <li><object type="text/sitemap">
        <param name="Name" value="Future Periods">
        <param name="Name" value="Future Periods">
        <param name="Local" value="GLConcepts\Future_Periods.htm">
      </object>
    </ul>
    </html>

    Hi there
    Are you using any Build Tags along with a Build Expression to control the output?
    I ask because the screen capture of the CHM seems to intimate that General Ledger is absent from the list. If it was linked to a topic and the topic was removed from the build, it would seem to make sense.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Error "roll area too small"! Can't find a way to resolve!Please hep.

    Hello everyone:
           i am getting the error "roll area too small" when I am looping through an internal table and calling the code below on change of some value.
    ===
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
          EXPORTING
            authority              = space
            immediately            = space
            new_list_id            = c_x
            no_dialog              = c_x
           user                   = sy-uname
          IMPORTING
            out_parameters         = params
          EXCEPTIONS
            archive_info_not_found = 1
            invalid_print_params   = 2
            invalid_archive_params = 3
            OTHERS                 = 4.
        IF sy-subrc NE 0.
          CLEAR : params.
        ENDIF.
    The printer destination has to be set up
        params-pdest = v_dest.
        params-prtxt = v_spool_text.
        params-paart = lc_paart.
        params-prtxt = v_spool_text.
        params-primm = 'X'.
        params-prrel = space.
        NEW-PAGE PRINT ON PARAMETERS params NO DIALOG.
        NEW-PAGE PRINT OFF.
    ======
    I posted this before and got some feedback and tried everything but it is not fixing the problem! I rewarded points to all the answers. I had basis increase roll area size, optimized code and did everything I can but I am still getting the same error "roll area too small". Same program works in 4.6C but in ECC6.0 I get this error! I have other programs that generates more than 10,000 pages in the spool but the program I am working on creates only 7700 pages! I  am not sure what else is changed in ECC6.0! Could someone please give me any ideas? rewards assured.
    thanks.
    Mithun

    Hello Mithun,
    Even i think increasing the roll area should have helped
    Are both the systems WIndows based  or is one unix based ?
    see this
    http://listserv.sap.com/pipermail/linux.general/2001-July/thread.html#670
    and search for "roll area too small" in the list of links
    it may help
    Also,
    in this solution, it says to use 'field groups'
    http://www.sapfans.com/sapfans/forum/r2all/messages/42.html
    Try these links as well - others with the same problem
    http://marc.info/?l=mysap-linux-general&w=4&r=1&s=%22rollareatoo+small%22&q=b
    Message was edited by:
            Kris Donald

  • Adding a field in a report

    Hi SDN
        i have a small problem where iam unable to add fields in the final internal table
      i have to add two fields i.e., COMMITMENT AND ACTVALUE from ESUH TABLE
    AND the final internal table is l_i_ekpo.
    we have to add only two fields COMMITMENT and a ....variable = COMMITMENT - ACTVALUE. which is already done in the program.
    here iam attaching a program.
    TABLES: ekpo.
    DATA: i_directory_list LIKE rlgrap-filename OCCURS 0 WITH HEADER LINE.
    DATA: i_directory_sel LIKE popuptext OCCURS 0 WITH HEADER LINE.
    *{ INSERT PS010306UPGR
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    *} INSERT
    DATA: BEGIN OF tab,
    *{ REPLACE PS010306UPGR
           T(1) TYPE X VALUE '09',  "HEX!
            t(1) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,  "Unicode
    *} REPLACE
    END OF tab.
    DATA: ekpo_konnr LIKE ekpo-konnr.
    DATA: ekpo_ktpnr LIKE ekpo-ktpnr.
    DATA: BEGIN OF t_bapiessrc OCCURS 0.
            INCLUDE STRUCTURE zbapiessrc_chars.
    DATA: END OF t_bapiessrc.
    DATA: t_bapiessrc_tab(301)  OCCURS 0." with header line.
    DATA: wa_bapiessrc_tab(301).
    DATA: BEGIN OF t_headertext OCCURS 0,
           ext_number LIKE zbapiessrc_chars-ext_number,
           linno(4) TYPE n,
           tcode(20),
           recordname(30),
           txpargraph(2),
           txline(72),
           text_mark,
          END OF t_headertext.
    DATA: BEGIN OF t_itemtext OCCURS 0,
           ext_number LIKE zbapiessrc_chars-ext_number,
           ext_line(18),
           linno(4) TYPE n,
           tcode(20),
           recordname(30),
           txpargraph(2),
           txline(72),
           text_mark,
           ext_linno(6),         
          END OF t_itemtext.
    DATA: t_headertext_tab(180) OCCURS 0.
    DATA: wa_headertext_tab(180).
    DATA: t_itemtext_tab(190) OCCURS 0.
    DATA: wa_itemtext_tab(190).
    DATA: BEGIN OF t_bapiesllc OCCURS 0.
           ext_number like bapiessrc-ext_number.
            INCLUDE STRUCTURE zbapiesllc_chars.
    DATA: END OF t_bapiesllc.
    DATA: t_bapiesllc_tab(650)  OCCURS 0." with header line.
    DATA: wa_bapiesllc_tab(650).
    DATA: no_of_files LIKE sy-index.
    DATA: perc_uploaded TYPE i.
    DATA: text_uploaded(50).
    DATA: text_fi_not_upl1(30), text_fi_not_upl2(30).
    DATA: continue_yn.
    DATA: file TYPE localfile.
    FIELD-SYMBOLS .
    DATA: BEGIN OF clbp_content OCCURS 0.
            INCLUDE STRUCTURE solisti1.
    DATA: END OF clbp_content.
    DATA w_mode VALUE 'A'.
    CONSTANTS:           c_update        VALUE 'S'.
    DATA: BEGIN OF bdcdata OCCURS 0.       " BDC Table
            INCLUDE STRUCTURE bdcdata.
    DATA: END   OF bdcdata.
    DATA: BEGIN OF bdcmsgcoll OCCURS 0.    " BDC Messages
            INCLUDE STRUCTURE bdcmsgcoll.
    DATA: END   OF bdcmsgcoll.
    DATA params LIKE pri_params.
    DATA list_text LIKE pri_params-prtxt.
    DATA: days(1)  TYPE n VALUE 2,
          count(3) TYPE n VALUE 1,
          valid    TYPE c.
    DATA t_bapi_essr LIKE bapiessrc OCCURS 0.
    DATA t_bapi_essr_log LIKE bapiessrc OCCURS 0 WITH HEADER LINE.
    DATA t_bapi_esll LIKE bapiesllc OCCURS 0.
    DATA t_bapi_esll_log LIKE bapiesllc OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF output_prot OCCURS 0.
            INCLUDE STRUCTURE essr.
            INCLUDE STRUCTURE bdcmsgcoll.
    DATA: END OF output_prot.
    DATA: BEGIN OF i_sgcses_struc OCCURS 0,
             po_number   LIKE zbapiessrc_chars-po_number,
             po_item     LIKE zbapiessrc_chars-po_item,
             short_text  LIKE zbapiessrc_chars-short_text,
             xblnr       LIKE essr-xblnr,
             ref_date    LIKE zbapiessrc_chars-ref_date,
             service     LIKE zbapiesllc_chars-service,
             flag,
             quantity    LIKE zbapiesllc_chars-quantity,
             final,
          END OF i_sgcses_struc.
    start of insert >>>                                     
    DATA: l_ses_no LIKE essr-lblni.
    TYPES: BEGIN OF t_ekpo,
             ebeln LIKE ekpo-ebeln,
             ebelp LIKE ekpo-ebelp,
             werks LIKE ekpo-werks,
             packno LIKE ekpo-packno,
           END OF t_ekpo.
    DATA: i_ekpo TYPE STANDARD TABLE OF t_ekpo.
    end of insert <<<                                       
    $$----
    S E L E C T I O N   S C R E E N -
    PARAMETERS: p_path TYPE localfile DEFAULT
      'C:     empBasellInterfacesSesSES-Daten'.
    ***parameters:     p_dismod type ctu_mode      default 'A'.
    PARAMETERS:     p_dismod TYPE ctu_mode      DEFAULT 'E'.
    PARAMETERS:     p_spnam  TYPE tsp01-rq2name DEFAULT 'SES_UPL.....'
                                                          OBLIGATORY.
    PARAMETERS:     cb_serv AS CHECKBOX DEFAULT 'X'.
    PARAMETERS:     cb_text AS CHECKBOX DEFAULT 'X'.
    PARAMETERS:     cb_chck AS CHECKBOX DEFAULT 'X'.
    $$----
    A T   S E L E C T I O N   S C R E E N -
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
      DATA: len TYPE i,
            testchar(1).
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          mask      = 'C:*.txt'
          static    = 'X'
        CHANGING
          file_name = p_path.
      DESCRIBE FIELD p_path LENGTH len IN CHARACTER MODE.
      DO len TIMES.
        len = len - 1.
        testchar =  p_path+len(1).
        IF testchar = ''.
          len = len + 1.
          p_path = p_path(len).
          EXIT.
        ENDIF.
      ENDDO.
    $$----
    S T A R T   O F   S E L E C T I O N -
    START-OF-SELECTION.
      PERFORM select_files.
    PERFORM spool_settings.                   
      PERFORM upload_files.
      PERFORM select_additional_data.                        
    $$----
    E N D   O F   S E L E C T I O N -
    END-OF-SELECTION.
    PERFORM spool_settings.                                
      CLEAR: perc_uploaded, no_of_files, text_uploaded.
      DESCRIBE TABLE t_bapiessrc LINES no_of_files.
    Loop over header-records: for each header-record one call transaction:
      LOOP AT t_bapiessrc.
        perc_uploaded = ( 100 * sy-tabix ) / no_of_files.
        IF cb_serv = 'X'.
          PERFORM prepare_clipboard.
        Upload Service Entry Sheets:
          PERFORM call_transaction_upload.
        Italian Version begin
          IMPORT output_prot FROM MEMORY ID 'OUT_PROT'.
          PERFORM write_prot_to_spool.
          FREE MEMORY ID 'OUT_PROT'.
          REFRESH: output_prot.
        Italian Version end
          PERFORM find_ses_number.                            
          PERFORM check_estimated_value.                     
        ENDIF.
        IF cb_text = 'X'.
        Upload SES Texts:
          PERFORM upload_texts.
        ENDIF.
      start of insert >>>                                   
        PERFORM change_account.                               
        IF cb_serv = 'X'.
          PERFORM release_ses.
        ENDIF.
      end of insert <<<                                     
      ENDLOOP.
    In case only text and no services shall be uploaded:
      IF NOT cb_text IS INITIAL.
      In case also services are uploaded this loop won't apply cause
         t_headertext-entries are deleted after they were processed in the
         loop above!
        LOOP AT t_headertext.
          MOVE t_headertext-ext_number TO t_bapiessrc-ext_number.
    *only for test cases since data file is not correct:
    move t_headertext-ext_number to t_bapiessrc-ref_doc_no.
    *only for test cases since data file is not correct:END
          PERFORM upload_texts.
        ENDLOOP.
      ENDIF.
      PERFORM log_upload_success.
    NEW-PAGE PRINT OFF.                                    
      PERFORM delete_files.
    WRITE: / text-001.                                     
    write: / 'Check spools for correct processing (Transaction SP01)!'.
    $$----
    T O P   O F   P A G E -
    TOP-OF-PAGE.
    *--at user-command--
    AT USER-COMMAND.
    *--top of page-during line selection--
    TOP-OF-PAGE DURING LINE-SELECTION.
    $$----
    F O R M - R O U T I N E S -
    *&      Form  SPLIT_BAPIESSRC
    FORM split_bapiessrc.
      DATA: l_score_time(3),
            l_score_qual(3),
            l_essr_lblni LIKE essr-lblni.
    start of insert >>>                                     
      TABLES: esuc.
      DATA: l_packno LIKE ekpo-packno.
    end of insert <<<                                       
      CLEAR: t_bapiessrc, ekpo_konnr, ekpo_ktpnr, ekpo.
       TRANSLATE doc_content-line USING '#;'.   ZBAPIESSRC_CHARS
      SPLIT  AT '§' INTO
            t_bapiessrc-sheet_no      t_bapiessrc-ext_number
            t_bapiessrc-person_int    t_bapiessrc-person_ext
            t_bapiessrc-location      t_bapiessrc-ref_date
            t_bapiessrc-begdate       t_bapiessrc-enddate
            t_bapiessrc-pckg_no       t_bapiessrc-short_text
    Only for testing due to wrong data
            t_bapiessrc-po_number     t_bapiessrc-po_item 
           ekpo_konnr ekpo_ktpnr                        
    Only for testing due to wrong data  END
            t_bapiessrc-block_ind     t_bapiessrc-score_time
            t_bapiessrc-score_qual    t_bapiessrc-doc_date
            t_bapiessrc-post_date     t_bapiessrc-ref_doc_no
    Only for testing due to wrong data
           t_bapiessrc-po_number     t_bapiessrc-po_item
    Only for testing due to wrong data  END
            t_bapiessrc-accasscat     t_bapiessrc-comm_no
            t_bapiessrc-user_field    t_bapiessrc-acceptance
    Only for testing due to wrong data
            ekpo_konnr ekpo_ktpnr  t_bapiessrc-final.      
    Only for testing due to wrong data  END
      MOVE '0000000001' TO t_bapiessrc-pckg_no.                
      SHIFT t_bapiessrc-po_item RIGHT DELETING TRAILING space.
      TRANSLATE t_bapiessrc-po_item USING ' 0'.
    start of delete >>>                                     
    IF NOT ekpo_konnr IS INITIAL AND NOT ekpo_ktpnr IS INITIAL.
       SELECT SINGLE konnr ktpnr FROM ekpo
                     INTO (ekpo-konnr, ekpo-ktpnr)
                     WHERE ebeln = t_bapiessrc-po_number
                     AND   ebelp = t_bapiessrc-po_item.
       IF NOT sy-subrc IS INITIAL.
         WRITE:/  text-101, t_bapiessrc-ext_number,
                  text-102,
                  t_bapiessrc-po_number,
                  text-103,
                  t_bapiessrc-po_item,
                  text-104.
         WRITE: / text-105.
         EXIT.
       ELSE.
         IF ekpo_konnr NE ekpo-konnr OR ekpo_ktpnr NE ekpo-ktpnr.
           WRITE:/ text-101, t_bapiessrc-ext_number,
                   text-106,
                   ekpo_konnr, '/',
                   ekpo_ktpnr,
                   text-107,
                   t_bapiessrc-po_number,
                   text-103, t_bapiessrc-po_item, ')'.
           WRITE: / text-105.
           EXIT.
         ENDIF.
       ENDIF.
    ENDIF.
    end of delete <<<                                     
    start of insert >>>                                   
      " check contract number
      IF NOT ekpo_konnr IS INITIAL AND NOT ekpo_ktpnr IS INITIAL.
        SELECT SINGLE konnr ktpnr packno
          FROM ekpo
          INTO (ekpo-konnr, ekpo-ktpnr, l_packno)
          WHERE ebeln = t_bapiessrc-po_number
          AND   ebelp = t_bapiessrc-po_item.
        IF sy-subrc NE 0.
          " no corresponding PO, no update will be performed
          WRITE:/  text-101, t_bapiessrc-ext_number,
                   text-102,
                   t_bapiessrc-po_number,
                   text-103,
                   t_bapiessrc-po_item,
                   text-104.
          WRITE: / text-105.
          EXIT.
        ELSE.
          " check contract number against table ESUC first.
          SELECT SINGLE *
            FROM esuc
            WHERE packno EQ l_packno
              AND ebeln EQ ekpo_konnr
              AND ebelp EQ ekpo_ktpnr.
          IF sy-subrc NE 0.
            " check against PO line
            IF ekpo_konnr NE ekpo-konnr OR ekpo_ktpnr NE ekpo-ktpnr.
              WRITE:/ text-101, t_bapiessrc-ext_number,
                      text-106,
                      ekpo_konnr, '/',
                      ekpo_ktpnr,
                      text-107,
                      t_bapiessrc-po_number,
                      text-103, t_bapiessrc-po_item, ')'.
              WRITE: / text-105.
              EXIT.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    end of insert <<<                                       
      IF cb_chck = 'X'.
        SELECT SINGLE lblni FROM essr INTO l_essr_lblni
                                      WHERE loekz = ' '
                                      AND   user1 = t_bapiessrc-ext_number.
        IF sy-subrc IS INITIAL.
          WRITE:/ 'External SES', t_bapiessrc-ext_number,
                  'is already uploaded. SES-Number: ', l_essr_lblni.
          WRITE: / 'No update of this sheet was accomplished!'.
          EXIT.
        ENDIF.
      ENDIF.
      APPEND t_bapiessrc.
    ENDFORM.                    " SPLIT_BAPIESSRC
    *&      Form  SPLIT_BAPIESLLC
    FORM split_bapiesllc.
      DATA: l_outl_level(3), l_ovf_tol(3), l_price_unit(5), l_gr_price(23),
            l_target_val(23), l_userf2_num(13), l_quantity(13),
            l_form_val1(13), l_form_val2(13), l_form_val3(13),
            l_form_val4(13), l_form_val5(13), l_ext_number(16).
      CLEAR: t_bapiesllc.
       TRANSLATE doc_content-line USING '#;'.
      SPLIT  AT '§' INTO
            t_bapiesllc-ext_number
            t_bapiesllc-pckg_no        t_bapiesllc-line_no
            t_bapiesllc-ext_line       t_bapiesllc-outl_level
            t_bapiesllc-outl_no        t_bapiesllc-outl_ind
            t_bapiesllc-subpckg_no     t_bapiesllc-service
            t_bapiesllc-serv_type      t_bapiesllc-edition
            t_bapiesllc-ssc_item       t_bapiesllc-ext_serv
            t_bapiesllc-quantity       t_bapiesllc-base_uom
            t_bapiesllc-uom_iso        t_bapiesllc-ovf_tol
            t_bapiesllc-ovf_unlim      t_bapiesllc-price_unit
            t_bapiesllc-gr_price       t_bapiesllc-from_line
            t_bapiesllc-to_line        t_bapiesllc-short_text
            t_bapiesllc-distrib        t_bapiesllc-pers_no
            t_bapiesllc-wagetype       t_bapiesllc-pln_pckg
            t_bapiesllc-pln_line       t_bapiesllc-con_pckg
            t_bapiesllc-con_line       t_bapiesllc-tmp_pckg
            t_bapiesllc-tmp_line       t_bapiesllc-ssc_lim
            t_bapiesllc-limit_line     t_bapiesllc-target_val
            t_bapiesllc-basline_no     t_bapiesllc-basic_line
            t_bapiesllc-alternat       t_bapiesllc-bidder
            t_bapiesllc-supp_line      t_bapiesllc-open_qty
            t_bapiesllc-inform         t_bapiesllc-blanket
            t_bapiesllc-eventual       t_bapiesllc-tax_code
            t_bapiesllc-taxjurcode     t_bapiesllc-price_chg
            t_bapiesllc-matl_group     t_bapiesllc-date
            t_bapiesllc-begintime      t_bapiesllc-endtime
            t_bapiesllc-extpers_no     t_bapiesllc-formula
            t_bapiesllc-form_val1      t_bapiesllc-form_val2
            t_bapiesllc-form_val3      t_bapiesllc-form_val4
            t_bapiesllc-form_val5      t_bapiesllc-userf1_num
            t_bapiesllc-userf2_num     t_bapiesllc-userf1_txt
            t_bapiesllc-userf2_txt     t_bapiesllc-hi_line_no.
    start of insert  >>>                                     "AP13022007i
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = t_bapiesllc-line_no
        IMPORTING
          output = t_bapiesllc-line_no.
    end of insert <<<                                        "AP13022007i
      TRANSLATE t_bapiesllc-quantity USING ',.'.
      MOVE '0000000002' TO t_bapiesllc-pckg_no.                 "TS20082002
      APPEND t_bapiesllc.
    ENDFORM.                    " SPLIT_BAPIESLLC
    *&      Form  SELECT_FILES
    FORM select_files.
      CALL FUNCTION 'KCD_FRONT_END_DIRECTORY_READ'
           EXPORTING
                i_path              = p_path
       IMPORTING
            E_PURE_PATH         =
           TABLES
                e_directory         = i_directory_list
          EXCEPTIONS
               download            = 1
               upload              = 2
               execute             = 3
               directory_not_exist = 4
               directory           = 5
               OTHERS              = 6
      IF sy-subrc <> 0.
    *{ REPLACE PS010306UPGR
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        MESSAGE w208(00) WITH 'Enter existing directory'(003).
    *} REPLACE
        EXIT.
      ENDIF.
      LOOP AT i_directory_list.
        CHECK i_directory_list(1) CA 'KPLT'.
       check i_directory_list cs '.XLS' or i_directory_list cs '.TXT'.
        CHECK i_directory_list CS '.TXT'.
        CLEAR i_directory_sel.
        MOVE  'X' TO  i_directory_sel-text(1).
        MOVE  i_directory_list(79) TO  i_directory_sel-text+1(79).
        APPEND i_directory_sel.
      ENDLOOP.
      CALL FUNCTION 'Z_SL018_POPUP_WITH_TEXT_TO_SEL'
        EXPORTING
          popup_title  = 'Select Files for SES-Upload'
          start_column = 10
          start_row    = 1
          end_column   = 50
          end_row      = 16
        IMPORTING
          sy_ucomm     = sy-ucomm
        TABLES
          x_popuptext  = i_directory_sel.
    *Check which Files shall be uploaded:
      LOOP AT  i_directory_sel.
        CHECK i_directory_sel-text(1) NE 'Y'.
        DELETE  i_directory_sel.
      ENDLOOP.
      SORT i_directory_sel.
      DESCRIBE TABLE i_directory_sel LINES no_of_files.
    ENDFORM.                    " SELECT_FILES
    *&      Form  UPLOAD_FILES
    FORM upload_files.
    *{ INSERT PS010306UPGR
      DATA: fname TYPE string.
    *} INSERT
      LOOP AT i_directory_sel.
        CLEAR: file.
        UNASSIGN: .
        perc_uploaded = ( 100 * sy-tabix ) / no_of_files.
        CONCATENATE i_directory_sel-text+1(31) 'uploaded from disk'
                                                         INTO text_uploaded
                                                SEPARATED BY space.
        CONCATENATE p_path i_directory_sel-text+1(31) INTO file.
    Choose the right structure for <doc_content> and <wa_doc_content>
    depending on file type K, P, T or L via assignment of field symbols:
        CASE i_directory_sel-text+1(1).
          WHEN 'K'. "Kopfdaten
            ASSIGN t_bapiessrc_tab   TO .
        ENDCASE.
    *{ REPLACE PS010306UPGR
       CALL FUNCTION 'WS_UPLOAD'
            EXPORTING
                 FILENAME                = FILE
            TABLES
                 DATA_TAB                = <DOC_CONTENT>
            EXCEPTIONS
                 CONVERSION_ERROR        = 1
                 FILE_OPEN_ERROR         = 2
                 FILE_READ_ERROR         = 3
                 INVALID_TABLE_WIDTH     = 4
                 INVALID_TYPE            = 5
                 NO_BATCH                = 6
                 UNKNOWN_ERROR           = 7
                 GUI_REFUSE_FILETRANSFER = 8
                 CUSTOMER_ERROR          = 9
                 OTHERS                  = 10.
        fname = file.
        CALL METHOD cl_gui_frontend_services=>gui_upload
          EXPORTING
            filename = fname
          CHANGING
            data_tab =  0.
          CLEAR: text_fi_not_upl1, text_fi_not_upl2, continue_yn.
          CONCATENATE 'File' i_directory_sel-text+1(21) ': upload failed!'
                       INTO text_fi_not_upl1 SEPARATED BY space.
          MOVE 'Continue Program?' TO text_fi_not_upl2.
          CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
            EXPORTING
              defaultoption  = 'N'
              textline1      = text_fi_not_upl1
              textline2      = text_fi_not_upl2
              titel          = 'Upload Failed'
              start_column   = 25
              start_row      = 6
              cancel_display = ' '
            IMPORTING
              answer         = continue_yn.
          IF continue_yn = 'N'.
            EXIT.
          ENDIF.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ELSE.
    Move uploaded File records line by line into correct internal table:
           t_bapiessrc  for K__.txt
           t_bapiesllc  for P__.txt
           t_headertext for T__.txt
           t_itemtext   for L__.txt
          LOOP AT .
              IF NOT sy-subrc IS INITIAL. EXIT. ENDIF.
            ENDDO.
            CASE i_directory_sel-text+1(1).
              WHEN 'K'. "Kopfdaten
                PERFORM split_bapiessrc.
              WHEN 'T'.
                PERFORM split_headertext.
              WHEN 'P'.
                PERFORM split_bapiesllc.
              WHEN 'L'.
                PERFORM split_itemtext.
            ENDCASE.
          ENDLOOP.
        ENDIF.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
            percentage = perc_uploaded
            text       = text_uploaded.
      ENDLOOP.
      SORT t_bapiessrc BY ext_number.
      SORT t_headertext BY ext_number linno.
    SORT t_bapiesllc BY ext_number.                         "
      SORT t_bapiesllc BY ext_number pckg_no line_no.         
    sort t_bapiesllc by ext_number line_no.
      SORT t_itemtext BY ext_number ext_linno ext_line linno.
    ENDFORM.                    " UPLOAD_FILES
    *&      Form  PREPARE_CLIPBOARD
    FORM prepare_clipboard.
      CLEAR:   clbp_content.
      REFRESH: clbp_content.
      DATA: l_line TYPE n.
      DATA: l_tabix LIKE sy-tabix.
      CLEAR l_tabix.
    *Assemble the File-Structure out of the internal tables t_bapiessrc
      and t_bapiesllc which is expected by the user exit
      exit_saplmlsx_002 and move it to the clipboard:
      MOVE 'K' TO clbp_content(1).  "Flag for header record
      MOVE t_bapiessrc TO clbp_content+1(246).
      APPEND clbp_content.
      READ TABLE t_bapiesllc WITH KEY ext_number = t_bapiessrc-comm_no
                                  BINARY SEARCH.
      CHECK sy-subrc IS INITIAL.
      MOVE sy-tabix TO l_tabix.
    insert dummy row for connection between pach_no and sub_packno:
      CLEAR l_line.
      CLEAR: clbp_content, t_bapiesllc.
      ADD 1 TO l_line.
      MOVE 'P' TO clbp_content(1).  "Flag for service-record
      MOVE l_line TO clbp_content+1(1).
      MOVE '0000000001' TO t_bapiesllc-pckg_no.
      MOVE '0000000002' TO t_bapiesllc-subpckg_no.
      WRITE t_bapiesllc16(245) TO clbp_content3(245).
      APPEND clbp_content.
      CLEAR clbp_content.
      ADD 1 TO l_line.
      MOVE 'P' TO clbp_content(1).
      MOVE l_line TO clbp_content+1(1).
      WRITE t_bapiesllc261(245) TO clbp_content3(245).
      APPEND clbp_content.
      APPEND clbp_content.
      CLEAR clbp_content.
      ADD 1 TO l_line.
      MOVE 'P' TO clbp_content(1).
      MOVE l_line TO clbp_content+1(1).
      MOVE 'E' TO clbp_content+2(1).
      WRITE t_bapiesllc506(27) TO clbp_content3(245).
      APPEND clbp_content.
      CLEAR clbp_content.
    end insert
      LOOP AT t_bapiesllc FROM l_tabix.
        CLEAR l_line.
        CLEAR clbp_content.
        IF t_bapiesllc-ext_number NE t_bapiessrc-ext_number.
          EXIT.
        ENDIF.
        ADD 1 TO l_line.
        MOVE 'P' TO clbp_content(1).  "Flag for service-record
      'P'-service records are split into three clipbord-lines since
        structure t_bapiesllc is too long for one line
        MOVE l_line TO clbp_content+1(1).
        WRITE t_bapiesllc16(245) TO clbp_content3(245).
        APPEND clbp_content.
        CLEAR clbp_content.
        ADD 1 TO l_line.
        MOVE 'P' TO clbp_content(1).
        MOVE l_line TO clbp_content+1(1).
        WRITE t_bapiesllc261(245) TO clbp_content3(245).
        APPEND clbp_content.
        CLEAR clbp_content.
        ADD 1 TO l_line.
        MOVE 'P' TO clbp_content(1).
        MOVE l_line TO clbp_content+1(1).
        MOVE 'E' TO clbp_content+2(1).
        WRITE t_bapiesllc506(27) TO clbp_content3(245).
        APPEND clbp_content.
        CLEAR clbp_content.
      ENDLOOP.
    ******Italy version of upload
      PERFORM include_italy.
    export t_bapiessrc to memory id 'GER_ESSRC'.
    export t_bapiesllc to memory id 'GER_ESLLC'.
      EXPORT t_bapi_essr TO MEMORY ID 'GER_ESSRC'.
      EXPORT t_bapi_esll TO MEMORY ID 'GER_ESLLC'.
      CHECK 1 = 2.
    ******Italy version of upload END
      CALL FUNCTION 'CLPB_EXPORT'
        TABLES
          data_tab   = clbp_content
        EXCEPTIONS
          clpb_error = 1
          OTHERS     = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " PREPARE_CLIPBOARD
    *&      Form  CALL_TRANSACTION_UPLOAD
    FORM call_transaction_upload.
      REFRESH bdcdata.
      PERFORM bdc_dynpro USING: 'RM11RL00'      '1000'.
      PERFORM bdc_field  USING: 'BDC_OKCODE'    '=UPL'.
      PERFORM bdc_field  USING: 'S_LBLNI-LOW'    '          '.
      PERFORM bdc_field  USING: 'S_LBLNI-HIGH'   '          '.
      PERFORM bdc_field  USING: 'P_BSTNR'        '          '.
      PERFORM bdc_field  USING: 'S_BSTPO-LOW'    '     '.
      PERFORM bdc_field  USING: 'S_BSTPO-HIGH'   '     '.
    *Italian upload version -> comments set|remove comments for Germ.Version
    perform bdc_dynpro using: 'SAPLMLSX'      '0480'.
    perform bdc_field  using: 'BDC_OKCODE'    '=EXEC'.
    perform bdc_dynpro using: 'SAPLGRAP'      '0210'.
    perform bdc_field  using: 'BDC_OKCODE'    '=UPL_FR_CLP'.
      PERFORM bdc_dynpro USING: 'SAPMSSY0'      '0120'.
    perform bdc_field  using: 'MARKIERT'      'X'.
    *Italian upload version -> comments set; END
      CASE p_dismod.
        WHEN 'A'.
          PERFORM bdc_field  USING: 'BDC_OKCODE'    '=LITE'.
        WHEN 'N'.
          PERFORM bdc_field  USING: 'BDC_OKCODE'    '=HIND'.
        WHEN 'E'.
          PERFORM bdc_field  USING: 'BDC_OKCODE'    '=DARK'.
      ENDCASE.
    Here the call transcation of SAP-standard takes place for creating the
      service entry sheet
    After SAP-standard call transaction: analyze the popup with the
    *Italian upload version -> comments set|remove comments for Germ.Version
      PERFORM bdc_dynpro USING: 'SAPMSSY0'      '0120'.
    perform bdc_field  using: 'BDC_OKCODE'    '=PRI'.
    perform bdc_dynpro using: 'SAPLSPRI'      '0100'.
    perform bdc_field  using: 'BDC_OKCODE'    '=PRIN'.
    perform bdc_field  using: 'PRI_PARAMS-PLIST'    p_spnam.
    perform bdc_field  using: 'PRI_PARAMS-PRIMM'    ' '.
    perform bdc_field  using: 'PRI_PARAMS-PRREL'    ' '.
    perform bdc_field  using: 'PRI_PARAMS-PRNEW'    ' '.
    perform bdc_dynpro using: 'SAPMSSY0'      '0120'.
    perform bdc_field  using: 'BDC_OKCODE'    '=EXEC'.
    *Italian upload version -> remove the following line for Germ. version:
      PERFORM bdc_field  USING: 'BDC_OKCODE'    '/00'.
      w_mode = p_dismod.
    currently w_mode and p_dismod are set to the same value:
    foregroud, background or error. But it could also be set to differnt
    values: Foreground for upload clipboard,
      CALL TRANSACTION 'ML81' USING bdcdata MODE w_mode UPDATE c_update
         MESSAGES INTO bdcmsgcoll.
    ENDFORM.                    " CALL_TRANSACTION_UPLOAD
    *&      Form  BDC_DYNPRO
    FORM bdc_dynpro
         USING program TYPE c
               dynpro  TYPE c.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    " BDC_DYNPRO
    *&      Form  BDC_FIELD
    FORM bdc_field
          USING fnam TYPE c
                fval TYPE c.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    " BDC_FIELD
    *&      Form  UPLOAD_TEXTS
    FORM upload_texts.
      DATA l_lblni LIKE essr-lblni.
      DATA l_tabix_header_start LIKE sy-tabix.
      DATA l_tabix_item_start LIKE sy-tabix.
      DATA:  p(2) TYPE c.
      DATA:  w  LIKE sy-index.
      DATA:  w_field(20) TYPE c.
      DATA: l_ext_line_save LIKE t_itemtext-ext_line.
      DATA: l_ext_linno_save LIKE t_itemtext-ext_linno.
      DATA: l_extrow(10)."  like ml_esll-extrow.
      DATA: l_messg LIKE message.
      DATA: l_msgno LIKE sy-msgno.
    *only for test cases since data file is not correct:
    read table t_headertext with key ext_number = t_bapiessrc-ref_doc_no.
      READ TABLE t_headertext WITH KEY ext_number = t_bapiessrc-ext_number
                                       BINARY SEARCH.
    *only for test cases since data file is not correct:END
      IF NOT sy-subrc IS INITIAL.
       MESSAGE ID 'ZV' TYPE 'I' NUMBER '011'                
            WITH text-202.                                  
        WRITE: / text-202.                                    
        EXIT.
      ENDIF.
      l_tabix_header_start = sy-tabix.
      SELECT SINGLE MAX( lblni ) FROM essr INTO l_lblni
                   where xblnr = t_headertext-ext_number.
                    WHERE user1 = t_headertext-ext_number
                    AND   loekz = ' '.
      IF NOT sy-subrc IS INITIAL.
       MESSAGE ID 'ZV' TYPE 'I' NUMBER '011'               
            WITH text-203.                                  
        WRITE: / text-203.                                    
        EXIT.
      ENDIF.
      CLEAR: bdcdata, bdcmsgcoll.
      REFRESH: bdcdata, bdcmsgcoll.
      PERFORM bdc_dynpro USING 'RM11RL00' '1000'.
      PERFORM bdc_field USING 'BDC_OKCODE'  '=ONLI'.
      PERFORM bdc_field USING 'S_LBLNI-LOW' l_lblni. " '1000001748'.
      PERFORM bdc_field USING 'BDC_CURSOR'  'P_LIST'.
      PERFORM bdc_field USING 'P_LIST'      ' '.
      PERFORM bdc_field USING 'P_DIRECT'    'X'.
      PERFORM bdc_field USING 'P_LISTU'     ' '.
      PERFORM bdc_dynpro USING 'SAPLMLSR' '0100'.
      PERFORM bdc_field USING 'BDC_OKCODE'  '=TXT'.
    perform bdc_field using 'ESSR-TXZ01'  t_headertext-txline(40).
      PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
      PERFORM bdc_field USING 'BDC_OKCODE'  '=TXBA'.
      CLEAR w.
      ADD 1 TO w.
      LOOP AT t_headertext FROM l_tabix_header_start.
    Is t_bapiessrc-ext_number really filled?
        IF t_headertext-ext_number NE t_bapiessrc-ext_number.
          EXIT.
        ENDIF.
        ADD 1 TO w.
        UNPACK w TO p.
        CLEAR w_field.
        w_field+00(17) = 'RSTXT-TXPARGRAPH('.
        w_field+17(02) = p.
        w_field+19(01) = ')'.
        PERFORM bdc_field USING w_field t_headertext-txpargraph.
        CLEAR w_field.
        w_field+00(13) = 'RSTXT-TXLINE('.
        w_field+13(02) = p.
        w_field+15(01) = ')'.
        PERFORM bdc_field USING w_field t_headertext-txline .
      delete line from internal table so that Upload Texts is not
          processed twice when perform_upload_texts is called without up-
          loading services:
        DELETE t_headertext.
      ENDLOOP.
      PERFORM bdc_dynpro USING 'SAPLMLSR' '0100'.
      PERFORM bdc_field USING 'BDC_OKCODE'  '=SERV'.
      PERFORM bdc_dynpro USING 'SAPLMLSP' '0210'.
      PERFORM bdc_field USING 'BDC_OKCODE'  'ENTER'.
      READ TABLE t_itemtext WITH KEY
                            ext_number = t_bapiessrc-ext_number.
      l_tabix_item_start = sy-tabix.
      CLEAR l_ext_line_save.
      LOOP AT t_itemtext FROM l_tabix_item_start.
        IF t_itemtext-ext_number NE t_bapiessrc-ext_number.
          EXIT.
        ENDIF.
        SHIFT t_itemtext-ext_line RIGHT DELETING TRAILING space.
        TRANSLATE t_itemtext-ext_line USING ' 0'.
        IF ( t_itemtext-ext_line NE l_ext_line_save )
            OR ( t_itemtext-ext_linno NE l_ext_linno_save ).
    ***find line number:
         break michalska.                                    
          SELECT SINGLE extrow FROM ml_esll INTO l_extrow
                                WHERE extrow = t_itemtext-ext_linno
                                  AND srvpos = t_itemtext-ext_line
                                  AND ebeln = l_lblni.
          IF NOT sy-subrc IS INITIAL.
            CONTINUE.
          ENDIF.
          PERFORM bdc_dynpro USING 'SAPLMLSP' '0210'.
          PERFORM bdc_field USING 'BDC_OKCODE'  'ENTER'.
          PERFORM bdc_field USING 'RM11P-NEW_ROW'  l_extrow.
          PERFORM bdc_dynpro USING 'SAPLMLSP' '0210'.
          PERFORM bdc_field USING 'BDC_OKCODE'  '=ZLT'.
          PERFORM bdc_field USING 'BDC_CURSOR'  'ESLL-EXTROW(01)'.
          PERFORM bdc_field USING 'RM11P-SELKZ(01)'  'X'.
          PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
          PERFORM bdc_field USING 'BDC_OKCODE'  '=TXBA'.
          CLEAR w.
          ADD 1 TO w.
        ENDIF.
        ADD 1 TO w.
        UNPACK w TO p.
        CLEAR w_field.
        w_field+00(17) = 'RSTXT-TXPARGRAPH('.
        w_field+17(02) = p.
        w_field+19(01) = ')'.
        PERFORM bdc_field USING w_field t_itemtext-txpargraph.
        CLEAR w_field.
        w_field+00(13) = 'RSTXT-TXLINE('.
        w_field+13(02) = p.
        w_field+15(01) = ')'.
        PERFORM bdc_field USING w_field t_itemtext-txline .
        l_ext_line_save = t_itemtext-ext_line.
        l_ext_linno_save = t_itemtext-ext_linno.
      ENDLOOP.
      PERFORM bdc_dynpro USING 'SAPLMLSP' '0210'.
      PERFORM bdc_field USING 'BDC_OKCODE'  '=SAV'.
      CALL TRANSACTION 'ML81' USING bdcdata MODE p_dismod UPDATE c_update
         MESSAGES INTO bdcmsgcoll.
      LOOP AT bdcmsgcoll.
        IF sy-tabix = 1.
          WRITE AT: /1 text-002,
         write at: /1 'Log for text uploads of entry sheet ',
                                               37 l_lblni, 48 ':'.
        ENDIF.
      check bdcmsgcoll-msgtyp = 'E' or bdcmsgcoll-msgtyp = 'A'.
        CHECK bdcmsgcoll-msgnr CO ' 0123456789'.
        MOVE  bdcmsgcoll-msgnr TO l_msgno.
        CALL FUNCTION 'WRITE_MESSAGE'
          EXPORTING
            msgid = bdcmsgcoll-msgid
            msgno = l_msgno
            msgty = bdcmsgcoll-msgtyp
            msgv1 = bdcmsgcoll-msgv1
            msgv2 = bdcmsgcoll-msgv2
            msgv3 = bdcmsgcoll-msgv3
            msgv4 = bdcmsgcoll-msgv4
          IMPORTING
            messg = l_messg.
        WRITE AT: /3 l_messg-msgtx.
      ENDLOOP.
    ENDFORM.                    " UPLOAD_TEXTS
    *&      Form  SPLIT_HEADERTEXT
    FORM split_headertext.
      DATA:  l_essr_lblni LIKE essr-lblni.
      CLEAR: t_headertext.
       TRANSLATE doc_content-line USING '#;'.   ZBAPIESSRC_CHARS
      SPLIT  AT '§' INTO
            t_headertext-ext_number
            t_headertext-linno
            t_headertext-tcode
            t_headertext-recordname
            t_headertext-txpargraph
            t_headertext-txline
            t_headertext-text_mark.
    start of insert  >>>                                    
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = t_headertext-linno
        IMPORTING
          output = t_headertext-linno.
    end of insert <<<                                       
      IF cb_chck = 'X'.
        SELECT SINGLE lblni FROM essr INTO l_essr_lblni
                                      WHERE loekz = ' '
                                      AND   user1 = t_headertext-ext_number.
        IF sy-subrc IS INITIAL.
          IF t_headertext-linno = 1.
            WRITE:/ 'External SES', t_headertext-ext_number,
                    'is already uploaded. SES-Number: ', l_essr_lblni.
            WRITE: / 'No update of this sheet-texts was accomplished!'.
          ENDIF.
          EXIT.
        ENDIF.
      ENDIF.
    start of insert >>>                                     
      IF NOT cb_serv IS INITIAL.
        " check
        READ TABLE t_bapiessrc WITH KEY ext_number = t_headertext-ext_number
                               BINARY SEARCH.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
      ENDIF.
    end of insert <<<                                      
      APPEND t_headertext.
    ENDFORM.                    " SPLIT_HEADERTEXT
    *&      Form  SPLIT_ITEMTEXT
    FORM split_itemtext.
      DATA: l_essr_lblni LIKE essr-lblni.
      CLEAR: t_itemtext.
       TRANSLATE doc_content-line USING '#;'.   ZBAPIESSRC_CHARS
      SPLIT  AT '§' INTO
            t_itemtext-ext_number
            t_itemtext-ext_line
            t_itemtext-linno
            t_itemtext-tcode
            t_itemtext-recordname
            t_itemtext-txpargraph
            t_itemtext-txline
            t_itemtext-text_mark
            t_itemtext-ext_linno.           
    start of insert  >>>                                    
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = t_itemtext-ext_linno
        IMPORTING
          output = t_itemtext-ext_linno.
    end of insert <<<                                      
      IF cb_chck = 'X'.
        SELECT SINGLE lblni FROM essr INTO l_essr_lblni
                                      WHERE loekz = ' '
                                      AND   user1 = t_itemtext-ext_number.
        IF sy-subrc IS INITIAL.
         write:/ 'External SES', t_itemtext-ext_number,
                 'is already uploaded. SES-Number: ', l_essr_lblni.
         write: / 'No update of this sheet was accomplished!'.
          EXIT.
        ENDIF.
      ENDIF.
      APPEND t_itemtext.
    ENDFORM.                    " SPLIT_ITEMTEXT
    start of delete >>>                                     
    *&      Form  SPOOL_SETTINGS
    *FORM spool_settings.
    MOVE p_spnam TO list_text.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
       EXPORTING  " destination = 'dest'
         copies         = 1
         list_name      = p_spnam
         list_text      = list_text
         immediately    = ' '
         release        = ' '
         new_list_id    = ' '
         expiration     = 9
         line_size      = 125
         line_count     = 23
         layout         = 'X_65_132'
         sap_cover_page = ' '
         receiver       = 'SAP*'
         department     = 'System'
         no_dialog      = 'X'
       IMPORTING
         out_parameters = params
         valid          = valid.
    IF valid <> space.
       NEW-PAGE PRINT ON PARAMETERS params NO DIALOG.
    ENDIF.
    *ENDFORM.                    " SPOOL_SETTINGS
    end of delete <<<                                       
    *&      Form  DELETE_FILES
          text
    -->  p1        text
    <--  p2        text
    FORM delete_files.
    *{ REPLACE PS010306UPGR
    DATA: l_return.
      DATA: l_return TYPE i.
      DATA: fname TYPE string.
    *} REPLACE
      LOOP AT  i_directory_sel.
       move space to i_directory_sel-text(1).
        MOVE 'X' TO i_directory_sel-text(1).
        MODIFY i_directory_sel.
      ENDLOOP.
    *{ REPLACE                                                 
    CLEAR i_directory_sel.
    MOVE'Xdir_file.bat' TO i_directory_sel-text.
    APPEND i_directory_sel.
    CLEAR i_directory_sel.
    MOVE'Xdir_file.txt' TO i_directory_sel-text.
    APPEND i_directory_sel.
      DATA: l_directory_list LIKE rlgrap-filename OCCURS 0 WITH HEADER LINE.
      CALL FUNCTION 'KCD_FRONT_END_DIRECTORY_READ'
        EXPORTING
          i_path      = p_path
        TABLES
          e_directory = l_directory_list
        EXCEPTIONS
          OTHERS      = 6.
      IF sy-subrc <> 0.
        LOOP AT l_directory_list.
          IF l_directory_list CS 'dir_file.bat'.
            CLEAR i_directory_sel.
            MOVE'Xdir_file.bat' TO i_directory_sel-text.
            APPEND i_directory_sel.
          ELSEIF l_directory_list CS 'dir_file.txt'.
            CLEAR i_directory_sel.
            MOVE'Xdir_file.txt' TO i_directory_sel-text.
            APPEND i_directory_sel.
          ENDIF.
        ENDLOOP.
      ENDIF.
      CALL FUNCTION 'Z_SL018_POPUP_WITH_TEXT_TO_SEL'
        EXPORTING
          popup_title  = 'Select Files for DELETION'
          start_column = 10
          start_row    = 1
          end_column   = 50
          end_row      = 16
        IMPORTING
          sy_ucomm     = sy-ucomm
        TABLES
          x_popuptext  = i_directory_sel.
    *Check which Files shall be uploaded:
      CHECK sy-ucomm = 'OK'.
      LOOP AT  i_directory_sel.
        CHECK i_directory_sel-text(1) = 'Y'.
        CLEAR file.
        CONCATENATE p_path i_directory_sel-text+1(31) INTO file.
    *{ REPLACE PS010306UPGR
       CALL FUNCTION 'WS_FILE_DELETE'
            EXPORTING
                 FILE   = FILE
            IMPORTING
                 RETURN = L_RETURN.
        fname = file.
        CALL METHOD cl_gui_frontend_services=>file_delete
          EXPORTING
            filename = fname
          CHANGING
            rc  

    HI
    add that fileds in the all locations where you need it like
    in internal table declaration , write statement , select statement
    these are the main areas where you have to add that 2 fileds

  • Urgent could u plz clear my doubut

    While copying the code for Z_CREATE_PDF program (which is getting submit from main program ZSDL_393_REASON_CODE_REPORT, we have noticed some issue:
    There are 2 Function Modules 'Z_CONVERT_ABAPSPOOLJOB_2_PDF' and 'Z_CONVERT_OTFSPOOLJOB_2_PDF' being called from Z_CREATE_PDF program, which are not yet copied to RD2 server. When I checked in PF server, there is Custom Function Group ZSMS developed under which these function modules are created.
    There are many other Function Modules, screens and includes under this Function Group.
    Please advise whether we need to copy all the objects under this Function Group in RD2 as well, or some other work around is possible. Please note that this part is related to just the PDF File Creation on selection screen of main program.
    TABLES:
      bkpf,
      bseg.
    DATA: "Internal tables
      BEGIN OF x_bkpf,
        bukrs LIKE bkpf-bukrs, "Company Code
        belnr LIKE bkpf-belnr, "Document Number
        gjahr LIKE bkpf-gjahr, "Fiscal Year
        budat LIKE bkpf-budat, "Posting Date
        xblnr LIKE bkpf-xblnr, "Reference           "PG01+
        blart LIKE bkpf-blart, "Document Type       "DB05+
      END OF x_bkpf,
      t_bkpf LIKE HASHED TABLE OF x_bkpf
        WITH UNIQUE KEY bukrs belnr gjahr
        WITH HEADER LINE,
      BEGIN OF t_bseg OCCURS 0,
        bukrs LIKE bseg-bukrs, "Company Code
        belnr LIKE bseg-belnr, "Document Number
        gjahr LIKE bseg-gjahr, "Fiscal Year
        shkzg LIKE bseg-shkzg, "Debit/Credit indicator
        wrbtr LIKE bseg-wrbtr, "Amount in doc currency
        sgtxt LIKE bseg-sgtxt, "Reason Desc
        hkont LIKE bseg-hkont, "G/L Account
        kunnr LIKE bseg-kunnr, "Customer number
        rstgr LIKE bseg-rstgr, "Reason Code
        prctr LIKE bseg-prctr, "Business Unit (SBU)
        xref1 LIKE bseg-xref1, "Ref Key 1           "PG01+
       zloc LIKE bseg-zloc,   "Location
       zexp LIKE bseg-zexp,   "Expense
       zdtl LIKE bseg-zdtl,   "Detail
      END OF t_bseg,
    Table of customer records from bseg (1 for each in T_BSEG)
      BEGIN OF t_kunnr OCCURS 0,
        bukrs LIKE bseg-bukrs, "Company Code
        belnr LIKE bseg-belnr, "Document Number
        gjahr LIKE bseg-gjahr, "Fiscal Year
        kunnr LIKE bseg-kunnr, "Customer number
      END OF t_kunnr,
      BEGIN OF t_rstgr_sum OCCURS 0,
        rstgr LIKE bseg-rstgr, "Reason Code
        sgtxt LIKE bseg-sgtxt, "Reason Desc
        wrbtr LIKE bseg-wrbtr, "Sum for a Reason Code
      END OF t_rstgr_sum,
      BEGIN OF t_hkont_sum OCCURS 0,
        hkont LIKE bseg-hkont, "GL Account
        wrbtr LIKE bseg-wrbtr, "Sum for a GL Account
      END OF t_hkont_sum.
    DATA: "Standalone work fields
      sum_wrbtr LIKE bseg-wrbtr,
      grand_wrbtr LIKE bseg-wrbtr,
      save_rstgr LIKE t_bseg-rstgr,
      save_sgtxt LIKE t_bseg-sgtxt,                             "PG02+
      save_hkont LIKE t_bseg-hkont,
      first_reason TYPE c,
      first_glacct TYPE c,
      detail_section TYPE c,
      amount_out LIKE t_bseg-wrbtr,
      l_rstgr LIKE t053r-rstgr.
    Start of RC03
    DATA:
    valid  TYPE c,
    params LIKE pri_params,
    job_released LIKE btch0000-char1,
    job_name LIKE tbtcjob-jobname,
    job_count LIKE tbtcjob-jobcount.
    DATA:
    BEGIN OF t_kna1 OCCURS 0,
       kunnr LIKE kna1-kunnr,
       knrza LIKE kna1-knrza,
    END OF t_kna1.
    DATA:
    s_monat1    LIKE bkpf-monat,
    s_monat2    LIKE bkpf-monat,
    s_monat3    LIKE bkpf-monat,
    s_monat4    LIKE bkpf-monat,
    s_monat5    LIKE bkpf-monat,
    s_monat6    LIKE bkpf-monat,
    s_monat7    LIKE bkpf-monat,
    s_monat8    LIKE bkpf-monat,
    s_monat9    LIKE bkpf-monat,
    s_monat10   LIKE bkpf-monat,
    s_monat11   LIKE bkpf-monat,
    s_monat12   LIKE bkpf-monat,
    s_monatlow  LIKE bkpf-monat,                               "DB05+
    s_monathigh LIKE bkpf-monat.                               "DB05+
    End of RC03
    CONSTANTS:
      c_company_code(4) VALUE 'PF01'.
    RANGES:
      r_rstgr FOR bseg-rstgr.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_gjahr LIKE bkpf-gjahr OBLIGATORY.
    SELECT-OPTIONS: s_monat FOR bkpf-monat  OBLIGATORY,     "RC03+   "DB05+
                    s_blart FOR bkpf-blart  OBLIGATORY,         "DB05+
                    s_budat FOR bkpf-budat.                     "PG01+
    SELECT-OPTIONS: s_hkont FOR bseg-hkont,
                    s_rstgr FOR bseg-rstgr.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-026.
    PARAMETERS: p_pdf AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK b2.
    *Start of RC03
    PARAMETERS:
    backgr(1) TYPE c DEFAULT 'X' MODIF ID dsp,
    process(1) TYPE c MODIF ID dsp.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-group1 = 'DSP'.
          screen-active = '0'.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    *End of RC03
    Print page headers *
    TOP-OF-PAGE.
      PERFORM page_header.
    START-OF-SELECTION.
    Start Processing
      IF process = 'X'.
        PERFORM main.
      ENDIF.
    Submit background job
      IF backgr = 'X'.
        job_name = 'Reason Code Report'.
        MESSAGE s000 WITH 'Background job has been submitted.'.
        PERFORM background.
      ENDIF.
    PDF creation
      IF p_pdf = 'X'.                                           "RC04
        SUBMIT zsdl_393_create_pdf
        VIA SELECTION-SCREEN AND RETURN.                        "RC04
      ENDIF.                                                    "RC04
    FORM main.
    Load Data into internal tables *
    *SELECT bukrs belnr gjahr budat FROM bkpf "PG01-
    *SELECT bukrs belnr gjahr budat xblnr FROM bkpf "PG01+    "DB05-
      SELECT bukrs belnr gjahr blart budat xblnr FROM bkpf      "DB05+
        INTO CORRESPONDING FIELDS OF TABLE t_bkpf
        WHERE gjahr = p_gjahr "Fiscal Year
         AND monat = p_monat  "Posting Period               "RC03-
           AND monat IN s_monat  "Posting Period              "RC03+
           AND blart IN s_blart  "Document Type               "DB05+
           AND budat IN s_budat. "Posting Date                "PG01+
    *AND (blart = 'AB' OR blart = 'DZ' OR blart = 'ZO' ).     "DB05-
      IF NOT t_bkpf[] IS INITIAL.
    If the user selected specific Reason Codes, use that range...
    Otherwise, create a range of valid Reason Codes from table T053R.
        IF s_rstgr IS INITIAL.
       READ TABLE t_bkpf INDEX 1. "Get first record for company code
          SELECT rstgr FROM t053r
            INTO l_rstgr
            WHERE bukrs = c_company_code.
            r_rstgr-sign = 'I'.          "Include
            r_rstgr-option = 'EQ'.       "where values equal
            r_rstgr-low = l_rstgr.       "comparison field
            APPEND r_rstgr.
          ENDSELECT.
        ELSE.
          r_rstgr[] = s_rstgr[].
        ENDIF.
    *--- This section removed b/c of TDS review
    SELECT bukrs belnr shkzg wrbtr sgtxt hkont
            kunnr rstgr prctr  zloc zexp zdtl
       FROM bseg
       INTO CORRESPONDING FIELDS OF t_bseg
       FOR ALL ENTRIES IN t_bkpf
       WHERE bukrs = t_bkpf-bukrs "Company code
       AND   belnr = t_bkpf-belnr "Doc#
       AND   hkont IN s_hkont     "Account# range
       AND   rstgr IN r_rstgr.    "Reason Code range
        Override blank Customer number in table from BSEG record.
         SELECT SINGLE kunnr FROM bseg
                     INTO t_bseg-kunnr
                     WHERE bukrs = t_bkpf-bukrs
                       AND belnr = t_bkpf-belnr
                       AND gjahr = t_bkpf-gjahr
                       AND koart = 'D'.
         if sy-subrc > 0.
           t_bseg-kunnr = ' '.
         endif.
       APPEND t_bseg.
    ENDSELECT.
    *--- End of TDS review removal
    *--- This is the new section added b/c of the TDS review
        SELECT bukrs belnr gjahr shkzg wrbtr sgtxt hkont
             kunnr rstgr prctr  zloc zexp zdtl                "PG01-
               kunnr rstgr prctr xref1 "zloc zexp zdtl           "PG01+
               FROM bseg
          INTO CORRESPONDING FIELDS OF TABLE t_bseg
          FOR ALL ENTRIES IN t_bkpf
          WHERE bukrs = t_bkpf-bukrs "Company code
          AND   belnr = t_bkpf-belnr "Doc#
          AND   hkont IN s_hkont     "Account# range
          AND   rstgr IN r_rstgr.    "Reason Code range
    Retrieve records from BSEG which have the Customer number
        SELECT bukrs belnr gjahr kunnr FROM bseg
                    INTO CORRESPONDING FIELDS OF TABLE t_kunnr
                    FOR ALL ENTRIES IN t_bkpf
                    WHERE bukrs = t_bkpf-bukrs
                      AND belnr = t_bkpf-belnr
                      AND gjahr = t_bkpf-gjahr
                      AND koart = 'D'.
    *--- End of TDS review addition
    *->Start of RC03
        SELECT kunnr
               knrza
               FROM kna1
               INTO TABLE t_kna1
               FOR ALL ENTRIES IN t_kunnr
               WHERE kunnr = t_kunnr-kunnr.
        SORT t_kna1 BY kunnr.
    *->End of RC03
      ENDIF. "t_bkpf has records in it
    MAINLINE - Write Report Details *
      detail_section = 'Y'. "Write column headers
      NEW-PAGE.
      CLEAR sum_wrbtr.
      SORT t_bkpf BY bukrs belnr.
    MAINLINE - LOOP THROUGH INTERNAL TABLE & PROCESS REPORT.
      SORT t_bseg BY rstgr belnr.
      LOOP AT t_bseg.
        ON CHANGE OF t_bseg-rstgr.
          IF sy-tabix <> 1. "If not first time
            PERFORM write_detail_subtotal.
          ENDIF.
          CLEAR sum_wrbtr. "Clear sum for next reason code.
          save_rstgr = t_bseg-rstgr.
          save_sgtxt = t_bseg-sgtxt.                            "PG02+
        ENDON.
    Set amount field, add to sum, and print detail line.
        amount_out = t_bseg-wrbtr.
        IF t_bseg-shkzg = 'H'.
          MULTIPLY amount_out BY -1.
        ENDIF.
        sum_wrbtr = sum_wrbtr + amount_out.
        PERFORM write_detail_line.
    Add amount to GL Account total internal table
        CLEAR t_hkont_sum-hkont.
        CLEAR t_hkont_sum-wrbtr.
        READ TABLE t_hkont_sum WITH KEY hkont = t_bseg-hkont.
        t_hkont_sum-wrbtr = t_hkont_sum-wrbtr + amount_out.
        IF sy-subrc = 0. "GL Account already found.
          MODIFY t_hkont_sum INDEX sy-tabix. "Modify existing itab record
        ELSE.
          t_hkont_sum-hkont = t_bseg-hkont.  "Set Account# itab key field
          APPEND t_hkont_sum.
        ENDIF.
        AT LAST.
          PERFORM write_detail_subtotal.
        ENDAT.
      ENDLOOP.
      FREE t_bkpf.
      FREE t_bseg.
      detail_section = 'N'. "Suppress column headers
      PERFORM write_summary. "Print Summary page by Reason & GL Account
    ENDFORM.                    " main
    *&      Form  page_header
          text
    -->  p1        text
    <--  p2        text
    FORM page_header.
    Start of RC03
      LOOP AT s_monat.
        CASE sy-tabix.
          WHEN 1.
            s_monat1    = s_monat-low.
            s_monatlow  = s_monat-low.                          "DB05+
            s_monathigh = s_monat-high.                         "DB05+
          WHEN 2.
            s_monat2 = s_monat-low.
          WHEN 3.
            s_monat3 = s_monat-low.
          WHEN 4.
            s_monat4 = s_monat-low.
          WHEN 5.
            s_monat5 = s_monat-low.
          WHEN 6.
            s_monat6 = s_monat-low.
          WHEN 7.
            s_monat7 = s_monat-low.
          WHEN 8.
            s_monat8 = s_monat-low.
          WHEN 9.
            s_monat9 = s_monat-low.
          WHEN 10.
            s_monat10 = s_monat-low.
          WHEN 11.
            s_monat11 = s_monat-low.
          WHEN 12.
            s_monat12 = s_monat-low.
        ENDCASE.
      ENDLOOP.
    End of RC03
      CALL FUNCTION 'Z_STANDARD_REPORT_HEADER'
        EXPORTING
          report_name  = sy-cprog
          report_width = sy-linsz
          report_title = 'Reason Code Summary'.
      SKIP.
    Print selected Fiscal Year
      WRITE AT: /51  text-002,
                 66  p_gjahr.
    Print selected Fiscal Period
      WRITE AT: /51  text-003.                                  "DB05
               66  p_monat.                                   "RC03-
    Start of RC03
      IF s_monathigh = 0.                                       "DB05+
        WRITE AT:  66  s_monat1    NO-ZERO,
                   69  s_monat2    NO-ZERO,
                   72  s_monat3    NO-ZERO,
                   75  s_monat4    NO-ZERO,
                   78  s_monat5    NO-ZERO,
                   81  s_monat6    NO-ZERO,
                  /66  s_monat7    NO-ZERO,
                   69  s_monat8    NO-ZERO,
                   72  s_monat9    NO-ZERO,
                   75  s_monat10   NO-ZERO,
                   78  s_monat11   NO-ZERO,
                   81  s_monat12   NO-ZERO.
      ELSE.                                                     "DB05+
        WRITE AT:  66  s_monatlow  NO-ZERO,                     "DB05+
                   69  '-',                                     "DB05+
                   71  s_monathigh NO-ZERO,                     "DB05+
                   74  s_monat2    NO-ZERO,                     "DB05+
                   77  s_monat3    NO-ZERO,                     "DB05+
                   80  s_monat4    NO-ZERO,                     "DB05+
                   83  s_monat5    NO-ZERO,                     "DB05+
                  /66  s_monat6    NO-ZERO,                     "DB05+
                   69  s_monat7    NO-ZERO,                     "DB05+
                   72  s_monat8    NO-ZERO,                     "DB05+
                   75  s_monat9    NO-ZERO,                     "DB05+
                   78  s_monat10   NO-ZERO,                     "DB05+
                   81  s_monat11   NO-ZERO,                     "DB05+
                   84  s_monat12   NO-ZERO.                     "DB05+
      ENDIF.                                                    "DB05+
    *End of RC03
    Print selected Posting Date range
      WRITE AT: /51  text-022.                                  "PG01+
      IF s_budat IS INITIAL.                                    "PG01+
        WRITE AT:  66  'All'.                                   "PG01+
      ELSE.                                                     "PG01+
        WRITE AT:  66  s_budat-low,                             "PG01+
                   77  '-',                                     "PG01+
                   79  s_budat-high.                            "PG01+
      ENDIF.                                                    "PG01+
      SKIP.
      SKIP.
    If we are in the detail section of the report, print column headers.
      IF detail_section = 'Y'.
        WRITE AT: /21 text-004,
                   34 t_bseg-rstgr,
                   39 text-005,
                   52 t_bseg-sgtxt.
        SKIP.
        WRITE AT: /1 text-006, "Doc Number"
                13 text-007, "Business Unit"            "DB05-
                28 text-008, "Location"                 "DB05-
                38 text-009, "Account"                  "DB05-
                50 text-010, "Expense"                  "DB05-
                59 text-011, "Detail"                   "DB05-
                69 text-012, "Customer"                 "DB05-
                81 text-025, "Alt Payer                 "DB05-
                93 text-023, "Reference      "PG01+     "DB05-
               111 text-024, "Ref Key 1      "PG01+     "DB05-
                81 text-013, "Amount"        "PG01-     "DB05-
                99 text-014. "Posting Date"  "PG01-     "DB05-
               125 text-013, "Amount"        "PG01+     "DB05-
               143 text-014. "Posting Date"  "PG01+     "DB05-
                  13 text-027, "Doc Type"                 "DB05+
                  23 text-007, "Business Unit"            "DB05+
                  38 text-008, "Loc"                      "DB05+
                  44 text-009, "Account"                  "DB05+
                  56 text-010, "Exp"                      "DB05+
                  61 text-011, "Detail"                   "DB05+
                  71 text-012, "Customer"                 "DB05+
                  83 text-025, "Alt Payer                 "DB05+
                  95 text-023, "Reference          "PG01+ "DB05+
                 113 text-024, "Ref Key 1          "PG01+ "DB05+
                 127 text-013, "Amount"            "PG01+ "DB05+
                 145 text-014. "Posting Date"      "PG01+ "DB05+
        WRITE AT: /1 '----
    ',       "Underline Doc Number
              13 '-------------',      "Underline Business Unit   "DB05-
              28 '--------',           "Underline Location        "DB05-
              38 '----------',         "Underline Account         "DB05-
              50 '-------',            "Underline Expense         "DB05-
              59 '--------',           "Underline Detail          "DB05-
              69 '----------',         "Underline Customer        "DB05-
              81 '----------',         "Underline Alternate payer "DB05-
              93 '----------------',   "Underline Reference       "DB05-
             111 '------------',       "Underline Ref Key 1       "DB05-
             125 '----------------',   "Underline Amount          "DB05-
             143 '------------'.       "Underline Posting Date    "DB05-
                13 '----
    ',           "Underline Doc Type        "DB05+
                23 '----
    ',      "Underline Business Unit   "DB05+
                38 '----',               "Underline Loc             "DB05+
                44 '----
    ',         "Underline Account         "DB05+
                56 '---',                "Underline Exp             "DB05+
                61 '----
    ',           "Underline Detail          "DB05+
                71 '----
    ',         "Underline Customer        "DB05+
                83 '----
    ',         "Underline Alternate payer "DB05+
                95 '----
    ',   "Underline Reference       "DB05+
               113 '----
    ',       "Underline Ref Key 1       "DB05+
               127 '----
    ',   "Underline Amount          "DB05+
               145 '----
    '.       "Underline Posting Date    "DB05+
    *->Start RC03
               81 '----------------',   "Underline Reference "PG01+
               99 '------------',       "Underline Ref Key 1 "PG01+
               81 '----------------',   "Underline Amount       "PG01-
               99 '------------'.       "Underline Posting Date "PG01-
              113 '----------------',   "Underline Amount        "PG01+
              131 '------------'.       "Underline Posting Date  "PG01+
    End RC03
        SKIP.
      ENDIF.
    ENDFORM.                    " page_header
    *&      Form  Write_Detail_Line
          Print a detail line.
    -->  p1        text
    <--  p2        text
    FORM write_detail_line.
    Retrieve the Posting Date from the header table (BUDAT)
      READ TABLE t_bkpf
        WITH TABLE KEY bukrs = t_bseg-bukrs
                       belnr = t_bseg-belnr
                       gjahr = t_bseg-gjahr.
    *--- This is a new section added b/c of the TDS review
    Retrieve the Customer number from the 'D' BSEG records
      READ TABLE t_kunnr
        WITH KEY bukrs = t_bseg-bukrs
                 belnr = t_bseg-belnr
                 gjahr = t_bkpf-gjahr.
      IF sy-subrc <> 0.
        t_kunnr-kunnr = 9999999999.
      ENDIF.
    *--- End of TDS review addition
    *Start of RC03
      CLEAR t_kna1.
      READ TABLE t_kna1 WITH KEY kunnr = t_kunnr-kunnr.
    *End of RC03
      WRITE AT: /1 t_bseg-belnr,
              13 t_bseg-prctr,                               "DB05-
              28 t_bseg-zloc,                                "DB05-
              38 t_bseg-hkont,                               "DB05-
              50 t_bseg-zexp,                                "DB05-
              59 t_bseg-zdtl,                                "DB05-
    *TDS-       69 t_bseg-kunnr,                               "DB05-
              69 t_kunnr-kunnr,                      "TDS+   "DB05-
              81 t_kna1-knrza,            "Alt payer "RC03+  "DB05-
              93 t_bkpf-xblnr,            "Reference "PG01+  "DB05-
             111 t_bseg-xref1,            "Ref Key 1 "PG01+  "DB05-
              81 amount_out,                         "PG01-  "DB05-
              99 t_bkpf-budat.                       "PG01-  "DB05-
             125 amount_out,                         "PG01+  "DB05-
             143 t_bkpf-budat.                       "PG01+  "DB05-
                13 t_bkpf-blart,                                "DB05+
                23 t_bseg-prctr,                                "DB05+
               38 t_bseg-zloc,                                 "DB05+
                44 t_bseg-hkont,                                "DB05+
               56 t_bseg-zexp,                                 "DB05+
               61 t_bseg-zdtl,                                 "DB05+
                71 t_kunnr-kunnr,                      "TDS+   "DB05+
                83 t_kna1-knrza,            "Alt payer "RC03+  "DB05+
                95 t_bkpf-xblnr,            "Reference "PG01+  "DB05+
               113 t_bseg-xref1,            "Ref Key 1 "PG01+  "DB05+
               127 amount_out,                         "PG01+  "DB05+
               145 t_bkpf-budat.                       "PG01+  "DB05+
    ENDFORM.                    " Write_Detail_Line
    *&      Form  Write_Detail_Subtotal
          Write the Reason Code subtotal line for the detail section.
    -->  p1        text
    <--  p2        text
    FORM write_detail_subtotal.
    WRITE AT: /81  '----------------'. "PG01-
    WRITE AT: /56  text-015,           "PG01-
               81  sum_wrbtr.          "PG01-
    WRITE AT: /81  '----------------'. "PG01-
    WRITE AT: /81  '----------------'. "PG01-
    WRITE AT: /125 '----------------'. "PG01+                  "DB05-
    WRITE AT: /56  text-015,           "PG01+                  "DB05-
               125 sum_wrbtr.          "PG01+                  "DB05-
    WRITE AT: /125 '----------------'. "PG01+                  "DB05-
    WRITE AT: /125 '----------------'. "PG01+                  "DB05-
      WRITE AT: /127 '----
    '. "PG01+                  "DB05+
      WRITE AT: /56  text-015,           "PG01+                  "DB05+
                 127 sum_wrbtr.          "PG01+                  "DB05+
      WRITE AT: /127 '----
    '. "PG01+                  "DB05+
      WRITE AT: /127 '----
    '. "PG01+                  "DB05+
      NEW-PAGE.
    Add the total for this reason code to an internal table
    for printing the Summary Page at the end.
      CLEAR t_rstgr_sum-rstgr.
      CLEAR t_rstgr_sum-wrbtr.
      t_rstgr_sum-rstgr = save_rstgr.
      t_rstgr_sum-sgtxt = save_sgtxt.                           "PG02+
      t_rstgr_sum-wrbtr = sum_wrbtr.
      APPEND t_rstgr_sum.
    ENDFORM.                    " Write_Detail_Subtotal
    *&      Form  Write_Summary
          Prints the Summary section at the end of the report
    -->  p1        text
    <--  p2        text
    FORM write_summary.
      NEW-PAGE.
      WRITE AT: /20 text-016.
      SKIP.
    Print Summary by Reason Code
    WRITE AT: /20 text-017. "Reason Code  Description                Total"
      SKIP.
      CLEAR grand_wrbtr.
      LOOP AT t_rstgr_sum.
        grand_wrbtr = grand_wrbtr + t_rstgr_sum-wrbtr.
        IF first_reason IS INITIAL.
          WRITE AT: /27 t_rstgr_sum-rstgr,
                  33 text-021, "Dollar sign ($) "PG02-
                  34 t_rstgr_sum-wrbtr.         "PG02-
                     33 t_rstgr_sum-sgtxt,
                     83 text-021, "Dollar sign ($) "PG02+
                     84 t_rstgr_sum-wrbtr.
          first_reason = 'N'.
        ELSE.
          WRITE AT: /27 t_rstgr_sum-rstgr,
                  34 t_rstgr_sum-wrbtr. "PG02-
                     33 t_rstgr_sum-sgtxt,
                     84 t_rstgr_sum-wrbtr.
        ENDIF.
      ENDLOOP.
      PERFORM grand_total.
      SKIP.
      SKIP.
      SKIP.
    Print Summary by GL Account
      WRITE AT: /20 text-018. "GL Account   Total"
      SKIP.
      CLEAR grand_wrbtr.
      LOOP AT t_hkont_sum.
        grand_wrbtr = grand_wrbtr + t_hkont_sum-wrbtr.
        IF first_glacct IS INITIAL.
          WRITE AT: /22 t_hkont_sum-hkont,
                     83 text-021, "Dollar sign ($)
                     84 t_hkont_sum-wrbtr.
          first_glacct = 'N'.
        ELSE.
          WRITE AT: /22 t_hkont_sum-hkont,
                     84 t_hkont_sum-wrbtr.
        ENDIF.
      ENDLOOP.
      PERFORM grand_total.
    ENDFORM.                    " Write_Summary
    *&      Form  Grand_Total
    *&  Replaced below by mod PG02.
          Writes Grand Total lines of the two summary page sections.
    -->  p1        text
    <--  p2        text
    *FORM grand_total.
    *SKIP.
    *WRITE AT: /33 text-020. "16 dashes (for underlining)
    *WRITE AT: /19 text-019, "Grand Total"
              33 text-021, "Dollar sign ($)
              34 grand_wrbtr.
    *WRITE AT: /33 text-020. "16 dashes (for underlining)
    *WRITE AT: /33 text-020. "16 dashes (for underlining)
    *SKIP.
    *ENDFORM. " Grand_Total
    *&      Form  Grand_Total
    *&  New column numbers by mod PG02
          Writes Grand Total lines of the two summary page sections.
    -->  p1        text
    <--  p2        text
    FORM grand_total.
      SKIP.
      WRITE AT: /83 text-020. "16 dashes (for underlining)
      WRITE AT: /19 text-019, "Grand Total"
                 83 text-021, "Dollar sign ($)
                 84 grand_wrbtr.
      WRITE AT: /83 text-020. "16 dashes (for underlining)
      WRITE AT: /83 text-020. "16 dashes (for underlining)
      SKIP.
    ENDFORM. " Grand_Total
    *&      Form  background
          text
    -->  p1        text
    <--  p2        text
    FORM background.
    *Get print parameters
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          immediately    = ' '
          no_dialog      = 'X'
        IMPORTING
          out_parameters = params
          valid          = valid.
    *Job Open
      CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          jobname          = job_name
          sdlstrtdt        = sy-datum
          sdlstrttm        = sy-uzeit
        IMPORTING
          jobcount         = job_count
        EXCEPTIONS
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          OTHERS           = 4.
    *Background job submittion
      SUBMIT zsdl_393_reason_code_report
      WITH p_gjahr   =  p_gjahr
      WITH s_monat   IN s_monat
      WITH s_blart   IN s_blart
      WITH s_budat   IN s_budat
      WITH s_hkont   IN s_hkont
      WITH s_rstgr   IN s_rstgr
      WITH backgr    = ' '
      WITH process   = 'X'
      VIA JOB job_name
      NUMBER job_count
      AND RETURN.
    *Job Close
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount             = job_count
          jobname              = job_name
          strtimmed            = 'X'
          targetsystem         = sy-host
        IMPORTING
          job_was_released     = job_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
          OTHERS               = 8.
    ENDFORM.                    " background
    this is a report of pdf
    theres is one pdf file could u plz explain this
    TABLES: tsp01,
            knvh,
            scal,
            p0001.
    I N T E R N A L  T A B L E S                                        *
    DATA: int_spo LIKE tsp01 OCCURS 100 WITH HEADER LINE.
    DATA: int_tsp01p LIKE tsp01psy OCCURS 100 WITH HEADER LINE.
    DATA: otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
    DATA: pdf LIKE tline OCCURS 100 WITH HEADER LINE.
    DATA: doctab LIKE docs OCCURS 1 WITH HEADER LINE.
    DATA: int_xpm LIKE btcxpm OCCURS 100 WITH HEADER LINE.
    DATA: cancel.
    DATA: BEGIN OF int_knvh OCCURS 100,
            kunnr  LIKE knvh-kunnr,
            hkunnr LIKE knvh-hkunnr.
    DATA: END OF int_knvh.
    DATA: BEGIN OF db_tab OCCURS 100,
            filenam(128) TYPE c.
    DATA: END OF db_tab.
    D A T A  C O N S T A N T S                                          *
    DATA: numbytes    TYPE i,
          arc_idx     LIKE toa_dara,
          pdfspoolid  LIKE tsp01-rqident,
          rq2name(12) TYPE n,
          rqcretime   LIKE tsp01-rqcretime,
          hkunnr      LIKE knvh-hkunnr,
          hreffile(30) TYPE c,
          jobname     LIKE tbtcjob-jobname,
          jobcount    LIKE tbtcjob-jobcount,
          counter     LIKE syst-tabix,
          g_count(4)  TYPE n,
          g_path      LIKE rlgrap-filename,
          g_filename TYPE string.
    DATA: client      LIKE tst01-dclient,
          name        LIKE tst01-dname,
          objtype     LIKE rststype-type,
          type        LIKE rststype-type,
          dblink      LIKE rlgrap-filename,
          bothpath    LIKE rlgrap-filename,
          add_param   LIKE sxpgcolist-parameters,
          icon_note(5).
    DATA: date        LIKE scal-date,
          weekday     LIKE scal-indicator,
          days        LIKE t5a4a-dlydy,
          months      LIKE t5a4a-dlymo,
          years       LIKE t5a4a-dlyyr,
          saturday    LIKE p0001-begda.
    P A R A M E T E R S  &  S E L E C T - O P T I O N S                 *
    SELECTION-SCREEN BEGIN OF BLOCK box WITH FRAME TITLE text-001.
    PARAMETERS:       p_client LIKE tsp01-rqclient DEFAULT syst-mandt.
    SELECT-OPTIONS:   s_spool FOR tsp01-rqident,
                      s_rqdate FOR sy-datum,
                      s_otptd FOR tsp01-rqdest NO INTERVALS.
    SELECT-OPTIONS:   p_rqnam1 FOR tsp01-rq0name NO INTERVALS,
                      p_rqnam2 FOR tsp01-rq1name NO INTERVALS,
                      p_rqnam3 FOR tsp01-rq2name NO INTERVALS,
                      s_rqownr FOR tsp01-rqowner NO INTERVALS,
                      s_rqtitl FOR tsp01-rqtitle NO INTERVALS.
    SELECTION-SCREEN SKIP.
    Block PDF description
    SELECTION-SCREEN BEGIN OF BLOCK desc WITH FRAME TITLE text-017.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:  p_sfx12 RADIOBUTTON GROUP two.
    SELECTION-SCREEN COMMENT 4(27) text-022.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:  p_sfx2 RADIOBUTTON GROUP two.
    SELECTION-SCREEN COMMENT 4(27) text-018.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:  p_titl RADIOBUTTON GROUP two.
    SELECTION-SCREEN COMMENT 4(27) text-019.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:  p_cust RADIOBUTTON GROUP two.
    SELECTION-SCREEN COMMENT 4(27) text-020.
    PARAMETERS:          pt_tcust(20) TYPE c.
    SELECTION-SCREEN COMMENT 52(1) text-024.
    PARAMETERS:  p_incre AS CHECKBOX.
    SELECTION-SCREEN COMMENT (20) text-021.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:  p_date AS CHECKBOX.
    SELECTION-SCREEN COMMENT 4(27) text-023.
    *PARAMETERS:          pt_date LIKE sy-datum DEFAULT sy-datum.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK desc.
    *Block download
    SELECTION-SCREEN BEGIN OF BLOCK options WITH FRAME TITLE text-003.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:       p_unix  RADIOBUTTON GROUP one.
    SELECTION-SCREEN COMMENT 4(27) text-007.
    PARAMETERS:       p_unxpat  LIKE rlgrap-filename.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:       p_pcdwn RADIOBUTTON GROUP one.
    SELECTION-SCREEN COMMENT 4(27) text-006.
    PARAMETERS:      p_pcpath LIKE rlgrap-filename.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:      p_test   AS CHECKBOX.
    SELECTION-SCREEN COMMENT 4(27) text-008.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK options.
    *Block Pointer file
    SELECTION-SCREEN BEGIN OF BLOCK dbfile WITH FRAME TITLE text-016.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS:      p_point   AS CHECKBOX.
    SELECTION-SCREEN COMMENT 4(27) text-025.
    PARAMETERS:      p_dbfile LIKE rlgrap-filename.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK dbfile.
    SELECTION-SCREEN END OF BLOCK box.
    AT-SELECTION-SCREEN                                                  *
    AT SELECTION-SCREEN ON pt_tcust.
      IF p_cust = 'X' AND
         pt_tcust IS INITIAL.
        MESSAGE e000 WITH 'Please enter custom name'.
      ENDIF.
    AT SELECTION-SCREEN ON p_unxpat.
      IF p_unix = 'X' AND
         p_unxpat IS INITIAL.
        MESSAGE e000 WITH 'Please enter Unix path'.
      ENDIF.
    AT SELECTION-SCREEN ON p_pcpath.
      IF p_pcdwn = 'X' AND
         p_pcpath IS INITIAL.
        MESSAGE e000 WITH 'Please enter PC path'.
      ENDIF.
    AT SELECTION-SCREEN ON p_dbfile.
      IF p_point = 'X' AND
         p_dbfile IS INITIAL.
        MESSAGE e000 WITH 'Please enter pointer file path in Unix'.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pcpath.
    *Checks for the selected file
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                mask             = ',*  ,*.'
                mode             = '0'
           IMPORTING
                filename         = g_filename
           EXCEPTIONS
                inv_winsys       = 1
                no_batch         = 2
                selection_cancel = 3
                selection_error  = 4
                OTHERS           = 5.
      IF sy-subrc = 0.
        p_pcpath = g_filename.
      ENDIF.
    TOP OF PAGE                                                          *
    TOP-OF-PAGE.
      PERFORM page_header.
    START OF SELECTION                                                  *
    START-OF-SELECTION.
      SELECT * FROM tsp01 CLIENT SPECIFIED WHERE rqident IN s_spool
                            AND rqclient EQ p_client
                            AND rqdest  IN s_otptd
                            AND rq0name IN p_rqnam1
                            AND rq1name IN p_rqnam2
                            AND rq2name IN p_rqnam3
                            AND rqowner IN s_rqownr
                            AND rqtitle IN s_rqtitl.
        CHECK tsp01-rqcretime(8) IN s_rqdate.
        MOVE tsp01-rqident TO int_spo-rqident.
        MOVE tsp01-rq0name TO int_spo-rq0name.
        MOVE tsp01-rq1name TO int_spo-rq1name.
        MOVE tsp01-rq2name TO int_spo-rq2name.
        MOVE tsp01-rqtitle TO int_spo-rqtitle.
        MOVE tsp01-rqcretime(8) TO int_spo-rqcretime.
        MOVE tsp01-rqdest TO int_spo-rqdest.
        APPEND int_spo.
      ENDSELECT.
      IF sy-subrc NE 0.
    Invalid parameters entered!  Please correct and re-execute.
        MESSAGE s014(zz).
      ENDIF.
    END-OF-SELECTION.
      CLEAR: int_spo.
      SORT int_spo BY rqident rq2name.
      LOOP AT int_spo.
    Sapscript or list
        PERFORM sapscript_or_list.
    Define PDF description
        PERFORM pdf_desc.
    Option to download PDF files to local PC
    Real-time or test mode
        IF p_test <> 'X'.
          IF p_pcdwn EQ 'X'.
            PERFORM down_to_pc.
    Option to download PDF files to Unix
          ELSEIF p_unix = 'X'.
            PERFORM down_to_unix.
          ENDIF.
        ENDIF.
    Print report
      

    Hello...
    Create a new function group and required function module in the RD2 server using SE37. Enter the various parameters and exceptions, then cut and paste the code from one system to another. Create includes and use cut and paste to do that as well.

  • PDF Download Problem

    Hi,
    I have one report using Reuse_Alv_List_Display as output. After that I have to download the output to PDF.
    By using the following code I can able to download, But the Problem is I have 54 fields( total length to 900 characters) in the out put and while downloading through Spool I am getting only 17 fields in one row and remaining fields are getting in 2nd and 3rd rows and are getting overlap.
    So is there any Possibility to download to 54 Fields in PDF.If so, Please help me...
    *&      Form  USER_COMMAND
          Form for user-command for providing Pdf Functionlity.
    -->  No Import / Export Parameters.
    FORM user_command USING l_okcode LIKE sy-ucomm
                           l_selfield TYPE slis_selfield .
      CASE l_okcode.
        WHEN '&PDF'.
          g_flag = 'X'.
          PERFORM pdf_download.
      ENDCASE.
    ENDFORM.                    " USER_COMMAND
    *&      Form  PDF_DOWNLOAD
          Form for Pdf functionalty
    -->  No Import / Export Parameters
    FORM pdf_download .
      DATA l_spoolid TYPE tsp01-rqident.
    Without archiving
      DATA: params LIKE pri_params,
      days(1) TYPE n VALUE 2,
      count(3) TYPE n VALUE 1, p_file TYPE rlgrap-filename,
      valid TYPE c.
      CLEAR l_spoolid.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          destination    = 'LOCA'
          copies         = count
          list_name      = 'TEST'
          list_text      = 'SUBMIT ... TO SAP-SPOOL'
          immediately    = 'X'
          release        = 'X'
          new_list_id    = 'X'
          expiration     = days
          line_size      = 132
          line_count     = 25
          layout         = 'X'
          sap_cover_page = 'X'
          cover_page     = 'X'
          receiver       = 'SAP*'
          department     = 'System'
          no_dialog      = ' '
        IMPORTING
          out_parameters = params
          valid          = valid.
      IF valid <> space.
        EXPORT g_flag TO MEMORY ID 'M1'.
        SUBMIT z_fi_exec_customercollection WITH s_kunnr IN s_kunnr
                                    WITH s_bukrs IN s_bukrs
                                    WITH s_budat IN s_budat
                                         TO SAP-SPOOL
        SPOOL PARAMETERS params
        WITHOUT SPOOL DYNPRO
        AND RETURN.
      ENDIF.
      DATA: lt_spooltab TYPE STANDARD TABLE OF  rsporq WITH HEADER LINE ,
        lc_rq2name LIKE tsp01-rq2name.
      CONCATENATE sy-repid+0(8)
                    sy-uname+0(3)
          INTO lc_rq2name SEPARATED BY '_'.
      CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
        EXPORTING
          rq2name       = lc_rq2name
          rqowner       = sy-uname
        TABLES
          spoolrequests = lt_spooltab
        EXCEPTIONS
          no_permission = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        WRITE:/ 'Error in Find Spool request '.
      ENDIF.
      SORT lt_spooltab DESCENDING BY rqcretime.
      READ TABLE lt_spooltab INDEX 1.
      l_spoolid = lt_spooltab-rqident.
      SUBMIT rstxpdft4 WITH spoolno EQ l_spoolid
                       WITH download EQ 'X'
                       WITH  p_file EQ p_file
                       AND RETURN.
    ENDFORM.                    " PDF_DOWNLOAD
    *&      Form  SET_PF_STATUS
          Setting Modified Pf-Status to our program.
    -->  No Import / Export Parameters.
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD_ALV_C'.
    ENDFORM.                    " SET_PF_STATUS

    Hi,
    I dont know the possibility but we can do some thing by using the hirarchial list display, reduce the field lengths where ever is unnecessary you will get it.
    Regards,
    venkat appikonda.

  • Print spool in a report

    I have a spool number and i want to print from a report. How can I do it?

    No it will just return the contents of spool in an internal table..
    For printing use
    GET_PRINT_PARAMETERS
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          destination    = 'LOCL'
          copies         = 1
          list_name      = 'list1234'
          list_text      = 'Delivery consolidation rep for ASN'
          immediately    = 'X'
          release        = ' '
          new_list_id    = 'X'
          expiration     = 2
          line_size      = 79
          line_count     = 65
          layout         = 'X_PAPER'
          sap_cover_page = ' '
          receiver       = 'SAP*'
          department     = 'System'
          sap_object     = 'RS'
          ar_object      = 'TEST'
          archive_id     = 'XX'
          archive_info   = 'III'
          archive_text   = 'Description'
          archive_mode   = '1'
          no_dialog      = 'X'
        IMPORTING
          out_parameters = params.
    Thanks.

  • How to print the dialog screen result

    Experts,
    Iam using dynpro and as a result a graph is printed on the screen container. This is my final screen and I want to take a print of that container with graph. so I have activated the print button in the functional keys by selecting the normal application function type.
    my screen output is graph as i said.
    My program code is like below
    PROGRAM  Z_GRP_PRT.
    TYPE-POOLS: GFW.
    DATA PARAMS LIKE PRI_PARAMS.
    DATA: OK_CODE TYPE SY-UCOMM,SAVE_OK LIKE  OK_CODE,
          VALUES TYPE TABLE OF GPRVAL WITH HEADER LINE,
          COLUMN_TEXTS TYPE TABLE OF GPRTXT WITH HEADER LINE.
    DATA: DAYS(1)  TYPE N VALUE 2,
          COUNT(3) TYPE N VALUE 1,
          VALID    TYPE C.
    MODULE STATUS_1000 OUTPUT
    MODULE STATUS_1000 OUTPUT.
      SET PF-STATUS 'YUSR1'.
      REFRESH VALUES.
      REFRESH COLUMN_TEXTS.
      VALUES-ROWTXT = 'Prod1 '.
      VALUES-VAL1 = 1.
      VALUES-VAL2 = 5.
      VALUES-VAL3 = 6.
      VALUES-VAL4 = 7.
      APPEND VALUES.
      VALUES-ROWTXT = 'Prod2 '.
      VALUES-VAL1 = 0.
      VALUES-VAL2 = 5.
      VALUES-VAL3 = 2.
      VALUES-VAL4 = 5.
      APPEND VALUES.
      COLUMN_TEXTS-COLTXT = 'time1'.
      APPEND COLUMN_TEXTS.
      COLUMN_TEXTS-COLTXT = 'time2'.
      APPEND COLUMN_TEXTS.
      COLUMN_TEXTS-COLTXT = 'time3'.
      APPEND COLUMN_TEXTS.
      COLUMN_TEXTS-COLTXT = 'time4'.
      APPEND COLUMN_TEXTS.
      CALL FUNCTION 'GFW_PRES_SHOW'
        EXPORTING
          CONTAINER         = 'CONTAINER'
          PRESENTATION_TYPE = GFW_PRESTYPE_LINES
        TABLES
          VALUES            = VALUES
          COLUMN_TEXTS      = COLUMN_TEXTS
        EXCEPTIONS
          ERROR_OCCURRED    = 1
          OTHERS            = 2.
      IF SY-SUBRC <> 0.
        LEAVE PROGRAM.
      ENDIF.
    ENDMODULE.                 " STATUS_1000  OUTPUT
    MODULE USER_COMMAND_1000 INPUT
    MODULE USER_COMMAND_1000 INPUT.
      OK_CODE = SY-UCOMM.
      SAVE_OK = OK_CODE.
      CASE SAVE_OK.
        WHEN 'EXIT' OR 'BACK'.
          LEAVE PROGRAM.
        WHEN 'PRINT'.
          CALL FUNCTION 'GET_PRINT_PARAMETERS'
            EXPORTING
              DESTINATION      = 'LOCA'
              COPIES               = COUNT
              LIST_NAME         = 'TEST'
              LIST_TEXT           = 'Test NEW-PAGE PRINT ON'
             IMMEDIATELY    = 'X'
              RELEASE            = 'X'
              NEW_LIST_ID       = 'X'
              EXPIRATION         = DAYS
              LINE_SIZE            = 79
              LINE_COUNT        = 23
              LAYOUT               = 'X_PAPER'
              SAP_COVER_PAGE = 'X'
              RECEIVER            = 'SAP*'
              DEPARTMENT      = 'System'
              NO_DIALOG          = ' '
            IMPORTING
              OUT_PARAMETERS = PARAMS
              VALID          = VALID.
          IF VALID = 'X'.
            NEW-PAGE PRINT ON PARAMETERS PARAMS NO DIALOG.
            WRITE / 'First line'.
          ENDIF.
    NOTE : Following code is tried and not printing anything so commented **********
       WHEN 'PRINT'.
         data : lv_program type sy-repid,
                lv_dynnr   type sy-dynnr.
                lv_program =  sy-repid.
                lv_dynnr   = sy-dynnr.
         CALL FUNCTION 'RS_SCRP_PRINT_IN_LIST'
             EXPORTING
               dynnr = lv_dynnr
               Progname = lv_program
               fullscr = 'X'
               EXCEPTIONS
                 cancelled = 1
                 not_found = 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_1000  INPUT
    Now, Iam getting a print out like
    SAP logo printed with stars and with all the parameters I have passed to the function module
    Iam not getting the graph as my output. I have tried another code calling 'RS_SCRP_PRINT_IN_LIST'. It is not even giving me any reply. The screen just blinks one time when I press the print button on the screen when I use the commented code function module.
    I just want to print a graph in the screen container. Should I have to convert the screen graph as a list ?
    Then how to do it. Post the complete code of any possible help. Please help me with this and keep my thanks in advance.I don't want to use hard copy.

    please  go through the link   here it was  give the step  .. first you have to create the short cut of the  sap desktop  ......  
    <a href="http://">http://www.sapdevelopment.co.uk/tips/debug/debug_popup.htm</a>
    reward  points  if  it is  usefull ...
    Girish

  • Printing report directly from printer

    Hi,
    I need a small information.if any one of our guys can give me some info that would be great.
    I am writing a ABAP report now. lets say when we write 'hello world' in code and F8  program o/p will show 'hello world' right. I need to print this through user default printer automatically...might be pop-up for confirmation would help.
    Thanks in advance...
    Raj

    Hi Rich,
    Calling program is
    REPORT ZTESTRAJ1 .
    parameters:p_date like sy-datum.
    DATA: SELTAB     TYPE TABLE OF RSPARAMS,
          SELTAB_WA  LIKE LINE OF SELTAB.
    start-of-selection.
          CLEAR SELTAB_WA.
    MOVE: 'p_date' TO SELTAB_WA-SELNAME,
          'P'     TO SELTAB_WA-KIND,      " PARAMETER
          sy-datum    TO SELTAB_WA-LOW.
    APPEND SELTAB_WA TO SELTAB.
    CLEAR SELTAB_WA.
    MOVE: 'p_matnr' TO SELTAB_WA-SELNAME,
          'P'     TO SELTAB_WA-KIND,      " PARAMETER
          '1233344'  TO SELTAB_WA-LOW.
    APPEND SELTAB_WA TO SELTAB.
    SUBMIT Ztestraj with p_date eq sy-datum
                    with p_uname eq sy-uname
                    with p_matnr eq '122333' and return.
    if sy-subrc = 0.
    write 'Printed'.
    endif.
    Here is the program Ztestraj
    parameters:
    p_matnr like mara-matnr,
    p_date like sy-datum,
    p_uname like sy-uname.
    data:  l_matnr like mcha-matnr.
    start-of-selection.
    l_matnr = p_matnr.
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
      EXPORTING
        INPUT              = l_matnr
    IMPORTING
       OUTPUT             =  l_matnr
    EXCEPTIONS
      LENGTH_ERROR       = 1
      OTHERS             = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WRITE:  L_MATNR.
    DATA: PARAMS LIKE PRI_PARAMS,
          DAYS(1)  TYPE N VALUE 2,
          COUNT(3) TYPE N VALUE 1,
          VALID    TYPE C.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING DESTINATION           = 'LOCL'
                COPIES                = COUNT
                LIST_NAME             = 'ZTESTRAJ'
                LIST_TEXT             = 'SUBMITTO SAP-SPOOL'
                IMMEDIATELY           = 'X'
                RELEASE               = 'X'
                NEW_LIST_ID           = 'X'
                EXPIRATION            = DAYS
                LINE_SIZE             = 80
                LINE_COUNT            = 120
                LAYOUT                = 'X_44_120'
               SAP_COVER_PAGE        = 'X'
                COVER_PAGE            = 'X'
               RECEIVER              = 'SAP*'
               DEPARTMENT            = 'System'
                NO_DIALOG             = 'X'
      IMPORTING OUT_PARAMETERS        = PARAMS
                VALID                 = VALID.
    IF VALID <> SPACE.
      SUBMIT ztestraj TO SAP-SPOOL
        SPOOL PARAMETERS PARAMS
        WITHOUT SPOOL DYNPRO and return.
        if sy-subrc = 0.
        endif.
    ENDIF.

  • Create spool in a program and read spool in same program

    hi all,
    i have a requirement like i have to create a spool in a program and should read that spool and send a email in same program.
    i m done with creating spool and sending email but the problem is when i execute a program the spool is created only after total program execution, is there a way to create a compleate spool before finishing the report execution.
    thanks,

    Solution:
    call function 'GET_PRINT_PARAMETERS'
          exporting
            destination    = 'LP01'
            copies         = count
            list_name      = 'ZTEST'
            list_text      = 'ZTESTSPOOL'
            immediately    = ' '
            release        = 'X'
            new_list_id    = 'X'
            expiration     = days
            line_size      = 90
            line_count     = 65
            layout         = 'X_PAPER'
            sap_cover_page = 'X'
            receiver       = 'SAP*'
            department     = 'System'
            no_dialog      = 'X'
          importing
            out_parameters = params
            valid          = valid.
        new-page print on parameters params no dialog.
    write : hi this is the test for spool.
    new-page print off.
        commit work.
    write : / sy-spono.   "system variable for spool no
    solved thanks
    anupama.

  • Submit report in background on specific server

    Hi,
    I like to execute a report on a specific server in background. Is there a FM to do this. I know I can use SM36, but that's not the way I want it.
    Regards,
    GJ van Holland

    Hi,
    Here is a sample code.
    Report bkgnd.
    Perform dobackground.
    FORM dobackground.
    Local parameters declaration
      DATA : jobname    LIKE tbtcjob-jobname,
             jobcount   LIKE tbtcjob-jobcount.
      DATA : ws_spld    LIKE pri_params-pdest,
             ws_lstname LIKE pri_params-plist,
             ws_listext LIKE pri_params-prtxt.
      DATA : params     LIKE pri_params,
             arparams   LIKE arc_params,
             days(1)    TYPE n VALUE 2,
             valid      TYPE c.
      jobname    = 'job_name'.
      ws_lstname = 'list_name'.
      ws_listext = 'List_text'.
    Create a job
      CALL FUNCTION 'JOB_OPEN'
           EXPORTING
                jobname          = jobname
           IMPORTING
                jobcount         = jobcount
           EXCEPTIONS
                cant_create_job  = 1
                invalid_job_data = 2
                jobname_missing  = 3
                OTHERS           = 4.
    Set print parameters
      SELECT SINGLE spld INTO ws_spld FROM usr01 WHERE bname = sy-uname.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING destination       = ws_spld
                  list_name         = ws_lstname
                  list_text         = ws_listext
                  immediately       = ' '
                  line_size         = 200
                  line_count        = 65
                  no_dialog         = c_true
        IMPORTING out_parameters         = params
                  out_archive_parameters = arparams
                  valid                  = valid.
    Submit the report to create spool with retreived print parameters
      SUBMIT your_program
        WITH    parameters_if_any
        TO      SAP-SPOOL
        SPOOL   PARAMETERS params
        ARCHIVE PARAMETERS arparams
        WITHOUT SPOOL DYNPRO
        VIA     JOB jobname NUMBER jobcount
        AND     RETURN.
    Close job
      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.
    ENDFORM.
    Hope this was of use to you.
    Thanks,
    Susmitha

  • JOB IN BACK GROUND

    I MADE THIS AND IT'S NOT WORK WHY???
    I MUST RUN IT ONLY IN BACKGROUD,IF I MADE
    PROGRAM---->EXECUTE IN BACKGROUD IT'S WORK???
    data: name like tbtcjob-jobname.
    data: number like tbtcjob-jobcount.
    DATA: PARAMS LIKE PRI_PARAMS,
    DAYS(1) TYPE N VALUE 2,
    COUNT(3) TYPE N VALUE 1,
    VALID TYPE C.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING DESTINATION = 'LOCAL'
    COPIES = COUNT
    LIST_NAME = 'TEST'
    LIST_TEXT = 'SUBMIT ... TO SAP-SPOOL'
    IMMEDIATELY = 'X'
    RELEASE = 'X'
    NEW_LIST_ID = 'X'
    EXPIRATION = DAYS
    LINE_SIZE = 79
    LINE_COUNT = 23
    LAYOUT = 'X_PAPER'
    SAP_COVER_PAGE = 'X'
    COVER_PAGE = 'X'
    RECEIVER = 'SAP*'
    DEPARTMENT = 'System'
    NO_DIALOG = ' '
    IMPORTING OUT_PARAMETERS = PARAMS
    VALID = VALID.
    IF VALID <> SPACE.
      CALL FUNCTION 'JOB_OPEN'
           EXPORTING
                jobname          = name
           IMPORTING
                jobcount         = number
           EXCEPTIONS
                cant_create_job  = 1
                invalid_job_data = 2
                jobname_missing  = 3
                OTHERS           = 4.
      IF sy-subrc = 0.
        SUBMIT rxxxx TO SAP-SPOOL
        SPOOL PARAMETERS PARAMS
        WITHOUT SPOOL DYNPRO
         WITH datum IN r_datum
         WITH sum = 'X'
         VIA JOB name NUMBER number
         AND RETURN.
        IF sy-subrc = 0.
          CALL FUNCTION 'JOB_CLOSE'
               EXPORTING
                    jobcount             = number
                    jobname              = name
                    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
                    OTHERS               = 8.
          IF sy-subrc <> 0.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.

    Hi Rani,
    What is the error that you are getting???
    Thanks & Regards,
    YJR.

  • Submit results with two spool request

    Hi
    I using the following submit code in my abap program.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
    *  DESTINATION           = 'LOCL'
    LIST_NAME             = 'TEST'
    LIST_TEXT             = 'SUBMIT ... TO SAP-SPOOL'
    IMMEDIATELY           = ' '
    LINE_SIZE              = 1023
    NO_DIALOG             = 'X'
    IMPORTING OUT_PARAMETERS        = PARAMS
    VALID                 = VALID.
    SUBMIT (pgnam) USING SELECTION-SET vrint
    TO SAP-SPOOL WITHOUT SPOOL DYNPRO
    SPOOL PARAMETERS PARAMS AND RETURN.
    This is working fine in my development system. But when i test this in testing server (QAS) it returns two spool one with 0 pages and second one with correct output. Can anyone help me with this?
    points will be rewarded for useful answers.
    thanks

    REPORT demo NO STANDARD PAGE HEADING.
    DATA: spfli_wa TYPE spfli,
          sflight_wa TYPE sflight.
    DATA: print_parameters TYPE pri_params,
          valid_flag       TYPE c LENGTH 1.
    START-OF-SELECTION.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        IMPORTING
          out_parameters       = print_parameters
          valid                = valid_flag
        EXCEPTIONS
          invalid_print_params = 2
          OTHERS               = 4.
      IF valid_flag = 'X' AND sy-subrc = 0.
        SELECT carrid connid
               FROM spfli
               INTO CORRESPONDING FIELDS OF spfli_wa.
          WRITE: / spfli_wa-carrid, spfli_wa-connid.
          HIDE:    spfli_wa-carrid, spfli_wa-connid.
        ENDSELECT.
      ELSE.
      ENDIF.
    AT LINE-SELECTION.
      NEW-PAGE PRINT ON PARAMETERS print_parameters
                        NO DIALOG.
      SELECT *
             FROM sflight
             INTO sflight_wa
             WHERE carrid = spfli_wa-carrid AND
                   connid = spfli_wa-connid.
        WRITE: / sflight_wa-carrid, sflight_wa-connid,
                 sflight_wa-fldate ...
      ENDSELECT.
      NEW-PAGE PRINT OFF.

  • Print directly to the printer

    Hi Guys
    Could anyone correct me how can I print directly to the printer from this program ,I am getting short dump error when I select the radio button printer and execute it.
    Rgds
    PE

    oops sorry here it is below
    REPORT  Z_ESLP_ZTCODE LINE-SIZE 132 .
    *TABLES
    TABLES : AGR_TCODES,
    AGR_USERS,
    TSTCT,
    T16FW,
    T16FD.
    type-pools: slis.                                 "ALV Declarations
    CONSTANTS MARK VALUE 'X'.
    TYPES: BEGIN OF  T_DISP,
    AGR_TCODES TYPE AGR_TCODES-TCODE ,             " Transaction code A
    AGR_NAME   TYPE AGR_TCODES-AGR_NAME,           " Role Name B
    AGR_UNAME  TYPE AGR_USERS-UNAME,               " Short User Name B
    TTEXT      TYPE TSTCT-TTEXT,                   " Description Name C
    TEXTC      TYPE USER_ADDR-NAME_TEXTC,          " Long User Name
    SPRSL      TYPE TSTCT-SPRSL ,                  " Language c
    TEL_EXTENS  TYPE USER_ADDR-TEL_EXTENS ,          " Extension
    DEPARTMENT  TYPE USER_ADDR-DEPARTMENT  ,         " Department Name B
    FRGGR      TYPE T16FW-FRGGR,
    FRGCO      TYPE T16FD-FRGCO,
    OBJID      TYPE T16FW-OBJID,
    FRGCT      TYPE T16FD-FRGCT,
    SPRAS      TYPE T16FD-SPRAS,
    END OF t_disp.
    DATA: it_disp TYPE STANDARD TABLE OF t_disp INITIAL SIZE 0,
          wa_disp TYPE t_disp.
    DATA: params like pri_params,
        days(1) type n value 2,
        count(3) type n value 1,
        valid type c.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    parameter: p_trigr type c default space.
    SELECTION PARAMETER CRITERIA
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS:
    P_TCODE FOR AGR_TCODES-TCODE  , "OBLIGATORY, "no-extension no intervals,
    U_NAME FOR AGR_USERS-UNAME,
    R_NAME FOR AGR_USERS-AGR_NAME .
    SELECTION-SCREEN END OF BLOCK BLK1.
    SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
    SELECTION-SCREEN END OF BLOCK BLK2.
    SELECTION-SCREEN END OF BLOCK BLK.
    SELECTION-SCREEN BEGIN OF BLOCK radio WITH FRAME.
      PARAMETERS :
      scr   RADIOBUTTON GROUP rbg1 ,
                  Pr   RADIOBUTTON GROUP rbg1 .
      SELECTION-SCREEN END OF BLOCK radio.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
      fieldcatalog-fieldname   = 'AGR_UNAME'.
      fieldcatalog-seltext_m   = 'User'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'TEXTC'.
      fieldcatalog-seltext_m   = 'Name'.
      fieldcatalog-outputlen   = 60.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AGR_NAME'.
      fieldcatalog-seltext_m   = 'Role Name'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AGR_TCODES'.
      fieldcatalog-seltext_m   = 'Trans Code'.
      fieldcatalog-col_pos     = 3.
      fieldcatalog-outputlen   = 20.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'TTEXT'.
      fieldcatalog-seltext_m   = 'Description'.
      fieldcatalog-outputlen   = 70.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT  PRINTER SETUP
          PRINTER SETUP
    form printer_setup.
      DATA:L_PARAMS TYPE PRI_PARAMS,
           L_VALID TYPE C.
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
           EXPORTING
             IMMEDIATELY                  = ' '
           LINE_SIZE                    = 220
           RELEASE                      = 'X'
             MODE                         = 'CURRENT'
             NO_DIALOG                    = ' '
           IMPORTING
        OUT_ARCHIVE_PARAMETERS       =
             OUT_PARAMETERS               = L_PARAMS
             VALID                        = L_VALID
           EXCEPTIONS
             ARCHIVE_INFO_NOT_FOUND       = 1
             INVALID_PRINT_PARAMS         = 2
             INVALID_ARCHIVE_PARAMS       = 3
             OTHERS                       = 4.
          IF SY-SUBRC  eq 0.
          ENDIF.
    "But it will take default printer from user settings
          NEW-PAGE PRINT ON   PARAMETERS L_PARAMS NO DIALOG.
           write : 'print is on'.
          NEW-PAGE PRINT OFF.
        DATA: PARAMS   LIKE PRI_PARAMS,
             ARPARAMS LIKE ARC_PARAMS,
             DAYS(1)  TYPE N VALUE 2,
             COUNT(3) TYPE N VALUE 1,
             VALID    TYPE C.
       CALL FUNCTION 'GET_PRINT_PARAMETERS'
             EXPORTING DESTINATION = 'LOCL'
                   COPIES                 = COUNT
                   LIST_NAME              = 'Z_ESLP_ZTCODE'
                   LIST_TEXT              = 'SUBMIT ... TO SAP-SPOOL'
                   IMMEDIATELY            = 'X'
                   RELEASE                = 'X'
                   NEW_LIST_ID            = 'X'
                   EXPIRATION             = DAYS
                   LINE_SIZE              = 79
                   LINE_COUNT             = 120
                   LAYOUT                 = 'X_44_120'
                   SAP_COVER_PAGE         = 'X'
                   COVER_PAGE             = 'X'
                   RECEIVER               = 'SAP*'
                   DEPARTMENT             = 'System'
                   SAP_OBJECT             = 'RS'
                   AR_OBJECT              = 'TEST'
                   ARCHIVE_ID             = 'XX'
                   ARCHIVE_INFO           = 'III'
                   ARCHIVE_TEXT           = 'Description'
                   NO_DIALOG              = ' '
         IMPORTING OUT_PARAMETERS         = PARAMS
                   OUT_ARCHIVE_PARAMETERS = ARPARAMS
                   VALID                  = VALID.
       IF VALID <> SPACE.
         SUBMIT RSTEST00 TO SAP-SPOOL
           SPOOL PARAMETERS PARAMS
           ARCHIVE PARAMETERS ARPARAMS
           WITHOUT SPOOL DYNPRO.
       ENDIF.
    endform.                    " BUILD_LAYOUT
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = it_disp
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc  EQ 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form lfa1 table and populate itab it_lfa1
    form data_retrieval.
    CASE MARK.
         WHEN scr.
       SELECT AGR_TCODESTCODE AGR_TCODESAGR_NAME AGR_USERSUNAME TSTCTTTEXT USER_ADDR~NAME_TEXTC
      INTO TABLE IT_DISP
      FROM AGR_TCODES
      INNER JOIN AGR_USERS
      ON  AGR_TCODESAGR_NAME = AGR_USERSAGR_NAME
      INNER JOIN USER_ADDR
      ON AGR_USERSUNAME = USER_ADDRBNAME
      INNER JOIN TSTCT
      ON AGR_TCODESTCODE = TSTCTTCODE
      where
      agr_tcodes~tcode in p_tcode
      and
      agr_users~uname in u_name
      and
      agr_tcodes~agr_name in r_name
      and
      TSTCT~SPRSL EQ 'E'.
      WHEN pr.
    perform printer_setup.
    ENDCASE.
    *lifnr
    *between '0000100001' AND '0000150000'.
    endform.                    " DATA_RETRIEVAL
    Release memory no longer required.
    free: it_lfa1 .
    Form  TOP-OF-PAGE                                                 *
    ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    Title
      wa_header-typ  = 'H'.
      wa_header-info = 'Transaction codes by User and Role Name ' .
      append wa_header to t_header.
      clear wa_header.
    Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    Total No. of Records Selected
      describe table it_disp lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Transaction Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
               i_logo             = 'Z_LOGO'.
    endform.
          FORM USER_COMMAND                                          *
          --> R_UCOMM                                                *
          --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
      Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'TCODES'.
        Read data table, using index of row user clicked on
          READ TABLE it_disp INTO wa_disp INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
         SET PARAMETER ID 'BES' FIELD wa_disp-tcode.
        Sxecute transaction zven, and skip initial data entry screen
         CALL TRANSACTION 'Z' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
          Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_events with key name =  slis_ev_end_of_list
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
          Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.

Maybe you are looking for

  • Updating hr infotype pa0305 with 'HR_INFOTYPE_OPERATION'

    Hi everyone i'm trying to update hr infotype pa0305 using fm HR_INFOTYPE_OPERATION but it doesn't work  maybe using in worng way. Maybe someone knows how can i use the second structure q0305 passing trough the parameter called "secondary records". Th

  • Retieve the related childern to the selected Tree Node

    Hello all, From here i got the folowing code,it helps me to retrieve the whole record which is related to the selected node in WHEN-TREE-NODE-SELECTED Trigger : declare        rank   number := 0; begin       rank :=      ftree.get_tree_node_property(

  • I can't watch you tube videos on my I pad

    I can't watch you tube videos on my iPad(3 gen) & my iPhone 5

  • Strange behaviour syncing with MobileMe Galleries

    Hi all. Apologies if this has been asked before but I couldn't find this exact problem I'm having. I have a few galleries that I sync to and it all works fine except if I ad to a bunch of photos it seems to then upload everything all over again. So i

  • New iMac's built-in iSight seems out of socus

    I have one of the new 24" 3.06GHz iMacs. The focus of my built-in iSight is somewhat blurry for objects 1-2 feet away from the monitor (like, the human in front of the computer). It seems like items in the background 10 feet or so behind me are in be