Get IDoc-number from flat IDoc using dynamic configuration

Dear experts
In an IDoc2File scenario I have added the IDoc-number to dynamic configuration using the folling code in an UDF:
DynamicConfiguration conf = (DynamicConfiguration)
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey FileName = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","DOCNUM");
conf.put(FileName, a);
The information is stored in the SOAP message
<SAP:DynamicConfiguration SOAP:mustUnderstand="1">
  <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="DOCNUM">0000000000012345</SAP:Record>
</SAP:DynamicConfiguration>
Can anybody tell me how I can access this information in the "variable substitution" section of the CC? Perhaps something like "message:docnum"?
Additional information:
Taking the IDoc-number from the payload using e.g. "payload:ORDERS05,1,IDOC,1,EDI_DC40,1,DOCNUM,1" does not work, since the XML-IDoc has been converted to an flat-IDoc.
Thanks in advance for any good ideas
Markus

Dear Rodrigo and Sarvesh
Thanks for your help so far! I applied your hints and now it is working fine.
But now I have the following additional questions
1.) My message mapping only maps the input IDoc to an output IDoc of the same type and structure. The MM is only required to process the UDF. Is there another, better solution to achieve my requirement that the IDoc-number shall be part of the filename?
2.) In the CC you have the possibility to use temporary files (section "Processing", Option "Put File" = "Use Temporary File". I think this will not work with the given solution, will it?
To possibly help somebody else or clarify the mechanism once again, I wrote down how my solution now looks like.
My UDF in the message-mapping looks like this
- Input = DOCNUM of IDoc, e.g. ORDERS05/IDOC/EDIDC/DOCNUM
- Outpt = DOCNUM of IDoc, e.g. ORDERS05/IDOC/EDIDC/DOCNUM
- UDF:
public String putDynamicConfiguration(String docnum, Container container) throws StreamTransformationException{
try
     DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
     DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
     String filename = "Prefix_" + docnum + ".txt";
     conf.put(key, filename);
     return docnum;
catch (Exception e)
     return docnum;
In the CC the settings are now as follows
File Name Scheme = . -> only a dot or something else, because this field is obligatory, even if it is not used in this case.
Variable substitution (...)
    Enable -> unchecked
Adapter-Specific Message Attributes
    Use Adapter-Specific Message Attributes -> checked
    Fail If Adapter-Specific Message Attributes Missing -> checked
    File Name -> checked
    Directory, File Type, Temporary Name Scheme for Target File Name -> unchecked
When I send an IDoc to PI and view the Adapte-Engine Version of the message (the SOAP-document, not the payload) I can find the Filename:
<SAP:DynamicConfiguration SOAP:mustUnderstand="1">
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">Prefix_0000000000012345.txt</SAP:Record>
</SAP:DynamicConfiguration>

Similar Messages

  • How to get page number from the PDF using Javascript

    Hi,
    We are having list of Single page PDF. The pdf are named in the order,
    ISBN_Author_01.PDF  (with real page number as i)
    ISBN_Author_02.PDF  (with real page number as ii)
    ISBN_Author_03.PDF  (with real page number as iii)
    ISBN_Author_04.PDF  (with real page number as 1)
    ISBN_Author_05.PDF  (with real page number as 2)
    ISBN_Author_06.PDF  (with real page number as 3)
    ISBN_Author_nn.PDF  (with real page number as 500)
    Here each pdf has a page number and in sequential order.
    The task is to check whether all the pdfs are in sequential order (i.e i, ii, iii, 1, 2, 3). If any page is missing, the script should throw an error report.
    To do this task, I am writing a Javascript to get the real page number from the PDF.
    Can anybody help me how to get the page number from the PDF using Javascript.
    Thanks,
    Gopal

    The "real" page number within a PDF is the count of the physical page starting at 0, zero.
    pageNum numPages
    The number printed on each page is the page label.
    setPageLabels  getPageLabel
    You will have to open each PDF and your script would need to know the page label for that file. I would expect you would need to build a 2 dimensional  array of the file names and the page label for the page within that array.

  • Getting file directory using dynamic configuration:Code needed

    Hi,
    I need the code for getting the source file directory name using dynamic configuration. Also, an explanation on how it can be used in mapping for comparison.
    Thanks,
    Vishal

    Hi Vishal,
      Refer  carefully the following blog by micheal to get the  Attributes dynamically during runtime by enabling the Adapter Specific message Attributes in adapter level.
      /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Create an UDF in mapping with no input parameters to it and include the piece of code and use it according to your requirement in mapping.
    //write your code here
    try{
    String filedirectory    = "";
    DynamicConfiguration conf1 = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","Directory");
    filedirectory = conf1.get(key1);
    return filedirectory;
    catch(Exception e)
         String exception = e.toString();
          return exception;
    Thanks,
    Ram.

  • Importing From Flat File with Dynamic Columns

    HI
    I am using ssis 2008,i have folder in which I have Four(4) “.txt” files each file will have 2 columns(ID, NAME). I loaded 4
    files in one destination, but today I receive one more “.txt” file here we have 3 columns (ID, NAME, JOB) how can I get a message new column will receive in source. And how can I create in extra column in my destination table dynamically …please help me

    Hi Sasidhar,
    You need a Script Task to read the names and number of columns in the first row of the flat file each time and store it in a variable, then create a staging table dynamically based on this variable and modify the destination table definition if one ore more
    new columns need to be added, and then use the staging table to load the destination table. I am afraid there is no available working script for your scenario, and you need some .NET coding experience to achieve your goal. Here is an example you can refer
    to:
    http://www.citagus.com/citagus/blog/importing-from-flat-file-with-dynamic-columns/ 
    Regards,
    Mike Yin
    TechNet Community Support

  • How to get field separator in flat file using GUI_DOWNLOAD function

    hi,
    how to get field separator in flat file using GUI_DOWNLOAD function.
                                    thanking you.

    Hi,
      Use WRITE_FIELD_SEPARATOR = 'X'.
      Check this sample code
    REPORT  z_file_download.
    DATA: w_name(90) TYPE c.
    DATA:
      BEGIN OF fs_flight,
        carrid   LIKE sflight-carrid,
        connid   LIKE sflight-connid,
        fldate   LIKE sflight-fldate,
        price    LIKE sflight-price,
        currency LIKE sflight-currency,
      END OF fs_flight.
    DATA:
      BEGIN OF fs_head,
        carrid(10) TYPE c,
        connid(10) TYPE c,
        fldate(10) TYPE c,
        price(10) TYPE c,
        curr(10) TYPE c,
      END OF fs_head.
    DATA:
      t_head LIKE
       TABLE OF
             fs_head.
    DATA:
      t_flight LIKE
         TABLE OF
               fs_flight.
    fs_head-carrid = 'CARRID'.
    fs_head-connid = 'CONNID'.
    fs_head-fldate = 'FLDATE'.
    fs_head-price  = 'PRICE'.
    fs_head-curr   = 'CURRENCY'.
    APPEND fs_head TO t_head.
    SELECT-OPTIONS:
      s_carrid FOR fs_flight-carrid.
    START-OF-SELECTION.
      SELECT carrid
             connid
             fldate
             price
             currency
        FROM sflight
        INTO TABLE t_flight
       WHERE carrid IN s_carrid.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        filename                      = 'D:\flight.xls'
       FILETYPE                      = 'ASC'
    *   APPEND                        = ' '
        WRITE_FIELD_SEPARATOR         = 'X'
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    *   CONFIRM_OVERWRITE             = ' '
    *   NO_AUTH_CHECK                 = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   WRITE_BOM                     = ' '
    * IMPORTING
    *   FILELENGTH                    =
      tables
        data_tab                      = t_head
    EXCEPTIONS
       FILE_WRITE_ERROR              = 1
       NO_BATCH                      = 2
       GUI_REFUSE_FILETRANSFER       = 3
       INVALID_TYPE                  = 4
       NO_AUTHORITY                  = 5
       UNKNOWN_ERROR                 = 6
       HEADER_NOT_ALLOWED            = 7
       SEPARATOR_NOT_ALLOWED         = 8
       FILESIZE_NOT_ALLOWED          = 9
       HEADER_TOO_LONG               = 10
       DP_ERROR_CREATE               = 11
       DP_ERROR_SEND                 = 12
       DP_ERROR_WRITE                = 13
       UNKNOWN_DP_ERROR              = 14
       ACCESS_DENIED                 = 15
       DP_OUT_OF_MEMORY              = 16
       DISK_FULL                     = 17
       DP_TIMEOUT                    = 18
       FILE_NOT_FOUND                = 19
       DATAPROVIDER_EXCEPTION        = 20
       CONTROL_FLUSH_ERROR           = 21
       OTHERS                        = 22
    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 FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = 'D:\flight.xls'
          filetype                = 'ASC'
          append                  = 'X'
          write_field_separator   = 'X'
        TABLES
          data_tab                = t_flight
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc EQ 0.
        MESSAGE 'Download successful' TYPE 'I'.
      ENDIF.
      IF sy-subrc <> 0.
    *  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • How to get a parameter from BPC and use it in ABAP program

    Hello gurus!
    I got a problem...
    SAP BPC will send parameters such as year, division, category, company code and so on via script logic to SAP BW.
    I need to get these parameters from BPC and use them in a ABAP program as a filter.
    This ABAP program will do several routines and return new values to BPC. It must be made on ABAP and I need to filter data to avoid performance issues.
    Does anybody knows how to do it? or have a example of it?
    Thank you in advance.
    Regards,
    Rubens Kumori

    Hello, I'm looking for a suggest.
    I need to pass two parameters (users can input them in a data manager package in bpc) to a BAdI.
    In this BAdI I write a code that store those parameters in a InfoObject.
    The problem is:
    - one parameter is for CATEGORY value. CATEGORY is a dimension of the application and I read the value with a code like this:
          READ TABLE it_cv INTO l_s_it_cv
               WITH TABLE KEY dim_upper_case = 'C_CATEGORY'.
    - other parameter is a generic DATE. this parameter is not a dimension of the application and I don't know how I can retrieve this value in BAdI.
          READ TABLE it_cv INTO l_s_it_cv
               WITH TABLE KEY dim_upper_case = '.....'.
    The data manager dynamic script is:
    PROMPT(SELECTINPUT,,,,"%CATEGORY_DIM%")
    PROMPT(TEXT,%SELECTED_DAY%,"Write the date (format YYYYMMDD)",)
    I also have a dynamic constant that assign the name %CATEGORY_DIM% to "C_CATEGORY" value.
    Can anyone help me?
    thanks a lot
    Edited by: Luca Novali on Feb 13, 2012 3:49 PM

  • FM to get Personel Number from USER ID

    Hi,
       Is there any FM to get Personel Number from the USER ID(sy-uname).
    Thank you,
    Ramu N.

    Hi Ramu,
    You can find the user-id & Personnel Number in the table PA0105.
    select single PERNR from pa0105 into PERSONEELSNUMMER
    where usrid eq USER_ID
    and   endda eq '99991231'.
    hope this helps!
    best regards,
    Thangesh

  • I am unable to get dragging guides from rulers when using CS6 InDesign. Is anybody else getting this problem?

    I am unable to get dragging guides from rulers when using CS6 InDesign. Is anybody else getting this problem?

    Try restoring your InDesign preferences:
    Trash, Replace, Reset, or Restore the application Preferences

  • Creative Cloud Student and Teacher Edition .I use the Macbook.I got the mail that said my order was checked,but I don't get the number.So I still use trial.Hoe can I change my character into member?

    Creative Cloud Student and Teacher Edition .I use the Macbook.I got the mail that said my order was checked,but I don't get the number.So I still use trial.Hoe can I change my character into member?

    This is an open forum, not Adobe support... you need Adobe support to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"

  • Problem:obtaing file name using Dynamic configuration of file adapter

    hi all
    I am using Dynamic configuration for getting file name.
    I am getting Dynamic configuration in SXMB_MONI containg file name, but payload is empty unlike file i am sending.

    Hi All,
    Basically my requirement to get Filename in idoc segments in order to validate the posting at month end.
    Its an File to idoc scenario- GL Posting.
    Please check attached UDF and it gives error. Kindly help. Thanks

  • Using Dynamic Configuration api for SOAP adapter

    I want to use Dynamic Configuration api to send a SOAP request to a webservice.
    tha value in my adapter is
    my Target URL  is
    http://xidr3.bcs.de:50000/XISOAPAdapter/MessageServlet? channel=:Routing2_Service:SS_SOAP_Sender_Working_June12&nosoap=true
    which is the corresponding field i have to set in Dynamic Configuration?
    I have written the following code is this right?
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    String temp = "http:/"+"/sap.com/xi/XI/System/SOAP";
    DynamicConfigurationKey key = DynamicConfigurationKey.create(temp, "TServerLocation");
    String varURL =
    "http:/"+"/xidr3.bcs.de:50000/XISOAPAdapter/MessageServlet?channel=:Routing2_Service:SS_SOAP_Sender_Working_June12&nosoap=true";
    conf.put(key,varURL);
    return "";

    Hi,
    Yes, your code looks fine. Can you let me know what is the error you are getting. Have you checked the Flag in your communication channel.
    Use Adapter-Specific Message Attributes
    Variable Transport Binding 
    Once you test your scenario you can see the Dynamic URL in your message Header by going to tcode sxmb_moni. See if you are able to find something called DynamicConfiguration in your message haeader. If yes what is the value set there.
    PS: From the target URL you posted It looks like your webservice is hosted on the XI box itself. Is it the same XI box or different box? Just curious to know.
    Reward point if answer is helpful
    Thanks
    Amit

  • Accesing Runtime Parameters using Dynamic configuration

    Hi..
    Can we access  the following  parameters from mapping using DYNAMIC CONFIGURATION key?
    <SAP:TraceLevel>1</SAP:TraceLevel>
      <SAP:LogSeqNbr>000</SAP:LogSeqNbr>
      <SAP:RetryLogSeqNbr>000</SAP:RetryLogSeqNbr>
      <SAP:QIdInternal>XBTI0001</SAP:QIdInternal>
    Please let me know how to access
    Thanks
    Ram

    Hi Ram,
        I dont think we can achieve this one,only two ways to read any values at mapping level
    1)Dynamic Configuration--Option ruled out....not possible,
    2)Write some java coding to read the value,i think this one also not work it out.
    your req unique..i am looking for answer..:)
    Cheers,
    Raj

  • Change Directory Path using Dynamic Configuration

    Hi,
    We have a requirement where the directory path for placing the files is different across our different environments. Ex: Development Environment has a different path than the Quality Enviornmnet. Also the full path is depending on fileds within the message.
    I want to use Dynamic Configuration to create the Directory path. But in order to capture the full requirement I need to know wheich environment I am within the User Defined Function.
    Can someone provide me the java class and function that I can use in my UDF to read the environment I am in.
    ( Essentially I want to read Sy-SYSID in ABAP...using Java. )
    Regards,
    Arunava

    Hi Arunva,
    >>Essentially I want to read Sy-SYSID in ABAP...using Java.
    It might not be possible to read system id in java, but you can read the sender or receiver service(SENDER_SERVICE or RECEIVER_SERVICE) and based on it can decide the diretory in DynamicConfiguration.
    If you have a sender or receiver SAP sysem then better to read its name because this business systm ill haeunique name aross different environment. Check this thread too
    User-defined function: RFC call
    Regards
    Suraj

  • Get FI Documet number from BKPF table using CO document number in COVP tabl

    Hi,
    In  datasource 0CO_OM_CCA_9 , we have written a code in CMOD to get the FI Document Number from CO document Number.
    The flow of code is:
    1) From the CO document number, get reference document number  (REFBNfield) from, COVP table
    2) Pass this REFBN in AWKEY(10) field of BKPF table.
    3) We have created new field in datasource named 'ZBELRE' which gets populated with BELNR field obtained from BKPF table.
    This ZBELNR is the FI Document number.
    But somehow wrong FI Document number is getting populated.
    After analyzing code, we found that the AWKEY which we passed in BKPF table is incomplete and the full AWKEY is
    COVP-REFBN+COVP-AWORG
    Is this condition always remains true in all the cases? Also, is the selection criterion which we have used to find the FI document number from BKPF table is sufficient?
    Our CO Consultant says that we should also pass AWTYP along with AWKEY in BKPF table.
    Please suggest a solution.
    Following is the code :
    ***********Datasource Modification for0CO_OM_CCA_9*******************
      WHEN '0CO_OM_CCA_9'." Data Source
        TYPES:BEGIN OF ty_bkpf,
        belnr TYPE bkpf-belnr,
        xblnr TYPE bkpf-xblnr,
        bktxt TYPE bkpf-bktxt,
        awkey TYPE bkpf-awkey,
        bukrs TYPE bkpf-bukrs,
        gjahr TYPE bkpf-gjahr,
        END OF ty_bkpf.
        TYPES : BEGIN OF ty_bseg1,
        lifnr TYPE bseg-lifnr,
        belnr TYPE bseg-belnr,
        bukrs TYPE bseg-bukrs,
        gjahr TYPE bseg-gjahr,
        END OF ty_bseg1.
        DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf,
        wa_bkpf TYPE ty_bkpf,
        it_bseg1 TYPE STANDARD TABLE OF ty_bseg1,
        wa_bseg1 TYPE ty_bseg1,
        l_s_icctrcsta1 TYPE icctrcsta1.
        "Extract structure for Datasoure 0co_om_cca_9.
        DATA: l_awkey TYPE bkpf-awkey.
        DATA: l_gjahr1 TYPE gjahr.
        DATA: len TYPE i,
        l_cnt TYPE i.
        l_cnt = 10.
        SELECT lifnr
        belnr
        bukrs
        gjahr
        FROM bseg
        INTO TABLE it_bseg1.
        DELETE ADJACENT DUPLICATES FROM it_bseg1 COMPARING belnr gjahr .
        SELECT belnr
        xblnr
        bktxt
        awkey
        bukrs
        gjahr
        FROM bkpf
        INTO TABLE it_bkpf.
        IF sy-subrc EQ 0.
          CLEAR: l_s_icctrcsta1,
          wa_bkpf,
          l_awkey,
          wa_bseg1.
          LOOP AT c_t_data INTO l_s_icctrcsta1.
            MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
            READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
            l_s_icctrcsta1-refbn
            gjahr = l_gjahr1.
            IF sy-subrc EQ 0.
              MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
              MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
              MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
              MODIFY c_t_data FROM l_s_icctrcsta1.
              READ TABLE it_bseg1 INTO wa_bseg1
              WITH KEY
              belnr = wa_bkpf-belnr
              bukrs = wa_bkpf-bukrs
              gjahr = wa_bkpf-gjahr.
              IF sy-subrc EQ 0.
                MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
                MODIFY c_t_data FROM l_s_icctrcsta1.
                CLEAR: l_s_icctrcsta1,
                wa_bseg1,
                l_gjahr1.
              ENDIF.
            ENDIF.
            CLEAR: l_s_icctrcsta1.
          ENDLOOP.
        ENDIF.
    ***End of Datasource Modification for 0CO_OM_CCA_9*******************

    Hi,
    this forum is for the SAP BusinessObjects BI Solution Architecture. Please post your question into the corresponding product forum for SPA BW
    regards
    Ingo Hilgefort

  • How to get week number from date

    Hi,
       please mention how to get the number of week from a particular date using fn module?

    Hi Debarshi,
                       Use FM <b>DATE_GET_WEEK</b>
    Reward points if helpful.
    Regards,
    Hemant

Maybe you are looking for

  • I cannot ask for paper bills or cancel my direct d...

    Hi, I get told to call 0800800150. I get an email a bill is due, but it does not contain the content of the bill. It says Direct Debit did not work or similar. My bank is changed, account no longer exists. I get phone numbers to call, these are UK do

  • How to load a class in lib/file.jar

    Hi, I use jboss 4.0.2. and i have a jar-file from a third party in my server/default/lib that calls Thread.currentThread().getContextClassLoader().loadClass("foo"); My problem is that foo.class is never found and i dont know where i have to place thi

  • Smartform as PDF attachment

    Hi Friends, I have created a Smartform for PO driver program its working fine but my requirement is i want to mail this SF as PDF attachment and they have given me Partner function as "MP' for mail Partner and "MA" ,medium 7 ( Simple mail).  Can any

  • Adding of essbase server .

    The new essbase installation is done in the new server on windows. The installation is successful. so was trying to add the new essbase server in the old server ,but getting this error while adding the server "Network error {10060} Unable to connect

  • Azure service administrator

    Hi Azure team, Will service administrator know when a new co-administrator has been added by another co-administrator? Will service admin will receive any mail alert? Thanks,