ABAP code - General question

Hi Guys,
What is the difference between the following statements? In what scenarios should we use these?
a.   CREATE DATA data_ref LIKE LINE OF xth_data.
     ASSIGN data_ref->* TO <ls_data>.
b.   LOOP AT xth_data ASSIGNING <ls_data>.
c.   LOOP AT xth_data INTO <ls_data>.
Regards

a. You are creating a variable data_ref which is a workarea of the type xth_data
and assigning that structure type to the field symbol <ls_data>
b. the field Symbol <ls_data> does not need to be assigned to any datatype
It will get assigned to the structure of xth_data
c. It is assumed that your field-symbol <ls_data> has already been assigned to the xth_data type
this code simply loops into the table
note that if your field symbol is not assigned as yet, it will result in a GETWA_NOT_ASSIGNED short dump

Similar Messages

  • Link BOR Event with ABAP code (program or function)!

    Hello experts,
    I am trying to link program or function to bor event. Change of data in HR IT0002 trigger event CHANGE of PERSDATA Object. I need to execute some ABAP code (program or function) on CHANGE event, so I have to link event and ABAP code.
    Question: is it possible and how?

    Hi,
    It is very much possible....
    You can use the Workflow & use BO as PERSDATA & this workflow can be triggered on event change.
    & You can write your code ...
    Regards,
    Rahul

  • General question on SQL Server 2000 to Oracle 10g

    Hello all,
    I just have a general question on migration from SQL Server 2000 to Oracle 10g using SQL Developer.
    How does it migrate Users with proper privileges from SQL Server to Oracle? Follow the interface steps? Or should the users be created on destination Oracle side?
    Thank you.

    Hi,
    It depends which type of migration you are making.
    For a 'Standard' migration when you migrate data a 'create user' statement is created as part of the migration and you will see this in the generated code.
    If you are using the 'Quick' migration option then you need to create the Oracle user or use an existing user to receive the data.
    Your best option is to review the documentation available from -
    http://www.oracle.com/technology/tech/migration//workbench/index_sqldev_omwb.html
    or directly from -
    http://download.oracle.com/docs/cd/E12151_01/index.htm
    and then get back with specific questions if this does not give you the information you need.
    Review the chapter -
    2. Migrating Third-Party Databases
    in -
    Oracle® Database SQL Developer User’s Guide Release 1.5
    Regards,
    Mike

  • How to insert a new line item in VA01/VA02 by using ABAP code?

    Hi Gurus
    i have a very tough requirement. the customer wants to insert a free goods after an item has been populated in VA01/VA02 automatically according to some certain rules. the input material may be a main material of a sales BOM.
    for example. let's suppose there is a material A who has two sub-material B and C which is maintained in a sales BOM via CS01/CS02. when the material A has been input in the line item in VA01/VA02, its quantity input and after the ENTER key has been clicked, another material D may be displayed in a new line as a gift if the condition met.  the condition relates to customer/material/quanity and these information are stored in a Z-table.
    on the other hand, if the material A is only a single material(not a BOM), the gift(material D) will also be filled automatically if the condition met.
    i have already enhance the FM cs_bom_explosion to filfill the requirment for BOM materials. whereas it is very hard to find the enhanment point for the single material.
    so my question is where is the correct place for me to insert the ABAP code, which decides whether the gift should be given or not and furthermore inserts the new line item into XVBAP. i tried to use MV45AFZZ, whereas the data is always inconsistant if a new line has been inserted. it is very strange that there is no temperary internal table storing line item data input in the table controal of VA01/VA02. system reads the line item data , line by line, via a system kernal function call.
    any hints are welcome. thanks

    HI Stephen,
    I have the same prolem. I modified the 5 global tables, but I don't see the new line in the screen.
    Can you help me with some details?
    Thx!
    Mihaela

  • ScreenPainter Properties in ABAP code

    Hi all that's my first post here & i have a "Big" question can we use a screen painter element Properties in an ABAP code
    Exemple:
    in a input/output Field i want to change the text color after a some conditions
    Help please
    Regards.
    MEHDI

    Hello,
    There would some functionality that can be attained by coding in ABAP. Say for instance you want the text in an input box to be changed in color upon clicking a puchbutton.
    Say TEXT is the name of the input box and OK is the function code of the button, then if you write the code similar to the following  in the PBO of the screen, the color change can be attained
    if sy-ucomm = 'OK'.
      loop at screen.
        if screen-name = 'TEXT'.
          screen-intensified = '1'.
          modify screen.
        endif.
      endloop.
    endif.
    Similarly using screen-invisible, screen-input etc can be used to hide or disable the input box at runtime.
    Regards,
    Sachin

  • Difference between checking Objects in SU24 and in ABAP code

    Hi all,
    What is the difference between objects checked in SU24 and the objects checked in ABAP Code.
    I think if objects are even checked to No in SU24 and they are in ABAP code then user is able is able to execute that object, is this correct?
    and vice versa, if objects are checked to yes in su24 and not in the ABAP code then user wont be able to excute? is this correct
    or what is the purpose of maintaing objects both in SU24 and in ABAP Code.
    Thanks,
    Sun

    This is what is known in German as a "Schwerer Geburt"... (not sure whether there is an English term which has the same meaning)...
    When you searched, did you read this thread?:
    F110 - S_BTCH_ADM
    >
    Julius Bussche wrote:
    > My understanding of this confusion is ...
    >
    > ... SAP's development systems deem an "unknown" check to be successfull until specifiied for a check (this is different in customer systems - which leads many to believe that adding and removing check indicators from SU24 will add and remove authority-checks....),
    >
    > ...This problem then reproduces itself both in SU53 and ST01 once the SU22 / SU24 error has been made.
    >
    > ...It is one of those things which you need to know or find on your own (not too difficult), otherwise you simple don't know it.
    It is context specific, when the context is known to the customer system where the code is running => You cannot activate a check in SU24 if it is not coded anywhere (please distingish between starting a transaction, using it, and navigating further from that transaction...). The only case where SAP does what you seem to be assuming (or hoping for...) is infact to turn an authority-check off in some cases or to make the calling context known when it is remote (in which case sy-tcode or the entry point context is not known)...
    *It is not to turn the check on when it is not coded anywhere!!!
    Perhaps you would like to phrase your final question just one more time.
    Cheers,
    Julius

  • ABAP code in Survey suite

    Hi,
    We have requirement to map survey values from flat file.For example I have question which accept multiple values like
    Intersted in below products...
    Windows
    Unix
    DOS
    If pass these three vaues in flat file, I am not getting any error.However If I pass only one value like windows, keep unix and DOS fields blank, I am getting mapping format error in External list.
    Does anyone knows how to configure this scenario? I know we have option in ELM Mapping format to write ABAP code, Can we achieve this using ABAP?
    Thanks for your time.
    Cheers,
    Ajay

    Hi Ajay,
    It must be because the IDOC is expecting details for all three values.
    Better use abap coding to map them.
    Best Regards,
    Pratik Patel

  • Implement activation key in ABAP code

    In short:
    I want to implement a way to control if certain ABAP code (certain logicial areas) are executed, by having the ABAP code prompting for an activation key.
    Much like when you are promptet for a Developer access key or an object key for chaning sap standard code.
    The long explanation:
    We have som local developement in our system landscape that we want subsiduraies to request an access key if they want to go beond a certain point (or if they want to use this logical part of the develoment).
    They should be promptet for an access key - which they then request from the head office.
    A case could also be if we are developing an SAP Add-on using AAK (Add-on Assemply Kit) and we want to close of certain areas of functionality, these areas of functionality could then be opened by a access key requested from headoffice.
    Question
    Do you know how to impelment an access key feature in ABAP?

    For programs (SE38), you may implement EXIT_SAPLS38E_001 of extension SEUED001 (using CMOD transaction) to keep users from modifying programs:
    IF operation = 'EDIT' AND
       program IN <reserved_to_head_office> AND
       sy-uname NOT IN <head_office_team>.
      MESSAGE i001(00) WITH 'program reserved exclusively to head office'.
      RAISE cancelled.
    ENDIF.
    For function modules (SE37), you may implement EXIT_SAPLS38L_001 of extension SEU00004:
    IF operation = 'MODIFY' AND
       objectname IN <reserved_to_head_office> AND
       sy-uname NOT IN <head_office_team>.
      MESSAGE e001(00) WITH 'this FM is reserved exclusively to head office'
              RAISING cancelled.
    ENDIF.
    For methods (SE24), I don't know how to do it. I guess implicit enhancement option should be used.
    Edited by: Rob Burbank on Mar 22, 2010 6:40 PM

  • Trouble with SAPconnect / sending email in ABAP-code

    Hi,
    with the code below I try to send an email from ABAP outside
    to an mail-account in the internet.
    I'll get no error/exceptions but the mail will be not send
    to the internet-mail-account.
    In Transaktion SCOT I checked the SAPconnect-Node "INT"-"SMTP".
    There is a mailserver with the right IP und the right Port. So I don't understand
    what could be the problem!?
    Can anybody help me and say me why the code below doesn't works?
    Best wishes!
    * For API
    data: maildata type sodocchgi1.
    data: mailtxt  type table of solisti1 with header line.
    data: mailrec  type table of somlrec90 with header line.
    start-of-selection.
      clear:    maildata, mailtxt,  mailrec.
      refresh:  mailtxt, mailrec.
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test'.
      maildata-obj_langu = sy-langu.
      mailtxt-line = 'This is a test'.
      append mailtxt.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type  = 'U'.
      append mailrec.
        call function 'SO_NEW_DOCUMENT_SEND_API1'
             exporting
                  document_data              = maildata
                  document_type              = 'RAW'
                  put_in_outbox              = 'X'
             tables
                  object_header              = mailtxt
                  object_content             = mailtxt
                  receivers                  = mailrec
             exceptions
                  too_many_receivers         = 1
                  document_not_sent          = 2
                  document_type_not_exist    = 3
                  operation_no_authorization = 4
                  parameter_error            = 5
                  x_error                    = 6
                  enqueue_error              = 7
                  others                     = 8.
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
    * Start the send process using the following statement
    submit rsconn01 with mode = 'int' and return.
    Message was edited by:
            sebastian eckes

    SAP is a robust system, which gives many facilities in the form of Function Modules (FMs) for connecting to external systems or for use within the system. With a clever use of these FMs we can achieve a lot of things through ABAP code.
    This article focuses on ways to send E-mails and SAP Mails using ABAP code.
    Firstly SAP Mail
    A SAP mail is a mail internal to the SAP system. It is a very good forum to exchange information with other users. Using a SAP mail in ABAP code facilitates exchange of automatic messages at various stages of the business process. It is easy to use and saves many hassles involved in using workflows for exchanging messages.
    The ABAP code to send a sap mail is built around the FM SO_OBJECT_SEND which has the following pattern.
    call function 'SO_OBJECT_SEND'
    exporting
    EXTERN_ADDRESS = ' '
    FOLDER_ID = ' '
    FORWARDER = ' '
    OBJECT_FL_CHANGE = ' '
    OBJECT_HD_CHANGE = ' '
    OBJECT_ID = ' '
    OBJECT_TYPE = ' '
    OUTBOX_FLAG = ' '
    OWNER = ' '
    STORE_FLAG = ' '
    DELETE_FLAG = ' '
    SENDER = ' '
    CHECK_ALREADY_SENT = ' '
    importing
    object_id_new =
    sent_to_all =
    tables
    OBJCONT =
    OBJHEAD =
    OBJPARA =
    OBJPARB =
    receivers =
    PACKING_LIST =
    ATT_CONT =
    ATT_HEAD =
    NOTE_TEXT =
    exceptions
    active_user_not_exist = 1
    communication_failure = 2
    component_not_available = 3
    folder_not_exist = 4
    folder_no_authorization = 5
    forwarder_not_exist = 6
    note_not_exist = 7
    object_not_exist = 8
    object_not_sent = 9
    object_no_authorization = 10
    object_type_not_exist = 11
    operation_no_authorization = 12
    owner_not_exist = 13
    parameter_error = 14
    substitute_not_active = 15
    substitute_not_defined = 16
    system_failure = 17
    too_much_receivers = 18
    user_not_exist = 19
    x_error = 20
    others = 21.
    In the next article we will understand the main parameters and table interfaces of the FM.
    Import Parameters Name and Description     Field name     Field function
    Object_hd_change (structure) Contains the process to be done when SAP mail is marked for execution.When the Execute Icon in the SAP mail is clicked the corresponding object is executed     vmtyp     ‘D’ for dialog module ‘F’ for function module‘R’ for report‘T’ for transaction‘U’ for transaction with export
         Acnam     Name of the object which is to be executed, like name of transaction/report
         Skips     ‘X’ to execute first screen in background
         Objsns     Indicates sensitivity of the object. ‘P’ for private object‘F’ for functional object‘O’ for confidential object‘C’ for company confidential objectSensitivity level is restricted to ‘O’ for documents in shared folders
         Objla     Language of the document ‘E’ for Englishsy-langu for system language
         Objnam     Name of the document
         Objdes     Short description (Title) of the document
         Objsrt     Name of the sort field. This is used to group documents based on certain criteria
    Object_type Type of document to be sent with mail           ‘RAW’ for raw text (default) ‘DOC’ for word file ‘XLS’ for excel fileAll classes can be used except for folders (‘FOL’) and distribution lists (‘DLI’)
    Outbox_flag           ‘X’ to indicate that mail should also be stored in outbox of the user after sending (default ‘ ‘)
    Owner           Sap login of the user responsible for transmission
    Table Parameters Name and Description     Field Name     Field function
    Objcont Table to hold the body of the mail     Line     Text lines up to 255 characters
    Objhead Table to hold number of lines in the body of the mail, i.e size of the table in lines     Line     Text lines up to 255 characters
    Objpara Table to hold the set/get parameters to be transferred to the processing element     Name     Name of the parameter. Only first three characters are used
         Option     Not used
         Low     Value of the parameter in name
         High     Not used
    Objparb Table to hold information for mails to which a certain processing type is assigned. For a report or transaction with transfer of values to global memory, the table has to contain the parameters with relevant values. The memory id is taken from the first row. For a FM or dialog module, data in table will be transferred as table parameter msgdial     Name     For report or transaction with transfer of values to global memory, the field for first row should hold the name of the memory id used for export and the other rows should hold the parameter names. For FM or dialog module this field should hold the values as per the usage of the module
         Value     For report or transaction with transfer of values to global memory, the field for first row should remain empty and the other rows should hold values of the parameters. For FM or dialog module this field should hold the values as per the usage of the module
    Receivers Table to hold recipient details     Recnam     SAP login of the recipient. Append all the recipients to this table
         Sndcp     X for sending mail as a copy
         Sndex     X for sending as express document. This will prompt a logged on recipient saying that he or she has received an express mail
         Recesc     ‘B’ for SAP user ‘E’ for external email address‘U’ for unix address
    Export Parameters Name and Description     Field name     Field function
    Object_id_new Contains object id of document created during send process            
    Sent_to_all X indicates that document was sent to all recipients. Flag is not activated if sending fails in one or more cases           
    Main Exceptions Name and Description     Description
    Too_much_receivers      Number of recipients is greater than number for which sender is authorised to send
    Object_not_sent     Document was not delivered to any of the recipients
    Object_not_exist     Document class specified does not exist or cannot be sent
    Object_no_authorisation     Document could not be sent as one of the required authorisations does not exist
    Parameter_error     Invalid combination of parameter values transferred to FM
    X_error     Internal error occurred
    Once all the parameters and table interfaces are properly filled, call the function module to send the SAP mail to the recipient inbox.
    Care should be taken to report the status of execution of the function module to the user using one of the exceptions defined (refer function module pattern above)
    Though SAP mail is a very robust method of interacting with users within SAP system, it is always good to receive email in Microsoft inbox. This also works like an additional notification to users in case they do not check SAP mail regularly. The next article covers sending E-mails using ABAP.
    Sending Email to a non-SAP system:
    Though SAP mail is a very robust method of interacting with users within SAP system, it is always good to receive email in Microsoft inbox. This also works like an additional notification to users in case they do not check SAP mail regularly.
    Sending an email to the Microsoft Inbox is a way of interacting with a non SAP system through ABAP code and hence is very interesting. A fair knowledge of UNIX shell scripting is assumed here.
    The ABAP code to send an email to Microsoft inbox revolves around following UNIX script
    Echo "From:" "<"$1">" > <unix file path name>
    Echo "To:" "<"$2">" >> <unix file path name>
    Echo "Subject:" "<"$3">" >> <unix file path name>
    Cat $4 >> <unix file path name>
    Uuencode $5 $6 >> <unix file path name>
    Cat <unix file path name> | /usr/sbin/sendmail –f $fraddr $toaddr
    (Note : the commands in the above script can be case sensitive. Check the actual case on the unix installation in question)
    Let us understand the various parts of the above script.
    $1 = Sender email address
    $2 = Recipient email address
    $3 = Subject of the email
    $4 = Path of unix server file having email body
    Form email body as an internal table in ABAP program, download it to a unix server file
    $5 = Path of unix server file to be sent as email attachment
    $6 = Name to be given to the attachment (like test1.doc, test1.xls). The corresponding Microsoft icon
    will be shown in the email for the type of file attached ( Word document, excel document etc)
    The script builds a temporary file and pipes the file to the sendmail command to achieve the mission.
    This script can be invoked from SAP to send the mail to the intended recipient. Store this small script on the unix server. (Assume script name is sndmail )
    To do this we should define a link in the SAP system between a customized command and this unix script.
    The FM to define a customized command in SAP system has the following pattern.
    call function 'SXPG_CALL_SYSTEM'
    exporting
    commandname =
    PARAMETERS = ' '
    importing
    status =
    tables
    exec_protocol =
    exceptions
    no_permission = 1
    command_not_found = 2
    parameters_too_long = 3
    security_risk = 4
    wrong_check_call_interface = 5
    program_start_error = 6
    program_termination_error = 7
    x_error = 8
    parameter_expected = 9
    too_many_parameters = 10
    illegal_command = 11
    others = 12.
    In the next article we will understand the main parameters and table interfaces of the FM.
    Import Parameters Name and Description     Field name     Field function
    Commandname Name of unix shell script or command to be executed by SAP           Name of unix shell script to be invoked
    Parameters           The parameters to be sent to unix shell script ($1, $2 etc). Send parameters as a concatenated string separated by space and length not exceeding 128 characters For eg in UNIX environment the above shell script would be executed as Sndmail [email protected] [email protected] Trial /home/test.doc testmail.We will be simulating this command using the FM from SAP system
    Table Parameters Name and Description     Field Name     Field function
    Exec_protocol (structure) Table to get messages from unix server after shell script is executed     Length     Length of the message from external program i.e unix
         Message     Log message from external program i.e unix
    Export Parameters Name and Description     Field name     Field function
    Status Contains the status of execution of external program            Scheduling status of external program i.e unix
    Once the above FM is invoked with the necessary parameters the unix program sendmail will send a mail to the inbox of the recipient in Microsoft.
    The restriction on the parameter string length of 128 characters can be removed to make way for very long email addresses and subjects. Build the parameters into an internal table and download it as a file on the unix server. Instead of passing each parameter individually, pass the unix server path of this file as the parameter to the unix shell script (sndmail mentioned above). Modify the shell script to read every line of this parameter file as variables to be used in the shell script.
    In the next article we will see an example of the ABAP code you can use to send SAP Mails.
    REPORT ZTSAPMAIL.
    DATA: X_OBJECT_TYPE LIKE SOOD-OBJTP.
    DATA: BEGIN OF X_OBJECT_HD_CHANGE.
    INCLUDE STRUCTURE SOOD1.
    DATA: END OF X_OBJECT_HD_CHANGE.
    DATA: BEGIN OF X_OBJCONT OCCURS 10.
    INCLUDE STRUCTURE SOLI.
    DATA: END OF X_OBJCONT.
    DATA: BEGIN OF X_OBJHEAD OCCURS 0.
    INCLUDE STRUCTURE SOLI.
    DATA: END OF X_OBJHEAD.
    DATA: BEGIN OF RAW_HEAD.
    INCLUDE STRUCTURE SORH.
    DATA: END OF RAW_HEAD.
    DATA: BEGIN OF X_RECEIVERS OCCURS 0.
    INCLUDE STRUCTURE SOOS1.
    DATA: END OF X_RECEIVERS.
    PARAMETERS: RECEIVER LIKE X_RECEIVERS-RECNAM. " Name
    *BUILD MESSAGE HEADER
    MOVE 'Sort field goes here' TO X_OBJECT_HD_CHANGE-OBJSRT. " Sort field
    MOVE 'Name of the object goes here' TO X_OBJECT_HD_CHANGE-OBJNAM. " Name
    MOVE 'Document title goes here' TO X_OBJECT_HD_CHANGE-OBJDES. " Title
    MOVE 'F' TO X_OBJECT_HD_CHANGE-OBJSNS. " Functional OBJECT
    MOVE 'E' TO X_OBJECT_HD_CHANGE-OBJLA. " Language
    Object type of the new document
    MOVE 'RAW' TO X_OBJECT_TYPE.
    CLEAR X_OBJCONT.
    MOVE 'Contents of mail' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    CLEAR X_OBJCONT-LINE. APPEND X_OBJCONT.
    MOVE 'More contents' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    MOVE 'Still more contents'
    to x_objcont-line.
    APPEND X_OBJCONT.
    MOVE ' ' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    Specific header (Dependent on the object type, here RAW)
    REFRESH X_OBJHEAD.
    DESCRIBE TABLE X_OBJCONT LINES RAW_HEAD-RAWSIZ.
    MOVE RAW_HEAD TO X_OBJHEAD.
    APPEND X_OBJHEAD.
    *RECEIVERS table
    CLEAR X_RECEIVERS.
    REFRESH X_RECEIVERS.
    MOVE RECEIVER TO X_RECEIVERS-RECNAM. " Name
    MOVE 'B' TO X_RECEIVERS-RECESC. " Receiver type
    MOVE 'X' TO X_RECEIVERS-SNDCP. " Send as a copy
    MOVE 'X' TO X_RECEIVERS-SNDEX. " EXPRESS DOCUMENT
    APPEND X_RECEIVERS.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = 'OUTBOX'
    forwarder = x_forwarder
    object_fl_change = x_object_fl_change
    OBJECT_HD_CHANGE = X_OBJECT_HD_CHANGE
    object_id = x_object_id
    OBJECT_TYPE = X_OBJECT_TYPE
    OUTBOX_FLAG = 'X'
    OWNER = SY-UNAME
    store_flag = x_store_flag
    importing
    object_id_new = x_object_id_new
    sent_to_all = x_sent_to_all "May need to use
    TABLES
    OBJCONT = X_OBJCONT
    OBJHEAD = X_OBJHEAD
    objpara = x_objpara
    objparb = x_objparb
    RECEIVERS = X_RECEIVERS.
    REPORT ZTUNIXMAIL.
    DATA : TO_ADDRESS LIKE SY_LISEL,
    FROM_ADDRESS LIKE SY-LISEL,
    SUBJECT LIKE SY-LISEL,
    ATTACHMENT_NAME LIKE SY_LISEL,
    DATA_FILE_PATH LIKE SXPGCOLIST-PARAMETERS,
    BODY_FILE_PATH LIKE SXPGCOLIST-PARAMETERS.
    DATA : BEGIN OF INT_EMAIL_ATTACH OCCURS 0,
    TXTLINE CHAR(255),
    END OF INT_EMAIL_ATTACH.
    DATA : BEGIN OF INT_EMAIL_BODY OCCURS 0,
    TXTLINE CHAR(255),
    END OF INT_EMAIL_BODY.
    CLEAR : INT_EXEC_PROTOCOL,INT_EMAIL_ATTACH,INT_EMAIL_BODY.
    REFRESH : INT_EXEC_PROTOCOL,INT_EMAIL_ATTACH,INT_EMAIL_BODY.
    INT_EMAIL_ATTACH-TXTLINE = 'Put all attachment text in this table'.
    APPEND INT_EMAIL_ATTACH. CLEAR INT_EMAIL_ATTACH.
    INT_EMAIL_BODY-TXTLINE = 'Put all attachment text in this table'.
    APPEND INT_EMAIL_BODY. CLEAR INT_EMAIL_BODY.
    CONCATENATE TO_ADDRESS
    FROM_ADDRESS
    SUBJECT
    BODY_FILE_PATH
    DATA_FILE_PATH
    ATTACHMENT_NAME
    INTO V_PARAMETERS.
    IF NOT INT_EMAIL_ATTACH[] IS INITIAL.
    OPEN DATASET DATA_FILE_PATH FOR OUTPUT IN TEXT MODE.
    LOOP AT INT_EMAIL_ATTACH.
    TRANSFER INT_EMAIL_ATTACH-TXTLINE TO DATA_FILE_PATH.
    ENDLOOP.
    CLOSE DATASET DATA_FILE_PATH.
    ENDIF.
    IF NOT INT_EMAIL_BODY[] IS INITIAL.
    OPEN DATASET BODY_FILE_PATH FOR OUTPUT IN TEXT MODE.
    LOOP AT INT_EMAIL_BODY.
    TRANSFER INT_EMAIL_BODY-TXTLINE TO BODY_FILE_PATH.
    ENDLOOP.
    CLOSE DATASET BODY_FILE_PATH.
    ENDIF.
    CALL FUNCTION 'SXPG_CALL_SYSTEM'
    EXPORTING
    COMMANDNAME = 'Z_EMAIL' - Command calling unix script
    PARAMETERS = V_PARAMETERS
    importing
    status = ''
    TABLES
    EXEC_PROTOCOL = INT_EXEC_PROTOCOL
    EXCEPTIONS
    NO_PERMISSION = 1
    COMMAND_NOT_FOUND = 2
    PARAMETERS_TOO_LONG = 3
    SECURITY_RISK = 4
    WRONG_CHECK_CALL_INTERFACE = 5
    PROGRAM_START_ERROR = 6
    PROGRAM_TERMINATION_ERROR = 7
    X_ERROR = 8
    PARAMETER_EXPECTED = 9
    TOO_MANY_PARAMETERS = 10
    ILLEGAL_COMMAND = 11
    OTHERS = 12.
    regards,
    srinivas
    <b>*Reward points for useful answers*</b>

  • ABAP Code To Authenticate Users

    Hi,
    How can I code a ABAP program/function which will authenticate a user based only on their user id?  Do not want to use their password.
    I want the entire authentication process to happen in the ABAP code.
    Any ideas?
    Thanks,
    Audrey

    Hi,
    To check the authorization of the user of an ABAP program, use the AUTHORITY-CHECK statement:
    AUTHORITY-CHECK OBJECT '<object>'
                            ID '<name1>' FIELD <f1>
                            ID '<name2>' FIELD <f2>
                            ID '<name10>' FIELD <f10>.
    <object> is the name of the object that you want to check. You must list the names (<name1>, <name2> ...) of all authorization fields that occur in <object>. You can enter the values <f 1 >, <f 2 >.... for which the authorization is to be checked either as variables or as literals. The AUTHORITY-CHECK statement checks the user’s profile for the listed object, to see whether the user has authorization for all values of <f>. Then, and only then, is SY-SUBRC set to 0. You can avoid checking a field by replacing FIELD <f> with DUMMY. You can only evaluate the result of the authorization check by checking the contents of SY-SUBRC. For a list of the possible return values and further information, see the keyword documentation for the AUTHORITY-CHECK statement. For further general information about the SAP authorization concept, refer to Users and Authorizations.
    There is an authorization object called F_SPFLI. It contains the fields ACTVT, NAME, and CITY.
    SELECT * FROM SPFLI.
       AUTHORITY-CHECK OBJECT 'F_SPFLI'
                            ID 'ACTVT'  FIELD '02'
                            ID 'NAME' FIELD SPFLI-CARRID
                            ID 'CITY'   DUMMY.
       IF SY-SUBRC NE 0. EXIT. ENDIF.
    ENDSELECT.
    If the user has the following authorizations for F_SPFLI:
    ACTVT 01-03, NAME AA-LH, CITY none,
    and the value of SPFLI-CARRID is not between "AA" and "LH", the authorization check terminates the SELECT loop.
    Hope it helps u.
    Thanks&Regards,
    Ruthra.R

  • ABAP code for custom OLAP variables

    Hi experts,
    We have a custom variant set as customer exit that I have just added to an infopackge for the data selection of 0FISCYEAR infoobject via 7-OLAP Variant. When I click on the magnifying glass under the "details for Type" column, the "Use Variable of OLAP Processor" window appears showing the OLAP Variable and the fiscal year variant. When you hit F6 (check) it should process the variant and return data for the ranges. With this variant we are using there is not data being returned (using the SAP exit variants data is returned).
    I have gone through the forums and have seen people citing the function module EXIT_SAPLRRS0_001 as this is the user exit which houses such abap code. I have seen the variant inside this module and the code itself, but why is it in the infopackage when I click on check (F6) no data is returned? I am getting the feeling this abap code is only executed for reporting. In this case I want the infopackage to select certain data from R/3 (via the use of OLAP variable with custom code) during the load to the ODS.

    Hi Mark,
    If you created the custom fiscal year variant as a customer exit type, I doubt that it'll work.
    Variant is an auxiliary time characteristic. You cannot create it. You can only add new char values:
    BW Customizing Implementation Guide (SPRO tcode) -> Business Information Warehouse -> General BW Settings -> Maintain fiscal year variant.
    Though, maybe I misunderstood your requirements.
    Best regards,
    Eugene
    Message was edited by: Eugene Khusainov

  • ECATT/ABAP code to close a session while executing a chain script

    How to close the extra created session during the execution of chain script??
    Details of the problem:
    I'm using eCATT for automating different business flows in SAP,
    For a particular scenario I have to create a chain script,
    One chain script may contain up to 40 individual scripts,
    This chain script will contain around 7 report programs using SE38 transation,
    While executing SE38 script(report program), one extra session is opening (log display session),
    but, my script can close the original SE38 screen only, not the extra created session,
    So, after executing 5 scripts (SE38 scripts), then "sessions reached to its max" message is appearing, and the script is failing,
    As it is a automation test script, no manual interaction will be there,
    i.e - we should not close the extra session manually.
    Now, my question is:
    How to close the extra created session..??
    How the recording should be done to handle this problem..??
    or any extra code should be added to close the extra session..??
    Is there any ABAP code.. or eCATT command available to handle this problem..??
    If you have any idea to close the extra created session, please share it with me,
    my effort:
    I tried with "RESCON" command... this will close all the SAP sessions,
    This will not work for my scenario,
    and, I tried with "Close session after every RFC",
    this will work, but, after executing 5 SE38 scripts, I'm facing the above problem.
    Please suggest me a solution, Thanks in advance..
    Regards,
    Chandra shekhar.A
    Message was edited by:
            chandra shekhar
    Message was edited by:
            chandra shekhar

    user13490676 wrote:
    could it be a problem with jmf itself that the endofstream doesnt get generated for the datasource being read from a fileIn this instance, that would be the problem... more than likely, there's something weird about the file, perhaps it doesn't have a duration set in the header and JMF treats it like a live stream.
    You could always write a custom DataSource that just passes through the input of a normal data source, and then generate the EndOfStream event yourself... maybe based on a timeout or failure counter? I haven't received any data in x seconds or after x attempts, so I'm assuming the file is done... Or when you've read enough data that the file can't possibly have any more (read >= file header + file data)...

  • GRR2- 4FM-RepPaint(put ABAP code for convert data in field)

    Hi,
    If somebody know how possible add ABAP code for convert data in some column-field of report (by RepWriter,UserExit,BADI)?
    Thanks a lot.

    Elaborate your question. Not clear ??

  • General Question on Proxies

    Hi,
    I have few general questions....
    How to decide which proxy to be used: Java or ABAP?
    What are the deciding factors?
    Which one is better when it comes to performance?
    Regards,
    Rajani Kumar

    bump

  • Delete scriptcode - General question: capacity limit of Acrobat Windows

    Hello everybody,
    I've got a general question to the capacity limit of Acrobat Windows.
    I often make forms with
    for instance the current one has 18 pages. Eleven pages have fields on it. (But some pages have only one field on it) The fields of one page to another are sometimes linked with script code. The file needs nearly 1 MB.
    Usual I write the script code by a double-click on the field/ calculate/ custom calculation script. (Is this the right way?) Today it happens again that a field with script code lost the script code.
    That's why I wonder whether there is a capacity limit of Acrobat Windows or whether I make mistakes. (This is only one instance of several where the form has his own life.)
    Thanks in advance for helping me!

    http://forums.adobe.com/community/acrobat/acrobat_scripting

