<?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: Dynamic SELECT conditions in background - problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055814#M1353180</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, an alternative is to define a range for each field and fill the ranges.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Aug 2009 14:12:38 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-24T14:12:38Z</dc:date>
    <item>
      <title>Dynamic SELECT conditions in background - problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055813#M1353179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I faced a strange problem. I have function module which uses dynamic conditions in SELECT statement. Everything works fine in foreground processing, but in background the function gives no values. You can find a piece of code below. It's a bit long but as mentioned - works fine in foreground, so seems to be non-coding error...   I'd be thankful for any ideas...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: itwa_where_cond(72) occurs 20 with header line,
       wa_where_cond(72) type c,
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;      ...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  clear: itwa_where_cond[], itwa_where_cond.
  move 'BZOBJ  = ''0''' to wa_where_cond.
  append wa_where_cond to itwa_where_cond.

  clear wa_where_cond.
  concatenate 'AND KADKY &amp;gt;= ''' l_date_start '''' into wa_where_cond.
  append wa_where_cond to itwa_where_cond.

  clear wa_where_cond.
  concatenate 'AND KADKY &amp;lt;= ''' l_date_end '''' into wa_where_cond.
  append wa_where_cond to itwa_where_cond.

  clear wa_where_cond.
  concatenate 'AND MATNR = ''' wa_matwrk-matnr '''' into wa_where_cond.
  append wa_where_cond to itwa_where_cond.

  clear wa_where_cond.
  concatenate 'AND WERKS = ''' wa_matwrk-werks '''' into wa_where_cond.
  append wa_where_cond to itwa_where_cond.

  clear wa_where_cond.
  concatenate 'AND KOKRS  = ''' pi_kokrs '''' into wa_where_cond.
  append wa_where_cond to itwa_where_cond.

  if not pi_freig is initial.
    clear wa_where_cond.
    concatenate  'AND FREIG =''' pi_freig '''' into wa_where_cond.
    append wa_where_cond to itwa_where_cond.
  endif.
  if not pi_tvers is initial.
    clear wa_where_cond.
    concatenate  'AND TVERS = ''' pi_tvers '''' into wa_where_cond.
    append wa_where_cond to itwa_where_cond.
  endif.
  if not pi_klvar is initial.
    clear wa_where_cond.
    concatenate  'AND KLVAR = ''' pi_klvar '''' into wa_where_cond.
    append wa_where_cond to itwa_where_cond.
  endif.
  if not pi_feh_sta is initial.
    clear wa_where_cond.
    concatenate  'AND FEH_STA = ''' pi_feh_sta '''' into wa_where_cond.
    append wa_where_cond to itwa_where_cond.
  endif.

  if not pi_kkzma is initial.
    clear wa_where_cond.
    concatenate  ' AND KKZMA = ''' pi_kkzma '''' into wa_where_cond.
    append wa_where_cond to itwa_where_cond.
  endif.

  SELECT * FROM  KEKO into corresponding fields of table it_keko
                                         WHERE  (itwa_where_cond).   

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Grzegorz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 14:08:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055813#M1353179</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T14:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SELECT conditions in background - problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055814#M1353180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, an alternative is to define a range for each field and fill the ranges.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 14:12:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055814#M1353180</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T14:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SELECT conditions in background - problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055815#M1353181</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;Can you please share the piece of code where you have defined the internal table  it_keko ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KR Jaideep,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 14:29:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055815#M1353181</guid>
      <dc:creator>jaideepsharma</dc:creator>
      <dc:date>2009-08-24T14:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SELECT conditions in background - problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055816#M1353182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think there is anything wrong with SELECT and it shouldn't matter whether it runs in the background or foreground. You might want to make sure that the program gets the correct parameters - add MESSAGE or WRITE statements to see the parameters in background (job log or spool, depending on which you choose).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. You might want to use CONCATENATE... SEPARATED BY space.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 21:15:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055816#M1353182</guid>
      <dc:creator>Jelena_Perfiljeva</dc:creator>
      <dc:date>2009-08-24T21:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SELECT conditions in background - problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055817#M1353183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jaideep,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;definition of it_keko is simple:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: it_keko  type table of keko.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Gregory&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2009 05:40:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055817#M1353183</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-25T05:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SELECT conditions in background - problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055818#M1353184</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;You may have to debug the program in background and check where the error lies. Check if the dynamic where condition is being populated correctly and the SY_SUBRC of the select statement. Its also better to try using concatnating using SEPERATED BY SPACE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2009 05:50:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055818#M1353184</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-25T05:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SELECT conditions in background - problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055819#M1353185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vik,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;You may have to debug the program in background and check where the error lies. Check if the dynamic where condition is being populated correctly and the SY_SUBRC of the select statement. Its also better to try using concatnating using SEPERATED BY SPACE.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm debugging program by command 'JDBG' after the job has finished execution. All parameters passed to function seem to be correct... &lt;/P&gt;&lt;P&gt;SY-SUBRC NE 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll try later concatnating using SEPERATED BY SPACE but if works in foreground...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for replies for all of you so far.&lt;/P&gt;&lt;P&gt;Gregory&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2009 05:59:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055819#M1353185</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-25T05:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SELECT conditions in background - problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055820#M1353186</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;TAKE THIS CODE... HOPE IT WORKS FOR YOU....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;clear: itwa_where_cond[], itwa_where_cond.
  move `BZOBJ  = '0'` to wa_where_cond.
  append wa_where_cond to itwa_where_cond.
 
  clear wa_where_cond.
  concatenate `AND KADKY &amp;gt;= '` l_date_start `'`  into wa_where_cond.
  append wa_where_cond to itwa_where_cond.
 
  clear wa_where_cond.
  concatenate `AND KADKY &amp;lt;= '` l_date_end `'` into wa_where_cond.
  append wa_where_cond to itwa_where_cond.
 
  clear wa_where_cond.
  concatenate `AND MATNR = '` wa_matwrk-matnr `'` into wa_where_cond.
  append wa_where_cond to itwa_where_cond.
 
  clear wa_where_cond.
  concatenate `AND WERKS = '` wa_matwrk-werks `'` into wa_where_cond.
  append wa_where_cond to itwa_where_cond.
 
  clear wa_where_cond.
  concatenate `AND KOKRS  = '` pi_kokrs `'` into wa_where_cond.
  append wa_where_cond to itwa_where_cond.
 
  if not pi_freig is initial.
    clear wa_where_cond.
    concatenate  `AND FREIG = '` pi_freig `'` into wa_where_cond.
    append wa_where_cond to itwa_where_cond.
  endif.

  if not pi_tvers is initial.
    clear wa_where_cond.
    concatenate  `AND TVERS = '` pi_tvers `'` into wa_where_cond.
    append wa_where_cond to itwa_where_cond.
  endif.
  if not pi_klvar is initial.
    clear wa_where_cond.
    concatenate  `AND KLVAR = '` pi_klvar `'` into wa_where_cond.
    append wa_where_cond to itwa_where_cond.
  endif.
  if not pi_feh_sta is initial.
    clear wa_where_cond.
    concatenate  `AND FEH_STA = '` pi_feh_sta `'` into wa_where_cond.
    append wa_where_cond to itwa_where_cond.
  endif.
 
  if not pi_kkzma is initial.
    clear wa_where_cond.
    concatenate  `AND KKZMA = '` pi_kkzma `'` into wa_where_cond.
    append wa_where_cond to itwa_where_cond.
  endif.
 
  SELECT * FROM  KEKO into corresponding fields of table it_keko
                                         WHERE  (itwa_where_cond).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REGARDS&lt;/P&gt;&lt;P&gt;SIDDARTH&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2009 06:21:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055820#M1353186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-25T06:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SELECT conditions in background - problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055821#M1353187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Problem is solved.... Select condition was quite OK. I wrote that all function parameters are passed correct but in fact are not. My authority check didn't work correct in background and gave wrong value for function module. I'm sorry for taking your time and thank you for willingness of help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;G.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2009 06:38:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-select-conditions-in-background-problem/m-p/6055821#M1353187</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-25T06:38:17Z</dc:date>
    </item>
  </channel>
</rss>

