Results 1 to 2 of 2

Thread: Select Fetch Next Not working in BSFN

  1. #1
    New Member
    Join Date
    Jun 2011
    Location
    INDIA
    Posts
    1

    Select Fetch Next Not working in BSFN

    Hello All ,

    This is my first post on JDE list.Please correct me if i missed anything

    I have created one C BSFN which fetches the multiple records from table F7611B by using Select Fetch Next API's.
    But when i run the BSFN from UBE/APPL ,it is going into error.
    I have checked the code but doesn't find anything which is causing error.I even checked the API's and it's parameters.

    JDE Release info ,as below :
    Application Release - E920
    Tool Release : 9.2.2.6

    Please find .c and .h file for your reference,as below.

    JDEBFRTN (ID) JDEBFWINAPI F7611BTableTEST (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD58TEST1 lpDS)

    {
    /************************************************** **********************
    * Variable declarations
    ************************************************** **********************/
    HREQUEST hRequestF7611B = (HREQUEST)NULL;
    NID szTableF7611B = NID_F7611B;
    ID idIndexF7611B = ID_F7611B_NOTAFISCALDET;
    SELECTSTRUCT Select[4] = { 0 };
    ID idJDBReturn = JDEDB_PASSED;
    /************************************************** **********************
    * Declare structures
    ************************************************** **********************/
    HUSER hUser = (HUSER)NULL;
    KEY1_F7611B dsF7611BKey1;
    F7611B dsF7611B ;
    /************************************************** **********************
    * Declare pointers
    ************************************************** **********************/
    memset((void*)(&dsF7611BKey1), (int)(_J('\0')), sizeof(KEY1_F7611B));
    /************************************************** **********************
    * Check for NULL pointers
    ************************************************** **********************/
    if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
    (lpVoid == (LPVOID) NULL) ||
    (lpDS == (LPDSD58TEST1) NULL))
    {
    jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), (LPVOID) NULL);
    return ER_ERROR;
    }

    /************************************************** **********************
    * Set pointers
    ************************************************** **********************/

    /************************************************** **********************
    * Main Processing
    ************************************************** **********************/
    idJDBReturn = JDB_InitBhvr(lpBhvrCom, &hUser, (JCHAR *)NULL, JDEDB_COMMIT_AUTO);
    idJDBReturn = JDB_OpenTable(hUser, szTableF7611B, idIndexF7611B, NULL, (ushort)(0), (JCHAR *)NULL, &hRequestF7611B);

    if (idJDBReturn == JDEDB_PASSED)
    {
    memset((void *)(Select), (int)(_J('\0')), sizeof(Select));
    idJDBReturn = JDB_ClearSelection(hRequestF7611B);

    jdeNIDcpy(Select[0].Item1.szDict, NID_BNNF);
    jdeNIDcpy(Select[0].Item1.szTable, NID_F7611B);
    Select[0].Item1.idInstance = 0;
    jdeNIDcpy(Select[0].Item2.szDict, _J(""));
    jdeNIDcpy(Select[0].Item2.szTable, _J(""));
    Select[0].lpValue = (void *)&lpDS->mnNotaFiscalNumberBSFN_BNNF;
    Select[0].nValues = (short)1;
    Select[0].nAndOr = JDEDB_ANDOR_AND;
    Select[0].nCmp = JDEDB_CMP_EQ;

    jdeNIDcpy(Select[1].Item1.szDict, NID_BSER);
    jdeNIDcpy(Select[1].Item1.szTable, NID_F7611B);
    Select[1].Item1.idInstance = 0;
    jdeNIDcpy(Select[1].Item2.szDict, _J(""));
    jdeNIDcpy(Select[1].Item2.szTable, _J(""));
    Select[1].lpValue = (void *)lpDS->szNotaFiscalSeriesBSFN_BSER;
    Select[1].nValues = (short)1;
    Select[1].nAndOr = JDEDB_ANDOR_AND;
    Select[1].nCmp = JDEDB_CMP_EQ;

    jdeNIDcpy(Select[2].Item1.szDict, NID_N001);
    jdeNIDcpy(Select[2].Item1.szTable, NID_F7611B);
    Select[2].Item1.idInstance = 0;
    jdeNIDcpy(Select[2].Item2.szDict, _J(""));
    jdeNIDcpy(Select[2].Item2.szTable, _J(""));
    Select[2].lpValue = (void *)&lpDS->mnNextNumber001BSFN_N001;
    Select[2].nValues = (short)1;
    Select[2].nAndOr = JDEDB_ANDOR_AND;
    Select[2].nCmp = JDEDB_CMP_EQ;

    jdeNIDcpy(Select[3].Item1.szDict, NID_DCT);
    jdeNIDcpy(Select[3].Item1.szTable, NID_F7611B);
    Select[3].Item1.idInstance = 0;
    jdeNIDcpy(Select[3].Item2.szDict, _J(""));
    jdeNIDcpy(Select[3].Item2.szTable, _J(""));
    Select[3].lpValue = (void *)lpDS->szDocumentTypeBSFN_DCT;
    Select[3].nValues = (short)1;
    Select[3].nAndOr = JDEDB_ANDOR_AND;
    Select[3].nCmp = JDEDB_CMP_EQ;


    idJDBReturn = JDB_SetSelection(hRequestF7611B, Select, (unsigned short)4, JDEDB_SET_REPLACE);
    if (idJDBReturn == JDEDB_PASSED)
    {
    idJDBReturn = JDB_SelectKeyed(hRequestF7611B, (ID)ID_F7611B_NOTAFISCALDET, (void *)&dsF7611BKey1, (short)0);
    if (idJDBReturn == JDEDB_PASSED)
    {
    while (JDB_Fetch(hRequestF7611B, (void *)&dsF7611B, FALSE) == JDEDB_PASSED)
    {
    jdeTraceSz1(NULL, _J("TEST While Loop"), NULL);
    }
    }
    }
    }
    /************************************************** **********************
    * Function Clean Up
    ************************************************** **********************/
    JDB_CloseTable(hRequestF7611B);
    return (ER_SUCCESS);
    }

    ================================================== =========
    .H File
    ================================================== =========
    #ifndef __B58TEST1_H
    #define __B58TEST1_H

    /************************************************** ***************************
    * Table Header Inclusions
    ************************************************** **************************/
    #include <f7611b.h>
    /************************************************** ***************************
    * External Business Function Header Inclusions
    ************************************************** **************************/

    /************************************************** ***************************
    * Global Definitions
    ************************************************** **************************/

    /************************************************** ***************************
    * Structure Definitions
    ************************************************** **************************/

    /************************************************** ***************************
    * DS Template Type Definitions
    ************************************************** **************************/
    /**
    * TYPEDEF for Data Structure
    * D58TEST1 : DSTR - F7611B Table Test
    *
    * Copyright Oracle USA
    *
    * This is a JDEdwards EnterpriseOne generated file.
    * Do not modify this file.
    * Only re-generate with the appropriate tool.
    * Generation Date : 09/12/2019
    */

    #ifndef DATASTRUCTURE_D58TEST1
    #define DATASTRUCTURE_D58TEST1

    typedef struct tagDSD58TEST1
    {
    MATH_NUMERIC mnNotaFiscalNumberBSFN_BNNF;
    JCHAR szNotaFiscalSeriesBSFN_BSER[3];
    MATH_NUMERIC mnNextNumber001BSFN_N001;
    JCHAR szDocumentTypeBSFN_DCT[3];
    JCHAR szDescriptionBSFN_DESC[31];
    JCHAR cModeofReportBSFN_EV01;
    MATH_NUMERIC mnNotaFiscalAmountBSFN_BVTN;
    MATH_NUMERIC mnAddressNumberBSFN_AN8;
    MATH_NUMERIC mnShipToNumberBSFN_SHAN;
    JCHAR cActionCodeBSFN_EV01;
    JCHAR cErrorCode_ERRC;
    ID idEventID_GENLNG;
    } DSD58TEST1, *LPDSD58TEST1;

    #define IDERRmnNotaFiscalNumberBSFN_BNNF_1 1L
    #define IDERRszNotaFiscalSeriesBSFN_BSER_2 2L
    #define IDERRmnNextNumber001BSFN_N001_3 3L
    #define IDERRszDocumentTypeBSFN_DCT_4 4L
    #define IDERRszDescriptionBSFN_DESC_5 5L
    #define IDERRcModeofReportBSFN_EV01_6 6L
    #define IDERRmnNotaFiscalAmountBSFN_BVTN_7 7L
    #define IDERRmnAddressNumberBSFN_AN8_8 8L
    #define IDERRmnShipToNumberBSFN_SHAN_9 9L
    #define IDERRcActionCodeBSFN_EV01_10 10L
    #define IDERRcErrorCode_ERRC_11 11L
    #define IDERRidEventID_GENLNG_12 12L

    #endif /* DATASTRUCTURE_D58TEST1 */

    /************************************************** ***************************
    * Source Preprocessor Definitions
    ************************************************** **************************/
    #if defined (JDEBFRTN)
    #undef JDEBFRTN
    #endif

    #if defined (WIN32)
    #if defined (WIN32)
    #define JDEBFRTN(r) __declspec(dllexport) r
    #else
    #define JDEBFRTN(r) __declspec(dllimport) r
    #endif
    #else
    #define JDEBFRTN(r) r
    #endif

    /************************************************** ***************************
    * Business Function Prototypes
    ************************************************** **************************/
    JDEBFRTN (ID) JDEBFWINAPI F7611BTableTEST (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD58TEST1 lpDS);

  2. #2
    I think the issue is with this statement below . the key structure you are providing for select keyed , the DSTR does not have any values . I dont think it is needed there , it should be as below

    dJDBReturn = JDB_SelectKeyed(hRequestF7611B, (ID)ID_F7611B_NOTAFISCALDET, (void *)&dsF7611BKey1, (short)0);

    New :

    dJDBReturn = JDB_SelectKeyed(hRequestF7611B, (ID)ID_F7611B_NOTAFISCALDET, (void *)NULL, (short)0);

    Data will be selected as per the ID index you have mentioned for fetching .Hope this helps

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
The legal restrictions and terms of use applicable to this site are available here.
Use of this site signifies your agreement to the terms of use.
JDELIST is NOT affiliated with JD Edwards® & Company, Oracle or Peoplesoft. Contents of this site are neither endorsed nor approved by JD Edwards® & Company and, or Oracle.