Maybe you are looking for

  • How do you delete numerous duplicates at one time?  Can you?

    I have bought a new computer and want to merge my IPod Itunes content and my PC content as I used my Classic IPod more as a hardware place to store everything.  I can get it to display duplicates, but there are so many I wondered if I could just dele

  • Low performanc​e USB port on X61

    Hi, Recently I found my X61 has a low USB performance, when I copy files to my external USB HDD, the speed is about 13MB/s. Then I tested X61's writing speed on external USB HDD with HDtune and ATTO Disk benchmark, it is around 12-14MB/s. But The USB

  • How to populate PERNR while posting with BAPI_ACC_INVOICE_RECEIPT_POST

    HI, I am not able to pass Personal Number(PERNR) while posting with BAPI_ACC_INVOICE_RECEIPT_POST. Is there any enhancement which will help to solve this. << Moderator message - Everyone's problem is important. But the answers in the forum are provid

  • How can I add a linkbutton in the matrix (SBO 7.10.75)

    Hi ,everybody ,I want to add a linkbutton in a matrix ,and it's linkobject is If_PurchaseOder , but there are some errores ,and I don't know why . in the SBO2004B ,You can use set oLink=oColumn.ExtendedObject oLink.LinkObject=If_PurchaseOrder but in

  • Getting error with word wrap

    So this is the error im getting: Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.           at flashx.textLayout.elements::FlowElement/getAbsoluteStart()[C:\Vellum\branches\v1\1.0\dev\ output\openSou