Tuesday, 19 April 2011

GL INTERFACE CODE


             GL INTERFACE CODE                                                        
                                                                     
                                                                     
                                             
CREATE OR REPLACE PROCEDURE  GE_Pro(Errbuf  OUT VARCHAR2,
                                                       Retcode OUT VARCHAR2) IS
  -- cursor declaration
  CURSOR gl_cur IS
    SELECT  
        status    ,
        set_of_books_id   ,
        accounting_date   ,
        currency   ,
        date_created   ,
        created_by    ,
        actual_flag    ,
        category       ,
        source     ,
        curr_conversion     ,
          segment1     ,
          segment2        ,
          segment3        ,
          segment4        ,
          segment5        ,
          entered_dr      ,
          entered_cr      ,
          accounted_dr    ,
          accounted_cr    ,
          group_id        
          FROM VENKAT_GL_INBOUND_INTERFACE;
l_currencycode VARCHAR2(25);
l_set_of_books_id NUMBER(3);
l_flag         VARCHAR2(2);
l_error_msg    VARCHAR2(100);
l_err_flag     VARCHAR2(10);
l_category     VARCHAR2(100);
L_USERID       NUMBER(10);
BEGIN
 DELETE FROM  gl_interface;
 COMMIT;
FOR rec_cur IN gl_cur LOOP
     l_flag:='A';
     l_err_flag:='A';
--This  PL/SQL Block will do the currency validation
 --end of the currency validation
--Category Column Validation
BEGIN
 SELECT USER_JE_CATEGORY_NAME
 INTO   l_CATEGORY
 FROM   GL_JE_CATEGORIES
 WHERE  USER_JE_CATEGORY_NAME = REC_CUR.Category;
 EXCEPTION
     WHEN OTHERS THEN
            l_category:=NULL;
            l_flag:='E';
            l_error_msg:='Category does not exist ';
 END;
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE'||L_FLAG);
 --End Category Column Validation
 --User ID column validation
BEGIN
SELECT USER_ID
INTO   L_USERID
FROM   FND_USER
WHERE  USER_ID = REC_CUR.created_by;
EXCEPTION
WHEN OTHERS THEN
            L_userid:=NULL;
            l_flag:='E';
            l_error_msg:='User ID does not exist ';
 END;
 Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE'||L_FLAG);
 --End of Created_by OR UserID column Validation
 --Set of  books Validation
 BEGIN
     SELECT set_of_books_id
     INTO   l_set_of_books_id
     FROM   GL_SETS_OF_BOOKS
     WHERE set_of_books_id=rec_cur.set_of_books_id;
     EXCEPTION
     WHEN OTHERS THEN
            l_set_of_books_id:=NULL;
            l_flag:='E';
            l_error_msg:='set of Books ID does not exist ';
 END;
 Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE'||L_FLAG);
-- End Set of  books Validation
 --Status Column validation
/* BEGIN
 IF rec_cur.status = 'NEW' THEN
 l_flag:= 'A';
 ELSE
 l_flag:= 'E';
 Fnd_File.put_line (Fnd_File.LOG,'Status column has got invalid data');
 END IF;
 END;*/
 BEGIN
     SELECT currency_code
     INTO   l_currencycode
     FROM   fnd_currencies
     WHERE currency_code=rec_cur.currency
     AND currency_code='USD';
     EXCEPTION
      WHEN OTHERS THEN
            l_currencycode:=NULL;
            l_flag:='E';
            l_error_msg:='currency code does not exists';
 END;
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE'||L_FLAG);
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE'||L_FLAG);
--End of Actual Flag Column validation
IF   l_flag!='E' THEN
Fnd_File.put_line (Fnd_File.LOG,'Inserting data into the Interface TABLE');
INSERT INTO gl_interface(status,
      set_of_books_id,
      accounting_date,
      currency_code,
      date_created,
      created_by,
      actual_flag,
      user_je_category_name,
      user_je_source_name,
      user_currency_conversion_type,
      segment1,
      segment2,
      segment3,
      segment4,
      segment5,
      entered_dr,
      entered_cr,
      accounted_dr,
      accounted_cr,
      group_id)
      VALUES
      (rec_cur.status    ,
       rec_cur.set_of_books_id   ,
       rec_cur.accounting_date   ,
       rec_cur.currency    ,
       rec_cur.date_created   ,
       rec_cur.created_by    ,
       rec_cur.actual_flag    ,
       rec_cur.category       ,
       rec_cur.source     ,
       rec_cur.curr_conversion                ,
       rec_cur.segment1  ,
       rec_cur.segment2  ,
       rec_cur.segment3  ,
       rec_cur.segment4  ,
       rec_cur.segment5  ,
       rec_cur.entered_dr   ,
       rec_cur.entered_cr   ,
       rec_cur.accounted_dr  ,
       rec_cur.accounted_cr  ,
       rec_cur.group_id);
 END IF;
 l_flag:=NULL;
 l_error_msg:=NULL;
  END LOOP;
