How to Concatenate 2 Variables in SAP APO DP Macro

Hi All
I am trying to concatenate 2 variables in a single third variable. Can some body please guid me on how this can be achieved
e.g.  I have a variable containting a characteristic Value - "1010101" and Another Variable have a number "12345"
I want to show a string -  "1010101 with value 12345"
Can somebody please guide on how this can be achieved
Any help in this regard is highly appreciated
Thanks
Vijay

Hi Vijay,
Try with with the command STRINGS_CONCATENATE().
Syntax
STRINGS_CONCATENATE ('String1'...'Stringn')
Thanks and Regards,
Mariano

Similar Messages

  • How to use Variable in SAP HANA Information Modeller?

    Hello Folks,
    I have created a variable in Information modeller of SAP HANA Studio on top of an Analytical view (Regional Sales).  This variable is SingleValue (Multiple Value Selections).  This variable should prompt me the name of Country/Regions but somehow this is not working when I am using data preview and Analysis tab of data preview.
    Could you please enlight me where I am going wrong? or Let me know if is there any other forum for this.
    P.S : I am using SAP HANA studio on Cloud.
    Regards
    Muffazzal Fani

    Hi,
    After you created that variable as mentioned above, did you apply this variable on your LAND1 attribute.
    How: Open Analytic View --> on right-side you see the attributes,measures etc. >right click on 'LAND1' and select>
    'Apply Filter'--> In the drop-down  select your created variable and activate.
    I assume the above should resolve your issue. Please let me know if it helps.
    Revision: I mean the HANA version you are using.
    Regards, Rahul

  • HOW TO CREATE A VARIABLE IN SAP SCRIPT

    HI ALL,
    CAN ANYONE TELL ME HOW TO CREATE A VARIABLE IN SAP SCRIPT.
    THANK YOU,
    BYE
    TAKE CARE.

    Hi Ravi,
    You can use like this
    A text in the editor contains the following DEFINE commands:
    /: DEFINE &mysymbol& = 'xxx xxx xxxxx xxxx'
    &mysymbol&
    /: DEFINE &mysymbol& = 'yyyyy yyy yyyy'
    / &mysymbol&
    The printed text appears

  • How to change process chain in SAP APO, in RSCP tcode.

    HI SAP APO Experts
    I am from SAP ABAP background, I need to change a 'AND' operator in process chain in RSCP tranaaction in SAP APO.
    I dont have any idea how to change process chain.
    Could you please help me how to change process chain in SAP APO in RSCP tcode.
    Appreciate your help or comments.
    Sandeep..

    Hi Sandeep,
    The t-code RSCP does not exist in SAP APO.  The correct t-code is RSPC. 
    Step 1:- In RSPC t-code, select the process chain which you need to change. 
    Step 2:- Double click on it. 
    Step 3:- It will display the various programmes attached to the process chain.  Go to change mode by clicking on the change indicator (Control + F9)
    Step 4:- Select the programme area where you need to do the correction or change.  Double click on it.
    Step 5:- It will take you to the programme and its selection contents.  Make the relevant changes.  You can directly carry out the change in se38 also if there is variant kind of changes for that particular programme.
    Step 6:- Once the changes are done, save the changes and press F3 button which will take you to the home page of the process chain
    Step 7:- Save again so that the change in the programme alongwith the process chain will get saved.
    Regards
    R. Senthil Mareeswaran.

  • How we can define User Constraints in SAP APO SNP?

    Hi
    How we can  define flexible User Constraints in SAP APO SNP ? Meaning standard constraints can be configured in SAP APO SNP but how we can configured real time  customer constraints?
    Thanks
    Poorna

    Hi,
    You can use CIF user exit CIFMAT01 for this purpose. You can follow below path in SAP for more details
    SPRO---SAP refrenceIMG----Integration with other SAP components---Advanced Planning and Optimization---Application specific settingsand enhancements---Enhancement for materials---Influence data before transfer to APO on user specific basis.
    YOu can read help in above path about exit.
    YOu need ABAP person who need to code this. What you need is read custom field from table from MARC  and Populate in procurement cose field in this exit.
    Regards,
    Santosh,

  • How we can define storage capacity constraint for SAP APO SNP(trading company)

    Hi
    can any one advise how we can define storage capacity constraint in SAP APO SNP.Typically businesss scenario its a trading company  sources from different sources and deliver to the distribution centres,its typically sourcing optimization using SNP optimizer.How we can define capacity constraint for a source?
    Thanks

    Hello Poorna
    I suggest you to refer this thread which will be helpful.
    Storage capacity as hard constraint in SNP optimizer
    and this is one very informative document too.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b004ab38-d73f-2d10-9d86-81f014034235?overridelayout=t…
    Hope this will help
    Thank you
    Satish Waghmare

  • How to "roll back" SAP APO PPDS planning batch run from infeasible batch mid-point to before start of planning batch run?

    Hi Experts,
    We are investigating if any SAP customer that implemented SAP APO PPDS has ever attempted to establish a "roll back" of the SAP APO PPDS created supply plan to a defined point before the start of the SAP APO PPDS planning batch run?  
    We have a situation where - in the middle of the planning batch run - randomly or intermittent the batch run hangs or runs a step for multiple hours that normally, at most days, takes only a few minutes to run.  In a situation like this, the supply plan is not in a state where customer sales orders can be promised  (using GATP CTP) or planned orders can be converted to production orders and published to SAP ECC, etc since the plan may be capacity infeasible or simply partial or incomplete.   To not hold the business operations hostage to wait resuming operations (promise customer sales orders, convert and release and execute orders to transfer, deliver, produce, or purchase) for hours or days, we need to find a way back to the original plan right before the nightly PPDS batch planning job started.
    We already close all the queues from ECC to APO, thus, no CIF traffic from ECC to APO.  We also shut down the customer sales order feed into ECC as normal process for duration of the APO PPDS batch planning run.  Thus, functionally,  we are theoretically in a situation to simply go back to a PPDS and active planning version save prior to the run.  Yet, many more technical and BASIS-related questions remain on how to roll back to a state where the plan was not compromised.
    This inquiry is to learn if any other SAP customer has ever established a process to roll back SAP APO PPDS to a previous point in time supply plan to resume operations?  Whatever the reasons are, be it after a failed  batch run, or any time during the normal interactive plan day.  
    Additional information about our design and plan:  
    1.  We have a two year horizon supply plan in PPDS
    2.  We only publish to ECC 14 days worth of planned orders, stock transfer requirements, and purchase requirements
    3.  We convert planned orders to production orders and release production orders in ECC 2 days before first operation starts
    4.  We convert PR's to PO's and STR's to STO's in ECC  2 days before execution (ship or submit to vendor)
    Any indication where a SAP customer has developed and uses a process to roll back an SAP APO PPDS- planned supply plan to an earlier point in time or version would be helpful to know.
    Regards,
    Manimaran M.

    Hi  Manimaran,
    Saving in Simulation means in DS board when you click on save it provides you option to save sim version or adopt to active version. If you copy to inactive version you cannot copy back  trasaction data specially PPDs orders back to active version again while if you save in simulation you can adope it to active version at any point of time. YOu can adopt simulation version changes to active version using T-code /SAPAPO/CDPSS0
    Copying to active version means you copy data from version 000 to some other active version while here results are kept simulation,

  • How we define Supplier constraints in SAP APO SNP?

    Hi
    Customer is trading company and SNP optimizer is configured  for sourcing optimization,Following are queries
    How we can define Supplier constraints? Supplier constraints meaning Supplier is capable of supplying 5000MT  how we model this and Minimum purchase need to happen from certain suppliers of quantity 2000MT,basically Quantity constraints need to be built in SAP APO SNP.
    expecting some valuable inputs
    Thanks
    Poorna

    Hi Poorna,
    Please follow below steps to delete Product-Location combinations in APO:
    1. In ECC, deactivate Integration model for Transaction data and master data of the Products and locations to be deleted from APO.
    2. Check where used list from transaction WUF and delete dependent transaction data and Master data from APO. You may use /sapapo/rlcdelete and /sapapo/sdorder_del.
    Also delete dependent Master data objects like CVC, PPM, Transportation lane, PDS etc. from APO
    Ensure deletion of transaction data in all existing versions in the 000 Model.
    3. Set the deletion flag for Product / Product-Location combination using transaction /sapapo/mat1
    4. Once the transaction data & related master data is deleted and deletion flag is set, it is possible to delete the location-products by running the report /sapapo/delete_products
    To delete Locations from APO:
    Follow same steps as above. In cases of deletion of Locations, all products in that location should be deleted using the Product-Location deletion flag optionJust change the report in step 4. For locations, use report /sapapo/delete_locations
    To answer your other question on change in location type, I think it is not possible to change once you CIF location master to APO.
    Regards,
    Ravi

  • How to Find Code for SAP Exit variables.....

    Gurus:
    The SAP Business Content Query "0FIAR_C03_Q0005" uses several BC variables of 'SAP Exit' type for determining "Date" values. I would like to see the code used in these variables. Can anyone please suggest how I can find it?
    For examople, the variable on Posting Date is "0P_KEYD2". What is the ABAP code for this? Please give me the Steps..!
    Thanks in Advance......PB

    Generally SAP doesn't give access to the code behind SAP exit variables, but you can find what the variable is doing using help documentation. Here is some info i saw on SAP help for your variable
    0CWD Current workday
    0DAT Current calendar day
    0P_KEYDT Key date of due date
    0P_KEYD2 Key date of posting (from key date of due date)
    0P_KEYD3 Key date of clearing (from key date of due date)
    0P_KEYD4 Key date of posting (posting date)
    0P_KEYD5 Key date of clearing (from key date of posting)

  • How sales order number generated in the SAP R/3  is transferred to SAP APO

    Dear Experts,
    During the creation of the Sales order in SAP  R/3 an Purchase requisition is created in SAP APO and assigned with temporary sales order and when we save the sales order in R/3 the corresponding sales order number is attached with the purchase requisition in SAP APO. Is there any exits or BADI available while this Sales order detail transferred to APO or during this sales order details attached to Purchase requisition  in APO side.
    Many thanks in advance,
    Senthil

    Senthil,
    During the creation of the Sales order in SAP R/3 a Purchase requisition is created in SAP APO
    ?? I guess you are talking about one of the planning procedures that executes 'Start product heuristic immediately', yes?
    and assigned with temporary sales order
    I guess you are talking about [Temporary Quantity Assignments|http://help.sap.com/saphelp_glossary/en/74/b171467944d3119b440060b0671acc/content.htm], yes?
    Is there any exits or BADI available while this Sales order detail transferred to APO
    Standard enhancements are
    Sales order CIF enhancement on the ECC side
    CIFSLS03  (outbound from ECC)
    Sales order CIF enhancement on the APO side
    APOCF010 (Inbound from ECC)
    Best Regards,
    DB49

  • How can we access R/3 data remotely from SAP APO system?

    Hi Experts...!
        I want to access R/3 data (i.e, some ZTABLE data) remotely from SAP APO system. Can any one give some solution regarding this ?
    Regards
    Rayudu

    Hi,
    Please try this FM RFC_READ_TABLE.
    Regards,
    Ferry Lianto

  • Customer Exit Variable in SAP BI

    Hi to all,
    Please can any body tell me , What is Customer Exit Variable in SAP BI , how to use it , why we use it.
    please also sned any website link , or any PDF or DOC file that have example to explain Customer Exit Variable in SAP BI.
    I shall be thankfull to you for this.
    Regards
    PAVNEET RANA

    Hi,
    Customer Exit Variable in SAP BI : is used to calculata MTD,YTD, and some other calculations.
    You can define variables with Customer Exits and then write code in CMOD. See the Article/Blogs in the same
    https://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    CHeck the Following Articles.
    Customer Exit Variables in BW/BI Reports
    Using Customer Exit Variables in BW or BI Reports Part - 1
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/s-u/using%20customer%20exit%20variables%20in%20bw%20or%20bi%20reports%20part%20-%201.pdf
    How to use Customer Exit Variables in BW Reports: Part - 2
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/g-i/how%20to%20use%20customer%20exit%20variables%20in%20bw%20reports%3a%20part%202.pdf
    Using Customer Exit Variables in BW/BI Reports Part - 3
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10fc4382-afa6-2c10-1380-fa224fe4324f&overridelayout=true
    Using Customer Exit Variables in BW/BI Reports: Part - 4
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0fefc77-40e3-2c10-8da3-d4bfcb013387?quicklink=index&overridelayout=true 
    Calculating the Ageing of the Materials
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/a-c/calculating%20the%20ageing%20of%20the%20materials.pdf
    Thanks
    Reddy

  • How to put variables in WAD

    Gurus,
    I'm new to WAD. Please could you guide me how to have variables in WAD (for planning). Right now When I launch the WAD it pops up for all the variables. But what I want is that it should not ask for any variable while launching the WAD and later the variables should be filled up by drop downs inside the WAD. Is that possible?
    BR,
    SSC

    Hi,
    Is there a way to avoid pop up while launching the web application
    --> You can set in general tab of web template properties the variable screen to false (unmark it) "Display Variable Screen". Check:
    Web Template Parameters
    http://help.sap.com/saphelp_nw04s/helpdata/en/14/31fa826d0bd540899b02888bf55df4/frameset.htm
    In this case when I have created a drop down box for company code and then linked it to the variable in planning function
    --> You can use CHARACTERISTIC_SELECTION for your variable. Then read it from drop down box.
    Check:
    Data Binding Type CHARACTERISTIC_SELECTION
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/e7460656b60a29e10000000a11466f/frameset.htm
    and
    Dropdown Box
    http://help.sap.com/saphelp_nw04s/helpdata/en/c0/de413a51ce2e3ae10000000a11402f/frameset.htm
    Is this correct that I will have to choose variable value twice. While launching the web application (as a pop up) and then in the drop down once the web application is launched.
    --> If you use a variable for restriction of a query I think this is not correct. Query is restricted by the variable value you can not choose it again from drop down. But you can overwrite this value with dropdown value...
    Check this link how to create planning applications with the WAD...
    Creating Planning Applications in the BEx Web Application Designer 
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/c8240e47460aa5e10000000a1553f6/frameset.htm
    and
    Execute a Planning Function (Simple)
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/f0f8dc73b56bede10000000a11466f/frameset.htm
    Regards
    Andreas

  • How to enable variable substitution?

    Hi,
    I'm looking for some note that guides you how to enable variable substitution to create Target Directory/File Name Scheme at runtime.
    Do you have some helpful tip?
    Best regards,
    Gerardo.
    PS. i'll post reward points.

    hi,
    if you upgreaded you need to do: (to see new adapter functinality)
    3. I can't see my adapters in the adater monitoring after the import of a new SP
    a) try reimporting "SAP Basis software component"
    b) take a look at the XI installation guide on how to do it: "Importing the XI Content for Software Component Version SAP Basis 6.40"
    from SAP XI FAQ
    BTW
    <b>but don't use varible substitution ! </b>
    use adapter specific messages - much easier, better
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Urgent ...how to send output of sap through mail

    Could you please guide me how to send output of SAP Script  through mail in PDF format.
    Thanks in Advance....
    Regards,
    Kumar.

    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver,
               p_sender LIKE somlreci1-receiver,
                   p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    regards,
    venkat

