Function Module to update the file path/name into Infopackage

Hi Experts,
I have some flat files which will be loaded to the directly daily. My requirement is to update the file name into the infopackage dynamically. Please suggest any function module or program for it.
Thanks,
Kittu

In Higher versions, we can use the below code:
call method CL_GUI_FRONTEND_SERVICES=>ENVIRONMENT_GET_VARIABLE
    exporting
      VARIABLE   = 'TEMP'
    importing
      VALUE      = LV_TMP
    exceptions
      CNTL_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.
  call method CL_GUI_CFW=>FLUSH
    exceptions
      CNTL_SYSTEM_ERROR = 1
      CNTL_ERROR        = 2
      others            = 3.
  if SY-SUBRC <> 0.
Error handling
  endif.
  concatenate lv_tmp '\' into folder_path.
But need to know in the lower versions like 3.1h and 4.0,

Similar Messages

  • Function module to get the file path in the system for TEMP folder

    Hi All,
    Is there any function module that I can use to get the file path in the system for TEMP folder.
    I mean, i am supposed to give only TEMP as the input for that function module and I need to get the path of that in the system as the output.
    I am unsing 4.0 version.
    Please advice.
    Regards
    Ramesh

    In Higher versions, we can use the below code:
    call method CL_GUI_FRONTEND_SERVICES=>ENVIRONMENT_GET_VARIABLE
        exporting
          VARIABLE   = 'TEMP'
        importing
          VALUE      = LV_TMP
        exceptions
          CNTL_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.
      call method CL_GUI_CFW=>FLUSH
        exceptions
          CNTL_SYSTEM_ERROR = 1
          CNTL_ERROR        = 2
          others            = 3.
      if SY-SUBRC <> 0.
    Error handling
      endif.
      concatenate lv_tmp '\' into folder_path.
    But need to know in the lower versions like 3.1h and 4.0,

  • CRM function module to update the attribute in the classification TAB of BP

    Hi All,
    Can any body let me know if there is any functionmodule to update the CRM function module to update the attribute in the classification TAB of BP tcode.
    I have searched a lot i get FM to update the marketing attribute and not the attributes in the classification tab.
    Thanks in Advance
    Edited by: Sharath Kumar on Dec 2, 2010 4:48 PM

    For material bom: CSAP_MAT_BOM_CREATE
    and CSAP_ORD_BOM_CREATE for Order BOM.
    Regards,
    Ravi

  • Creation of function module for updating the ztable

    Hi,
    I am sending the requirement for ceation of function module for updating the ztable.
    Requirement----
    Table Updation rule (New record)
    While creating a new record the calling function will export the following to the table handling function.
    Table field     Probable Values
    ZORDERNO------->     Sales Delivery no in case of sales orderShipment no in case of transfer order
    UNAME----
    >     User ID
    ZORDTYPE----
    >     SALEOR in case of sales orderTRANSF in case of transfer order
    ZREFDOCNO----
    >Sales Order no in case of sales orderPurchase Order no in case of transfer order
    ZREFDOCNO1----
    >Delivery no in case of transfer order
    The table handling function will calculate the following fields
    Table field     Probable Values
    ZREQNO----
    >Running serial number (incremented by 1 for each new record)
    ZREQDAT     -
    >System date
    ZREQTIME----
    >     System time
    ZSTATUS----
    >OPEN (for all new records)
    Before inserting a new record the table handling function will always check if a previous record exists for the same order / shipment no. if record exists the function will not insert a new record.
    Table Updation rule (Status Update)
    While updating a record the calling function will export the following to the table handling function.
    Table field     Probable Values
    ZORDERNO----
    >Sales order no in case of sales orderShipment no in case of transfer order
    ZSTATUS----
    >CANCEL if cancellation successfulERROR if cancellation not possible (order already processed)
    The table handling function will calculate the following fields
    Table field     Probable Values
    ZSTATDAT----
    >System date
    ZSTATTIME----
    >     System time

    Do you have to create/update new record in Ztable through Function Module ?
    or you need to write FM only for validation?
    Any how, you need to create a Program with Input values for the fields of Ztable, and for rest of fields the Value can be calculated based on input as per your requirement.
    Let me know clearly what exactly u need ?
    Regards,
    Kiran

  • Function module to choose the file for download and upload

    what is the function module to choose the file for download and upload  for presentation server.
    give me with example

    Please search in SCN.
    This has been discussed so many times.

  • Function Module to Update the values in STPO!! VERY URGENT!!!!!!!!!!!!!!!!!

    Hi All,
    Can any one tell me is there any Remote function module to update the values of components in STPO table while creating Sales order BOM, Material BOM, and WBS BOM. For example I want to update the Spare Part Indicator for Item components based on Plant.
    Please do the needful..
    Regards
    Yathish

    Hi Naren,
    Thanks for ur reply,
    The BAPI that you have gave is to update only Material BOM. But I want to Change  and create spare part indicator for 4 BOM's, ie Sales Order BOM, Eqipment BOM and also Material BOM and WBS BOM.
    Can u please shed some light on it,so that it would be helpfull to me.
    Thanks
    Yathish

  • Function module to update the values in STPO table :   VERY URGENT!!!!!!!!!

    Hi All,
    Can any one tell me is there any Remote function module to update the values of components in STPO table while creating Sales order BOM, Material BOM, and WBS BOM. For example I want to update the Spare Part Indicator for Item components based on Plant.
    Please do the needful..
    Regards
    Yathish

    For material bom: CSAP_MAT_BOM_CREATE
    and CSAP_ORD_BOM_CREATE for Order BOM.
    Regards,
    Ravi

  • Function Module to update the FI and Logistics Invoice

    Hi All,
    Is there any function module which updates the FI and Logistics Invoice simultaneously?
    Regards,
    Adapala M

    For material bom: CSAP_MAT_BOM_CREATE
    and CSAP_ORD_BOM_CREATE for Order BOM.
    Regards,
    Ravi

  • Function Module to update the sales order header status

    Hi,
      I am looking for a function module to update the Sales order header status.
      Pls. let me know if anybody has used any FM to update the SO status.
    Thanks,

    By mentioning status do you mean Object status or Document status??
    For Object status you may use FM: STATUS_MAINTAIN
    For document status it changes according to flow.
    Regards
    Eswar

  • Java Module for changing the file's name

    Hi all
    I m developing a java module for altering a file's name. I m trying to append system date and time to the file name and send it back. I was successful in retrieving the file's name, appending date n time in it but now I want to send it back. How can I achieve this ? any pointers will be very helpful
    awaiting your reply
    Regards
    Kapil

    String SIGNATURE = "process(ModuleContext moduleContext, ModuleData inputModuleData)";
              TRACE.entering(SIGNATURE, new Object[] { moduleContext, inputModuleData });
    //          Access the XI message. I.e. this module must be placed in the module chain
               // behind a module that sets an XI message as principal data.
               Object obj = null;
               Message msg = null;
               try {
                         obj = inputModuleData.getPrincipalData();
                         msg = (Message) obj;
                        Message msgg = (Message)inputModuleData.getPrincipalData();     
                        AuditMessageKey amk = new AuditMessageKey(msgg.getMessageId(), AuditDirection.INBOUND);               
                        Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "RenameFile: Module Called");
    //               Read the channel ID, channel and the module configuration
                         String cid  = null;
                         String mode = null;
                         String fileName = null;
                         try {
                              // CS_GETMODDAT START
                              mode = (String) moduleContext.getContextData("mode");
                              // CS_GETMODDAT END
                              // CS_GETCHADAT START
                              cid  = moduleContext.getChannelID();
                              Channel channel = new Channel(cid);
    //                          channel = (Channel) LookupManager.getInstance().getCPAObject(CPAObjectType.CHANNEL, cid);
                              // Example to access a channel configuration parameter in a module: String someParameter = channel.getValueAsString("YourAttributeName");
                              // CS_GETCHADAT END
    //                         Hashtable mp = (Hashtable) inputModuleData.getSupplementalData("module.parameters");
    //                           if(null != mp)
    //                                 fileName = (String)mp.get("FileName");
    //                                 fileName = fileName + todaysDate;
    //                                 mp.put("FileName",fileName);     
                             fileName = channel.getValueAsString("file.targetFileName");
                             Date todaysDate = new Date(System.currentTimeMillis());
                             fileName = fileName + todaysDate;
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "RenameFile: fileed" + fileName);
                              if (mode == null) {
                                   TRACE.debugT(SIGNATURE, "Mode parameter is not set. Switch to 'none' as default.");
                                   mode = "none";
                              TRACE.debugT(SIGNATURE, "Mode is set to {0}", new Object[] {mode});
                         } catch (Exception e) {
                              TRACE.catching(SIGNATURE, e);
                              TRACE.errorT(SIGNATURE, "Cannot read the module context and configuration data");
                              ModuleException me = new ModuleException(e);
                              TRACE.throwing(SIGNATURE, me);
                             Audit.addAuditLogEntry(amk, AuditLogStatus.ERROR, "Rerrrd" + me);
                              throw me;
    //               try{
    //                  Hashtable mp = (Hashtable) inputModuleData.getSupplementalData("module.parameters");
    //                  String fileName = null;
    //                  Date todaysDate = new Date(System.currentTimeMillis());
    //                  if(null != mp)
    //                       fileName = (String)mp.get("FileName");
    //                       fileName = fileName + todaysDate;
    //                       mp.put("FileName",fileName);     
    //                  inputModuleData.setSupplementalData("module.parameters", mp);
    //               }catch(Exception e){
               } catch (Exception e) {
                    TRACE.catching(SIGNATURE, e);
                    if (obj != null)
                         TRACE.errorT(SIGNATURE, "Input ModuleData does not contain an object that implements the XI message interface. The object class is: {0}", new Object[] {obj.getClass().getName()});
                    else
                         TRACE.errorT(SIGNATURE, "Input ModuleData contains only null as XI message");
                    ModuleException me = new ModuleException(e);
                    TRACE.throwing(SIGNATURE, me);
                    throw me;
              return inputModuleData;
    Please refer the above code, it might help you to understand what i m trying to do. I have also included some code that is in comments which I tried by referring the links given by other users but its nt working. Please tell me how to improve my code to set the filename into the <b>reciever file adapter</b>.
    Regards
    Kapil

  • Function Modules for uploading the file

    Hi experts ,
                      I have a requirement to download a file (csv) from my local sytem (say desktop) into an internal table first and then update the contents of the same internal table into the database table.
    Can anybody provide me with a sample program for doing the same or at least the name of function modules for the same.
    Prompt replies will be rewarded.
    TIA
    Abhishek

    Hi Abhishek,
    How to use INSERT Statement..
    Check this Sample Program..
    TABLES:MARA.
    DATA:ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
    ITAB-MATNR = '123ABCDA'. .
    ITAB-MBRSH = 'C'.
    ITAB-MTART = 'FERT' .
    ITAB-MEINS = 'KG' .
    APPEND ITAB.
    ITAB-MATNR = '123ABCDB'. .
    ITAB-MBRSH = 'C'.
    ITAB-MTART = 'FERT' .
    ITAB-MEINS = 'KG' .
    APPEND ITAB.
    LOOP AT ITAB.
    INSERT MARA FROM ITAB.
    MODIFY MARA .
    ENDLOOP.

  • Functional module to get the File from a given Directory

    Hi all,
    I am using a FM name 'subst_get_file_list' to get the file from a given directory but it is accepting only 40 Character length file only my requirement is to accept file name other than 40 char,
    give me good sugestion
    regards
    paul

    Hi Paul,
    Check the Function Module Gayathri has given. ie. 'SO_SPLIT_FILE_AND_PATH'.
    In the exporting parameter FULL_NAME , give the path name and in the importing parameter stripped_name , you will get the filename.
    Check this code.
    REPORT ZSHAIL_SPLITFILE.
    data: it_tab type filetable with header line,
          gd_subrc type i.
    tables: rlgrap.
    data: path type string,
          file_name type string.
    parameters file_nam type rlgrap-filename .
    data: user_act type i.
    at selection-screen on value-request for file_nam.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
      EXPORTING
        WINDOW_TITLE            = 'select a file'
       DEFAULT_EXTENSION       = '*.txt
        DEFAULT_FILENAME        = ''
        FILE_FILTER             = '*.txt'
        INITIAL_DIRECTORY       = ''
        MULTISELECTION          = abap_false
       WITH_ENCODING           =
      CHANGING
        file_table              = it_tab[]
        rc                      = gd_subrc
        USER_ACTION             = user_act
       FILE_ENCODING           =
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if user_act = '0'.
    loop at it_tab.
    file_nam = it_tab-filename.
    endloop.
    endif.
    path = file_nam.
    CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
      EXPORTING
        full_name           = path
    IMPORTING
       STRIPPED_NAME       = file_name
      FILE_PATH           =
    EXCEPTIONS
      X_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.
    at selection-screen.
    message i001(zmess) with file_name.
    Regards,
    SP.

  • Equalent of F4_filename function module for application server file path

    hi experts,
            i am using  cl_gui_frontend_services=>file_open_dialog
           for bring file path dynamically for user, in front end.
          same feature i want to give when i am trying upload file from application server.
      kindly provide me function module or class method, which will do it.
    thanks in advance
    regards,
    pavan

    Hi,
    Use FM F4_DXFILENAME_TOPRECURSION
    Sample code here
    report ztest.
    data : filename like DXFIELDS-LONGPATH.
    data : begin of itab occurs 0,
    a(200) type c,
    end of itab.
    CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
    EXPORTING
    I_LOCATION_FLAG = 'A'
    *I_SERVER = '?'
    *I_PATH =
    FILEMASK = '.*'
    *FILEOPERATION = 'R'
    IMPORTING
    *O_LOCATION_FLAG =
    *O_SERVER =
    O_PATH = filename
    *ABEND_FLAG =
    EXCEPTIONS
    RFC_ERROR = 1
    ERROR_WITH_GUI = 2
    OTHERS = 3
    break-point.
    open dataset filename for input in binary mode.
    while sy-subrc = 0.
    clear itab .
    read dataset filename into itab.
    append itab.
    endwhile.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    FILENAME = 'd:\abc.txt'
    FILETYPE = 'BIN'
    TABLES
    DATA_TAB = itab
    Regards,
    Satish

  • BAPI or Function Module to Update the Alternative Payer  (KNZA) of Customer

    Hi Experts,
    My client requirement is to update the Customer Permitted Alternative Payer during creation of BP
    Would you please let me know the any BAPI or Fictional Module available to UPDATE the u201CPermitted Alternative Payer (KNZA)u201D of Customer Master.
    iam trying  SD_CUSTOMER_MAINTAIN_ALL function module, its failed to update the  KNZA tables. please help to close the issue. 
    Thanks in Advance.
    Venkatesh M.

    Hi Ravi,
    Thanks for the quick reply.
    The Function Module, what you are given is BTE. it will not trigger when creating of contract.
    My Requirement is when creating the contract for the particular BP, we need to UPDATE the Alternative Payer of Customer.
    Here i required BAPI or Function Module to change or Update the customer master Alternative Payer (KNZA).   
    Regards,
    Venkatesh M

  • Function module to update the classification of each of the devices 'IQ02'

    Can any one please tell me if there is any Function module or BAPI that can be used to update the device classification details. I am referring to the classification details that are updated for each of the device serial numbers using Transaction 'IQ02'

    Please see the following code
    log initialization
      CALL FUNCTION 'BAPI_LOG_INIT'.
    do some initializations
      CLEAR db_update.
    create classification data
      CALL FUNCTION 'CACL_OBJECT_ALLOCATION_MAINT'
        EXPORTING
          object_type                 = x_auto-header-object_type
          class                       = x_auto-header-class
          class_type                  = x_auto-header-class_type
      STATUS                      =
      STANDARD_CLASS              =
      DELETE_ALLOCATION           =
      CHANGE_NO                   =
      I_OBJ_NOT_CHK               = ' '
      I_DATUV                     =
      I_NO_DEFAULTS               = ' '
        TABLES
          object_identification       = x_auto-data
       EXCEPTIONS
         error                       = 1
         warning                     = 2
         OTHERS                      = 3.
      IF sy-subrc NE 0.
        CALL FUNCTION 'BAPI_LOG_CLOSE'
          TABLES
            return = lt_return.
        LOOP AT lt_return INTO wa_return WHERE type = 'E'.
          mac_msg_putx co_msg_error wa_return-number
                       wa_return-id
                       wa_return-message_v1
                       wa_return-message_v2
                       wa_return-message_v3
                       wa_return-message_v4
                       space.
        ENDLOOP.
        RAISE input_error.
      ENDIF.
      * transfer validation data
      CALL FUNCTION 'CACL_OBJECT_VALIDATION_MAINT'
        EXPORTING
          object_type                 = x_auto-header-object_type
          class                       = x_auto-header-class
          class_type                  = x_auto-header-class_type
      CHANGE_NO                   =
      I_OBJ_NOT_CHK               = ' '
      I_DATUV                     =
      I_NO_DEFAULTS               = ' '
        TABLES
          object_identification       = x_auto-data
          validation_maint            = x_auto-value
       EXCEPTIONS
         error                       = 1
         warning                     = 2
         OTHERS                      = 3.
      IF sy-subrc <> 0.
        CALL FUNCTION 'BAPI_LOG_CLOSE'
          TABLES
            return = lt_return.
        LOOP AT lt_return INTO wa_return WHERE type = 'E'.
          mac_msg_putx co_msg_error wa_return-number
                       wa_return-id
                       wa_return-message_v1
                       wa_return-message_v2
                       wa_return-message_v3
                       wa_return-message_v4
                       space.
        ENDLOOP.
        RAISE input_error.
      ENDIF.
      * transfer to data base without commit
      CALL FUNCTION 'CACL_CLASSIFICATION_SAVE'
           EXPORTING
                i_commit      = ' '
                i_no_upd_task = 'X'.
    close internal log
      CALL FUNCTION 'BAPI_LOG_CLOSE'
        TABLES
          return = lt_return.
    set update flag if everything went well
      db_update = 'X'.

Maybe you are looking for