cancel
Showing results for 
Search instead for 
Did you mean: 

How to display Query result into CFL ?

Former Member
0 Kudos

Hi,

Can anybody help on how to get Query result to be displayed in CFL ?

I have tried by doing below code in CFL before event

               SAPbouiCOM.Conditions oBatchCons = default(SAPbouiCOM.Conditions);

                SAPbouiCOM.Condition oBatchCon = default(SAPbouiCOM.Condition);

                oBatchCons = CFLBatch.GetConditions();

                string BatchQuery = "exec [dbo].[U_Sp_BatchData] ";

                oRecordSet.DoQuery(BatchQuery);

              

               for (int i = 1; i <= oRecordSet.RecordCount; i++)

                {

                    if (i > 1)

                        oBatchCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR;

              

                    oBatchCon = oBatchCons.Add();

                    oBatchCon.Alias = "DistNumber";

                    oBatchCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;

                    oBatchCon.CondVal = oRecordSet.Fields.Item("Distnumber").Value.ToString();

                    oRecordSet.MoveNext();

                }

                CFLBatch.SetConditions(oBatchCons);

Above code is bringing result with filter of Batch which are in SP only but columns are from Batch Master only

Gives SP result with below list of Column:

Itemcode,

Distnumber,

availbleqty,

producedqty,

But we need result in CFL of above mention column.

So please suggest on how we can do this.

Thanks,

Harshal

Accepted Solutions (0)

Answers (2)

Answers (2)

edy_simon
Active Contributor
0 Kudos

Hi Harshal,

The columns are limited to the batch master only, we don't have control on this.

Your work around is to use Formatted Search.

Regards

Edy

Former Member
0 Kudos

HI Harshal,

The example below works for Profit Centers. I'm filtering Cost Centers using the variable sCC.


The philosophy is to create a where clause like "MSAccess" eg. WHERE 1=1 AND((FIELD = 'VAL1') OR (FIELD = 'VAL2') OR (FIELD = 'VAL3'))



                    string sCC="100,200,300";

                    string[] CCs = sCC.ToString().Split(',');

                    SAPbouiCOM.DBDataSource oDBDataSource = this.oForm.DataSources.DBDataSources.Add("OOCR");

                    SAPbouiCOM.Condition _oCondition_acct;

                    cflChildCC = this.oForm.ChooseFromLists.Item("cfCC");

                    cflChildCC.SetConditions(new SAPbouiCOM.Conditions());

                    SAPbouiCOM.Conditions _oConds_acct = cflChildCC.GetConditions();

                    _oCondition_acct = _oConds_acct.Add();

                    _oCondition_acct.BracketOpenNum = 1;

                    int i = 1;

                    foreach (string sCC in CCs)

                    {

                        _oCondition_acct.BracketOpenNum = 1;

                        _oCondition_acct.Alias = "OcrCode";

                        _oCondition_acct.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;

                        _oCondition_acct.CondVal = sCC;

                        _oCondition_acct.BracketCloseNum = 1;

                        i++;

                        if (i <= CCs.Length)

                        {

                            _oCondition_acct.Relationship = BoConditionRelationship.cr_OR;

                            _oCondition_acct = _oConds_acct.Add();

                        }

                    }

                    _oCondition_acct.BracketCloseNum = 1;

                    cflChildCC.SetConditions(_oConds_acct);

                    oDBDataSource.Query(_oConds_acct);

Best Regards,

Evangelos D. Plagianos