Program to Print FI/MM Documents having Note Attachment

There has been a requirement to generate a program for displaying all those FI Documents and Material Documents having a Note as an attachment. Following program can be used to get all FI and MM documents that a user have created with a Note.

Note Attachment 

Source Code:
 
*&———————————————————————*
*& Report  ZFI_FINDATTCH
*&
*&———————————————————————*
*& The program display all the documents (FI or MM) where a note is
*& created as an attachement by the user.
*&———————————————————————*

REPORT  ZFI_FINDATTCH NO STANDARD PAGE HEADING LINE-SIZE 255.

TABLES: SOOD, SRGBTBREL.

Types: begin of ty_itab,
        BUKRS type BUKRS,
        BELNR type BELNR_D,
        GJAHR type GJAHR,
        OBJDS type SO_OBJ_DES,
        CRDAT TYPE SO_DAT_CR,
        CRONM TYPE SO_CRO_NAM,
        CHDAT type SO_DAT_CH,
        CHONM TYPE SO_CHO_NAM,
       end of ty_itab.
data: itab type ty_itab occurs 0 with header line.
data: srch_txt(70).

* Selection Screen
SELECTION-SCREEN: begin of block blk WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_name FOR sy-uname.

parameters: fi_chk RADIOBUTTON GROUP rb1 default ‘X’ ,
            mm_chk RADIOBUTTON GROUP rb1.
SELECTION-SCREEN: END OF BLOCK blk.

* Read Data for printing
start-of-selection.
select * from SOOD where
  OBJTP = ‘RAW’ and
  OBJNAM = ‘MESSAGE’ and
  OWNNAM in s_name.

  clear: srch_txt.
  concatenate ‘%’ sood-OBJTP sood-OBJYR sood-OBJNO ‘%’ into srch_txt.

  if fi_chk = ‘X’.
    select * from SRGBTBREL where
      INSTID_B like srch_txt and
      TYPEID_A = ‘BKPF’.
      itab-BUKRS = SRGBTBREL-INSTID_A(4).
      itab-BELNR = SRGBTBREL-INSTID_A+4(10).
      itab-GJAHR = SRGBTBREL-INSTID_A+14(4).
      itab-OBJDS = SOOD-OBJDES.
      itab-CRDAT = SOOD-CRDAT.
      itab-CRONM = SOOD-CRONAM.
      itab-CHDAT = SOOD-CHDAT.
      itab-CHONM = SOOD-CHONAM.
      append itab.
    endselect.
  elseif mm_chk = ‘X’.
    select * from SRGBTBREL where
      INSTID_B like srch_txt and
      TYPEID_A = ‘BUS2017′.
      itab-BELNR = SRGBTBREL-INSTID_A(10).
      itab-GJAHR = SRGBTBREL-INSTID_A+10(4).
      itab-OBJDS = SOOD-OBJDES.
      itab-CRDAT = SOOD-CRDAT.
      itab-CRONM = SOOD-CRONAM.
      itab-CHDAT = SOOD-CHDAT.
      itab-CHONM = SOOD-CHONAM.
      append itab.
    endselect.
  endif.
endselect.

* Print Document List
end-of-selection.
if fi_chk = ‘X’.
  write: / ‘FI Documents containting Notes:’.
  write: / sy-uline(30).
  write: /(5) ‘CCode’,(10) ‘Doc.Number’, ‘Year’,(20) ‘Description’,
              (12)’Creator Name’,(12)’Date Created’, (12)’Changed By’,
              (12)’Changed On’.
  loop at itab.
    write: /(5) itab-BUKRS, itab-BELNR, itab-GJAHR,(20) itab-OBJDS,
    (12) itab-CRONM,(12) itab-CRDAT,(12) itab-CHONM,(12) itab-CHDAT.
  endloop.
elseif mm_chk = ‘X’.
  write: / ‘MM Documents containting Notes:’.
  write: / sy-uline(30).
  write: /(10) ‘Doc.Number’, ‘Year’,(20) ‘Description’,
              (12)’Creator Name’,(12)’Date Created’, (12)’Changed By’,
              (12)’Changed On’.
  loop at itab.
    write: / itab-BELNR, itab-GJAHR,(20) itab-OBJDS,
    (12) itab-CRONM,(12) itab-CRDAT,(12) itab-CHONM,(12) itab-CHDAT.
  endloop.
endif.

The output of the program looks like following:

Note Attachment

Download Source Code : Note Attachment

You might also be interested in these posts:

  1. ABAP Program to show My Inactive Programs
  2. ABAP Program to Search For SMARTFORMS in your Language
  3. ABAP program to create Formatted Excel File using XML
  4. Best way to Loop At ‘Standard’ Internal Table in ABAP
  5. ABAP Program to Track ‘Hard Coding’ in Programs

6 Responses to “Program to Print FI/MM Documents having Note Attachment”
physical therapist Posted on May 29, 2010 at 5:44 AM

This is such a great resource that you are providing and you give it away for free. I enjoy seeing websites that understand the value of providing a prime resource for free. I truly loved reading your post. Thanks!

nursing schools Posted on June 1, 2010 at 9:28 AM

I’ve recently started a blog, the information you provide on this site has helped me tremendously. Thank you for all of your time & work.

Pharmacy technician jobs in California Posted on June 2, 2010 at 8:59 AM

What a great resource!

WP Themes Posted on June 9, 2010 at 2:56 AM

Genial brief and this enter helped me alot in my college assignement. Gratefulness you for your information.

medical assistant Posted on June 11, 2010 at 3:34 PM

Great site. A lot of useful information here. I’m sending it to some friends!

financial aid for college Posted on June 25, 2010 at 7:40 PM

What a great resource!

Post a Comment