Maybe you are looking for

  • Simple Mail Merge from Apex

    Hi All, I have a simple Report in Apex 3.0 that displays 10 people in the format Firstname Surname. I have linked this Report to BI Publisher and my RTF Template is setup as: - Dear Firstname Surname The Report opens OK in either PDF or Word format,

  • OBIEE 11g - usins Query as column

    hi all, I have a requirement to convert this SQL as a column value in OBIEE level select count(*) from ( SELECT SUM(quantity),SUM(quantity_received),po_header_id FROM F_ERP_PO group by po_header_id having SUM(quantity) = SUM(quantity_received)) as a

  • Adobe player and reader -updates and now cannot open new Email, reply Email or attached PDF's. Fix?

    On my Windows PC, Win 7, 64 bit, I have Adobe Reader and Adobe Player. a week or two or more I have had messages of Adobe updates and downloaded and installed them, but I think after these (could also be after Windows updates) I cannot open a new Ema

  • SOLAR01

    Hi , I want to disable the INSERT LINE(ICON) and DELETE ROW(ICON) in SOLAR01 in tab Structure, Kindly help me out in solving this... Regards Arun

  • Conversion in sales order

    Hi, I am creating sales order for exprt sales. The currency for the customer is "USD" I have maintained the exchange rate between INR & USD. 1. When i create the sales order without any reference, the system in the pricing conditions shows me values