Copy Attachement in CV03N via ABAP program

I would like to copy an attachment in CV03N to my C: drive.  I can do this by right clicking on the file and selecting Copy To.  I need to do this via an ABAP program.  Is this possible?
Thanks Gary

Found the answer....
CALL FUNCTION 'CVAPI_DOC_VIEW' copies attachment from CV03N to my PC

Similar Messages

  • Send a mail via ABAP program

    Hello Experts,
    I want to send mail via ABAP program with the following requirements :
    1. Recipient is OUTLOOK email -id
    2. Sender address has to be an external email-id
    3. Send mail as CC and BCC also to other email-id.
    Is there any function module which can satisfy all the above requirements.
    Regards,
    Mansi.

    hi,
    this code will definately help you just go through it:
    firstly  exported the data to memory using the FM LIST_FROM_MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = t_listobject
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE e000(su) WITH text-001.
    ENDIF.
    then i converted it into ASCII using LIST_TO_ASCI,
    CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
    listasci = t_xlstab
    listobject = t_listobject
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    OTHERS = 3.
    IF sy-subrc NE 0.
    MESSAGE e003(yuksdbfzs).
    ENDIF.
    This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
    cl_abap_char_utilities=>horizontal_tab.
    Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
    This will create an excel attachment.
    Sample code for formatting the data for the attachment in excel format.
    u2022     Format the data for excel file download
    LOOP AT t_xlstab INTO wa_xlstab .
    DESCRIBE TABLE t_xlstab LINES lw_cnt.
    CLEAR lw_sytabix.
    lw_sytabix = sy-tabix.
    u2022     If not new line then replace '|' by tabs
    IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
    REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
    WITH cl_abap_char_utilities=>horizontal_tab.
    MODIFY t_xlstab FROM wa_xlstab .
    CLEAR wa_xlstab.
    wa_xlstab = cl_abap_char_utilities=>newline.
    IF lw_cnt NE 0 .
    lw_sytabix = lw_sytabix + 1.
    u2022     Insert new line for the excel data
    INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
    lw_cnt = lw_cnt - 1.
    ENDIF.
    CLEAR wa_xlstab.
    ENDIF.
    ENDLOOP.
    Sample code for creating attachment and sending mail:
    FORM send_mail .
    u2022     Define the attachment format
    lw_doc_type = 'XLS'.
    u2022     Create the document which is to be sent
    lwa_doc_chng-obj_name = 'List'.
    lwa_doc_chng-obj_descr = w_subject. "Subject
    lwa_doc_chng-obj_langu = sy-langu.
    u2022     Fill the document data and get size of message
    LOOP AT t_message.
    lt_objtxt = t_message-line.
    APPEND lt_objtxt.
    ENDLOOP.
    DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
    IF lw_tab_lines GT 0.
    READ TABLE lt_objtxt INDEX lw_tab_lines.
    lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
    lwa_doc_chng-obj_langu = sy-langu.
    lwa_doc_chng-sensitivty = 'F'.
    ELSE.
    lwa_doc_chng-doc_size = 0.
    ENDIF.
    u2022     Fill Packing List For the body of e-mail
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = 'RAW'.
    APPEND lt_packing_list.
    u2022     Create the attachment (the list itself)
    DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
    u2022     Fill the fields of the packing_list for creating the attachment:
    lt_packing_list-transf_bin = 'X'.
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = lw_doc_type.
    lt_packing_list-obj_name = 'Attach'.
    lt_packing_list-obj_descr = w_docdesc.
    lt_packing_list-doc_size = lw_tab_lines * 255.
    APPEND lt_packing_list.
    u2022     Fill the mail recipient list
    lt_reclist-rec_type = 'U'.
    LOOP AT t_recipient_list.
    lt_reclist-receiver = t_recipient_list-address.
    APPEND lt_reclist.
    ENDLOOP.
    u2022     Finally send E-Mail
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = lwa_doc_chng
    put_in_outbox = 'X'
    commit_work = 'X'
    IMPORTING
    sent_to_all = lw_sent_to_all
    TABLES
    packing_list = lt_packing_list
    object_header = lt_objhead
    contents_bin = t_xlstab
    contents_txt = lt_objtxt
    receivers = lt_reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8.
    Hope it will help you
    regards
    Rahul sharma

  • How to extract data from BPC InfoCube via ABAP program?

    Hi experts!!
    I tried to extract data from a BPC InfoCube via ABAP program, but I did'n have succeed.
    I used the function 'RSDRI_INFOPROV_READ' to extract data from standard InfoCubes such as '0COPC_C07' and it run OK! However, when I change the InfoCube name to '/CPMB/WAIX8NE' (BPC InfoCube), everything goes wrong...
    Is there any difference between extracting data from BPC and standard InfoCubes?
    Thank you all!

    Moderator message - Welcome to SCN.
    But please do not cross and duplicate post.
    Thread locked.
    Rob

  • Schedule Jobs with multiple steps via ABAP Program

    Hi,
    I need to schedule multiple programs via background jobs on a daily basis. Since all these jobs are to be run as a single job, the various programs have to be run as steps in a major job.
    I am however not very clear on how this can be done via an ABAP program ( the idea of a program is that various parameters to be passed to each program in the step can be entered dynamically rather than via variants).
    I am using the JOB_OPEN and JOB_CLOSE functions and submitting the programs with selection screen parameters dynamically passed to create a job. I need to do this for various programs as a job step (WITHOUT Variants being defined).
    Can anyone suggest any ideas for this? I have tried out JOB_SUBMIT Function but am not very confident I know what exactly it is for as it asks for a variant.
    Thanks very much,
    Preet

    Hi Preet,
    just to be sure: you know, that variants can be dynamical, too?
    It's quite usual to assign dynamical current date, but it's also possible to add / subtract value and even define own functionality.
    Maybe it's easier to implement a dynamical selection and handle static jobs.
    If you try to plan a job (online or with JOB_SUBMIT), you have to use variants - you can create (or change) them dynamical in beforehand. Only SE38, F8, F9 is creating a temporary variant, so that no saved variant is necessary.
    But if you end up creating variants dynamical, you can change one existing variant, too. Then you can use a static job definition (with periodical starting rule).
    So: have a look, if dynamic variants are enough, otherwise change variants per job.
    Regards,
    Christian

  • Regarding text attachment in Email in ABAP program

    Hello...
    Need your expertise in one of the issues. Requirement is seems to be simple
    but i am stuck up at this moment. i have refereed SDN with Several code but
    some point its not giving the proper solution. So its a request to you please
    do not provide any SDN link for reference as i am very much tried all of them.
    please share piece of code.
    Requirement : Need to develope one ABAP program, Email text attachment with Header line.thought its
    very simple but still facing difficulties.
    i have tried many code either its showing Data in single line without new line , in one of the Codes
    data is coming in successive line but there is lot of spacing within Words means all alphabates are tab
    separated. coud you please provide ,me the proper solution for this.
    in  one of the codes is working fine for excel but when Txt extension done data is not coming in successive line all
    data is coming in single line.
    Ex. Text file should contain 1 head and 4 colunns and Data size 50..
    Thanks
    Nishi

    Hi,
    Another option....
    Some sample code using cl_bcs .
    Note the use of cl_abap_char_utilities=>cr_lf .
    FORM mail_1_prep_10
    USING
        it_data         TYPE table
      CHANGING
        ob_document_bcs TYPE REF TO cl_document_bcs .
      DATA: txt_line TYPE string .
      DATA: txt_data TYPE string .
    * Create some text data .
      DO 20 TIMES .
        txt_line = '' .
        DO 10 TIMES .
          CONCATENATE txt_line '|' 'some data 01' '|'   INTO txt_line .
        ENDDO .
        CONCATENATE txt_line cl_abap_char_utilities=>cr_lf INTO txt_line .
        CONCATENATE txt_data txt_line INTO txt_data .
      ENDDO .
    * Mail stuf....
      DATA: it_solix TYPE solix_tab .
      CALL METHOD cl_bcs_convert=>string_to_solix
        EXPORTING
          iv_string = txt_data
        IMPORTING
          et_solix  = it_solix.
      DATA: attachment_subject TYPE so_obj_des .
      DATA: attachment_type TYPE so_obj_tp .
      attachment_subject = 'Some text data' .
      attachment_type = 'txt' .
      TRY.
          CALL METHOD ob_document_bcs->add_attachment
            EXPORTING
              i_attachment_type    = attachment_type
              i_attachment_subject = attachment_subject
              i_att_content_hex    = it_solix.
        CATCH cx_document_bcs .
      ENDTRY.
    ENDFORM .                    "mail_1_prep_10
    regards.
    This is how I see it in my mail :

  • Create a DDic sturcture via ABAP program

    Hello,
    is it possible to create a DDic structure via a ABAP program? I've got the components and component type of the new structure in a table.
    I want to create a DDic structure with this information. Is there function module or a method, with this functionality?
    Thanks for help!
    Matthias

    I need a DDic structure to use this in the exporting parameters of an remote-enabled function module.  Thier isn't it posible to use an none typed parameter, because of the remote.
    I want to create an admin-screen for an tool calls DocFinder. For this tool you need for every DocuSpace an extra structure to return the values.
    We use this tool in an shared systemlandscape so its nessessary to use an remode-enabled function module.
    In the admin-screen it should be able to create an new DocuSpace with its structures and other generatet coding.
    But I've got no idea how to create an structure via programm.

  • How to add a new output type in sales order header via ABAP program

    Hi All,
    I have to add new output type (ex Z001) in sales order header via an ABAP program. please let me know how to do this.
    Thank you all in advance.

    Hi,
    You can use the FM ..RV_MESSAGE_UPDATE..
    Thanks
    Naren

  • Calling ITS Service via abap program

    We have made an ITS Service (SAP GUI for HTML) for one of the R/3 programs (Customized).
    If the URL is linked directly to the service, it shows correctly.
    But if we call the service via transaction code as in: Call tcode Zabc..., it does not work.
    How can we call the service directly from the abap program on the click of a button?
    Thanks in advance.

    Hi,
    You can do something like this:
    CALL FUNCTION 'CALL_BROWSER'
             EXPORTING
               url                          = path
               new_window                   = 'X'
             EXCEPTIONS
               frontend_not_supported       = 1
               frontend_error               = 2
               prog_not_found               = 3
               no_batch                     = 4
               unspecified_error            = 5
               OTHERS                       = 6
    where PATH variable is ITS service url:
        CONCATENATE 'http://server:port/sap/bc/gui/sap/its/webgui?transaction=xxxxxx&okcode=xxxx INTO path.
    Hope this helps,
    Iván.

  • Parse XML streams via ABAP program or class

    Hi all,
    because of a new requirement we would like to create characteristics from a XML file by using the following structure.  
    xmlns:gdt="http://sap.com/xi/SAPGlobal/Global" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    We do not use SAP XI but I would like to parse the XML stream from a file in order to have the information available in a ABAP program. For this reason I'm looking for a standard SAP ABAP program or class to read and parse such a XML file. 
    I would appreciate if somebody have more details on this topic.

    Check this out.
    XML to ABAP
    Regards,
    Rich Heilman

  • Schedule/Execute POWL Query in Background or via ABAP Program

    Hi all,
    I would like to know if there is any chance/possibilities to schedule/execute the POWL Query for example the Query ID
    "SAPSSRM_R_CENTRALCONFIRM_01_01" Confirmations Pending in the background to output report.
    Or perhaps there is anyway I can make use of the logic within the Query ID above in an ABAP program?
    The main reason is that I need create a Confirmations Pending report and sent out to relevant SC Creator and the quickest way is to make use of the existing query of above.
    Many thanks and regards,
    Hon Leong

    Hi Hon Leong,
    please first check POWL - Web Dynpro ABAP - SCN Wiki to understand, how POWL works.
    You need to find a Feeder Class of your query and execude GET_OBJECTS Method to get the result list.
    For example you can check report POWL_WLOAD or function module POWL_QUERY_REFRESH.
    Regards
    Konstantin

  • Insert Nodes into Hierarchy via ABAP Program

    Hello,
    I want to create ABAP program to insert nodes into a hierarchy.
    I got a class CL_RSSH_HIERMAINTAIN_FRONT with method INSERT_NODES_HIERARCHY .
    But the method is private and cannot be used in the ABAP call.
    I also don't want a pop up which asks for the action on duplicate nodes.
    Can anyone guide me a bit here ?
    Any help would be appreciated.
    Varun

    pl check following
    http://www.scribd.com/doc/7300428/Structure-of-a-Flat-Hierarchy-File-for-Loading-Using-a-PSA

  • After sending attachment through mail using ABAP program.....

    Hello Experts,
    I am facing a problem to fulfill a requirement.
    My requirement is....sending the data of the internal table to an external mail with attachment(excel format). I have done with this. But when o am opening the excel sheet(attachment) it is showing a message that 'The file you are trying to open is in different format than specified by the file extension'
    I am using the extension 'XLS' and 'RAW ' in the coding for the file formats.
    You can please suggest your solutions if you know or already faced this type of issues.
    Thank you.
    Regards,
    Anand

    Hi,
    The system does not trust you....
    I have the feeling that the file you are sending is a text file with the extension 'XLS'
    If the file is comma separated values (http://en.wikipedia.org/wiki/Comma-separated_values) then
    use the extension 'CSV' if it is a tab separated then use the extension 'TXT' .
    Regards.
    CSV is also good for tab separated  I just checked by a copy of BCS_EXAMPLE_7 and changing:
            i_attachment_type    = 'CSV'                        "#EC NOTEXT

  • Error when opening a zipped file transfred to the FTP via ABAP program

    Hi All,
    I have extracted the files from al11 and have zipped them and moved the zipped file to FTP site.
    But when I open the zipped file in FTP site, it shows the file names, but they dont look like real files(looks as text)...Even when copied the zipped file to the local pc and tried opening it the result was same.
    Note : For testing when the same zipped file is written to al11 and dowloaded from there using CG3y it works fine.
    Also created a zipped folder manualy and copied it to the FTP site and tried opening it.....It opened but displayed there are no records in it (which is incorrect), But when copied the same file back to local PC it displayed correctly.
    Please let me know hoe to resolve this issue. 
    Regards
    Jithu

    Hi Andreas Mann ,
    Thanks for your reply.
    I dont have access to choose tools in Tcode SXDB.
    Error msg: "You are not authorized to use Transaction SXDA_TOOLS"
    So can you pls Elaborate on this would be helpful in resolving the issue.
    Regards
    Jithu

  • Schedule a Job with multiple steps via ABAP Program

    Hi Friends,
    I want to create a report(Ex: ZREP) that will run another program(Ex: ZPGM) in background. What I need to do is, when I execute the report ZREP it should run the ZPGM automatically in background. This background execution should happen through JOB with multiple steps.
    Why i am mentioned steps is, i have 1000 records in ZTABLE and need to execute 100 records each in one step and need to proecess in ZPGM with selection parameters. So in my case my job should create with 10 steps and need to execute in sequential manner.
    FYI, In the ZREP selection screen i need to enter the records count/ interval to derive the job steps.
    Please guide how to go ahead? Thanks in advance for all the help.
    Regards,
    Raghu.

    Hi Raghu,
    You can try the following pieces of code:
    Loop at gt_table.   "This table contains 100 records previously appended
    w_jobname = c_job_emision   "Job Name.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname          = w_jobname
          IMPORTING
            jobcount         = w_jobacount
          EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    * Perform or create T_SELTAB with parameters options
    PERFORM Create_seltab_table.
    *Call second program.
    SUBMIT ZREP WITH  SELECTION-TABLE t_seltab AND RETURN.
    *Close Job.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = w_jobacount
            jobname              = w_jobname
            strtimmed            = c_x  "Immediate Start
         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.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    ENDLOOP.
    Hope this helps.
    Regards
    Ernesto
    PS: Raymond Giuseppi was faster.
    Edited by: Ernesto Caballero on Mar 10, 2010 1:57 PM

  • Update default profile from ABAP Program

    Hi All,
    I want to update/create a system parameter in default profile via ABAP Program.
    Eg. login/system_client = 000
    Anybody has any idea how to achieve this?
    Thanks and Regards, Pradeep

    Hi Pradeep,
                        Iam not sure it can be changed from ABAP prog., for me it's look difficult because this default profile is located at OS level not in the application level.
              For any basis guy this is matter of few min. to change/ add this parameter from RZ10. If you want to reinvent the wheel it's up to you.
    Regards,
    Hari.

Maybe you are looking for

  • FireFox web buttons and movie scroll bar do not work anymore!

    == Issue == Firefox is having problems with certain web sites == Description == When watching movies after choosing Maximize movie to full screen movie controls no longer work. You must first hit ESC to get out of full screen mode before controls wor

  • Mapping of field with MinOccurs 0 in SAP XI 2.0 SP5

    Hi, Our Scenario is File -> Adapter -> XI -> Idoc Adapter -> SAP We are trying to push IDoc and the mapping tool is giving an error. I am providing the error that I am getting. The snippet of the XSD for the IDoc is given below:    <xsd:element name=

  • Audigy 2 zs quest

    I am new to the Audigy card and would like to know how to record whatever is playing on my computer such as something from the internet.

  • Baffled by design view mangling

    Hello all - new to this forum and could use some guidance for what to check for/revise to have my situation resolved. On NVu web authoring editor, I see the follow visually correct web page, complete with banner frame, left/right menu bars, and cente

  • Slight file size discrepencies between identical photos?

    While looking at the metadata of photos I am working with, I have noticed that identical photos in every single aspect of pertinent metadata (lense, focal, other various exif data) happens to have a slight file size discrepency.  For instance, a dscf