Program to Print FI/MM Documents having Note Attachment

6
776

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

6 COMMENTS

  1. 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!

LEAVE A REPLY