COMMIT;
END  GE_Pro;
/

17 comments:

Anonymous said...

I think this is among the most significant information for me.
And i'm glad reading your article. But wanna remark on few general things, The site style is ideal, the articles is really excellent : D. Good job, cheers
Feel free to visit my site ... aaa locations

Anonymous said...

Hello friends, nice piece of writing and nice urging commented
here, I am in fact enjoying by these.
Also visit my site :: www.bookmarks.creativesoftsolutions.com

Anonymous said...

Cool blog! Is your theme custom made or did you download it from somewhere?
A design like yours with a few simple tweeks would
really make my blog stand out. Please let me know where you got your theme.
Cheers
Look at my weblog - www.seoheap.com

Anonymous said...

Thank you for any other informative web site.
Where else may just I am getting that kind of
info written in such an ideal method? I have a undertaking
that I am simply now operating on, and I have been at the glance out for
such information.
My web blog - acronyms medical

Anonymous said...

Your means of telling the whole thing in this paragraph is in fact
fastidious, all can simply be aware of it, Thanks a lot.


my blog post; section 21 4 a notice form

Anonymous said...

Good dаy! This is my 1ѕt comment here so I just ωanted to give a quick shout out anԁ tell
you I genuinely еnjoy reаԁing your posts.
Can you recommend any οthеr blogs/websitеs/forumѕ thаt
deal with the same toрics? Thank you so much!


Hеre is my website - http://crearfacebook.webs.com

Anonymous said...

Hi there everyone, it's my first pay a quick visit at this website, and paragraph is truly fruitful in favor of me, keep up posting these types of posts.

my website :: abrir cuenta facebook

Anonymous said...

Εxсellеnt blog herе! Alsо your site lоаds up
fast! Whаt host are you using? Cаn Ӏ gеt youг affiliate
link tο youг host? I ωiѕh my sіte loadеd uρ as fast as yours
lol

my wеb-site Crear facebook

Anonymous said...

It's a shame you don't have a donatе button!

ӏ'd certainly donate to this superb blog! I guess for now i'll settle for bookmаrking anԁ adԁing your RSS feed to my Google account.
I look forward to new uρdates and will talk about this website with my Facebook group.
Τalk soon!

Have а loоk at my weblog ... crear facebook

Anonymous said...

Eveгything iѕ veгy οpen with a verу clear clarіfication
оf thе challengеs. Ӏt was гeаlly
informativе. Your ѕite is extremely helpful.
Thanks for sharing!

Here is my sіte ... Crear Facebook Gratis

Anonymous said...

Hi therе, I enϳoy rеading all of your artісlе pоѕt.
I liκe to write а littlе comment to support you.


Feel frеe tο suгf to my homepage:
22.62.344a.static.theplanet.com

Anonymous said...

Nicе pοѕt. I was cheсkіng constantly this blоg аnԁ І'm impressed! Very helpful information specifically the last part :) I care for such info a lot. I was seeking this particular info for a very long time. Thank you and good luck.

My blog - abrir cuenta facebook

Anonymous said...

I feel that is one of the such a lot vital information for me.
And i'm glad reading your article. But wanna statement on some general issues, The web site style is ideal, the articles is in point of fact nice : D. Just right task, cheers

Here is my blog post section 21 notice template free

Anonymous said...

Originality gold ghd hair the shape ghd flat iron without carry trump also locations http://www.clonlineoutlet.co.uk/ a to and cheap ghd hair straighteners choosing most a brings easy toms shoes outlet you other

Anonymous said...

Υes! Finally someone ωrites about creaг
facebook.

Here іs my weblog ... abrir cuenta facebook

Anonymous said...

It's a pity you don't have a donate button! I'd without a doubt donate to this superb blog! I suppose for now i'll settle fοr bookmarking and adding your
RSS feed to my Google accоunt. I look forward to new updates
and will share thiѕ wеbsite with my Facebook group.
Talk ѕoon!

Also visit my web site ... http://sheridantalentscout.wordpress.com/2012/02/15/kickstarter-and-soap-ends/

Anonymous said...

Hey there! I'm at work surfing around your blog from my new iphone 4! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the great work!

Here is my web site; crear facebook gratis