<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Select query is not working in BDC Program in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289860#M1634615</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Before using the value of MATNR in the select query, use conversion exit (CONVERSION_EXIT_ALPHA_INPUT)&lt;/P&gt;&lt;P&gt;to add the prefixed zeroes to the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at I_DATA.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input  = I_DATA-matnr
  IMPORTING
    output = I_DATA-matnr.

  select matnr mtart from mara into table itab where matnr = I_DATA-matnr.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Sep 2011 06:53:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-09-22T06:53:03Z</dc:date>
    <item>
      <title>Select query is not working in BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289859#M1634614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working in BDC for update valuation class for T-code mm01.Actually In this BDC i am using two recoding based on material type.&lt;/P&gt;&lt;P&gt;i am using two internal table : I_DATA and ITAB&lt;/P&gt;&lt;P&gt;Use I_DATA to hold excle data in which material No, plant , valuation type , valuation No. and ITAB for material No, material type Only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, i am fetching material Type ( MARA-MTART ) through select query. But Select query is not working. and also i did check MARA table according that  Material Number then  material no. exit in Mara Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : at run time  I_DATA have 1 row but ITAB have 0 row ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********************************&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF I_DATA OCCURS 0,&lt;/P&gt;&lt;P&gt;MATNR TYPE MARA-MATNR,&lt;/P&gt;&lt;P&gt;WERKS TYPE MARC-WERKS,&lt;/P&gt;&lt;P&gt;BWTAR TYPE RMMG1-BWTAR,&lt;/P&gt;&lt;P&gt;VERPR TYPE BMMH1-VERPR,&lt;/P&gt;&lt;P&gt;BKLAS TYPE MBEW-BKLAS,&lt;/P&gt;&lt;P&gt;STATUS TYPE C,&lt;/P&gt;&lt;P&gt;END OF I_DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;MATNR LIKE MARA-MATNR,&lt;/P&gt;&lt;P&gt;MTART LIKE MARA-MTART,&lt;/P&gt;&lt;P&gt;END OF ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at I_DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr mtart from mara into table itab where matnr = I_DATA-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;************************************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guide me..........&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 06:41:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289859#M1634614</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-22T06:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Select query is not working in BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289860#M1634615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Before using the value of MATNR in the select query, use conversion exit (CONVERSION_EXIT_ALPHA_INPUT)&lt;/P&gt;&lt;P&gt;to add the prefixed zeroes to the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at I_DATA.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input  = I_DATA-matnr
  IMPORTING
    output = I_DATA-matnr.

  select matnr mtart from mara into table itab where matnr = I_DATA-matnr.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 06:53:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289860#M1634615</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-22T06:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select query is not working in BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289861#M1634616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  vinraaj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' is gud working .  actually I have  10 rows in  I_DATA. and &lt;/P&gt;&lt;P&gt; loop is working 10 time . &lt;/P&gt;&lt;P&gt;But I have only 1 row in ITAB  after loop ending. i want append every loop iteration in ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I am using Code......&lt;/P&gt;&lt;P&gt;*********************************************************&lt;/P&gt;&lt;P&gt;Loop at I_DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    input  = I_DATA-matnr&lt;/P&gt;&lt;P&gt;  IMPORTING&lt;/P&gt;&lt;P&gt;    output = I_DATA-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  select matnr mtart from mara into table itab where matnr = I_DATA-matnr.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  MODIFY itab TRANSPORTING matnr mtart.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   APPEND itab.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   modify itab.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endloop. &lt;/P&gt;&lt;P&gt;*********************************************************&lt;/P&gt;&lt;P&gt;How can possible...........?&lt;/P&gt;&lt;P&gt;Guide me.........&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 07:36:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289861#M1634616</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-22T07:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select query is not working in BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289862#M1634617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you use your&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at I_DATA.
  select matnr mtart from mara into table itab 
    where matnr = I_DATA-matnr.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;At end of loop, itab will only contain the result of the last select, so use a&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at I_DATA.
  select matnr mtart from mara APPENDING table itab 
    where matnr = I_DATA-matnr.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; better&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;if I_DATA[] is not initial.
  select matnr mtart from mara into table itab 
    FOR ALL ENTRIES IN i_data where matnr = i_data-matnr.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;EM&gt;Some Remarks&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;- If actually required (where does I_DATA come from, is it an external format, you need the internal value to use in SELECT statement), check via SE11 the correct [conversion exit|http://help.sap.com/saphelp_nw04/helpdata/en/35/26b217afab52b9e10000009b38f974/content.htm] associated with domain MATNR (Is it truly ALPHA, and not something like MATN1, so [CONVERSION_EXIT_MATN1_INPUT|http://www.sdn.sap.com/irj/scn/advancedsearch?query=conversion_exit_matn1_input])&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;- You could try to use BAPI like [BAPI_MATERIAL_SAVEDATA|http://www.sdn.sap.com/irj/scn/advancedsearch?query=bapi_material_savedata] and not BDC&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 08:29:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289862#M1634617</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2011-09-22T08:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Select query is not working in BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289863#M1634618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vinraaj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks vinraj my problem has been solved ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I have not able to understand. why I am not able to  fetch data from MARA on the basis of  internal Table  I_DATA .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;why inside loop at   I_DATA this query  &lt;/P&gt;&lt;P&gt;select matnr mtart from mara into table itab where matnr = I_DATA-matnr. ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 08:53:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289863#M1634618</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-22T08:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select query is not working in BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289864#M1634619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;But I have not able to understand. why I am not able to fetch data from MARA on the basis of internal Table I_DATA .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See  in table I_DATA the value of MATNR will be for example : 98968493.&lt;/P&gt;&lt;P&gt;But in table it will be stored as 000000000098968493.  So when we fetch using 98968493 from table MARA the same will not be fetched.  The type of MATNR is CHAR, so in CHAR '001' and '1' are different.  Both 001 and 1 are same only if the type is integer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your problem is solved, please &lt;EM&gt;&amp;lt;removed by moderator&amp;gt;&lt;/EM&gt; close the thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Sep 22, 2011 9:02 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 09:12:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289864#M1634619</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-22T09:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Select query is not working in BDC Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289865#M1634620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree, if data comes from an external source, like a file on presentation server, with material reference in external format, you don't have anything to do for a BDC as it accepts data in external format, but to enrich the data in your program you have to convert it in internal format.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT i_data ASSIGNING &amp;lt;wa&amp;gt;.
  CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
      input        = &amp;lt;wa&amp;gt;-mfrpn " external format, you can keep for BDC
    IMPORTING
      output       = &amp;lt;wa&amp;gt;-matnr " internal format required for SELECT
    EXCEPTIONS
      length_error = 1
      OTHERS       = 2.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But before coding, look via SE11 for the correct conversion  exit associated to domain MATNR on your system. (Customizing and Solutions applied on system)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 10:02:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-is-not-working-in-bdc-program/m-p/8289865#M1634620</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2011-09-22T10:02:18Z</dc:date>
    </item>
  </channel>
</rss>

