2 Replies Latest reply: Dec 4, 2014 10:01 AM by Julien Vaillant RSS

    Setting dynamic Where conditions through variables

      Hi all,

      I'm trying to create a huge SAP table looping on a specific query that will bring me an acceptable bunch of records and concatenate them until my table will be done.

       

      So, my script-code looks like:

       

      //BSIS_Soc_Ejer:
      //SQL SELECT DISTINCT BUKRS GJAHR from BSIS;
      
      // --> First I get all distinct combinations of the fields I'll use as where conditions. This table has been stored into a QVD.
      set i=0;
      Rows:
      LOad *
      from [~\DinamicWhere.QVD];
      
      
      let NOrows=NoOfRows(Rows);
      for i=1 to '$(NOrows)'
      Trace $(i);
      let BUKRS=FieldValue('BUKRS',$(i));
      let GJAHR=FieldValue('GJARH',$(i));
      Trace $(BUKRS);
      Trace $(GJAHR);
      BSIS_Complete:
      NoConcatenate
      SQL SELECT BUKRS HKONT GJAHR BELNR BUDAT BLDAT XBLNR BLART BSCHL SHKZG BUZEI FKONT WRBTR GSBER SGTXT VBUND ZFBDT SHKZG AUGBL AUGDT
      FROM  BSIS 
      WHERE  BUKRS=''$(BUKRS)'' AND GJAHR=''$(GJAHR)''
      ;
      next
      
      
      Store BSIS_Complete into [~\BSIS_Complete.QVD](qvd);
      Drop Table BSIS_Complete;
      

       

      But when I execute it, there's no value in my BUKRS and GJAHR fields.

      Is there anything wrong? Trace shows me the value of "i", but Fieldvalue doesn't bring me anything...

       

      Thansk for reading and thank for your probably future help in advance.