Reg. RFC look up

Hi All,
I am working on RFC look up. My Scenario is IDoc to IDoc. The IDoc has a segment say E1 where the occurence is 0---5 and two fields inside that i.e. QUALF and IDTNR.  The requiremnt is like when QUALF  is equal to 002 then fetch the value of material number from SAP and map to IDTNR. Also this material number is picked only when QUALF is equal to 003 and the field IDTNR has some value i.e. article number in SAP. So I need to get value of the material number equal to this article number.
I am using RFC look up for this mapping condition in order to fetch value from SAP.
Can anyone help me on this to configure the RFC look up in PI?
Thanks and Regards,
Neethu

Hi All,
For my requirement I have used this UDF,
String content = "";
MappingTrace importanttrace;
importanttrace = container.getTrace();
// filling the string with our RFC-XML (with values)
String m ="<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:ZSD_EAN_MATERIAL_GET xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"><P_EAN11></P_EAN11></ns0:ZSD_EAN_MATERIAL_GET>" ;
RfcAccessor accessor = null;
ByteArrayOutputStream out = null;
try
// 1. Determine a channel (Business system, Communication channel)
Channel channel = LookupService.getChannel("RD9","CC_RFC_RECEIVER_LOOKUP_I040");
// 2. Get a RFC accessor for a channel.
accessor = LookupService.getRfcAccessor(channel);
// 3. Create a xml input stream representing the function module request message.
InputStream inputStream = new ByteArrayInputStream(m.getBytes());
// 4. Create xml payload
XmlPayload payload = LookupService.getXmlPayload(inputStream);
// 5. Execute lookup.
Payload result = accessor.call(payload);
InputStream in = result.getContent();
out = new ByteArrayOutputStream(1024);
byte[] buffer = new byte[1024];
for (int read = in.read(buffer); read > 0; read = in.read(buffer)) {
out.write(buffer, 0, read);
content = out.toString();
catch(LookupException e)
importanttrace.addWarning("Error while lookup " + e.getMessage() );
catch(IOException e)
importanttrace.addWarning("Error " + e.getMessage() );
finally
if (out!=null) {
try {
out.close();
} catch (IOException e) {
importanttrace.addWarning("Error while closing stream " + e.getMessage() );
// 7. close the accessor in order to free resources.
if (accessor!=null) {
try {
accessor.close();
} catch (LookupException e) {
importanttrace.addWarning("Error while closing accessor " + e.getMessage() );
//returning the result u2013 RFC-XML.response
return content;
While executing this UDF I am getting the output as:
<?xml version="1.0" encoding="UTF-8"?><rfc:ZSD_EAN_MATERIAL_GET.Response xmlns:rfc="urn:sap-com:document:sap:rfc:functions"><Materialnumber></Materialnumber></rfc:ZSD_EAN_MATERIAL_GET.Response></IDTNR>
  <KTEXT />
instead of value
Can anyone suggest me on this?
Thanks and Regards,
Neethu

Similar Messages

  • Need help on RFC look up in PI 7.0

    Dear experts ,
    I am working on Jdbc to Abap Proxy  scenario where i need to perform a RFC Look up . I have searched in SCN  and found some help ful blogs, but still need more information in below points.
    My requirement is need to fetch Cost Center (KOSTL) by taking Personal number(PERNR)  as Input parameter.
    1) Do we have to create and import the RFC into PI ?
    2) Do we need to create a UDF ? If yes, Kindly provide some useful links.
    Thanks in Advance,
    Mohammed

    Hi indrajit,
      i had written :  java.util.Map map;" in the import secion of UDF. but still i am getting the following errors
    Source code has syntax error:  /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:3: cannot resolve symbol symbol : class map location: interface java.util.Map import com.sap.aii.mappingtool.tf3.*;import com.sap.aii.mappingtool.tf3.rt.*;import java.util.*;import java.io.*; import java.lang.reflect.*;import java.util.Map.map; ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:257: cannot resolve symbol symbol : class RfcAccessor location: class com.sap.xi.tf._MM_RMF_TO_SAP_ RfcAccessor accessor = null; ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:262: cannot resolve symbol symbol : class Channel location: class com.sap.xi.tf._MM_RMF_TO_SAP_ Channel channel = LookupService.getChannel(BS_SAP_R3,CC_RFC_LOOK_UP_CRMNEXT); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:262: cannot resolve symbol symbol : variable BS_SAP_R3 location: class com.sap.xi.tf._MM_RMF_TO_SAP_ Channel channel = LookupService.getChannel(BS_SAP_R3,CC_RFC_LOOK_UP_CRMNEXT); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:262: cannot resolve symbol symbol : variable CC_RFC_LOOK_UP_CRMNEXT location: class com.sap.xi.tf._MM_RMF_TO_SAP_ Channel channel = LookupService.getChannel(BS_SAP_R3,CC_RFC_LOOK_UP_CRMNEXT); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:262: cannot resolve symbol symbol : variable LookupService location: class com.sap.xi.tf._MM_RMF_TO_SAP_ Channel channel = LookupService.getChannel(BS_SAP_R3,CC_RFC_LOOK_UP_CRMNEXT); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:264: cannot resolve symbol symbol : variable LookupService location: class com.sap.xi.tf._MM_RMF_TO_SAP_ accessor = LookupService.getRfcAccessor(channel); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:268: cannot resolve symbol symbol : class XmlPayload location: class com.sap.xi.tf._MM_RMF_TO_SAP_ XmlPayload payload = LookupService.getXmlPayload(inputStream); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:268: cannot resolve symbol symbol : variable LookupService location: class com.sap.xi.tf._MM_RMF_TO_SAP_ XmlPayload payload = LookupService.getXmlPayload(inputStream); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:270: cannot resolve symbol symbol : class Payload location: class com.sap.xi.tf._MM_RMF_TO_SAP_ Payload result = null; ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:275: cannot resolve symbol symbol : class DocumentBuilderFactory location: class com.sap.xi.tf._MM_RMF_TO_SAP_ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:275: cannot resolve symbol symbol : variable DocumentBuilderFactory location: class com.sap.xi.tf._MM_RMF_TO_SAP_ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:276: cannot resolve symbol symbol : class DocumentBuilder location: class com.sap.xi.tf._MM_RMF_TO_SAP_ DocumentBuilder builder = factory.newDocumentBuilder(); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:277: cannot resolve symbol symbol : class Document location: class com.sap.xi.tf._MM_RMF_TO_SAP_ Document document = builder.parse(in); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:278: cannot resolve symbol symbol : class NodeList location: class com.sap.xi.tf._MM_RMF_TO_SAP_ NodeList list = document.getElementsByTagName("I_KOSTL"); // The lookupValue is available as WA tag in the response ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:279: cannot resolve symbol symbol : class Node location: class com.sap.xi.tf._MM_RMF_TO_SAP_ Node node = list.item(0); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:283: cannot resolve symbol symbol : variable returnValue location: class com.sap.xi.tf._MM_RMF_TO_SAP_ returnValue = node.getNodeValue(); ^ /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2d519647b0c211e39616000000844522/source/com/sap/xi/tf/_MM_RMF_TO_SAP_.java:290: cannot resolve symbol symbol : class LookupException location: class com.sap.xi.tf._MM_RMF_TO_SAP_ } catch (LookupException e) { ^ 18 errors
    so can you please explain, how can i import those files.

  • Urgent : Error in RFC  Look Up using JCO.

    Hi,
    I have a scenario od accessing a database table by passing the name through XI and also giving the Where condition ,passing the fieldnames and getting back the field values . The FM that id used for this on ABAP side is <b>RFC_READ_TABLE</b>. 
    For this Scenario I inserted a Java Code using JCO's in th UDF for the  RFC Look Up's.
    I got errors while activating the MM which i am not able to rectify.Please Help me in this.
    <b>Activation of the change list canceled Check result for Message Mapping MM_Notes_2_ED_Z_SDIDOC |
    Starting compilation  Source code has syntax error:  /usr/sap/EXD/DVEBMGS49/j2ee/cluster/server0/./temp/classpath_resolver/Map303c42607df411dc8b1d00e000c553d9/source/com/sap/xi/tf/_MM_Notes_2_ED_Z_SDIDOC_.java:1539: cannot resolve symbol symbol : method createClient (java.lang.String,java.lang.String) location: class com.sap.mw.jco.JCO JCO.Client mConnection = JCO.createClient("200","EN"); ^ /usr/sap/EXD/DVEBMGS49/j2ee/cluster/server0/./temp/classpath_resolver/Map303c42607df411dc8b1d00e000c553d9/source/com/sap/xi/tf/_MM_Notes_2_ED_Z_SDIDOC_.java:1578: cannot resolve symbol symbol : variable result location: class com.sap.xi.tf._MM_Notes_2_ED_Z_SDIDOC_ result.addValue(resultSet[pos]); ^ 2 errors</b>
    <b>This is an Urgent Requirement. Please reply ASAP.</b>
    Regards,
    Priyanka.

    Hi Priyanka,
    The error message says there are 2 errors:
    1. createClient
    2. result.addValue
    For the first one, I guess you might not have included all the API required for lookup
    For second one, please check what is the type of object you are adding to the resultset, maybe you can just say result.addValue(resultSet[pos] + ""); to typecast it.

  • RFC Look Up with MultiMapping in PI 7.1

    Hi All,
    I have created a multimapping with one source & two target messages. I am using a RFC look Up for one of fields inside mapping.
    But, when I used this multimapping in interface determination in PI 7.1, at runtime i got an error.
    Error - is variable (Say XYZ) used while creating parameter for RFC look Up in message mapping doesn't exist.
    If I execute multimapping without RFC look Up, it worked absolutely fine.
    I have used RFC look Up in number of normal message mappings, it worked fine.
    Not sure, if this is a issue with PI 7.1, that multi-mapping with RFC look Up isn't supported at enhanced interface determination.
    Please provide inputs for this or if anybody has hands on experience using this with PI 7.1
    Thanks,
    Venkat

    Hi,
    Please go through the thread:
    Re: Global Variables declaration in PI 7.1
    and check whether its useful.
    Regards,
    Vineetha.

  • IDOC to IDOC....... RFC look up

    Hi Friends,
    Iam new to SAP XI and have some questions.Answers to this query will be my pleasure.
    my scenario:
    sender :idoc1 (delivery)
    receiver: idoc2 if customer present
                  else idoc3 to create "customer" and then idoc2 to create "sales order"
    Message mappings:
    1 for idoc1 to idoc2
    1 for idoc1 to idoc3
    and 2 interface mappings for the above message mappings.
    Please explain me how can i use one mapping if condition is false and then mapping2
    and how to use second mapping if condition is true.
    Also given below is mapping for a field .Please check and explain:
    source field:E1ADRM1-PARTNER_ID          
    Mapping/Transformation rule:E1ADRM1-PARTNER_Q = 'WE' Select KUNNR from KNB1where     ALTKN = E1ADRM1-PARTNER_ID and BUKRS = 'GR11'   Value = KNB1-KUNNR    and check that KNA1-STCD2 = 999839383 with KNA1-KUNNR=KNB1-KUNNR                        if no entry found in KNB1customer must be created     
    Target field: PARTN_NUMB
    Please explain.I got an answer previously that i have to use RFC look up, if so please explain where and how to write the RFC look up.
    Thanks in advance,
    Harish.

    Hi Kinthali,
    I think I am not getting your question correctly...
    You need to map from Idoc1 to idoc2 or if idoc 2 is not the idoc1 to idoc3... right??
    <i>>>Please explain me how can i use one mapping if condition is false and then mapping2 and how to use second mapping if condition is true.</i>
    Which condition are you talking about here?? Check the condition in the interface determination and then choose the needed interface...
    Regards
    Suraj

  • Cannot perform RFC Look UP

    Hi All,
    When I executed the RFC Look up function in the mapping could see the following error.
    "Run time exception when processing target field mapping. Cannot perform RFC Look Up".
    I performed the below steps but still could find the same error again:
    1.In the test tab of the message mapping I have assined a channel which I configured in the Interface determination of the configuration and also assigned a value to that channel.
    2. Has given the values for the parameters in the operation mapping and also the binding is done successfully.
    3. The function module I assined is also existing and could test the same for output values for the given input values.
    Please help me resolve the error.
    Thanks & Regards,
    Kumar.

    Hi,
    This is the error I could see in the communication channel monitoring of RWB.
    "Error in processing caused by: com.sap.aii.adapter.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.adapter.rfc.core.client.RfcClientException: functiontemplate from repository was <null>"
    Help me with this error.
    Thanks,
    Kumar.

  • RFC Look up Caching Results

    Hello Experts,
                I am facing an issue in PI7.1 while using RFC Look up functionality. I use this in a high usage interface and now I see that it actually caches the results somewhere and does not actually make the RFC call to the backend system.
    I refered some threads, but could not get answers. Has anyone else faced this issue ? If yes, could you let me know what the solution is to get around this issue?
    Thanks,
    Karthik

    Thanks Arpil, We are calling the RFC look up once per mapping. We get results into a global variable and process it thereafter. But this interface that has this mapping itself gets called very frequently, around 30 calls per second.
    We are using the RFC look up wizard in PI7.1 and hence not building any new java code etc..but the results are cached. If the data changes in the back end system, the RFC still fetches us old data and only a forced cache refresh is causing it to pick up the new results..

  • Using RFC Look Up in Java Mapping

    Hi All,
    I need to do an RFC Look Up in a Java Mapping program. The response structure of the Function Module to be called consists of only one node called RESULT. In order to read the value exported by the function module in this export parameter RESULT, I am using the following code:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = null;
    factory.setNamespaceAware(false);
    factory.setValidating(false);
    Document docResponse = null;          
    InputStream in1 = result.getContent();
    docResponse = builder.parse(in1);
    String output = docResponse.getDocumentElement().getFirstChild().getNodeValue();
    The function module works correctly and returns the expected result when tested in SE37. However, on running the above code, the statement docResponse.getDocumentElement().getFirstChild().getNodeValue(); always returns the value NULL and not the expected value that is actually returned by the RFC.
    Kindly let me know where could I be going wrong.
    Thanks in advance.

    Hi Sreehari,
    Your DOM code looks correct, it might be something with the overall code of java mapping. Just have a look at this blog /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    and compare you code with it. See whether you can fine tune your coding to get the rigth response.
    Regards
    Suraj

  • RFC Look Up APIs for a IDOC Receiver Communication Channel

    Hi,
    Can we use RFC Look Up APIs in UDF for a IDOC Receiver Communication Channel. (File to IDOC Scenario). Requirement is to send a notificaiton when IDOC got posted with IDOC number.
    Best Regards,
    Madan Agrawal

    As the name suggests, RFC lookup uses RFC receiver channel only. In mapping of your File to Idoc scenario, you may perform this lookup.
    Requirement is to send a notificaiton when IDOC got posted with IDOC number.
    Configure ALEAudit for this requirement. How were you planning to use RFC lookup for such a requirement?
    Regards,
    Prateek

  • RFC Look ups

    Hi all,
    I need to get a value for a field from the target system according to the soucre field.
    For Ex : material number 0001 is from source system and i need to find the corresponding material number from the target SAP system.
    Please let me know how it can acheived.
    Thanks
    Faheem

    1. Create a RFC in R/3 system that has ur desired functioanlity.
    2. Create RFC look up in the UDF.
    3. Map the UDF as follows
    Source- field-> UDF(RFC Look up)---> Target Field
    Refer this for more info
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8e7daa90-0201-0010-9499-cd347ffbbf72

  • Reg:rfc

    Hai to all,
    I am created one below rfc function module. that is ZTEST_FUNC.
    Expert Forums » ABAP Development » ABAP Dictionary
    Thread: reg:fm
    Welcome, chaitu sumi   
    Your Control Panel 
    Your Reward Points 
    Your Questions 
    There are new replies to your question.
    Mark question as still not answered.
    Mark question as answered.
    Use the radio buttons to award points to replies.
      You are watching this thread. To stop watching this thread, click "Stop Watching Thread" below. (Watch Options) 
    This watch sends emails by default. If you don't want to receive emails on changes in this thread, go to the watch options, un-mark the "Email" checkbox next to the thread's entry and click "Update". 
    Reply to this Thread   Search Forum    Stop Watching Thread    Back to Thread List 
      Replies: 2 - Pages: 1 - Last Post: Aug 6, 2007 5:03 PM by: Sudheer Junnuth...  Threads: Previous  
    chaitu sumi  
    Posts: 9
    Questions: 9
    Registered: 7/13/07
    Forum points: 0 
       reg:fm  
    Posted: Aug 6, 2007 4:47 PM         Reply      E-mail this post 
    I created below function module, which is having below import parameters and tables:
    FUNCTION ztest_func.
    ""Local interface:
    *" IMPORTING
    *" VALUE(S_LFDAT1) LIKE LIKP-LFDAT
    *" VALUE(S_LFDAT2) LIKE LIKP-LFDAT OPTIONAL
    *" VALUE(RAIL_ROAD) TYPE CHECKBOX
    *" TABLES
    *" IT_FINAL STRUCTURE ZTLC_SAL
    data: it_cond type n,
    loop_index like sy-tabix .
    select zdelv~vkorg
    zdelv~vbeln
    zdelv~lfart
    zdelv~lfdat
    zdelv~wadat
    zdelv~vtweg
    zdelv~spart
    zdelv~vkbur
    zdelv~vkgrp
    zdelv~kunnr
    zdelv~vsbed
    zdelv~ntgew
    zdelv~route
    zdelv~lgort
    zdelv~inco1
    zdelv~matnr
    zdelv~mvgr1
    zdelv~vsart
    zdelv~rwerks
    zdelv~dwerks
    into corresponding fields of table IT_FRGT
    From zdelv WHERE zdelv~wadat = s_lfdat1 " and s_lfdat2
    AND zdelv~lfart IN ('ZGDP','ZGRR','ZRLF','ZGLF').
    if Sy-subrc = 0.
    Sort it_frgt
    by vbeln dwerks lgort route kunnr regio vkbur vkgrp bran1 cityc.
    Delete adjacent duplicates from it_frgt
    Comparing vbeln dwerks lgort route kunnr
    regio vkbur vkgrp bran1 Cityc.
    Loop_index = 1.
    Loop at it_frgt." to wa_frgt.
    *select kunnr regio from kna1 into kna1 where kunnr = it_frgt-kunnr.
    *select bland from t005u into corresponding fields of table it_regio where Bland = kna1-regio.
    *endselect.
    IF RAIL_ROAD = 'I'.
    IF IT_FRGT-VSBED <> '04'.
    DELETE IT_FRGT.
    clear it_frgt.
    CONTINUE.
    ENDIF.
    ENDIF.
    IF RAIL_ROAD = 'R'.
    IF IT_FRGT-VSBED = '04'.
    DELETE IT_FRGT.
    clear it_frgt.
    CONTINUE.
    endif.
    endif.
    clear wa_frgt.
    select single lifnr from vbpa into vbpa
    where vbeln eq it_frgt-vbeln and
    parvw eq 'ZD'.
    move-corresponding it_frgt to wa_frgt.
    move vbpa-lifnr to wa_frgt-lifnr.
    If wa_frgt-lfart eq 'ZGND' OR
    wa_frgt-lfart eq 'ZGNL' OR
    wa_frgt-lfart eq 'ZGNS'.
    wa_frgt-LVTEXT = 'STA'.
    if wa_frgt-lfart eq 'ZGNS'.
    delete it_frgt.
    continue.
    endif.
    select mseg~werks
    mseg~lgort
    into (wa_frgt-rwerks,wa_frgt-rlgort)
    from vbfa join mseg
    on mseg~mblnr = vbfa~vbeln
    where vbfa~vbelv eq wa_frgt-vbeln and
    vbfa~vbtyp_n = 'i'.
    Endselect.
    wa_frgt-netwr = 0.
    if wa_frgt-netwr = 0.
    select single regio region plant lgobe cityc from zsta
    into corresponding fields of it_zfrgt
    where werks = it_frgt-dwerks
    and lgort = it_frgt-lgort
    and vkorg = it_frgt-vkorg
    and kunnr = it_frgt-kunnr.
    if sy-subrc <> 0.
    select single regio region plant lgobe cityc from zsta into corresponding fields of it_zfrgt
    where werks = it_frgt-dwerks
    and lgort = it_frgt-lgort
    and vkorg = it_frgt-vkorg.
    select single cityc from kna1 into wa_frgt-cityc
    where kunnr = wa_frgt-kunnr.
    it_zfrgt-cityc = wa_frgt-cityc.
    endif.
    select single regio region plant lgobe cityc from zsta into corresponding fields of it_zfrgt1
    where werks = it_frgt-rwerks
    and lgort = it_frgt-rlgort
    and vkorg = it_frgt-vkorg
    and kunnr = it_frgt-kunnr.
    if sy-subrc <> 0.
    select single regio region plant lgobe cityc from zsta into corresponding fields of it_zfrgt1
    where werks = it_frgt-rwerks
    and lgort = it_frgt-rlgort
    and vkorg = it_frgt-vkorg.
    endif.
    else.
    select single regio region plant lgobe cityc from zsta into corresponding fields of it_zfrgt
    where werks = it_frgt-dwerks
    and lgort = it_frgt-lgort
    and vkorg = it_frgt-vkorg.
    endif.
    else.
    select single * from zsta into it_zfrgt
    where werks = it_frgt-dwerks
    and lgort = it_frgt-lgort
    and vkorg = it_frgt-vkorg.
    endif.
    wa_frgt-regio = it_zfrgt-regio.
    wa_frgt-region = it_zfrgt-region.
    wa_frgt-plant = it_zfrgt-plant.
    wa_frgt-lgobe = it_zfrgt-lgobe.
    wa_frgt-cityc = it_zfrgt-cityc.
    wa_frgt-soffice = it_zfrgt1-Plant.
    STA *
    endif.
    if wa_frgt-lfart eq 'ZGDP' OR
    wa_frgt-lfart eq 'ZGDR' OR
    wa_frgt-lfart eq 'ZGRR' OR
    wa_frgt-lfart eq 'ZRLF' OR
    wa_frgt-lfart eq 'ZGLF' OR
    wa_frgt-lfart eq 'ZGLR' .
    if wa_frgt-lfart eq 'ZGLR'.
    delete it_frgt.
    continue.
    endif.
    if wa_frgt-lfart eq 'ZGDR'.
    delete it_frgt.
    continue.
    endif.
    select single WBSTK from LIKPUK into Likpuk-wbstk
    where vbeln = wa_frgt-vbeln.
    if sy-subrc = 0.
    if likpuk-wbstk <> 'C'.
    delete it_frgt.
    clear wa_frgt.
    continue.
    endif.
    endif.
    wa_frgt-LVTEXT = 'SALES'.
    wa_frgt-netwr = 0.
    if wa_frgt-netwr = 0.
    Select single * from ZFRGT into it_zfrgt2
    where werks = it_frgt-dwerks
    and lgort = it_frgt-lgort
    and vkorg = it_frgt-vkorg
    and kunnr = it_frgt-kunnr.
    if sy-subrc <> 0.
    clear it_zfrgt2.
    Select single * from ZFRGT into it_zfrgt2
    where werks = it_frgt-dwerks
    and lgort = it_frgt-lgort
    and vkorg = it_frgt-vkorg.
    if sy-subrc <> 0.
    select single * from t001w
    where werks = it_frgt-dwerks.
    if sy-subrc = 0.
    wa_frgt-plant = t001w-name1.
    select single * from t001l
    where werks = it_frgt-Dwerks and
    lgort = it_frgt-lgort.
    if sy-subrc = 0.
    wa_frgt-lgobe = t001l-lgobe.
    endif.
    it_zfrgt2-lgobe = wa_frgt-lgobe.
    it_zfrgt2-plant = wa_frgt-plant.
    endif.
    Endif.
    Select single * from kna1 where kunnr = it_frgt-kunnr.
    wa_frgt-cityc = kna1-cityc.
    wa_frgt-regio = kna1-regio.
    wa_frgt-bran1 = kna1-bran1.
    select single vtext from tbrct into tbrct where braco = it_frgt-bran1.
    wa_frgt-vtext = tbrct-vtext.
    endselect.
    select single bezei from t005u into t005u where bland = wa_frgt-regio
    and land1 = 'IN'.
    wa_frgt-region = t005u-bezei.
    it_zfrgt2-cityc = wa_frgt-cityc.
    it_zfrgt2-regio = wa_frgt-regio.
    it_zfrgt2-region = wa_frgt-region.
    it_zfrgt2-vtext = wa_frgt-vtext.
    it_zfrgt2-bran1 = wa_frgt-bran1.
    endif.
    endif.
    endif.
    wa_frgt-regio = it_zfrgt2-regio.
    wa_frgt-region = it_zfrgt2-region.
    wa_frgt-plant = it_zfrgt2-plant.
    wa_frgt-lgobe = it_zfrgt2-lgobe.
    wa_frgt-cityc = it_zfrgt2-cityc.
    wa_frgt-vtext = it_zfrgt2-vtext.
    wa_frgt-bran1 = it_zfrgt2-bran1.
    select single * from tvkbt into tvkbt where vkbur = wa_frgt-vkbur.
    if sy-subrc = 0.
    wa_frgt-soffice = tvkbt-bezei.
    endif.
    select single * from tvgrt where vkgrp = wa_frgt-vkgrp.
    if sy-subrc = 0.
    wa_frgt-district = tvgrt-bezei.
    endif.
    endif.
    select single * from zdest into zdest where
    vkorg = wa_frgt-vkorg and
    regio = wa_frgt-regio and
    cityc = wa_frgt-cityc and
    actvt = 'A'.
    if sy-subrc = 0.
    wa_frgt-vtext = zdest-vtext1.
    wa_frgt-bran1 = zdest-ibraco.
    wa_frgt-vkgrp = zdest-ivkgrp.
    select single * from tvgrt into tvgrt where vkgrp = wa_frgt-vkgrp.
    if sy-subrc = 0.
    wa_frgt-district = tvgrt-bezei.
    endif.
    else.
    wa_frgt-vtext = ' '.
    wa_frgt-bran1 = ' '.
    wa_frgt-district = ' '.
    endif.
    endselect.
    *endselect.
    *IF kna1-regio IS NOT INITIAL.
    Read table it_regio with key BLAND = wa_FRGT-REGIO.
    IF SY-SUBRC <> 0.
    DELETE IT_FRGT.
    clear it_frgt.
    CONTINUE.
    ENDIF.
    ENDIF.
    if wa_frgt-lfart eq 'ZGDR'.
    wa_frgt-NQGEW = wa_frgt-NTGEW.
    wa_frgt-NQGEW = wa_frgt-NQGEW * 1.
    else.
    wa_frgt-NQGEW = wa_frgt-NTGEW.
    wa_frgt-NQGEW = wa_frgt-NQGEW * 1.
    endif.
    if wa_frgt-vsbed <> '04'.
    Wa_frgt-t_mode = 'Road'.
    else.
    Wa_frgt-t_mode = 'Rail'.
    endif.
    it_cond = 0.
    if wa_frgt-netwr eq 0.
    if wa_frgt-vsbed <> '04'.
    select * from a531 into a531
    where werks eq wa_frgt-dwerks and
    zzlgort eq wa_frgt-lgort and
    cityc eq wa_frgt-cityc
    order by datbi DESCENDING.
    if sy-subrc = 0.
    it_cond = 1.
    if ( a531-datbi >= sy-datum and
    a531-datab <= sy-datum ).
    wa_frgt-knumh = a531-knumh.
    exit.
    endif.
    endif.
    endselect.
    if it_cond = 0.
    select * from a524 into a524
    where werks eq wa_frgt-dwerks and
    ZZTRANSP eq wa_frgt-lifnr and
    cityc eq wa_frgt-cityc
    order by datbi DESCENDING.
    if sy-subrc = 0.
    it_cond = 1.
    if ( a524-datbi >= sy-datum and
    a524-datab <= sy-datum ).
    . wa_frgt-knumh = a524-knumh.
    exit.
    endif.
    endif.
    endselect.
    endif.
    if it_cond = 0.
    select * from a530 into a530
    where werks eq wa_frgt-dwerks and
    ZZLGORT eq wa_frgt-lgort and
    inco1 eq wa_frgt-inco1 and
    cityc eq wa_frgt-cityc
    order by datbi DESCENDING.
    if sy-subrc = 0.
    it_cond = 1.
    if ( a530-datbi >= sy-datum and
    a530-datab <= sy-datum ).
    wa_frgt-knumh = a530-knumh.
    exit.
    endif.
    endif.
    endselect.
    endif.
    if it_cond = 0.
    select * from a527 into a527
    where werks eq wa_frgt-dwerks and
    ZZLGORT eq wa_frgt-lgort and
    ZZTRANSP eq wa_frgt-lifnr and
    cityc eq wa_frgt-cityc
    order by datbi DESCENDING.
    if sy-subrc = 0.
    it_cond = 1.
    if ( a527-datbi >= sy-datum and
    a527-datab <= sy-datum ).
    wa_frgt-knumh = a527-knumh.
    exit.
    endif.
    endif.
    endselect.
    endif.
    endif.
    else.
    select * from a519 into a519
    where vsbed eq wa_frgt-vsbed and
    rke_route eq wa_frgt-route
    order by datbi DESCENDING.
    if sy-subrc = 0.
    it_cond = 1.
    if ( a519-datbi >= sy-datum and
    a519-datab <= sy-datum ).
    wa_frgt-knumh = a519-knumh.
    exit.
    endif.
    endif.
    endselect.
    endif.
    if wa_frgt-knumh is not initial.
    select single * from konp into konp
    where knumh = wa_frgt-knumh.
    move konp-kbetr to wa_frgt-netwr.
    if konp-KMEIN = 'BAG'.
    wa_frgt-NQTWR = wa_frgt-NETWR *
    ( wa_frgt-ntgew * ( 20 / konp-kpein ) ).
    else.
    wa_frgt-NQTWR = wa_frgt-NETWR * wa_frgt-ntgew.
    endif.
    else.
    delete it_frgt.
    clear wa_frgt.
    continue.
    endif.
    else.
    wa_frgt-NQTWR = wa_frgt-NETWR.
    endif.
    CLEAR ZFREIGHT.
    if wa_frgt-vsbed = '04'.
    select single distn frgt from Zfreight into Zfreight
    Where Werks eq wa_FRGT-DWERKS
    AND LGORT eq wa_FRGT-LGORT
    AND route eq wa_FRGT-route.
    else.
    if ( it_frgt-lfart = 'ZGNL' ) OR ( it_frgt-lfart = 'ZGLF' ).
    Select single * from Zfreight into Zfreight
    Where Werks eq wa_FRGT-DWERKS
    AND cityc eq wa_FRGT-cityc
    AND route eq wa_FRGT-route.
    else.
    Select single * from Zfreight into Zfreight
    Where Werks eq wa_FRGT-DWERKS
    AND LGORT eq wa_FRGT-LGORT
    AND cityc eq wa_FRGT-cityc
    AND route eq wa_FRGT-route.
    endif.
    endif.
    if sy-subrc = 0.
    wa_FRGT-RRKM = ZFREIGHT-DISTN.
    if wa_frgt-rrkm > 0.
    wa_frgt-NKTWR = wa_frgt-rrkm * wa_frgt-ntgew.
    endif.
    IF ZFREIGHT-FRGT = 'P'.
    wa_frgt-BEZEI = 'Primary Freight'.
    Endif.
    IF ZFREIGHT-FRGT = 'S'.
    wa_frgt-BEZEI = 'Secondary Freight'.
    Endif.
    endif.
    modify it_frgt from wa_frgt index loop_index .
    Loop_index = loop_index + 1.
    endloop.
    endif.
    Sort it_frgt by Regio dwerks lgort Vkbur district bran1 mvgr1 t_mode.
    Clear:WA_frgt.
    Loop at it_frgt.
    If wa_frgt is initial.
    move-corresponding it_frgt to wa_frgt.
    wa_frgt-NQGEW = 0.
    wa_frgt-NQTWR = 0.
    wa_frgt-NKTWR = 0.
    endif.
    if it_frgt-lfart eq 'ZGDR' .
    it_frgt-NQGEW = it_frgt-NQGEW * -1.
    it_frgt-NQTWR = it_frgt-NQTWR * -1.
    it_frgt-NKTWR = it_frgt-NKTWR * -1.
    endif.
    if it_frgt-regio = wa_frgt-regio and
    it_frgt-dwerks = wa_frgt-dwerks and
    it_frgt-lgort = wa_frgt-lgort and
    it_frgt-vkbur = wa_frgt-vkbur and
    it_frgt-district = wa_frgt-district and
    it_frgt-bran1 = wa_frgt-bran1 and
    it_frgt-t_mode = wa_frgt-t_mode.
    wa_frgt-NQGEW = wa_frgt-NQGEW + it_frgt-NQGEW.
    wa_frgt-NQTWR = wa_frgt-NQTWR + it_frgt-NQTWR.
    wa_frgt-NKTWR = wa_frgt-NKTWR + it_frgt-NKTWR.
    else.
    Append wa_frgt to it_sfrgt.
    Clear wa_frgt.
    move-corresponding it_frgt to wa_frgt.
    wa_frgt-NQGEW = 0.
    wa_frgt-NQTWR = 0.
    wa_frgt-NKTWR = 0.
    wa_frgt-NQGEW = WA_frgt-NQGEW + it_frgt-NQGEW.
    wa_frgt-NQTWR = wa_frgt-NQTWR + it_frgt-NQTWR.
    wa_frgt-NKTWR = wa_frgt-NKTWR + it_frgt-NKTWR.
    endif.
    AT LAST .
    Append wa_frgt to it_sfrgt.
    Clear wa_frgt.
    ENDAT.
    endloop.
    sort it_sfrgt by regio dwerks lgort Vkbur district bran1 t_mode rrkm nqgew nqtwr nktwr avg_frt.
    Loop At IT_SFRGT.
    IT_SFRGT-RRKM = 0 .
    IF IT_SFRGT-NQGEW > 0 AND IT_SFRGT-NQTWR > 0.
    IT_SFRGT-AVG_FRT = IT_SFRGT-NQTWR / IT_SFRGT-NQGEW.
    ENDIF.
    IF IT_SFRGT-NQGEW > 0 AND IT_SFRGT-NKTWR > 0.
    IT_SFRGT-RRKM = IT_SFRGT-NKTWR / IT_SFRGT-NQGEW.
    ENDIF.
    IF IT_SFRGT-RRKM > 0 AND IT_SFRGT-AVG_FRT > 0.
    IT_SFRGT-FRT_RT = IT_SFRGT-AVG_FRT / IT_SFRGT-RRKM.
    ENDIF.
    MODIFY IT_SFRGT .
    Endloop.
    Sort it_sfrgt by REGION vkorg dwerks lgort t_mode rwerks mvgr1.
    loop at it_sfrgt.
    move-corresponding it_sfrgt to itab1.
    append itab1.
    endloop.
    loop at itab1.
    move-corresponding itab1 to IT_FINAL.
    append it_final.
    endloop.
    ENDFUNCTION.
    AND I created another function module ZTEST_RFC.
    In ZTEST_RFC MODULE I AM CALLING ABOVE FUNCTION MODULE ZTEST_FUNC.
    NOW its going to dump its showing the error CALL_FUNCTION_UC_STRUC RUNTIME ERROR IS COMING.
    how can i solve this problem could any body tell me its very urgent.
    In ZTEST_FUNC  function module only i am collecting the data and put into IT_FINAL INTERNAL TABLE.

    According to
    http://help.sap.com/saphelp_nw04/helpdata/en/f9/3f69fd11a80b4e93a5c9230bafc767/content.htm
    The reason for the Runtime error: CALL_FUNCTION_UC_STRUCT is that "Type conflict while transferring structure ".
    I'd suggest therefore that you check the definition of the variables in ZTEST_RFC where it calls ZTEST_FUNC as there would seem to be a mismatch.  If you are editing ZTEST_RFC, try using the Check > Extended check functionality as this will typically pinpoint such problems for you.

  • Hi experts- RFC look up in IDoc to File Senario

    Hi,
    I have req with Idoc to file (delivery Idoc).
    But i need to get user name of sender(r/3) into file which is not available in idoc type.
    I think we can do through <b>RFC lookup</b> functonality.
    Can u tell me <b>exact procedure and code</b> for this?

    Hi,
    Check some links on Look ups.
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    Look ups.
    /people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
    /people/francesco.bersani/blog/2007/03/05/data-lookup-optimized
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function
    Use this crazy piece for any RFC Mapping Lookups!
    /people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
    SAP XI Lookup API
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    Lookup’s in XI made simpler
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    Lookup - /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    DB lookup - /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    SOAP Lookup - /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0
    Lookup's in XI made simpler - /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    How to check JDBC SQL Query Syntax and verify the query results inside a User Defined Function of the Lookup API -
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    /people/prasad.illapani/blog/2006/10/25/how-to-check-jdbc-sql-query-syntax-and-verify-the-query-results-inside-a-user-defined-function-of-the-lookup-api
    Lookups - /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    Lookups - /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0/content.htm
    /people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
    Lookups with XSLT - https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8e7daa90-0201-0010-9499-cd347ffbbf72
    /people/sravya.talanki2/blog
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14
    How we have to create the lookups?
    Check this weblogs with some screenshots on how to achieve this:
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    /people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    /people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
    /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    Regards,
    Phani
    Rewar points if Helpful

  • Reg : RFC Lookups

    Hi..
    Now i have a scenario for u instead :
    this is what gimme a solid realistic approach : 
    i have records in this format lets say :
    RecordID   ordertype
    900           0305
    900           0305
    920           DS01
    900           0304
    900           0305
    920           DS02
    Now here is what i have look into :
    for all 900's whose Ordertype is same i have to make a call and then to decide to create/change by an RFC Lookup, with this RFC Lookup i have to then decide on which IDOC i have to map to . So that means i have to sort all the records of 900's based on ordertype with in the mapping itself and then make a call to IDOC .
    I am not expecting whether to use XSLT / Java mapping ,  I can only use custom functions. Lemme know whatz the best approach?
    for all 920's its not that complex but all 920 goes to one IDOC.
    Any clue?
    regards..sankar

    Hi Michal,
    >>>>>I'd go with Shravan's approach for sure
    please send link for this, i do not have shravan's approach?
    Hope you got my problem: or else see follow:
    I am outlining the scenarios here :
    I have a flat file with a following type of records:
    RecordID   ordertype
    900           0305    ..............................
    900           0305    .............................
    920           DS01 .............................
    900           0304 .........................................
    900           0305 .....................................
    920           DS02 .......................
    930    -->not concerned with these type of records
    Now here is what i have look into :
    for all 900's whose Ordertype is same i have to make a call and then to decide to create/change by an RFC Lookup, with this RFC Lookup (i.e. i have to group all the records with ordertype same ) i have to then decide on which IDOC i have to map to .
    i.e. For all 900's with one ordertype if i find that there exists an OPEN_PO then i have to call one IDOC with one set of values along with values returned from that RFC
    if its OPEN_PO is blan that i should send values to another IDOC
    for all 920 records i have to call another IDOC .
    I am not expecting whether to use XSLT / Java mapping ,  I can only use custom functions.  well lemme know whatz the best approach?
    Please help
    thanks,
    regards
    sankar

  • Help on RFC Look up

    Hi Folks,
    We are using PI 7.1 in our project and we have a requiremnt for RFC lookup on a table which is on PI ABAP stack.
    I know that with 7.1, SAP has provided the option of RFC lookup and JDBC lookup as a pre-defined function in message mapping. But my req is to call RFC lookup for a set of records (array of records) and get the output for all records and then work on it rather than calling the lookup for each record seperately as it will be performance intensive. Is there any way to do this?
    Thanks,
    Enivass
    Edited by: enivas on Mar 22, 2011 11:25 AM

    Hello,
    But my req is to call RFC lookup for a set of records (array of records) and get the output for all records and then work on it rather than calling the lookup for each record seperately as it will be performance intensive. Is there any way to do this?
    Yes, you can use the RFCAccessor using UDF or Java Mapping. Below is a blog regarding its use:
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    Hope this helps,
    Mark

  • Reg RFC to JDBC scenario

    Hi Techies,
    This is inregard of RFC to JDBC Scenario.
    Iam having an old RFC to JDBC scenarion which is working fine.
    I want to call other BAPI programme using the same RFC connection.
    I have changed  BAPI and ABAP Programmes.
    But Still in my integration builder, Still the RFC is calling the old stucture.
    How flush the buffer and call the new structure using the same RFC.
    Regards,
    Kiran

    But Still in my integration builder, Still the RFC is calling the old stucture.
    what about the RFC structure that is imported in IR/ ESR....was it re-imported?

Maybe you are looking for

  • Uninvited cookie

    Using Safari v3.1.1, something interesting happens with one particular cookie. I always have my cookie security settings set to "only from sites you navigate to". I have only been to this particular site once, long ago. And yet, this cookie keeps bou

  • Synaptics Touchpad of my HP Pavilion 15 Notebook PC not working

    My touchpad driver stopped working today afternoon. It was working perfectly and suddenly it stopped and i have recently (last week) purchased it. I uninstalled and the reinstalled the driver but still its not working. Please help me.. Also, please n

  • How Do I Authorize Purchased ITunes Musi Without a Internet Connection

    I made a backup of my library at home so I could update my library at work. The problem I am having is my work has a block on the ITunes website so I am unable to authorize my purchased music. Is there any other way to get my purchased music authoriz

  • Installed app not vissable

    I Installed à few App's nBut Theo are not visible. I am sure that THE app is installed because I can find it through spotlight. Can you help me?

  • Derivation of Transaction Type

    Hi all in some of the postings our SAP HCM interface should deliver the transaction type. But as SAP HCM does not know the transaction type (TRTYP) I would like to use the table V_T856K (transaction OBMA) for the derivation. How can I activate this d