Search This Blog

Wednesday, 6 June 2012

FlexSQL,FlexID Code in Reports

QUERY:-

SELECT AI.INVOICE_NUM,
               AID.DISTRIBUTION_LINE_NUMBER,
               &SELECT_ALL    FLEX_DATA
  FROM AP_INVOICES_ALL AI,
              AP_INVOICE_DISTRIBUTIONS_ALL AID,
              GL_CODE_COMBINATIONS  GCC
 WHERE AI.INVOICE_ID=AID.INVOICE_ID
     AND  GCC.CODE_COMBINATION_ID=AID.DIST_CODE_COMBINATION_ID
     AND AI.ORG_ID=:P_ORG_ID

WE HAD WRITTEN ONE LEXICAL PARAMETER AS &SELECT_ALL (IT IS NOTHING BUT PLACE HOLDER COLUMN(REPORT LEVEL)  AND IT CONTAINS SEGMENTS STRUCTURE AND DATATYPE AS CHAR AND  INITIAL VALUE AS -->VALUE IF NULL-->GCC.SEGMENT1) ).

NOW PLACE TWO FORMULA COLUMNS .... ONE FOR FLEX DATA AND ONE FOR FLEX DESC WHICH SHUD BE IN GROUP LEVEL BY USING FLEXIDVAL USEREXITS....

NOW WE WANT TO DISPLAY STRUCTURE  BY USING FNDFLEXSQL ... FOR DISPLAYING THE STRUCTURE WE SHUD WRITE CODE IN " BEFORE REPORT TRIGGER" WHICH IS SHOWN BELOW..................

BEFORE THIS WE SHUD CREATE TWO USER PARAMETERS i.e P_COA_ID AND P_CONC_REQUEST_ID...............

--FND FLEXSQL
--------------
BEGIN
SRW.USER_EXIT('FND SRWINIT');                               }
SRW.USER_EXIT('FND FLEXSQL                                  }
                             CODE="GL#"                              }-- THIS WE SHUD WRITE IN " BEFORE
                                                                                                  REPORT TRIGGER                      
                             NUM=":P_COA_ID"                      }-- THIS IS FOR DISPLAYING STRUCTURE AND RETRIVE THE DATA FROM DATABASE
         APPL_SHORT_NAME="SQLGL"
                       OUTPUT=":SELECT_ALL"
                TABLE_ALIAS="GCC"
                          MODE="SELECT"
                       DISPLAY="ALL" ');
RETURN(TRUE);
END;
------------------------------------------------------------------------------------------------------------
NOW WE WANT TO DISPLAY THE DATA WHICH IS PRESENT IN THE STRUCTURE .... FOR THAT WE USE  " FLEXID"

FOR THAT  PLACE TWO FORMULA COLUMNS IN GROUP LEVEL AND NAME IT  AS "CF_FLEXDATA" AND  "CF_FLEXDESC"

DATATYPE -- CHAR
WIDTH --1000
--FND FLEXID
-------------
"CF_FLEXDATA--->"

  SRW.USER_EXIT('FND FLEXIDVAL                                                    ---OBUL
                 CODE="GL#"
                 NUM=":P_COA_ID"
                 APPL_SHORT_NAME="SQLGL"
                 DATA=":FLEXDATA"
                 VALUE=":CF_DATA"
                 DISPLAY="ALL"
                 IDISPLAY="ALL" ');
              RETURN(:CF_DATA);                }
                                                         }    -- THIS WE SHUD WRITE IN FORMAULA COLUMN WHICH NAMED AS :CF_FLEXDATA
                                                         }
                                                         }
                       
                                          -- THESE TWO FOR DISPLAY DATA WICH IS PRESENT IN DAT FLEXSQL

-------------------------------------------------------

"CF_FLEXDESC"--->

    SRW.USER_EXIT('FND FLEXIDVAL                                              ---OBUL
                 CODE="GL#"
                 NUM=":P_COA_ID"
                 APPL_SHORT_NAME="SQLGL"
                 DATA=":FLEXDATA"
                 DESCRIPTION=":CF_DESC"
                 DISPLAY="ALL"
                 IDISPLAY="ALL" ');                                       }
                                                                                 }
                                                                                 }-- THIS IS ALSO WE SHUD WRITE IN FORMULA COLUMN WHICH NAMED AS :CF_FLEXDESC
                                                                               
               
         
                               

------ THESE 2 FORMULA COLUMNS WE SHUD TAKE IN GROUP LEVEL

for finding the CODE="GL#" -- GO TO APPLICATION DEVELOPER RESP---> FLEXFIELD-->REGISTER-->QUERY-->General Ledger



NOW AS USUAL WE REGISTER IT IN APPS.......

FOR DISPLAYING CHART_OF_ACCOUNTS_ID DYNAMICALLY WE SHUD USE DEFAULT TYPE AS SQL FRO P_COA_ID PARAMETER AND IN DEFAULT VALUE WRITE BELOW CODE...

SELECT CHART_OF_ACCOUNTS_ID FROM GL_SETS_OF_BO0OKS WHERE SET_OF_BOOKS_ID=:$PROFILES$.GL_SET_OF_BKS_ID

2 comments:

  1. Hi,
    very useful code.
    but how to map the headers and lines.

    plz give me the replay to:
    mail2saadiq@gmail.com

    ReplyDelete
  2. very useful code.
    but how to map the headers and lines.

    plz give me the replay to:
    mail2saadiq@gmail.com

    ReplyDelete