REPORT YUPLOAD LINE-SIZE 255 NO STANDARD PAGE HEADING.
DATA: BEGIN OF ITAB OCCURS 20,
LINE(1) TYPE X,
END OF ITAB.
DATA: BEGIN OF BTAB OCCURS 20,
LENGTH TYPE I,
LINE(100) TYPE X,
END OF BTAB.
DATA: BEGIN OF IREC OCCURS 10,
LINE(100) TYPE X,
END OF IREC.
DATA: LAST, DSPSTR(100), MODE, A TYPE I, POINTER TYPE I, SUM TYPE I.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'c:\sapgui\sapgui\rectrans'
FILETYPE = 'BIN'
TABLES
DATA_TAB = ITAB.
********************************************************
LAST = 'B'.POINTER = 0.
LOOP AT ITAB.
A = ITAB-LINE.
IF A >= 32 AND A <= 124.
IF LAST = 'B'.
BTAB-LENGTH = POINTER.
APPEND BTAB.CLEAR BTAB.
BTAB-LINE = ITAB-LINE.
LAST = 'A'.POINTER = 1.
ELSE.
BTAB-LINE+POINTER(1) = ITAB-LINE.
POINTER = POINTER + 1.
ENDIF.
ELSE.
IF LAST = 'B'.
BTAB-LINE+POINTER(1) = ITAB-LINE.POINTER = POINTER + 1.
ELSE.
BTAB-LENGTH = POINTER.
APPEND BTAB.CLEAR BTAB.
BTAB-LINE = ITAB-LINE.
LAST = 'B'.POINTER = 1.
ENDIF.
ENDIF.
ENDLOOP.
BTAB-LENGTH = POINTER.
APPEND BTAB.CLEAR BTAB.
LOOP AT BTAB.
POINTER = BTAB-LENGTH.
DSPSTR = BTAB+4(POINTER).
WRITE: / SY-TABIX, SUM, POINTER, DSPSTR.
SUM = SUM + POINTER.
ENDLOOP.
READ TABLE BTAB INDEX 30.
BTAB+4(12) = 'testuser '.
WRITE BTAB TO BTAB INDEX 30.
READ TABLE BTAB INDEX 34.
BTAB+4(8) = 'qwertyui'.
WRITE BTAB TO BTAB INDEX 34.
WRITE: / '***********************************************************'.
LOOP AT BTAB.
POINTER = BTAB-LENGTH.
DSPSTR = BTAB+4(POINTER).
WRITE: / SY-TABIX, SUM, POINTER, DSPSTR.
SUM = SUM + POINTER.
ENDLOOP.
********************************************************
MODE = ''.
LOOP AT BTAB.
CLEAR IREC. REFRESH IREC.
IREC = BTAB+4(100).
APPEND IREC.
POINTER = BTAB-LENGTH.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = POINTER
FILENAME = 'c:\sapgui\sapgui\tttttttt'
FILETYPE = 'BIN'
MODE = MODE
TABLES
DATA_TAB = IREC.
MODE = 'A'.
ENDLOOP.
Search Here
Tuesday, January 15, 2008
Display and change the binary file created by the sapgui record function - abap report
Posted by
A S Chakrapani
at
8:55 PM
1 comments
Labels: Free ABAP Samples
ABAP Program for Send an email from SAP to a specific user, to all users of a client or to all users of a system - report
REPORT YCHORIG .
TABLES: SSCRFIELDS, TADIR.
************************************************************************
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 5(72) AAA.
SELECTION-SCREEN COMMENT /5(72) BBB.
SELECTION-SCREEN COMMENT /5(72) CCC.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK BLOCK WITH FRAME.
SELECTION-SCREEN COMMENT /2(72) DDD.
SELECTION-SCREEN COMMENT /2(72) EEE.
SELECTION-SCREEN COMMENT /2(72) FFF.
SELECTION-SCREEN COMMENT /2(72) GGG.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: A LIKE E071-PGMID.
PARAMETERS: B LIKE E071-OBJECT.
PARAMETERS: C LIKE E071-OBJ_NAME.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN COMMENT /1(72) HHH.
SELECTION-SCREEN COMMENT /1(72) III.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN PUSHBUTTON 3(30) MMM USER-COMMAND DISP.
SELECTION-SCREEN PUSHBUTTON 36(8) JJJ USER-COMMAND PROC.
SELECTION-SCREEN PUSHBUTTON 47(8) KKK USER-COMMAND EXIT.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /1(72) LLL.
SELECTION-SCREEN END OF BLOCK BLOCK .
************************************************************************
INITIALIZATION.
AAA = 'This program changes the specifyed object''s original system.'.
BBB = 'The new SID will be the login SID.'.
CCC = 'USE THIS PROGRAM WITH EXTREME CARE!!!'.
DDD = 'Name of R/3 ABAP/4 Development Workbench object'.
EEE = '| Object type'.
FFF = '| | Object name'.
GGG = '| | |'.
HHH = 'Example:'.
III = 'R3TR PROG ZLOAD'.
JJJ = 'PROCEED'.
KKK = 'EXIT'.
MMM = 'DISPLAY RECENT ORIGINAL SYSTEM'.
LLL = ' '.
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'EXIT'.
SET SCREEN 0.LEAVE SCREEN.
ELSEIF SSCRFIELDS-UCOMM = 'PROC'.
CLEAR TADIR.
SELECT SINGLE * FROM TADIR WHERE PGMID = A AND OBJECT = B AND
OBJ_NAME = C.
IF TADIR-PGMID IS INITIAL.
LLL = 'THIS OBJECT DOES NOT EXIST'.
ELSE.
IF SY-SYSID <> TADIR-SRCSYSTEM.
TADIR-SRCSYSTEM = SY-SYSID.
MODIFY TADIR.
COMMIT WORK.
LLL = 'THE ORIGINAL SYSTEM CHANGED TO:'.
LLL+31(3) = SY-SYSID.
ELSE.
LLL = 'NO CHANGE: THE ORIGINAL SYSTEM AND LOGIN SYSTEM ARE THE SAME'.
ENDIF.
ENDIF.
ELSEIF SSCRFIELDS-UCOMM = 'DISP'.
CLEAR TADIR.
SELECT SINGLE * FROM TADIR WHERE PGMID = A AND OBJECT = B AND
OBJ_NAME = C.
IF TADIR-PGMID IS INITIAL.
LLL = 'THIS OBJECT DOES NOT EXIST'.
ELSE.
LLL = 'THE RECENT ORIGINAL SYSTEM IS: '.
LLL+31(3) = TADIR-SRCSYSTEM.
ENDIF.
ENDIF.
Posted by
A S Chakrapani
at
8:52 PM
0
comments
Labels: Free ABAP Samples
ABAP Program for Change an original system status of an SAP object - program
REPORT YUSRLOCK NO STANDARD PAGE HEADING.
TABLES: TRDIR, USR02.
DATA: MARK,CNTR TYPE I,
ACCNT LIKE USR02-ACCNT, ERDAT LIKE USR02-ERDAT,
ANAME LIKE USR02-ANAME, CLI(3) VALUE 'AAA', SZIN TYPE I,
SYDATUM LIKE SY-DATUM, FLAG(3).
TABLES: UINFO.
DATA: OPCODE TYPE X VALUE 2.
DATA: BEGIN OF USR_TABL OCCURS 10.
INCLUDE STRUCTURE UINFO.
DATA: END OF USR_TABL.
START-OF-SELECTION.
CALL 'ThUsrInfo' ID 'OPCODE' FIELD OPCODE
ID 'TAB' FIELD USR_TABL-*SYS*.
SELECT * FROM USR02 CLIENT SPECIFIED ORDER BY MANDT BNAME.
IF USR02-MANDT <> CLI.
SZIN = SZIN + 1. SZIN = SZIN MOD 2.
CLI = USR02-MANDT.
ENDIF.
IF USR02-UFLAG = 0.
MARK = ' '.
ELSE.
MARK = 'X'.
ENDIF.
CLEAR FLAG.
LOOP AT USR_TABL.
IF USR_TABL-BNAME = USR02-BNAME AND USR_TABL-MANDT = USR02-MANDT.
FLAG = '!!!'.
ENDIF.
ENDLOOP.
SYDATUM = SY-DATUM - 30.
IF SYDATUM < szin =" 0." szin =" 0." ucomm =" 'SEL'." mandt =" USR02-MANDT" bname =" USR02-BNAME." mark =" 'X'" uflag =" 0." uflag =" 64." uflag =" 64" mandt =" USR02-MANDT" bname =" USR02-BNAME." mark =" '" uflag =" 64." uflag =" 0." uflag =" 0" mandt =" USR02-MANDT" bname =" USR02-BNAME.">
Posted by
A S Chakrapani
at
8:48 PM
0
comments
Labels: Free ABAP Samples
ABAP Program for Collect data about the active SAP users - program
EPORT YCOLLECT.
TABLES: UINFO, YUINFO.
DATA: OPCODE TYPE X VALUE 2, DATUM TYPE D, IDOPONT TYPE T.
DATA: BEGIN OF USR_TABL OCCURS 10.
INCLUDE STRUCTURE UINFO.
DATA: END OF USR_TABL.
CALL 'ThUsrInfo' ID 'OPCODE' FIELD OPCODE
ID 'TAB' FIELD USR_TABL-*SYS*.
DATUM = SY-DATUM.
IDOPONT = SY-UZEIT.
LOOP AT USR_TABL.
MOVE-CORRESPONDING USR_TABL TO YUINFO.
YUINFO-DATUM = DATUM.
YUINFO-IDOPONT = IDOPONT.
YUINFO-SORSZAM = YUINFO-SORSZAM + 1.
INSERT YUINFO.
ENDLOOP.
COMMIT WORK.
Posted by
A S Chakrapani
at
8:47 PM
0
comments
Labels: Free ABAP Samples
ABAP Program for Start WORD - pass data - change it there - after exiting get the changed data - report
REPORT YDOSEXEC.
PARAMETERS: LINE(50).
DATA: START_TIME TYPE T, END_TIME TYPE T.
DATA: BEGIN OF ITAB OCCURS 3,
LINE(50),
END OF ITAB.
ITAB-LINE = LINE.
APPEND ITAB.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = 'C:\TEMP\TEST.TXT'
TABLES
DATA_TAB = ITAB.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
PROGRAM = 'C:\MSOFFICE\WINWORD\WINWORD.EXE'
COMMANDLINE = 'C:\TEMP\TEST.TXT'
INFORM = ''
EXCEPTIONS
PROG_NOT_FOUND.
GET TIME.
START_TIME = SY-UZEIT.
END_TIME = SY-UZEIT + 20.
DO.
GET TIME.
START_TIME = SY-UZEIT.
IF START_TIME >= END_TIME.
EXIT.
ENDIF.
ENDDO.
CLEAR ITAB.
REFRESH ITAB.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'C:\TEMP\TEST.TXT'
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1.
IF SY-SUBRC = 0.
LOOP AT ITAB.
WRITE: / ITAB.
ENDLOOP.
ELSE.
WRITE: / 'File open error.'.
ENDIF.
Posted by
A S Chakrapani
at
8:43 PM
0
comments
Labels: Free ABAP Samples
Sunday, January 6, 2008
ABAP MODEL PROGRAMS ON EVERY TOPIC
Posted by
A S Chakrapani
at
10:05 PM
0
comments
Labels: Free ABAP Samples
Hiding and making ABAP Code non editable
Making Code Non Editable
Steps: Goto se38
for your Program. Choose Attributes radio Button and click Change.
In this screen check the check box Editor Lock and save it.
Now this locked for editing by any other use.
Hiding a Code
Write a Simple program:
Program to Hide ABAP's Source Code and Protects it
report zsam_hide no standard page heading.
******************************
* This program hides any ABAP's source code and protects it with a
* password in this source code.
*
* After hiding, you can still run the abap (the load version is intact)
* but it cannot be displayed, edited, traced, transported or generated.
*
* If the ABAP is not hidden, the program hides it, if it is hidden, it
* unhide it.
* Remember to hide this program first!
******************************
selection-screen begin of block block.
parameters: program(30) obligatory.
selection-screen begin of line.
selection-screen comment 1(8) pwd.
selection-screen position 35.
parameters: password(8) modif id aaa.
selection-screen end of line.
selection-screen end of block block.
*
data: message(60) type c.
*
at selection-screen output.
loop at screen.
if screen-group1 = 'AAA'.
screen-invisible = '1'.
modify screen.
endif.
endloop.
*
initialization.
pwd = 'Password'.
*
start-of-selection.
tables: trdir.
* User name and password check
if password <> 'ABCDEFG'.
write: / 'Wrong password'.
exit.
endif.
* SAP owned?
if not program cp 'Z*' and not program cp 'Y*'.
write: / 'Do not hide original SAP programs!'.
exit.
endif.
* Exists?
select single * from trdir where name = program.
if sy-subrc <> 0.
write: / 'Program does not exists!'.
exit.
endif.
* Does it have a current generated version?
data: f1 type d, f3 type d.
data: f2 type t, f4 type t.
EXEC SQL.
SELECT UDAT, UTIME, SDAT, STIME INTO :F1, :F2, :F3, :F4 FROM D010LINF
WHERE PROG = :PROGRAM
ENDEXEC.
if f1 < f1 =" f3" new_name =" program." i =" sy-index" j =" 0." j =" j" j =" 1." new_name =" program."> 1.
write: / 'Cannot generate appropriate program name'.
exit.
endif.
* Check if it is already hidden
data: f5(30).
EXEC SQL.
SELECT PROG INTO :F5 FROM D010S WHERE PROG = :NEW_NAME
ENDEXEC.
if f5 is initial.
* There is no such hidden program, hide it
EXEC SQL.
UPDATE D010S SET PROG = :NEW_NAME WHERE PROG = :PROGRAM
ENDEXEC.
concatenate 'Program' :program 'was hidden.'
into message separated by space.
else.
* There is already a hidden program there, unhide it
EXEC SQL.
UPDATE D010S SET PROG = :PROGRAM WHERE PROG = :NEW_NAME
ENDEXEC.
concatenate 'Program' :program 'was restored.'
into message separated by space.
endif.
write message.
*** end of program
Posted by
A S Chakrapani
at
10:03 PM
0
comments
Labels: Free ABAP Samples
ABAP - Memory Usage Check
*&---------------------------------------------------------------------**& Report ZUSEMEM*&---------------------------------------------------------------------*REPORT zusemem.
PARAMETERS mb TYPE i.
TYPES:
BEGIN OF ty_tab_s,
ch(1024) TYPE c,
END OF ty_tab_s.
TYPES: ty_tab_t TYPE TABLE OF ty_tab_s.
DATA:
ls TYPE LINE OF ty_tab_t,
lt TYPE ty_tab_t.
DO mb TIMES.
DO 1024 TIMES.
APPEND ls TO lt.
ENDDO.
ENDDO.
SKIP.
WRITE: / 'At the moment ',
mb,
' MB of this program are being used'.
-->
Posted by
A S Chakrapani
at
10:02 PM
0
comments
Labels: Free ABAP Samples
OPEN DATASET sap abap keyword syntax and description
Opens a file.
Syntax
OPEN DATASET
[IN BINARY|TEXT MODE]
[AT POSITION
[MESSAGE
[FILTER
Opens a file
reading or writing, whether the contents are to be interpreted in binary or character form, the
position in the file, the location to which an operating system can be written, and allow you to
execute an operating system command.
Posted by
A S Chakrapani
at
10:01 PM
0
comments
Labels: Free ABAP Samples
PUT sap abap keyword syntax and description
Triggers a GET event.
Syntax
PUT
Only occurs in logical databases. Branches the program flow according to the structure of the
logical database.
Posted by
A S Chakrapani
at
10:00 PM
0
comments
Labels: Free ABAP Samples
Display the growth history of a selected tablespace using SAP graphics - interactive report
*
* Display the growth history of a specific tablespace using SAP graphics.
* The tablespace has to be selected from an interactive list.
*
REPORT ZTBSPCGR.
DATA: BEGIN OF HIST OCCURS 100.
INCLUDE STRUCTURE HIST.
DATA: END OF HIST.
DATA: BEGIN OF HIST2 OCCURS 100,
TS LIKE HIST-TS,
DATE_ LIKE HIST-DATE_,
TUSED LIKE HIST-TUSED,
END OF HIST2 .
DATA: BEGIN OF DATA OCCURS 1,
W TYPE I,
F TYPE F,
END OF DATA.
DATA: BEGIN OF OPTS OCCURS 1,
C(80),
END OF OPTS.
DATA: SELTS LIKE HIST-TS, CLIN(7) TYPE N, CCLIN(7), LIN TYPE I,
DATEC(25), REFDAT TYPE D VALUE '19970801', X1 TYPE I VALUE 0,
X2 TYPE I VALUE 300, Y1 TYPE I VALUE 0, Y2 TYPE I VALUE 10000,
FLAG TYPE I.
START-OF-SELECTION.
CALL FUNCTION 'DB_ORA_TABLESPACE_HISTORY' DESTINATION 'zzzzzzzz'
TABLES
HIST1 = HIST.
LOOP AT HIST.
MOVE-CORRESPONDING HIST TO HIST2.
HIST2-TUSED = HIST2-TUSED / 1024.
HIST2-DATE_ = HIST2-DATE_ - REFDAT.
APPEND HIST2.
ENDLOOP.
SORT HIST2 BY TS.
FLAG = 0.
LOOP AT HIST2.
AT NEW TS.
FLAG = FLAG + 1. FLAG = FLAG MOD 2.
IF FLAG = 0.
WRITE: / HIST2-TS COLOR 2. HIDE: HIST2-TS.
ELSE.
WRITE: / HIST2-TS COLOR 4. HIDE: HIST2-TS.
ENDIF.
ENDAT.
ENDLOOP.
AT LINE-SELECTION.
SELTS = HIST2-TS.
SY-LSIND = SY-LSIND - 1.
SORT HIST2 BY DATE_ ASCENDING.
CLEAR DATA. REFRESH DATA.
CLEAR OPTS. REFRESH OPTS.
LOOP AT HIST2.
IF HIST2-TS = SELTS.
DATA-W = HIST2-DATE_.
DATA-F = HIST2-TUSED.
APPEND DATA.
ENDIF.
ENDLOOP.
DESCRIBE TABLE DATA LINES LIN.
CLIN = LIN. CCLIN = CLIN. CCLIN(1) = '$'.
DATEC = 'TABLESPACE: '. DATEC+12 = SELTS.
OPTS-C = CCLIN .APPEND OPTS.
OPTS-C = 'COLOR=1'.APPEND OPTS.
OPTS-C = 'thick=1'.APPEND OPTS.
OPTS-C = 'LTEXT='.APPEND OPTS.
OPTS-C = 'DTEXT='.APPEND OPTS.
CALL FUNCTION 'STAT_GRAPH'
EXPORTING
TTEXT = DATEC
UTEXT = 'Kb/day (from Aug-01-97)'
X_ART = 'LIN'
Y_ART = 'LIN'
SCALE = 'MAN'
XRNGL = X1
XRNGU = X2
YRNGL = Y1
YRNGU = Y2
XTCKS = '11'
YTCKS = '11'
XDECS = '0'
YDECS = '0'
TABLES
OPTS = OPTS
DATA = DATA.
Posted by
A S Chakrapani
at
9:59 PM
0
comments
Labels: Free ABAP Samples
ABAP Program for Download the custom developed abap programs to a UNIX text file - report
*
* This program downloads the custom developed abap programs
* to a UNIX text file.
*
REPORT ZABAPSAV.
DATA: BEGIN OF ITAB OCCURS 500,
C(72),
END OF ITAB.
PARAMETERS: OUTFILE(50) DEFAULT '/tmp/abaps' LOWER CASE..
DATA: HEADER(72), SPC(72) VALUE ' '.
TABLES: TRDIR.
OPEN DATASET OUTFILE IN TEXT MODE FOR OUTPUT.
SELECT * FROM TRDIR WHERE NAME LIKE 'Z%' OR NAME LIKE 'Y%'.
HEADER = '#@$%&************* '.
HEADER+20 = TRDIR-NAME.
HEADER+30 = TRDIR-CNAM.
HEADER+40 = TRDIR-UDAT.
HEADER+54 = '******************'.
TRANSFER SPC TO OUTFILE.
TRANSFER HEADER TO OUTFILE.
TRANSFER SPC TO OUTFILE.
CLEAR ITAB. REFRESH ITAB.
READ REPORT TRDIR-NAME INTO ITAB.
LOOP AT ITAB.
TRANSFER ITAB TO OUTFILE.
ENDLOOP.
ENDSELECT.
CLOSE DATASET OUTFILE.
Posted by
A S Chakrapani
at
9:54 PM
0
comments
Labels: Free ABAP Samples
ABAP Program for Detects the "heavy" ABAP programs of a certain period of time: data collector - report
*
* This program creates a sequential file of long running ABAPs.
* Later, with the ZHEAVYLS program, we can figure out the
* "heavy" ABAPs of a given period of time, by interpreting the
* sequential file.
* The program creates a snapshot every 5 minutes, of the workpocesses
* on the different app. servers and db. server, running ABAPs
* longer then 5 minutes.
*
REPORT ZHEAVYPR.
DATA: OUTPUT_FILE(40) VALUE '/oracle/SID/sapreorg/heavy_abaps'.
DATA: DEST(8).DATA: WITH_CPU TYPE X VALUE 10,
SRVNAME LIKE SPFID-APSERVER.
DATA: BEGIN OF SRV_TBL OCCURS 100.
INCLUDE STRUCTURE MSXXLIST.
DATA END OF SRV_TBL.
DATA: BEGIN OF WPLIST OCCURS 30.
INCLUDE STRUCTURE WPINFOS.
DATA: END OF WPLIST.
DATA: BEGIN OF LOC_WPLIST OCCURS 30.
INCLUDE STRUCTURE WPINFO.
DATA: END OF LOC_WPLIST.
DATA: BEGIN OF WPINFO OCCURS 30.
INCLUDE STRUCTURE WPINFO.
DATA: END OF WPINFO.
DATA: BEGIN OF PFNORM OCCURS 30.
INCLUDE STRUCTURE PFNORM.
DATA: END OF PFNORM.
DATA: BEGIN OF O,
1(10), 2(8), 3(8), 4(3), 5(8), 6(8),
END OF O.
CALL FUNCTION 'TH_SERVER_LIST' DESTINATION '????????'
TABLES
LIST = SRV_TBL.
REFRESH WPLIST.
LOOP AT SRV_TBL.
SRVNAME = SRV_TBL-NAME.
REFRESH LOC_WPLIST.
WITH_CPU = 1.
CALL FUNCTION 'TH_WPINFO' DESTINATION '???????'
EXPORTING
SRVNAME = SRVNAME
TABLES
WPLIST = LOC_WPLIST
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC = 0.
LOOP AT LOC_WPLIST.
MOVE-CORRESPONDING LOC_WPLIST TO WPLIST.
WPLIST-APSERVER = SRVNAME.
APPEND WPLIST.
ENDLOOP.
ENDIF.
ENDLOOP.
OPEN DATASET OUTPUT_FILE FOR APPENDING IN TEXT MODE.
LOOP AT WPLIST.
DEST = WPLIST-APSERVER.
CALL FUNCTION 'TH_WP_DETAIL_INFO' DESTINATION DEST
EXPORTING
WP = WPLIST-WP_NO
WITH_CPU = WITH_CPU
IMPORTING
WPINFO = WPINFO
PFNORM = PFNORM.
IF NOT WPINFO-WP_REPORT IS INITIAL AND WPINFO-WP_ELTIME > 310.
* write: / sy-datum no-gap, sy-uzeit, dest, ' ',wplist-wp_typ, ' ',
* wpinfo-wp_eltime, ' ', wpinfo-wp_report.
O-1 = SY-DATUM. O-2 = SY-UZEIT.
O-3 = DEST. O-4 = WPLIST-WP_TYP.
O-5 = WPINFO-WP_ELTIME. O-6 = WPINFO-WP_REPORT.
TRANSFER O TO OUTPUT_FILE.
ENDIF.
ENDLOOP.
CLOSE DATASET OUTPUT_FILE.
Posted by
A S Chakrapani
at
9:52 PM
0
comments
Labels: Free ABAP Samples
ABAP Program for Balance the different services between the app. servers: CPU time per workprocess type and application server
REPORT ZPROCTIM.
*
* This program sums the CPU time by workprocess type, and by
* application server, consumed by the workprocesses.
* It is useful, to help to balance the different
* services between the servers.
*
INCLUDE
DATA: DEST(8), TAIL(5), HEAD(5).
DATA: SAPS TYPE I, SALL TYPE I, T1 TYPE I, T2 TYPE I, T3 TYPE I,
T4 TYPE I, T5 TYPE I, T6 TYPE I.
DATA: WITH_CPU TYPE X VALUE 10.
DATA: SRVNAME LIKE SPFID-APSERVER.
DATA: BEGIN OF SRV_TBL OCCURS 100.
INCLUDE STRUCTURE MSXXLIST.
DATA END OF SRV_TBL.
DATA: BEGIN OF WPLIST OCCURS 30.
INCLUDE STRUCTURE WPINFOS.
DATA: END OF WPLIST.
DATA: BEGIN OF LOC_WPLIST OCCURS 30.
INCLUDE STRUCTURE WPINFO.
DATA: END OF LOC_WPLIST.
DATA: BEGIN OF WPINFO OCCURS 30.
INCLUDE STRUCTURE WPINFO.
DATA: END OF WPINFO.
DATA: BEGIN OF PFNORM OCCURS 30.
INCLUDE STRUCTURE PFNORM.
DATA: END OF PFNORM.
DATA: BEGIN OF RES OCCURS 10,
HOST(8), TYPE(3), TIME TYPE I,
END OF RES.
DATA: BEGIN OF RES2 OCCURS 10,
TYPE(3), HOST(8), TIME TYPE I,
END OF RES2.
CALL FUNCTION 'TH_SERVER_LIST' DESTINATION '????'
TABLES
LIST = SRV_TBL.
REFRESH WPLIST.
LOOP AT SRV_TBL.
SRVNAME = SRV_TBL-NAME.
REFRESH LOC_WPLIST.
WITH_CPU = 1.
CALL FUNCTION 'TH_WPINFO' DESTINATION '????'
EXPORTING
SRVNAME = SRVNAME
TABLES
WPLIST = LOC_WPLIST
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC = 0.
LOOP AT LOC_WPLIST.
MOVE-CORRESPONDING LOC_WPLIST TO WPLIST.
WPLIST-APSERVER = SRVNAME.
APPEND WPLIST.
ENDLOOP.
ENDIF.
ENDLOOP.
LOOP AT WPLIST.
DEST = WPLIST-APSERVER.
CALL FUNCTION 'TH_WP_DETAIL_INFO' DESTINATION DEST
EXPORTING
WP = WPLIST-WP_NO
WITH_CPU = WITH_CPU
IMPORTING
WPINFO = WPINFO
PFNORM = PFNORM.
RES-HOST = DEST. RES-TYPE = WPLIST-WP_TYP.
SPLIT WPINFO-WP_CPU AT ':' INTO HEAD TAIL.
RES-TIME = 60 * HEAD + TAIL.
COLLECT RES.
ENDLOOP.
LOOP AT RES.
AT NEW HOST.
WRITE: ' ' COLOR 2 NO-GAP,
RES-HOST COLOR 2 NO-GAP,
' ' COLOR 2 NO-GAP.
ENDAT.
ENDLOOP.
WRITE: ' ' COLOR 2 NO-GAP,
SYM_CUMULATED AS SYMBOL COLOR 2 NO-GAP,
'appserv' COLOR 2 NO-GAP,
' ' COLOR 2 NO-GAP,
SYM_CUMULATED AS SYMBOL COLOR 2 NO-GAP,
'all ' COLOR 2 NO-GAP.
LOOP AT RES.
RES2-HOST = RES-HOST. RES2-TYPE = RES-TYPE. RES2-TIME = RES-TIME.
APPEND RES2.
ENDLOOP.
SORT RES2 BY TYPE.
*reak-point.
LOOP AT RES2.
AT NEW TYPE.
WRITE: / RES2-TYPE COLOR 2.
ENDAT.
CASE RES2-HOST.
WHEN '????'.
WRITE 6 RES2-TIME.
SALL = SALL + RES2-TIME.
T3 = T3 + RES2-TIME.
WHEN '????'.
WRITE 26 RES2-TIME.
SALL = SALL + RES2-TIME.
SAPS = SAPS + RES2-TIME.
T4 = T4 + RES2-TIME.
WHEN '????'.
WRITE 48 RES2-TIME.
SALL = SALL + RES2-TIME.
SAPS = SAPS + RES2-TIME.
T5 = T5 + RES2-TIME.
WHEN '????'.
WRITE 69 RES2-TIME.
SALL = SALL + RES2-TIME.
SAPS = SAPS + RES2-TIME.
T6 = T6 + RES2-TIME.
ENDCASE.
AT END OF TYPE.
WRITE: 89 SAPS, 109 SALL.
T1 = T1 + SALL. T2 = T2 + SAPS.
SAPS = 0. SALL = 0.
ENDAT.
ENDLOOP.
WRITE: / SYM_CUMULATED AS SYMBOL COLOR 2.
WRITE: 6 T3, 26 T4, 48 T5, 69 T6, 89 T2, 109 T1.
Posted by
A S Chakrapani
at
9:48 PM
0
comments
Labels: Free ABAP Samples
ABAP Program for List yesterday's system log entries - report
REPORT YRDSYSLG.
* Display yesterday's system log entries
* Copy RSLG0001 to the program you want to call (yslg0001).
* For the most readeable result change these lines:
*
* call function 'RSLG_LAYOUT_ST_COL_TABE' exporting with_column = ' '.
* call function 'RSLG_LAYOUT_ST_COL_MANDT' exporting with_column = ' '.
* call function 'RSLG_LAYOUT_ST_COL_DEVC' exporting with_column = ' '.
* call function 'RSLG_LAYOUT_ST_COL_POSI' exporting with_column = ' '.
* call function 'RSLG_LAYOUT_ST_COL_MAND' exporting with_column = 'X'.
* call function 'RSLG_LAYOUT_ST_COL_DATE' exporting with_column = ' '.
* call function 'RSLG_LAYOUT_ST_COL_PROG' exporting with_column = ' '.
* call function 'RSLG_LAYOUT_ST_COL_TERM' exporting with_column = 'X'.
* call function 'RSLG_SEL_ST_PARAREC' exporting with_line = ' '.
*
DATA: BEGIN OF TAB OCCURS 10.
INCLUDE STRUCTURE ABAPLIST.
DATA: END OF TAB.
SUBMIT YSLG0001 WITH TR_DAY EQ '1'
LINE-SIZE 255 EXPORTING LIST TO MEMORY AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = TAB.
CALL FUNCTION 'WRITE_LIST'
TABLES
LISTOBJECT = TAB.
Posted by
A S Chakrapani
at
9:46 PM
0
comments
Labels: Free ABAP Samples
Free ABAP Material
ABAP MODEL PROGRAMS ON EVERY TOPIC
SAMPLE PROGRAMS(1000+PRO)
To download from SAP to Excel:
o download from SAP to Excel:
* Many SAP reports have direct download function to EXCEL.
* SAP Query and SAP QuickViewer are excellent tools for Downloading (BvdR AO).
* Transaction SE16N allows you to access any sap table and download result to Excel
* SAP RFC functions can be called directly from Excel / VBA.
Use transaction BAPI in SAP to find your business object and study the function.
If you know the SAP table the RFC RFC_READ_TABLE offers a SQL query of the table
Trouble is .. you can not use joins here. you have to put the join in as a query in the SAP database and use the query in RFC_READ_TABLE
To upload data from Excel into SAP:
* Some of the Business functions (BAPI's / RFC unctions) offer data upload
* The general tool in SAP for data upload is the Batch input / call transactons
In the batch input file you specify screen by screen and field by field the input to SAP. SAP has a recorder to create the sample file. Just run trans SHDB and within this trans you run a case of the changes you want to do. On exit of the trans you will have a batch input file that you can download and from excel manipulate the file before you call the RFC function RFC_CALL_TRANSACTION.
Did I say it was easy ? No , not really , but it's a set of very powerful tools there if you take your time to study them. Our company would not manage without them.
review all my A/R customers
What t-codes can I use if I want to review all my A/R customers, by document types and posting keys with totals and then line item detail?
You can use SAP standard line item report FBL5N। This report has lot of feautures. This is in ALV format and you can display / hide fields as you require. You can also do sub totals as required.
I know of FBL5N, I need something that captures all my customers, not individual।
What is the t-code to execute the following:Alternatively, you can explore the reports S_ALR_87012197 / S_ALR_87012174 etc??
1. You can use FBL5N for a range of customers2. If you want all your A/R then you can go to FS10N and execute this for customer recon.account
The same transaction code S_ALR_87012197 can be used to execute the report.
SAP abap sd tables structure
free sap abap sd tables structure
free SAP abap mm tables structure
free sap abap mm tables
sap abap purchasing tables structures
sap abap purchasing tables structures
SAP abap fico tables structure
abap fico tables structureP
SAP abap Project Systems tables structure
Project Systems tables
SAP abap Production Planning tables structures
sap abap production planning tables structures
SAP abap pm tables
SAP abap pm tables
SAP abap system tables
abap system tables
program to create subscreen in your ABAP Program
*
* A demo program to create subscreen in your ABAP Program
*
* This report will display the user last login date and time.
*
* Subscreen selection 1 : User Name
* 2 : Last Login Date
* 3 : Class Belong To
*
* Written by : SAP Basis, ABAP Programming and Other IMG Stuff
REPORT ZSUBSCREEN.
TABLES: USR02, "Logon data
SSCRFIELDS. "FIELDS ON SELECTION SCREENS
*---------------------------------------------------------------
* SUBSCREEN 1
*---------------------------------------------------------------
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-010.
SELECT-OPTIONS: USERNAME FOR USR02-BNAME.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN END OF SCREEN 100.
*---------------------------------------------------------------
* SUBSCREEN 2
*---------------------------------------------------------------
SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-020.
SELECT-OPTIONS: LASTLOGI FOR USR02-TRDAT.
SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN END OF SCREEN 200.
*---------------------------------------------------------------
* SUBSCREEN 3
*---------------------------------------------------------------
SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-030.
SELECT-OPTIONS: CLASSTYP FOR USR02-CLASS.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN END OF SCREEN 300.
* STANDARD SELECTION SCREEN FOR SCROLLING LEFT AND RIGHT
SELECTION-SCREEN: FUNCTION KEY 1,
FUNCTION KEY 2.
SELECTION-SCREEN: BEGIN OF TABBED BLOCK SUB FOR 15 LINES,
END OF BLOCK SUB.
START-OF-SELECTION.
SELECT * FROM USR02 WHERE BNAME IN USERNAME
AND ERDAT IN LASTLOGI
AND CLASS IN CLASSTYP.
WRITE: / 'User ', USR02-BNAME,
'Last Login Date ', USR02-TRDAT,
'Last Login Time ', USR02-LTIME,
'CLASS ', USR02-CLASS.
ENDSELECT.
END-OF-SELECTION.
INITIALIZATION.
* SCREEN ICON LEFT AND RIGHT
SSCRFIELDS-FUNCTXT_01 = '@0D@'.
SSCRFIELDS-FUNCTXT_02 = '@0E@'.
SUB-PROG = SY-REPID.
SUB-DYNNR = 100.
AT SELECTION-SCREEN.
CASE SY-DYNNR.
WHEN 100.
IF SSCRFIELDS-UCOMM = 'FC01'.
SUB-DYNNR = 300.
ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
SUB-DYNNR = 200.
ENDIF.
WHEN 200.
IF SSCRFIELDS-UCOMM = 'FC01'.
SUB-DYNNR = 100.
ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
SUB-DYNNR = 300.
ENDIF.
WHEN 300.
IF SSCRFIELDS-UCOMM = 'FC01'.
SUB-DYNNR = 200.
ELSEIF SSCRFIELDS-UCOMM = 'FC02'.
SUB-DYNNR = 100.
ENDIF.
ENDCASE.
Posted by
A S Chakrapani
at
9:38 PM
0
comments
Labels: Free ABAP Material
ABAP Keywords and their usage
What is a collect statement and how it is different from append ?
ANS:-
If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.
Dependency Syntax: General Rules in SAP
Operators
Operators
Use in Dependencies
AND
Two statements that are both either true or not true are linked with AND.
Length = 300 and Width = 200
OR
Two statements of which at least one is either true or not true are linked with OR.
Color = ‘red’ or Basic_material = ‘wood’
NOT
You can negate one or more expressions by using NOT.
NOT (Color = ‘blue’)
NOT (Color = ‘red’ and Basic_material = ‘wood’)
IF
Conditions in actions and procedures start with IF.
Color = 'red' if Model = ‘A’
Special Features
Lists
In lists, the individual elements are always separated by commas.
COLOR = 'RED' IF MODEL = 'A',
COLOR = 'BLUE' IF MODEL = 'B',
COLOR = 'GREEN' IF MODEL = 'C',
Case sensitivity
In characteristic names, object variables, and operators, there is no distinction between upper case and lower case letters.
Concatenation
LC
All letters are converted to lower case.
Leather_saddle = LC('Alpha')
= 'a'
UC
All letters are converted to upper case.
Leather_saddle = U C('Alpha')
= 'A'
This function is important if the assigned characteristic does not allow lower case, but the assigned expression may contain lower-case letters.
||
The string is cut off at the maximum number of 30 characters.
Leather_saddle = Alpha || Beta
= 'AB'
List of Built-In Conditions
Expression
Implied Condition
SPECIFIED
Characteristic has a value:
SPECIFIED COLOR
See Built-In Condition SPECIFIED
IN
One of these values must be set:
COLOR IN (‘red’, ‘green’, ‘blue’)
See Built-In Condition IN
TYPE_OF
Only for certain objects:
TYPE_OF ($ROOT, (Material) (300) (NR = 'U91’))
See Built-In Condition TYPE_OF
PART_OF
The object is a component of a BOM
(only in constraints).
See Constraints: Entering Conditions
SUBPART_OF
The object is a component of an assembly that is part of the BOM of a configurable material
(only in constraints).
WRITE TO sap abap keyword syntax and description
Assigns strings.
Syntax
WRITE TO [].
Converts the contents of the data object to type C and assigns the resulting string to the
variable . You can use the same formatting options available in the WRITE statement.
WRITE sap abap keyword syntax and description
Creates list output.
Syntax
WRITE [AT [/][][()]] [AS CHECKBOX|SYMBOL|ICON|LINE]
[QUICKINFO ].
[]
The contents of the field are formatted according to their data type and displayed on the list.
The additions before the field allow you to specify a line break, the starting position, and the
length of the field. The additions after the field allow you to display checkboxes, symbols, icons,
and lines. The addition can contain various other formatting options. The QUICKINFO
addition allows you to assign a quickinfo to the field.
WINDOW sap abap keyword syntax and description
Displays a list as a modal dialog box.
Syntax
WINDOW STARTING AT [ENDING AT ].
Can only be used in list processing. The current detail list is displayed as a modal dialog box.
The top left-hand corner of the window is positioned at column and line . The bottom
right-hand corner is positioned at column and line (if specified).
WHILE sap abap keyword syntax and description
Introduces a loop.
Syntax
WHILE [VARY FROM NEXT ].
Introduces a statement block that is concluded with ENDWHILE. The statement block between
WHILE and ENDWHILE is repeated for as long as the expression is true, or until a
termination statement such as CHECK or EXIT occurs. The VARY addition allows you to process
fields that are a uniform distance apart within memory.
WHEN sap abap keyword syntax and description
Introduces a statement block in a CASE control structure
Syntax
WHEN [OR OR...] | OTHERS.
The statement block after a WHEN statement is executed if the contents of the field in the
CASE statement are the same as those of one of the fields
. Processing then resumes after the ENDCASE statement. The WHEN OTHERS statement
block is executed if the contents of do not correspond to any of the fields .
UPDATE sap abap keyword syntax and description
Modifies lines in database tables.
Syntax
UPDATE SET =
| = +
| = - [WHERE ].
Sets the value in to , increases it by , or decreases it by for all selected lines. The
WHERE addition determines the lines that are updated. If you omit the WHERE addition, all lines
are updated.
Syntax
UPDATE FROM .
UPDATE FROM TABLE .
Overwrites the line with the same primary key as with the contents of , or all lines with
the same primary key as a line in the internal table with the corresponding line of itab. The
work area or the lines of the table must have at least the same length and the same
alignment as the line structure of the database table.
UNPACK sap abap keyword syntax and description
Converts variables from type P to type C.
Syntax
UNPACK TO .
Unpacks the packed field and places it in the string with leading zeros. The opposite of
PACK.
ULINE sap abap keyword syntax and description
Places a horizontal line on the output list.
Syntax
ULINE [AT [/][][()]].
Without additions, generates a new line on the current list and fills it with a horizontal line. The
additions allow you to insert a line break and specify the starting position and length of the line.
TYPES for Aggregate Types sap abap keyword syntax and description
Defines aggregated types.
Syntax
TYPES: BEGIN OF ,
...
...,
...
END OF .
Combines the data types to form the structure . You can address the individual
components of a structure in a program using a hyphen between the structure name and the
component name as follows: -.
Syntax
TYPES TYPE|LIKE OF [WITH ].
Defines the local data type in the program as an internal table with the access type
, the line type , and the key
TYPES for Simple Field Types sap abap keyword syntax and description
Defines a simple field type.
Syntax
TYPES [()] [TYPE |LIKE ] [DECIMALS ].
Defines the internal data type in the program with length , reference to the ABAP
Dictionary type or a data object , and, where appropriate, with decimal
places.
Syntax
TYPES TYPE REF TO |.
Defines the internal data type in the program with reference to the class or the
interface .
TYPE-POOLS sap abap keyword syntax and description
Declares the types and constants of a type group to a program.
Syntax
TYPE-POOLS .
After this statement, you can use all of the data types and constants defined in the type group
in your program.
TYPE-POOL sap abap keyword syntax and description
Introduces a type group.
Syntax
TYPE-POOL .
The first statement in a type group. You do not have to enter this statement in the ABAP Editor -
instead, it is automatically inserted in the type group by the ABAP Dictionary. A type group is an
ABAP program containing type definitions and constant declarations that can then be used in
several different programs.
TRANSLATE sap abap keyword syntax and description
Converts characters in strings.
Syntax
TRANSLATE TO UPPER|LOWER CASE
|USING .
The characters of the string are converted into upper- or lowercase, or according to a
substitution rule specified in .
TRANSFER
Writes data to a file.
Syntax
TRANSFER TO [LENGTH ].
Writes the field to the file on the application server. The LENGTH addition specifies
the length of the data you want to transfer
TOP-OF-PAGE sap abap keyword syntax and description
Event keyword for defining an event block for a list event.
Syntax
TOP-OF-PAGE [DURING LINE-SELECTION].
Whenever a new page begins while a standard list is being created, the runtime environment
triggers the TOP-OF-PAGE event and the corresponding event block is executed. The addition
DURING LINE-SELECTION has the same function, but for detail lists.
TABLES
Declares an interface work area.
Syntax
TABLES .
Declares a structure with the same data type and name as a database table, a view, or a
structure from the ABAP Dictionary. Structures declared using TABLES in main programs and
subroutines use a common data area.
SUPPRESS DIALOG sap abap keyword syntax and description
Prevents the current screen from being displayed.
Syntax
SUPPRESS DIALOG.
Can only occur in a PBO dialog module. The screen is not displayed, but its flow logic is still
processed.
SUPPLY sap abap keyword syntax and description
Fills context instances with values.
Syntax
SUPPLY = ... = TO CONTEXT .
Fills the key fields of the context instance with the values .
SUPPRESS
Posted by
A S Chakrapani
at
9:37 PM
0
comments
Labels: Free ABAP Coaching
Free Download Working with Parameter Effectivity
Posted by
A S Chakrapani
at
9:29 PM
0
comments
Labels: Free ABAP Books
free download sap 4.6 abap basic study book
Posted by
A S Chakrapani
at
9:28 PM
0
comments
Labels: Free ABAP Books
sap ABAP SAPweb Approve/Change Requisition
Posted by
A S Chakrapani
at
9:26 PM
0
comments
Labels: Free ABAP Books
free download book on object oriented sap abap
Posted by
A S Chakrapani
at
9:26 PM
0
comments
Labels: Free ABAP Books
free download book on abap programming Tutorial
Posted by
A S Chakrapani
at
9:25 PM
0
comments
Labels: Free ABAP Books
free download abap programmin pdf book
Posted by
A S Chakrapani
at
9:25 PM
0
comments
Labels: Free ABAP Books
Free ALE Introduction and Administration
Posted by
A S Chakrapani
at
9:23 PM
0
comments
Labels: Free ABAP Books
Free ALE QuickStart for Distributed HR
Posted by
A S Chakrapani
at
9:20 PM
0
comments
Labels: Free ABAP Books
Actual Costing/Material Ledger (CO-PC-ACT)
Posted by
A S Chakrapani
at
9:11 PM
0
comments
Labels: FI/CO
Material Ledger/Actual Costing: Revaluating COGS
For the techy bits .. I’m on 4.7 (with IS-Oil) and I’m trying to see how to make use of ML for stock valuation…
I pretty much got everything so far – single-level price determination (calculating the actual price within a depot where product is bought into) – multi-level price determination (calculating the actual at e.g. service stations getting supplied from the depots)
...when posting the closing entries remaining inventory is now valuated at the “right” price (meaning the newly calculated actuals) at month-end, price differences from the depots are carried over to the service stations to calculate the value of the closing inventories there
Only thing that I can’t seem to get right is the revaluation of the GI for Sales (Cost of Goods Sold: COGS) out of the service stations (e.g. via MvmtType 601)
According to the SAP documentation that should be possible:
Quote:
Release Notes 4.7: As of Release 4.70 you can revaluate comsumption for the actual period using actual prices. In particular, this enables you to valuate the cost of goods sold using actual prices. In earlier Releases it was only possible to use the results from actual costing to valuate materials already delivered to the warehouse.
Somehow though, the price differences that should be charged to COGS still remains as an Not Allocated Consumption under the respective material…
Anybody ever tried that? ...and made it work??? What setting am I missing?
—————————————————————————————-
Yes, it works on 4.7 (without IS-Oil, but i think this is not essential).
Customising for this functionality is under IMG menu items: Actual Costing/Material Ledger -> Material Update -> Define Movement Type Groups of Material Ledger, Assign Movement Type Groups of Material Ledger, Define Material Update Structure.
Don’t forget also to set “Revaluate consumption” check box in ML closing costing run “Post closing” step’s parameters screen.
—————————————————————————————-
That could be it ! I do not have this option (P_RECONS or PXCOBL) on the Post Closing screen when maintaining the variant! There is only the option for Revaluate materials…. any idea what controls this option field on the selection screen? To me the ABAP look like this parameter should be invisible depending on the result of the call of Code:
CALL METHOD
l_badi_instance->check_active IMPORTING e_active = l_activein FORM RUN_AT_SELECTION_SCREEN_OUTPUT?!
Another question: do you have other step in the Actual Costing Run then the following
Selection
Determine Sequence
Single-Level Pr. Determination
Multilevel Pr. Determination
Post Closing
Mark Material Prices
Shouldn’t there be an entry for Revaluate consumptions?
—————————————————————————————-
Is the SAP R/3 Enterprise Extension Set “EA-FIN Financials Extension” activated in your system?
You can find “Activation Switch for SAP R/3 Enterprise Extension Set” item at the top of IMG menu tree. As I remember, we also had lost several functionality items related to revaluation, before we had activated EA-FIN. There was a SAP consultation, to activate EA-FIN to have revaluation of consumption option:
“The Revaluation of Consumption in release 4.7 (Enterprise) belongs to the Extension “EA-FIN” (Financials Extension). In order to use any new functionality belonging to an Extension, you have to activate the corresponding Extension.
Please start the customizing (transaction SPRO) and execute the function “SAP Reference IMG” (or your corresponding customizing). At the very top you find the function “Activation Switch for SAP R/3 Enterprise Extension Set”. Please execute it. Set the flag “Active” at the Appl.
“EA-FIN” and save your work.
Now you have activated all functionality of the Financials Extension, including the Revaluation of Consumption.
Some system table entries were not shipped in Enterprise release, for unknown reasons.
Please apply the note 631395 to create the missing entries.”
Posted by
A S Chakrapani
at
9:05 PM
0
comments
Labels: FI/CO
Tuesday, January 1, 2008
Interview Question on BDC
Interview Question on BDC
What is BDC- its use, and how to use it?
It is Batch Data conversion used for transferring some data other than sap into sap ... this is also a work of an ABAPer.
What is "UTS" Or may be it is "UST", something called Unit test?
Use: After developing any object we should write a test case proving that the object is working properly or not. This is done by the ABAPer. This is UNIT TEST CASE.
In BDC how can we handle Table Controls?
When you do your recording you will have a tab for Next line or Insert. You have to capture that in your recording. If your transaction code doesn't have that in the recording then you have to set up a page down (=P+) and loop it based on the line entries u c on teh screen.
Suppose we are transfer data through BDC from leagacy to SAP and their is some duplicate data in legacy system but we don't want this in SAP system .So how can we check that this data is already exist?
In BDC you would have all your legacy data in an internal table. Use Delete Adjacent dulpicates syntax to delete duplicate entries.
Can we use two transaction code in one BDC like XK01 & XD01 if yes how?
Yes, we can do that by combining the two bdc program codes together. Then you perform the program routine accordingly. However, it will make your BDC program very long and complex.
How can we handle errors in Function Module?
Exceptions is used to handle errors.
Can we use Session method & Call transaction both in one BDC if yes please give me example and scenerio where we use this?
You start your dataload using Call Transaction and if any errors occur push all those errors in a session so that your dataload takes place uninterrupted and you can processs ur errors later.
Posted by
A S Chakrapani
at
6:40 PM
0
comments
Labels: Free ABAP Coaching
Question About BDC Program
Question About BDC Program
What is bdc_okcode?
It is the user command that was executed. eg. '/00' means Enter command.
The user command can varies during a bdc program. Therefore, we need to used tcode shdb to check what it actually contains.
What is the function key values of BDC_OKCODE ie '/00' what this is for?
How will we handle the errors in call transaction method?
'/00' is generally the BDC_OKCODE for the ENTER key.
You don't need to know the list of the BDC_OKCODE s.
You go to the transaction SHDB.
You can execute any transaction here.
Then you can replay the execution of the trasaction afterwards.
Select 'display all screens' mode.
BDC_OKCODEs for each one functions you use is displayed on the screen.
Now, regarding the error handling in call transaction.
The BDCMSGCOLL does not have the messages text. It has only the message type, number and message parameters.
You have to read the message text. (recall that the database table T100 stores all the messages.)
There are more than one method of doing this.
Following is the psuedocode for one of the methods.
LOOP for the internal table IT1 which has data value from flat file.
call transcation using....
if SY-SUBRC <> 0.
Read the dictionary table T100 FOR ALL ENTRIES in BDCMSGCOLL.
(also use the condition T100-SPRAS = SY-LANGU (the log on language. This is because you need only the message texts in English if the user is logged in English language)
IF message type is E , then, transfer the contents of this particular error record to file x. (TRANSFER......)
( Ignore all other messages. Only consider type 'E' messages. Ignore other types of messages.)
(You can also store the message text from T100 and the error record in another internal table IT2)
.....
....
ENDLOOP.
Please note that the client might ask you for a file of records which could not be uploaded.
Give him the file created in the above psuedocode. (most often you will have to do this).
Otherwise just display the error messages and the error records in the internal table IT2 in the form of a list.
Thats it.
Alternatively,
Instead of
" Read the dictionary table T100 FOR ALL ENTRIES in BDCMSGCOLL."
you can use the function module
WRITE_MESSAGES to read the messages.
Please refer to the function module for the list of parameters.
Also refer FORMAT_MESSAGES function module.
As, I said, there are more than one method of doing this.
ABAP Tips by: Satheesh, Jinna
1) How to handle error in bdc call transaction method...without using structure BDCMSGCOLL.
Use Std Function module 'FORMAT_MESSAGE'
2) How to load images from application server in bdc
Solution: I don't think so.
3) How to insert data in table control through bdc ....problem is every system displays different no of rows in the table control when you enter the application....for ex .. purchase order, pur req, bom....
Solution: Use CALL TRANSACTION 'ME21N' OPTIONS FROM w_ctu_params.( type CTU_PARAMS)
This structure contains the follwing.
DISMODE : Display mode (like the MODE addition)
UPDMODE: Update mode (like the UPDATE addition)
CATTMODE: CATT mode (controls a CATT)
CATT mode can have the following values:
' ' No CATT active
'N' CATT without single-screen control
'A' CATT with single-screen control
DEFSIZE : Use default window size (Here we are handling those transaction by giving default window size)
RACOMMIT: Do not end transaction at COMMIT WORK
NOBINPT : No batch input mode (that is, SY-BINPT = SPACE)
NOBIEND : No batch input mode after the end of BDC data.
The components DEFSIZE , RACOMMIT, NOBINPT, and NOBIEND always take the following values:
'X' Yes
4) Can you give me one example where we should use only bdc call transaction method:
Solution: With CALL TRANSACTION USING, the system processes the data more quickly than with batch input sessions. Unlike batch input sessions, CALL TRANSACTION USING does not automatically support interactive correction or logging functions
5) In the reports when you press f4 to get list is it possible to pass default value in that value...i.e suppose i have created select option on company code when the user press f4 automatically he should get the default value.
Solution: Ya, It is possible.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_BUKRS.
P_BUKRS-LOW = ‘2000’.
With Compliment by: Venkat .O.
I want to learn BDC ....how should I go about it so that I make it my strong area......please help.
BDC is Batch Data Communication where data is transferred from legacy system to SAP system. Different methods of BDC are
1. Call Transaction Method.
2. Session Method
3. Direct Input method.
In all the above methods you have to prepare a flat file containing the data in the required format to be uploaded to the SAP system. You need to call the function ' UPLOAD' to do this. Then the contents of the flat file have to copied to your internal table and then u need to call the transaction through which you want to update the database. You internal table should also have the information relating to the structure BDCDATA which is having the details like the module pool program name, screen no. The basic concept of updating the database is same in all the 3 methods but only the method differs.
In session method after the data transfer program is coded, in order to process that particular session you have to go to TC: SM 35 to process the session.
Direct input method have some standard programs that have to executed.....
Well, to be strong you got to try it out.......and check if it works!!!
Smitha
Q: Our ABAP program is working properly in Foreground. Can I schedule it for background processing on the weekend?
A: SAP standard program RSBDCSUB helps you to schedule the job. Create a variant for RSBDCSUB with the BDC session name.
Q: How can we send a mail to the user intimating him that his report/BDC is completed in background?
A: You can use FUNCTION RS_SEND_MAIL_FOR_SPOOLLIST
If UNIX is being used, you may send a report to any internet mail with the following:
REPORT ZSNDMAIL.
DATA: COMND (200) type c.
DATA: RESULT (200) type c occurs 100 with header line.
PARAMETERS: FILE (60) type c lower case default '/sapdata/sd_outbound/testmail.dat'.
PARAMETERS: SUBJECT (60) type c lower case.
PARAMETERS: EMAIL (60) type c lower case.
INITIALIZATION.
TRANSLATE EMAIL TO LOWER CASE.
START-OF-SELECTION.
TRANSLATE EMAIL TO LOWER CASE.
CONCATENATE 'cat' FILE '| elm -s "' subject '"' email into comnd seperated by space.
CALL 'SYSTEM' ID 'COMMAND' FIELD comnd 'TAB' FIELD UNIX_RESULTS-*SYS*.
Loop at Results.
write: /1 results.
endloop
end-of-selection.
Posted by
A S Chakrapani
at
6:39 PM
0
comments
Labels: Free ABAP Coaching
BDC Programming
Learning BDC Programming
I want to learn how to upload data using BDC. If I have a excel data file how will upload it using BDC. I don't know the full process of doing it, if someone help me in this. I want it using BDC session process and processing that session. I was trying to upload material master other day. But could not follow the process of uploading using BDC though I know LSMW. Please explain me the BDC process in details with examples.
For a BDC upload you need to write a program which created BDC sessions.
Steps:
1. Work out the transaction you would use to create the data manually.
2. Use transaction SHDB to record the creation of one material master data.
Click the New recording button or the Menu - Recording - Create
3. Save the recording, and then go back a screen and go to the overview.
4. Select the recording and click on Edit - Create Program. Give the program a Z name, and select transfer from recording.
5. Edit the program. You will see that all the data you entered is hard-coded into the program. You need to make the following changes:
5.1 After the start-of-selection, Call ws_upload to upload the file (the excel file needs to be saved as TAB separated).
5.2 After the open-group, Loop on the uploaded data. For each line, perform validation checks on the data, then modify the perform bdc_field commands to use the file data.
5.3. After perform bdc_transaction, add the endloop.
Execute the program. It will have options to create a batch session or to process directly.
These are all my finds . Might be it will be useful to you.
Direct call of transactions, session handling:
/nxxxx This terminates the current transaction, and starts transaction xxxx
/n This terminates the transaction. This generally corresponds to pressing F15 to go back.
/nend This termiantes all separate sessions and logs off (corresponds to System - Logoff).
/nex This terminates all separate sessions and logs off immediately (without any warning!).
/oxxxx This opens a new session and starts transaction xxxx in This session.
/o This lists existing sessions and allows deletion or opening of a new session.
/i This terminates the current session (corresponds to System End
/i1, /i2,... This terminates the session with the number given.
.xyzw Fast path: 'xyzw' refers to the underlined letters in the menus. This type of navigation is uncommon and is provided more for emergencies (such as a defective mouse).
Batch
The following commands can be entered in correction mode ('Process in foreground' or 'Display errors only') when processing a batch input session:
/n This terminates the current batch input transaction and characterizes it as
/bdel This deletes the current batch input transaction.
/bend This terminates batch input processing and sets the session to Failed
/bda This switches from Display errors only to Process in foreground
/bde This switches from Process in foreground to Display errors only
ABAP/4
/h This switches into debugging mode.
/hs This switches into debugging mode and activates the debugging of system functions.
Buffer
WARNING: Resetting buffers can significantly change the performance of the entire system for a long time.
It should therefore only be used where there is a good reason tdso. As of release 3.0B system administator authorization is required (authorization object (S_ADMI_FCD). The action is noted in the system log.
/$SYNC This resets all buffers of the application server
/$CUA This resets the CUA buffer of the application server
/$TAB This resets the TABLE buffers of the application server
/$NAM This resets the nametab buffer of the application server
/$DYNP This resets the screen buffer of the application server
ABAP Tips by: Vijay K.
What is recording?
As the word record implies, it mean recording the keystroke of the user input of a SAP transaction screen.
Why it is used?
It is normally used for mass update or uploading of data to the system.
What is its need?
It help to save time for the users who need to mass change the system data. For e.g. tax rate change announce by the country government.
How it is related with bdc?
It is related to bdc because bdc programming allows recording of user inputs.
Posted by
A S Chakrapani
at
6:38 PM
0
comments
Labels: Free ABAP Coaching
What is BDC?
BDC or Batch Input Program Tips and Tricks
What is BDC?
Batch Data Communication or BDC is a batch interfacing technique that SAP developed. It is mainly used for uploading data into the SAP R/3 system. BDC works by simulating the user input from transactional screen via an ABAP program.
The data input data file will come in the form of a flat file which the user save as file type txt file or prn file from the Microsoft Excel program. An Abaper will create a program to read the text file and upload into the SAP system.
Normally, the tcode SHDB will be used to record the transaction code the user used. After, the simulation, the Abaper can generate a sample program and modify from there. It makes the programming easier and faster.
Posted by
A S Chakrapani
at
6:34 PM
0
comments
Labels: Free ABAP Coaching
List of SAP QM Transaction Codes 1
Q000 Quality managementWhat tcode to activate quality management, how to do this for all the material in the BOM. and what are the settings to be mainteined in the material master record?
QA00 Quality inspection
QA01 Create Inspection Lot
QA01A Create Inspection Lot
QA02 Change Inspection Lot
QA02A Change Inspection Lot
QA03 Display inspection lot
QA05 Job planning: Periodic inspection
QA06 Job overview: Periodic inspection
QA07 Trigger for recurring inspection
QA07L Deadline Monitoring Log
QA08 Collective Processing of Insp. Setup
QA09 No. range maintenance for insp.lots
QA10 Trigger automatic usage decision
QA10L Log for Automatic Usage Decision
QA11 Record usage decision
QA12 Change usage decision with history
QA13 Display usage decision
QA14 Change UD without history
QA16 Collective UD for accepted lots
QA17 Job planning for auto usage decision
QA18 Job overview for auto usage decision
QA19 Automatic usage decision
QA22 Change inspection point quantities
QA23 Display insp.point quantities
QA32 Change data for inspection lot
QA32WP QA32 -Call from Workplace/MiniApp
QA33 Display data for inspection lot
QA40 Auto. Usage Decision for Production
QA40L Log for Automatic Usage Decision
QA41 Scheduling UD for Production Lots
QA42 Job planning: UD prod. insp.lots
QA51 Scheduling Source Inspections
QA52 Source inspections: Job overview
QAC1 Change insp. lot actual quantity
QAC2 Transfer stock to insp. lot
QAC3 Reset sample
QAER Display archive objects
QAS1 Download Insp. Specs. (Obsolete)
QAS2 Download Basic Data (Obsolete)
QAS3 Upload Results (Obsolete)
QAS4 Upload UD (Obsolete)
QC01 Create certificate profile
QC02 Change certificate profile
QC03 Display certificate profile
QC06 Immediate delete of cert. profiles
QC11 Create cert. profile assignment
QC12 Change cert. profile assignment
QC13 Display cert. profile assignment
QC14 Create cert.prof.assign.w/copy model
QC15 Create cert. profile assignment
QC16 Change cert. profile assignment
QC17 Display cert. profile assignment
QC18 Create cert.prof.assign.w/copy model
QC20 Certificates for Deliveries
QC21 Quality certificate for the insp.lot
QC22 Quality Certificate for Batch
QC31 Archive display: Delivery item
QC32 Archive display: Inspection lot
QC40 Internet Certificate for Delivery
QC40A Internet Certificate for Delivery
QC42 Batch certificate on WWW
QC51 Create certificate in procurement
QC52 Change certificate in procurement
QC53 Display certificate in procurement
QC55 Worklist: Certificates - Procurement
QCC0 QM: Direct Access to IMG
QCC1 Direct Access to IMG: Notification
QCC2 IMG Direct Access: QM Q-Notification
QCC3 IMG Direct Access: QM Q-Inspection
QCC4 IMG Direct Access: QM Q-Planning
QCC5 IMG Direct Selection: QM Bus. Add-In
QCC_STABI Copy Stability Study Customizing
QCC_STABI_NK Copy Stability Study Number Ranges
QCCC QM standard settings complete
QCCF QM standard forms
QCCK QM standard settings: Catalogs
QCCM QM std. settings: Qual. notifs.
QCCN QM standard number ranges
QCCP QM std. settings: Quality planning
QCCS QM sampling schemes
QCCT QM standard texts
QCCU QM standard settings: Environment
QCCW QM std. settings: Quality inspection
QCCY Transport QM tolerance key
QCCZ QM std. settings: Qual. certificates
QCE2 Edit Communication Support
QCE3 Display Communication Support
QCYF QM standard forms (general)
QCYT QM standard texts (general)
by : Jeyaraj
1. Create quality view by MM01 for that material.In that activate procurement key. Goto inspection type tab page activate inspection type 01 for goods receipt inspection.
2. Create quality info record by QI01
3. Create quality plan by QP01. It is same as routing. Usage 5, Status 4,control key PPQM. Assign inspection character to that opn.
Posted by
A S Chakrapani
at
6:31 PM
0
comments
Labels: SAP Tips
Commonly Used Tcodes in PP Module Part 1
MATERIAL
CREATE-GENERAL MM01 IMMEDIETELY
MM11 SCHEDULE
CHANGE MM02 IMMEDIETELY
MM12 SCHEDULE
MM13 ACTIVATE
FLAG FOR DELETION MM06 IMMEDIETELY
MM16 SCHEDULE
DISPLAY MM03 DISPLAY CURRENT
MM19 DISPLAY AT KEY DATE
DISPLAY CHANGES MM04 ACTIVE CHANGES
MM14 SCHEDULE CHANGES
MM17 MASS MAINTENANCE
MMAM CHANGE MATERIAL TYPE
OTHER MMBE STOCK OVERVIEW
MMPV CLOSE PERIOD
MMRV ALLOW POSTING TO
PREVIOUS PERIOD
MM50 INSTANT MATERIAL VIEW
MMSC ENTER STORAGE LOCATIONS
MM60 MATERIAL LIST
ARCHIVING(MATERIAL) MM71 ARCHIVE/DELETE
MM72 DISPLAY ARCHIVE
BILL OF MATERIAL (MATERIAL BOM)
CS01 CREATE
CS02 CHANGE
CS03 DISPLAY
EXTRAS CS28 ARCHIVING
CS20 MASS CHANGES
EVALUATION/BOM CS11 BOM MULTILEVEL
EXPLOSION/MATERIAL CS12 STRUCTURE MULTILEVEL
BOM CS13 SUMMURISED BOM
WORK CENTRES
CR01 CREATE
CR02 CHANGE
CR03 DISPLAY
CA85 REPLACE
CAPACITY CR11 CREATE
CR12 CHANGE
CR13 DISPLAY
HIERARCHY CR21 CREATE
CR22 CHANGE
CR23 DISPLAY
LINE HIERARCHY LDB1 CREATE
LDB2 CHANGE
LDB3 DISPLAY
REPORTING CR60 W/C INFORMATION SYSTEM
CR05 W/C LIST
CR06 COST CENTRE ASSIGNMENT
CR07 W/C CAPACITIES
CR08 W/C HIERARCHY
WHERE USED CA80 WORK CENTRE
CR15 CAPACITY
CR10 CHANGE DOCUMENTS
EXTRAS CR09 STD. TEXTS TASK LIST
CR41 ARCHIVING
ROUTING
STAD. ROUTING CA01 CREATE
CA02 CHANGE
CA03 DISPLAY
REF. OPERATION SETS CA11 CREATE
CA12 CHANGE
CA13 DISPLAY
RATE ROUTING CA21 CREATE
CA22 CHANGE
CA23 DISPLAY
REF. RATE ROUTING CA31 CREATE
CA32 CHANGE
CA33 DISPLAY
EXTRAS CA85 REPLACE W/C
MASS CHANGES CA95 REPLACE REF. OP. SET
CA75 REPLACE PRT
DELETE TASK LIST CA99 WITH ARCHIVING
CA98 W/O ARCHIVING
REPORTING CA80 WORK CENTRE
WHERE USED LIST CA90 REF. OP. SETS
CA70 PRODUCTION RESORCE TOOLS
COST CENTREWhat is the T-Code for trigger point?
OKKP MAINTAIN CONTROLLING AREA
KS01 CREATE COST CENTRE
KZS2 CREATE COSTING SHEET
KA01 CREATE PRI. COST ELEMENT
KA06 CREATE SEC. COST ELEMENT
KL01 CREATE ACTIVITY TYPE
KP26 ACTIVITY TYPE/PRICE PLANNING
CO30 MENUCO30 Standard trigger points
CO31 SAPMCNSM Create standard trigger point
CO32 SAPMCNSM Change standard trigger point
CO33 SAPMCNSM Display standard trigger point
What the tcodes to archieve/delete a material BOM? - by Jia
Look at this option to delete a material BOM
There are two ways of deleting BOMs:
- Using the Delete function.
- Using the Deletion indicator.
If you select the deletion indicator, the BOM is archived in the next reorganization run, and can be deleted if required. In the BOM header, you set the indicator that controls physical deletion after the archiving run. You can still process the BOM within its validity period.This also applies if the deletion indicator is entered with reference to a change number with a valid-from date that is after the date of the next reorganization run
You can use the below mentioned tcodes:
CS25/CS28 Archiving for BOMs
CS26 BOM deletion
CS27 Retrieval of BOMs
Posted by
A S Chakrapani
at
6:30 PM
0
comments
Labels: SAP Tips
USA Country Specific Infotypes
Tell me some USA country specific infotypes.
These are most of the ITS used for US besides normal PA ITs which are valid for all the countries.
*Additional PA ITs For US*
*Additional Personal Data (IT 007* )– here data like ethnic tec will be entered
*Assignment of EEO and AAP Categories to Jobs (IT 1610)* in this IT
legally required data for jobs within U.S. organizations is maintained . You can define both Equal Employment Opportunity (EEO) and Affirmative Action Planning (AAP) categories.
*Assignment of Workers' Comp Codes to Org Units ( IT1612*) this IT is used to assign Workers' Compensation Classification Codes to organizational units for U.S. companies. Assignment of Workers' Comp Codes to Positions (PD Infotype 1613) this PD IT is used for assigning workers' compensation classification codes to individual positions within U.S. companies. State-specific attributes, such as the area codes required in Alaska,
*Residence Status (IT 0094) *
*IT 0094* allows to store information regarding an employee's residence status, as well as information regarding the compliance with the Immigration Reform and Control Act (IRCA), which requires every employer verify that each person hired can prove via documents their identity, and their eligibility for employment.
Workers' Compensation (IT 0076)
*IT 0076: * is used in conjunction with the Additional Absence Data infotype (0082) to store information that is needed when filling out a Workers' Compensation form.
US Pay roll ITs:
Garnishment Order (IT 0195)
Creating a Garnishment Order (IT 0195)
Changing a Garnishment Order (IT 0195)
Garnishment Document (IT 0194)
Creating a Garnishment Document (IT 0194)
Garnishment Adjustment (IT 0216)
IRS Limits (IT 0161)
Creating IRS Mandates for an Employee (IT 0161)
Residence Tax Area (IT 0207)
Creating Residence Tax Area Data (IT 0207)
W-4 Withholding Information (IT 0210)
Creating Withholding Overrides (IT 0234)
Work Tax Area (IT 0208)
Withholding Overrides (IT 0234)
Creating an Employee's Work Tax Area (IT 0208)
Other Taxes (IT 0235)
Creating Other Taxes (IT 0235)
Unemployment State (IT 0209)
U.S. Tax Payroll ITS (0446 - 0457)
Tip Indicators (IT 0506)
Defining Tip Indicators (IT 0506)
U.S. Benefits Payroll IT(0496 - 0501) *-- Madhuuri
Posted by
A S Chakrapani
at
6:27 PM
0
comments
Labels: SAP Tips
BAPI and JAVA Program to Interface Two System
I am working with a client, who wish to use both SAP and P3e. The data from SAP will be send back to P3e. With respect to this I am working on field mapping betweem the 2 systems.
Develope Z Bapi using the standard BAPI and use jave program to interface these two system. We are also working on the same and for your help, please find attached the ZBAPI developed. *-- Waris
FUNCTION zbapi_project_maintain.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(WBS_ELEMENT) LIKE BAPI_WBS_ELEMENT-WBS_ELEMENT
*" VALUE(WBS_ELEMENT_DESCRIPTION) LIKE
*" BAPI_PROJECT_DEFINITION-DESCRIPTION
*" VALUE(WBS_ELEMENT1) LIKE BAPI_WBS_ELEMENT-WBS_ELEMENT
*" VALUE(PROJECT_DEFINITION) LIKE
*" BAPI_WBS_ELEMENT-PROJECT_DEFINITION
*" VALUE(DESCRIPTION) LIKE BAPI_PROJECT_DEFINITION-DESCRIPTION
*" VALUE(NETWORK) LIKE BAPI_NETWORK-NETWORK
*" VALUE(NETWORK1) LIKE BAPI_NETWORK-NETWORK
*" VALUE(NETWORK_TYPE) LIKE BAPI_NETWORK-NETWORK_TYPE
*" VALUE(PROFILE) LIKE BAPI_NETWORK-PROFILE
*" VALUE(ACTIVITY) LIKE BAPI_NETWORK_ACTIVITY-ACTIVITY
*" VALUE(CONTROL_KEY) LIKE BAPI_NETWORK_ACTIVITY-CONTROL_KEY
*" VALUE(ACT_DESC) LIKE BAPI_NETWORK_ACTIVITY-DESCRIPTION
*" VALUE(NETWORK_PREDECESSOR) LIKE
*" BAPI_NETWORK_RELATION-NETWORK_PREDECESSOR
*" VALUE(ACTIVITY_PREDECESSOR) LIKE
*" BAPI_NETWORK_RELATION-ACTIVITY_PREDECESSOR
*" VALUE(NETWORK_SUCCESSOR) LIKE
*" BAPI_NETWORK_RELATION-NETWORK_SUCCESSOR
*" VALUE(ACTIVITY_SUCCESSOR) LIKE
*" BAPI_NETWORK_RELATION-ACTIVITY_SUCCESSOR
*" VALUE(RELATION_TYPE) LIKE BAPI_NETWORK_RELATION-RELATION_TYPE
*" VALUE(ELEMENT) LIKE BAPI_ACT_ELEMENT-ELEMENT
*" VALUE(UP) LIKE BAPI_WBS_HIERARCHIE-UP
*" VALUE(DOWN) LIKE BAPI_WBS_HIERARCHIE-DOWN
*" VALUE(LEFT) LIKE BAPI_WBS_HIERARCHIE-LEFT
*" VALUE(RIGHT) LIKE BAPI_WBS_HIERARCHIE-RIGHT
*" VALUE(UP1) LIKE BAPI_WBS_HIERARCHIE-UP
*" VALUE(DOWN1) LIKE BAPI_WBS_HIERARCHIE-DOWN
*" VALUE(LEFT1) LIKE BAPI_WBS_HIERARCHIE-LEFT
*" VALUE(RIGHT1) LIKE BAPI_WBS_HIERARCHIE-RIGHT
*" VALUE(VPLANT) LIKE BAPI_NETWORK-PLANT
*" VALUE(VPROJ_TYPE) LIKE BAPI_WBS_ELEMENT-PROJ_TYPE
*" TABLES
*" WBS_CREATE_ERROR STRUCTURE BAPI_METH_MESSAGE OPTIONAL
*" NETWORK_CREATE_ERROR STRUCTURE BAPI_METH_MESSAGE OPTIONAL
*" WBS_HIERARCHY_ERROR STRUCTURE BAPI_METH_MESSAGE OPTIONAL
*" ACTIVITY_CREATE_ERROR STRUCTURE BAPI_METH_MESSAGE OPTIONAL
*" ACTIVITY_RELATION_ERROR STRUCTURE BAPI_METH_MESSAGE OPTIONAL
*"----------------------------------------------------------------------
DATA : BEGIN OF itproj OCCURS 0.
INCLUDE STRUCTURE bapi_project_definition.
DATA :END OF itproj.
DATA : BEGIN OF itprojupd OCCURS 0.
INCLUDE STRUCTURE bapi_project_definition_up.
DATA :END OF itprojupd.
DATA : BEGIN OF itwbsmethod OCCURS 0.
INCLUDE STRUCTURE bapi_method_project.
DATA :END OF itwbsmethod.
DATA : BEGIN OF itwbs OCCURS 0.
INCLUDE STRUCTURE bapi_wbs_element.
DATA :END OF itwbs.
DATA : BEGIN OF itnetmethod OCCURS 0.
INCLUDE STRUCTURE bapi_method_project.
DATA :END OF itnetmethod.
DATA : BEGIN OF itnetwork OCCURS 0.
INCLUDE STRUCTURE bapi_network.
DATA :END OF itnetwork.
DATA : BEGIN OF itwbshierarchy OCCURS 0.
INCLUDE STRUCTURE bapi_wbs_hierarchie.
DATA :END OF itwbshierarchy.
DATA : BEGIN OF iterr OCCURS 0.
INCLUDE STRUCTURE bapi_meth_message .
DATA :END OF iterr.
DATA : iterr1 LIKE bapi_meth_message OCCURS 0 WITH HEADER LINE.
DATA : itemsg LIKE bapi_meth_message OCCURS 0 WITH HEADER LINE.
DATA : itemsg1 LIKE bapi_meth_message OCCURS 0 WITH HEADER LINE.
DATA : itemsg2 LIKE bapi_meth_message OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF itactivity OCCURS 0.
INCLUDE STRUCTURE bapi_network_activity.
DATA :END OF itactivity.
DATA : BEGIN OF itactmethod OCCURS 0.
INCLUDE STRUCTURE bapi_network_activity_up.
DATA :END OF itactmethod.
DATA :BEGIN OF itrelation OCCURS 0.
INCLUDE STRUCTURE bapi_network_relation.
DATA :END OF itrelation.
DATA : v_str(100) TYPE c.
DATA : v_str1(34) TYPE c.
IF NOT wbs_element IS INITIAL AND
NOT project_definition IS INITIAL.
* AND NOT description IS INITIAL.
MOVE wbs_element TO itwbs-wbs_element.
MOVE project_definition TO itwbs-project_definition.
* MOVE vproj_type TO itwbs-proj_type.
MOVE WBS_ELEMENT_DESCRIPTION TO itwbs-description.
IF NOT wbs_element1 IS INITIAL.
MOVE vproj_type TO itwbs-proj_type.
ELSE.
MOVE ' ' TO itwbs-proj_type.
ENDIF.
APPEND itwbs.
MOVE project_definition TO itproj-project_definition.
MOVE description to itproj-description.
APPEND itproj.
MOVE '000010' TO itwbsmethod-refnumber.
MOVE 'WBS-ELEMENT' TO itwbsmethod-objecttype.
MOVE 'CREATE' TO itwbsmethod-method.
MOVE wbs_element TO itwbsmethod-objectkey.
APPEND itwbsmethod.
MOVE '000000' TO itwbsmethod-refnumber.
MOVE ' ' TO itwbsmethod-objecttype.
MOVE 'SAVE' TO itwbsmethod-method.
MOVE ' ' TO itwbsmethod-objectkey.
APPEND itwbsmethod.
************ create WBS Elements******************
REFRESH iterr.
CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'
EXPORTING
i_project_definition = itproj
i_project_definition_upd = itprojupd
* IMPORTING
* RETURN =
TABLES
i_method_project = itwbsmethod
* I_WBS_ELEMENT_TABLE_UPDATE =
i_wbs_element_table = itwbs
* I_WBS_MILESTONE_TABLE =
* I_WBS_MILESTONE_TABLE_UPDATE =
* I_WBS_HIERARCHIE_TABLE = itwbshierarchy
* i_network = itnetwork
* I_NETWORK_UPDATE =
* i_activity = itactivity
* i_activity_update = itactmethod
* I_RELATION =
* I_RELATION_UPDATE =
e_message_table = iterr.
* I_ACTIVITY_ELEMENT =
* I_ACTIVITY_ELEMENT_UPDATE =
* I_ACTIVITY_MILESTONE =
* I_ACTIVITY_MILESTONE_UPDATE =
IF sy-subrc = 0.
ENDIF.
LOOP AT iterr.
MOVE : iterr-method to wbs_create_error-method,
iterr-object_type to wbs_create_error-OBJECT_TYPE,
iterr-internal_object_id to
wbs_create_error-INTERNAL_OBJECT_ID,
iterr-external_object_id to
wbs_create_error-EXTERNAL_OBJECT_ID,
iterr-message_id to wbs_create_error-MESSAGE_ID,
iterr-message_number to wbs_create_error-MESSAGE_NUMBER,
iterr-message_type to wbs_create_error-MESSAGE_TYPE,
iterr-message_text to wbs_create_error-MESSAGE_TEXT.
append wbs_create_error.
clear iterr.
endloop.
COMMIT WORK .
WAIT UP TO 1 SECONDS.
ENDIF. " if not wbs_element initial
************ create network ***********
if not network is initial.
MOVE '000001' TO itnetmethod-refnumber.
MOVE 'NETWORK' TO itnetmethod-objecttype.
MOVE 'CREATE' TO itnetmethod-method.
MOVE network TO itnetmethod-objectkey.
APPEND itnetmethod.
MOVE '000000' TO itnetmethod-refnumber.
MOVE ' ' TO itnetmethod-objecttype.
MOVE 'SAVE' TO itnetmethod-method.
MOVE ' ' TO itnetmethod-objectkey.
APPEND itnetmethod.
MOVE network TO itnetwork-network.
MOVE network_type TO itnetwork-network_type.
MOVE vplant TO itnetwork-plant.
MOVE 'NEW NETWORK' TO itnetwork-short_text.
MOVE wbs_element TO itnetwork-wbs_element.
MOVE '001' TO itnetwork-mrp_controller.
MOVE project_definition TO itnetwork-project_definition.
MOVE profile TO itnetwork-profile.
APPEND itnetwork.
REFRESH itemsg.
CALL FUNCTION 'BAPI_NETWORK_MAINTAIN'
* IMPORTING
* RETURN =
TABLES
i_method_project = itnetmethod
i_network = itnetwork
* I_NETWORK_UPDATE =
* I_ACTIVITY =
* I_ACTIVITY_UPDATE =
* I_RELATION =
* I_RELATION_UPDATE =
e_message_table = itemsg.
* I_ACTIVITY_ELEMENT =
* I_ACTIVITY_ELEMENT_UPDATE =
* I_ACTIVITY_MILESTONE =
* I_ACTIVITY_MILESTONE_UPDATE =
IF sy-subrc = 0.
ENDIF.
LOOP AT itemsg.
MOVE : itemsg-method to network_create_error-method,
itemsg-object_type to network_create_error-OBJECT_TYPE,
itemsg-internal_object_id to
network_create_error-INTERNAL_OBJECT_ID,
itemsg-external_object_id to
network_create_error-EXTERNAL_OBJECT_ID,
itemsg-message_id to network_create_error-MESSAGE_ID,
itemsg-message_number to
network_create_error-MESSAGE_NUMBER,
itemsg-message_type to network_create_error-MESSAGE_TYPE,
itemsg-message_text to network_create_error-MESSAGE_TEXT.
append network_create_error.
clear itemsg.
endloop.
COMMIT WORK .
WAIT UP TO 1 SECONDS.
endif. "if not network is initial.
********* this method will decide hierarchy of WBS *******
IF NOT wbs_element1 IS INITIAL.
"AND NOT wbs_element_parent IS INITIAL.
CLEAR:itwbsmethod,itwbshierarchy,itwbs,iterr1.
REFRESH:itwbsmethod,itwbshierarchy,itwbs,iterr1.
*********MAINTAIN HIERARCHY*************************************
******* New WBS along with position w.r.t parent********
* MOVE wbs_element_parent TO itwbshierarchy-wbs_element.
MOVE wbs_element TO itwbshierarchy-wbs_element.
MOVE project_definition TO itwbshierarchy-project_definition.
MOVE up TO itwbshierarchy-up.
MOVE down TO itwbshierarchy-down.
MOVE left TO itwbshierarchy-left.
MOVE right TO itwbshierarchy-right.
APPEND itwbshierarchy.
CLEAR itwbshierarchy.
********Pass WBS elements parent with position w.r.t child***
MOVE wbs_element1 TO itwbshierarchy-wbs_element.
MOVE project_definition TO itwbshierarchy-project_definition.
MOVE up1 TO itwbshierarchy-up.
MOVE down1 TO itwbshierarchy-down.
MOVE left1 TO itwbshierarchy-left.
MOVE right1 TO itwbshierarchy-right.
APPEND itwbshierarchy.
CLEAR itwbshierarchy.
******** Method for saving and creating WBS**********
MOVE 'WBS-HIERARCHY' TO itwbsmethod-objecttype.
MOVE 'CREATE' TO itwbsmethod-method.
APPEND itwbsmethod.
CLEAR itwbsmethod.
MOVE 'SAVE' TO itwbsmethod-method.
APPEND itwbsmethod.
CLEAR itwbsmethod.
***********end method ****************
***** WBS updating it with proj_type***
* MOVE wbs_element_parent TO itwbs-wbs_element.
MOVE wbs_element TO itwbs-wbs_element.
MOVE project_definition TO itwbs-project_definition.
MOVE WBS_ELEMENT_DESCRIPTION TO itwbs-description.
MOVE vproj_type TO itwbs-proj_type.
APPEND itwbs.
***** WBS updating it with proj_type***
CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'
EXPORTING
i_project_definition = itproj
i_project_definition_upd = itprojupd
* IMPORTING
* RETURN =
TABLES
i_method_project = itwbsmethod
* I_WBS_ELEMENT_TABLE_UPDATE =
i_wbs_element_table = itwbs
* I_WBS_MILESTONE_TABLE =
* I_WBS_MILESTONE_TABLE_UPDATE =
i_wbs_hierarchie_table = itwbshierarchy
* I_NETWORK = itnetwork
* I_NETWORK_UPDATE =
* I_ACTIVITY = itactivity
* I_ACTIVITY_UPDATE = itactmethod
* I_RELATION =
* I_RELATION_UPDATE =
e_message_table = iterr1.
* I_ACTIVITY_ELEMENT =
* I_ACTIVITY_ELEMENT_UPDATE =
* I_ACTIVITY_MILESTONE =
* I_ACTIVITY_MILESTONE_UPDATE =
IF sy-subrc = 0.
ENDIF.
LOOP AT iterr1.
MOVE : iterr1-method to wbs_hierarchy_error-method,
iterr1-object_type to wbs_hierarchy_error-OBJECT_TYPE,
iterr1-internal_object_id to
wbs_hierarchy_error-INTERNAL_OBJECT_ID,
iterr1-external_object_id to
wbs_hierarchy_error-EXTERNAL_OBJECT_ID,
iterr1-message_id to wbs_hierarchy_error-MESSAGE_ID,
iterr1-message_number to wbs_hierarchy_error-MESSAGE_NUMBER,
iterr1-message_type to wbs_hierarchy_error-MESSAGE_TYPE,
iterr1-message_text to wbs_hierarchy_error-MESSAGE_TEXT.
append wbs_hierarchy_error.
clear iterr1.
endloop.
COMMIT WORK .
WAIT UP TO 1 SECONDS. .
ENDIF." if not wbs_element1 initial
**************** create activity in network************
CLEAR : itactivity,itnetmethod,itemsg1,itnetwork.
REFRESH :itactivity,itnetmethod,itemsg1,itnetwork.
IF NOT network IS INITIAL.
CONCATENATE itemsg-internal_object_id activity INTO v_str.
MOVE itemsg-internal_object_id+0(12) TO itactivity-network.
ELSE.
CONCATENATE network1 activity INTO v_str.
MOVE network1 TO itactivity-network.
ENDIF.
MOVE activity TO itactivity-activity.
MOVE act_desc TO itactivity-description.
MOVE 'PS01' TO itactivity-control_key.
MOVE project_definition TO itactivity-project_definition.
MOVE wbs_element TO itactivity-wbs_element.
MOVE 'W7' TO itactivity-factory_calendar.
APPEND itactivity.
MOVE '000001' TO itnetmethod-refnumber.
MOVE 'NETWORKACTIVITY' TO itnetmethod-objecttype.
MOVE 'CREATE' TO itnetmethod-method.
MOVE v_str TO itnetmethod-objectkey.
APPEND itnetmethod.
CLEAR itnetmethod.
MOVE 'SAVE' TO itnetmethod-method.
APPEND itnetmethod.
CLEAR itnetmethod.
MOVE network1 TO itnetwork-network.
MOVE '001' TO itnetwork-mrp_controller.
APPEND itnetwork.
CALL FUNCTION 'BAPI_NETWORK_MAINTAIN'
* IMPORTING
* RETURN =
TABLES
i_method_project = itnetmethod
i_network = itnetwork
* I_NETWORK_UPDATE =
i_activity = itactivity
* I_ACTIVITY_UPDATE =
* I_RELATION =
* I_RELATION_UPDATE =
e_message_table = itemsg1.
* I_ACTIVITY_ELEMENT =
* I_ACTIVITY_ELEMENT_UPDATE =
* I_ACTIVITY_MILESTONE =
* I_ACTIVITY_MILESTONE_UPDATE =
IF sy-subrc = 0.
ENDIF.
LOOP AT itemsg1.
MOVE : itemsg1-method to activity_create_error-method,
itemsg1-object_type to activity_create_error-OBJECT_TYPE,
itemsg1-internal_object_id to
activity_create_error-INTERNAL_OBJECT_ID,
itemsg1-external_object_id to
activity_create_error-EXTERNAL_OBJECT_ID,
itemsg1-message_id to activity_create_error-MESSAGE_ID,
itemsg1-message_number to
activity_create_error-MESSAGE_NUMBER,
itemsg1-message_type to activity_create_error-MESSAGE_TYPE,
itemsg1-message_text to activity_create_error-MESSAGE_TEXT.
append activity_create_error.
clear itemsg1.
endloop.
COMMIT WORK .
WAIT UP TO 1 SECONDS.
*********************** create network relationship*********************
CLEAR : itnetmethod,itemsg2,itnetwork,itrelation.
REFRESH :itnetmethod,itemsg2,itnetwork,itrelation.
MOVE '000001' TO itnetmethod-refnumber.
MOVE 'NETWORKRELATION' TO itnetmethod-objecttype.
MOVE 'CREATE' TO itnetmethod-method.
CONCATENATE relation_type network_predecessor activity_predecessor
network_successor activity_successor INTO v_str1.
MOVE v_str1 TO itnetmethod-objectkey.
APPEND itnetmethod.
CLEAR itnetmethod.
MOVE 'SAVE' TO itnetmethod-method.
APPEND itnetmethod.
CLEAR itnetmethod.
MOVE network1 TO itnetwork-network.
APPEND itnetwork.
CLEAR itnetwork.
MOVE network_predecessor TO itrelation-network_predecessor.
MOVE activity_predecessor TO itrelation-activity_predecessor.
MOVE network_successor TO itrelation-network_successor.
MOVE activity_successor TO itrelation-activity_successor.
MOVE relation_type TO itrelation-relation_type.
APPEND itrelation.
CLEAR itrelation.
CALL FUNCTION 'BAPI_NETWORK_MAINTAIN'
* IMPORTING
* RETURN =
TABLES
i_method_project = itnetmethod
i_network = itnetwork
* I_NETWORK_UPDATE =
* I_ACTIVITY = itactivity
* I_ACTIVITY_UPDATE =
i_relation = itrelation
* I_RELATION_UPDATE =
e_message_table = itemsg2.
* I_ACTIVITY_ELEMENT =
* I_ACTIVITY_ELEMENT_UPDATE =
* I_ACTIVITY_MILESTONE =
* I_ACTIVITY_MILESTONE_UPDATE =
IF sy-subrc = 0.
ENDIF.
LOOP AT itemsg2.
MOVE : itemsg2-method to activity_relation_error-method,
itemsg2-object_type to activity_relation_error-OBJECT_TYPE,
itemsg2-internal_object_id to
activity_relation_error-INTERNAL_OBJECT_ID,
itemsg2-external_object_id to
activity_relation_error-EXTERNAL_OBJECT_ID,
itemsg2-message_id to activity_relation_error-MESSAGE_ID,
itemsg2-message_number to
activity_relation_error-MESSAGE_NUMBER,
itemsg2-message_type to
activity_relation_error-MESSAGE_TYPE,
itemsg2-message_text to
activity_relation_error-MESSAGE_TEXT.
append activity_relation_error.
clear itemsg2.
endloop.
.
COMMIT WORK .
WAIT UP TO 1 SECONDS. .
ENDFUNCTION.
Posted by
A S Chakrapani
at
6:25 PM
0
comments
Labels: SAP Tips
