Tuesday, July 31, 2007

Transaction Code Authority Check

The following code demonstrates how to check that a user has the correct authority for a particular transaction code. Useful to check if a user has the correct authority before executing a transaction via BDC input.

authority-check object 'S_TCODE'
id 'TCD'
field 'SM35'.
if sy-subrc ne 0.
* User does not have authority for transaction SM35!!!
endif.

Password Field on Selection-screen

The following code sets a PARAMETER to be a password input field, where for security purposes only *'s are displayed on the screen during input i.e. Password: *******
Parameters: p_password like sy-uname.
AT SELECTION-SCREEN OUTPUT.

loop at screen.
check screen-name eq 'P_PASSWORD'.
move: 1 to screen-invisible.
modify screen.
endloop.

Insert image onto SAP screen

This is very simple to do, first create a dialog program with one screen (any number i.e. 0100) and create a custom control called 'CUST_CONTROL'. Now use the below sections of code to create a top include and a PBO module/process. And then finally create a transaction code for it. This version does not work for version 4.6., so http://www.sapdevelopment.co.uk/graphics/add_image46.htm for alternative code.

The Code:

CONSTANTS: CNTL_TRUE TYPE I VALUE 1,
CNTL_FALSE type i value 0.
data: h_picture type ref to cl_gui_picture,
h_pic_container type ref to cl_gui_custom_container.
* h_tree type ref to cl_gui_list_tree,
* h_docking type ref to cl_gui_docking_container,
* h_application type ref to lcl_application.

data: graphic_url(255),
graphic_refresh(1),
g_result like cntl_true.

data: begin of graphic_table occurs 0,
line(255) type x,
end of graphic_table.

data: graphic_size type i.

And then in the include program

*--------------------------------------------------------------------*
***INCLUDE ZDISPLAYIMAGEPBO .
*--------------------------------------------------------------------*
*&-------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&-------------------------------------------------------------------*
* text
*--------------------------------------------------------------------*
module STATUS_0100 output.
data: l_graphic_xstr type xstring,
l_graphic_conv type i,
l_graphic_offs type i.
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = 'GRAPHICS'
p_name = 'ENJOY' "IMAGE NAME - Image name from SE78
p_id = 'BMAP'
p_btype = 'BMON' "(BMON = black&white, BCOL = colour)
RECEIVING
p_bmp = l_graphic_xstr
EXCEPTIONS
not_found = 1
OTHERS = 2.
* IF sy-subrc = 1.
* MESSAGE e287 WITH g_stxbitmaps-tdname.
* ELSEIF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* EXIT.
* ENDIF.
graphic_size = XSTRLEN( l_graphic_xstr ).
CHECK graphic_size > 0.
l_graphic_conv = graphic_size.
l_graphic_offs = 0.
WHILE l_graphic_conv > 255.
graphic_table-line = l_graphic_xstr+l_graphic_offs(255).
APPEND graphic_table.
l_graphic_offs = l_graphic_offs + 255.
l_graphic_conv = l_graphic_conv - 255.
ENDWHILE.
graphic_table-line = l_graphic_xstr+l_graphic_offs(L_GRAPHIC_CONV).
APPEND graphic_table.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image' "#EC NOTEXT
subtype = cndp_sap_tab_unknown " 'X-UNKNOWN'
size = graphic_size
lifetime = cndp_lifetime_transaction "'T'
TABLES
data = graphic_table
CHANGING
url = graphic_url
EXCEPTIONS
* dp_invalid_parameter = 1
* dp_error_put_table = 2
* dp_error_general = 3
OTHERS = 4 .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
create object h_pic_container
exporting container_name = 'CUST_CONTROL'.
create object h_picture exporting parent = h_pic_container.
call method h_picture->load_picture_from_url
exporting url = graphic_url
importing result = g_result.
endmodule. " STATUS_0100 OUTPUT

Friday, July 27, 2007

User Exits - Simple Example

User Exits :
1. Introduction

2. How to find user exits
3. Using Project management of SAP Enhancements

1. Introduction:
User exits (Function module exits) are exits developed by SAP. The exit is implementerd as a call to a functionmodule. The code for the function module is writeen by the developer. You are not writing the code directly in the function module, but in the include that is implemented in the function module.

The naming standard of function modules for functionmodule exits is:
EXIT_<3>

The call to a functionmodule exit is implemented as:
CALL CUSTOMER.-FUNCTION <3>

Example:
The program for transaction VA01

Create salesorder is SAPMV45A

If you search for CALL CUSTOMER-FUNCTION i program SAPMV45A you will find ( Among other user exits):

CALL CUSTOMER-FUNCTION '003'
exporting
xvbak = vbak
xvbuk = vbuk
xkomk = tkomk
importing
lvf_subrc = lvf_subrc
tables
xvbfa = xvbfa
xvbap = xvbap
xvbup = xvbup.

The exit calls function module EXIT_SAPMV45A_003

2. How to find user exits?
Display the program where you are searching for and exit and search

for CALL CUSTOMER-EXIT

If you know the Exit name, go to transaction CMOD.

Choose menu Utillities->SAP Enhancements. Enter the exit name and press enter.

You will now come to a screen that shows the function module exits for the exit.

3. Using Project management of SAP Enhancements, we want to create a project to enahance trasnaction VA01 .

  • - Go to transaction CMOD - Create a project called ZVA01 - Choose the Enhancement assign radio button and press the Change button
  • In the first column enter V45A0002 Predefine sold-to party in sales document.
Note that an enhancement can only be used in 1 project. If the enhancement is already in use, and error message will be displayed

  • Press Save
  • Press Components. You can now see that enhancement uses user exit EXIT_SAPMV45A_002.

Double click on the exit.

  • Now the function module is displayed. Double click on include ZXVVAU04 in the function module
  • Insert the following code into the include: E_KUNNR = '2155'.
  • Activate the include program. Go back to CMOD and activate the project.
  • Goto transaction VA01 and craete a salesorder.
  • Note that Sold-to-party now automatically is "2155"

Table Realtionships between SAP Modules

Here is the link to download the file which gives you a detailed relations hip between tables of various Functional Modules. Just 633 KB.

http://www.sap-img.com/sap-download/sap-tables.zip

Standard SAP Programs

Standard SAP Programs

BALVBT01: Example SAP program for displying multiple ALV reports on one page
BCALV_GRID_DEMO: ALV Dialog grid demo (4.6)
SHOW_COLO: Displays all colours available
SHOW_ICON: Displays all icon available
RGUGBR00: Substitution/Validation and rules utility
RKCTSEAR: Search source code of various programs for up to two strings. Also see RPR_ABAP_SOURCE_SCAN or use search in source functionality via SE80
RPCIFU01: Display File
RPCIFU03: Download Unix File to PC
RPCIFU04: Upload PC File to Unix File
RPR_ABAP_SOURCE_SCAN: Search ABAP code for a string. Much more flexible than RSRSCAN1 or RKCTSEAR
RSBDCBTC: Submit a BDC job with an internal batch number and wait for the end of the batch input session
RSBDCDRU: Prints the contents of a Batch Input session. No options for error transactions only
RSBDCOS0: Execute OS Command (Logged in SYSLOG and Trace Files)
RSBDCSUB: Process batch input sessions automatically
RSBTCDEL: Delete batch jobs
RSCONN01: SAPconnect: Start Email Send Process
RSCSAUTH: Maintain/Restore Authorization Groups
RSINCL00: Extended ABAP Program Reference List
RSMODRES: Restore enhancement projects after upgarde
RSORAREL: Check Oracle Version
RSPARAM: Display all instance parameters
RSPO0041: Delete Old Spool Requests
RSSNAPDL: Reorganization Program for Table SNAP of Short Dumps
RSTRANSP: Transport Report Variants
RSTXFCON: SAPscript: Conversion of Page Format for Forms
RSTXPDFT4: Convert spool request to PDF document
RSTXPDFT5: GUI download of a spool request
RSTXSCRP: SAPscript Export to Dataset / SAPscript Import from Dataset (Upload and download SAPScript layout sets)
RSTXTRAN: Transfer of SAPscript Texts(standard texts) to a transport
RSUSR003: Check the Passwords of Users SAP* and DDIC in All Clients
RSUSR006: List of Users with Incorrect Logons
RSVARFIT: Adjust Variants to Modified Selections
RSVTPROT: Evaluation of change logs
RSWBO052: Change Object Directory Entries
RSWBO060: Include Objects in a Transport Request
SAPMSUU0: Program for user maintenance(SU01), Maybe useful if you do not have access to the actual SU01 transaction code.

Select Statements - Explained

The select command is the most fundamental function of writing ABAP programs allowing the retrieval ofdata from SAP database tables. Below are a few examples of the various ways of selecting data.

*Code to demonstrate select command
*Code to demonstrate select into internal table command

TYPES: BEGIN OF t_bkpf,

* include structure bkpf.

bukrs LIKE bkpf-bukrs,
belnr LIKE bkpf-belnr,
gjahr LIKE bkpf-gjahr,
bldat LIKE bkpf-bldat,
monat LIKE bkpf-monat,
budat LIKE bkpf-budat,
xblnr LIKE bkpf-xblnr,
awtyp LIKE bkpf-awtyp,
awkey LIKE bkpf-awkey,
END OF t_bkpf.

DATA: it_bkpf TYPE STANDARD TABLE OF t_bkpf INITIAL SIZE 0,
wa_bkpf TYPE t_bkpf.

TYPES: BEGIN OF t_bseg,

*include structure bseg.

bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
gjahr LIKE bseg-gjahr,
buzei LIKE bseg-buzei,
mwskz LIKE bseg-mwskz, "Tax code
umsks LIKE bseg-umsks, "Special G/L transaction type
prctr LIKE bseg-prctr, "Profit Centre
hkont LIKE bseg-hkont, "G/L account
xauto LIKE bseg-xauto,
koart LIKE bseg-koart,
dmbtr LIKE bseg-dmbtr,
mwart LIKE bseg-mwart,
hwbas LIKE bseg-hwbas,
aufnr LIKE bseg-aufnr,
projk LIKE bseg-projk,
shkzg LIKE bseg-shkzg,
kokrs LIKE bseg-kokrs,
END OF t_bseg.

DATA: it_bseg TYPE STANDARD TABLE OF t_bseg INITIAL SIZE 0,
wa_bseg TYPE t_bseg.

*Select directly into an internal table
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
dmbtr mwart hwbas aufnr projk shkzg kokrs
FROM bseg
INTO TABLE it_bseg.

* Select directly into an internal table where fields are in a different order or not all fields are specified
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
dmbtr mwart hwbas aufnr projk shkzg kokrs
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg.

*Select... endselect command
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
dmbtr mwart hwbas aufnr projk shkzg kokrs
FROM bseg
INTO wa_bseg.
APPEND wa_bseg TO it_bseg.
ENDSELECT.

*Select FOR ALL ENTRIES command
SELECT bukrs belnr gjahr bldat monat budat xblnr awtyp awkey
UP TO 100 ROWS
FROM bkpf
INTO TABLE it_bkpf.
IF sy-subrc EQ 0.

* The FOR ALL ENTRIES comand only retrieves data which matches entries within a particular internal table.
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
dmbtr mwart hwbas aufnr projk shkzg kokrs
FROM bseg
INTO TABLE it_bseg
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs EQ it_bkpf-bukrs AND
belnr EQ it_bkpf-belnr AND
gjahr EQ it_bkpf-gjahr.
ENDIF.

Thursday, July 26, 2007

Automatic creation of ALV Reports

www.ALVROBOT.com.ar is intended to help ABAP programmers on the creation of ALV reports by automatically generating source code using a specially designed template.
This way ALV reports get done easier and faster. Also, as they are all made from the same template, standards get honored. The generated source is not messy nor complicated. Is as readable, simple and straight-forward as any other program created by yourself!


Steps
Just enter to
www.ALVROBOT.com.ar and follow the wizard (7 steps). All you have to tell the wizard is:
  1. The tables involved in the report.
  2. The fields of the selection screen.
  3. The Fields of the ALV report.

By the end, will get the source code for your report.

  1. Copy the source code given in the textbox.
  2. Using the SE38 transaction, create a new program.
  3. Paste the source code in it.
  4. Compile.
  5. Go! You are ready to run the program.

Conclusion
As we have said in the previous pages, ALV robot is intended to help the programmers in the programming of ALV reports. Using a template and a couple of questions, it takes care of most of the typing needed to create the source code of the report.

As the reports generated are neither complex nor contain complex queries, you may find usefull to use this site to create a base report for later enhacement. Since the source code given is simple, clean and straigh-forward, you may easily do that and won't get messed in the source code.

File Upload Program

REPORT ZHARZTEST NO STANDARD PAGE HEADING
LINE-SIZE 132
LINE-COUNT 65.
*----------------------------------------------------------------------*
* 1. Read input file *
* 2. Check the mandatory fields and if any one of them is missing *
* move the record to error file. *
* 3. If any errors format the message and send it for reporting *
* 4. If any errors, it downloads the error file *
* 5. Display the Audit report *
*----------------------------------------------------------------------*

*----------------------------------------------------------------------*
* FLAGS *
*----------------------------------------------------------------------*
DATA: FG_STOP TYPE C, " Flag used to stop processing
FG_COLOR TYPE C, " Flag to set Background color
FG_OPENSESSION TYPE C. " Flag for Open Sesssion

*----------------------------------------------------------------------*
* INTERNAL TABLE DECLARATIONS *
*----------------------------------------------------------------------*
*--- Internal table for Dimension Details
DATA: BEGIN OF IT_DATA OCCURS 0,
MANDT(3),
ZDIMID(10),
ZDIMDESC(120),
END OF IT_DATA.

*--- Internal table for input file for ascii data load
DATA: BEGIN OF I_INFILE_ASC OCCURS 0,
STRING(1000) TYPE C,
END OF I_INFILE_ASC.

*--- Internal table to store messages from Call Transaction.
DATA : I_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL WITH HEADER LINE,

*--- Internal table for BDC data
IT_BDCTAB TYPE BDCDATA OCCURS 0 WITH HEADER LINE.

*--- Internal table to hold the error records.
DATA : BEGIN OF IT_ERROR OCCURS 0.
INCLUDE STRUCTURE IT_DATA.

DATA : MESSAGE(80) TYPE C,
END OF IT_ERROR.

*--- Internal table for session names
DATA : BEGIN OF IT_SESSION OCCURS 0,
NAME(12),
END OF IT_SESSION.

*--- Internal table to hold Collecting messages in the SAP System
DATA : IT_MSG LIKE BDCMSGCOLL OCCURS 10 WITH HEADER LINE.

*--- Internal table to hold error records to be downloaded
DATA : BEGIN OF I_FINAL OCCURS 0,
STRING(1000),
END OF I_FINAL.

*--- Internal table for session names
DATA : BEGIN OF I_SESSION OCCURS 0,
NAME(12),
END OF I_SESSION.

*--- Internal table to hold data from Excel
DATA : IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

*----------------------------------------------------------------------*
* CONSTANTS *
*----------------------------------------------------------------------*
CONSTANTS : C_FILETYPE LIKE RLGRAP-FILETYPE VALUE 'DAT'. " Filetype
*----------------------------------------------------------------------*
* DATA DECLARATIONS *
*----------------------------------------------------------------------*
DATA : G_TABIX LIKE SY-TABIX, " Table Index
G_MESG(80) TYPE C, " Message,
G_ERROR TYPE I, " No.of Errors
G_SUCCESS TYPE I, " No.of successes
G_BDC_SESS TYPE APQI-GROUPID VALUE 'UPLOAD', " Queue info defn
G_MAX TYPE I VALUE '900', " Max records
G_LINES TYPE I, " No.of records
G_INSERT TYPE I, " Insert
G_COUNTER(2) TYPE N, " No.of Sessions
G_EMPTY TYPE I, " No. of empty records
G_TOTAL TYPE I, " Total no. of records with data
G_SESSION TYPE APQI-GROUPID, " Session name
G_DEL TYPE X VALUE '09', " To seperate fields in case of Dat
G_SFILE(255), " File path
G_FILEEXT(3). " File Extension

*----------------------------------------------------------------------*
* SELECTION SCREEN. *
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-001.
PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY, " Input File
P_FTYPE LIKE RLGRAP-FILETYPE DEFAULT 'XLS'. " File Type
PARAMETERS: P_HEADER TYPE I DEFAULT 1. " Header Lines

SELECTION-SCREEN END OF BLOCK SCR1.
PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY, " Start Column
P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY, " Start Row
P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY, " End Column
P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY. " End Row

*---------------------------------------------------------------------*
* AT SELECTION-SCREEN *
*---------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
*--- Validating file
PERFORM VALIDATE_FILE USING P_FILE.
*----------------------------------------------------------------------*
* START-OF-SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
*--- Perform to store the data to an internal table
PERFORM READ_INPUT_FILE_DATA.
*--- Process data in non test mode only
IF NOT IT_DATA[] IS INITIAL.
*--- Perform to process data
PERFORM PROCESS_DATA.
*--- Perform to Update the Table with the Input data
PERFORM UPDATE_TABLE.
ENDIF.

*----------------------------------------------------------------------*
* END OF SELECTION. *
*----------------------------------------------------------------------*
END-OF-SELECTION.
*----------------------------------------------------------------------*
* Form : validate_input_file
*----------------------------------------------------------------------*
* Description : To provide F4 help for file if read from PC
*----------------------------------------------------------------------*
FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.
*--- Call function to get the File (user specified)
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
FILE_NAME = F_FILE
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.

*----------------------------------------------------------------------*
* Form : Read_inputfile
*----------------------------------------------------------------------*
* Description : To upload the data into internal table
*----------------------------------------------------------------------*
FORM READ_INPUTFILE TABLES F_INFILE
USING F_FILE TYPE RLGRAP-FILENAME
F_FILTYP TYPE RLGRAP-FILETYPE.
*--- Local variable declarations
DATA : LV_DEL TYPE CHAR01,
LV_FILE TYPE STRING.
*--- Clear and initialize variables
CLEAR F_INFILE.
REFRESH F_INFILE.
LV_FILE = F_FILE.
*--- Function module to upload the input file
IF F_FILTYP = 'DAT'.
LV_DEL = ''.
ENDIF.
*--- Call function GUI_UPLOAD to upload data from flat file to internal table
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = LV_DEL
TABLES
DATA_TAB = F_INFILE
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17 .
IF SY-SUBRC <> 0.
*--- Display message if error occurs in uploading data from file
* G_MESG = 'Error in uploading the file'(003).
* MESSAGE I001(Z_MSGCLASS) WITH G_MESG.
* CLEAR G_MESG.
* FG_STOP = 'X'.
* STOP.
ENDIF.
ENDFORM. "Read_inputfile

*&---------------------------------------------------------------------*
*& Form FORMAT_ASC_DATA
*&---------------------------------------------------------------------*
* To format the ASCII data
*----------------------------------------------------------------------*
FORM FORMAT_ASC_DATA.
*--- Loop to format ASCII data
LOOP AT I_INFILE_ASC.
IT_DATA-ZDIMID = I_INFILE_ASC-STRING+0(10).
IT_DATA-ZDIMDESC = I_INFILE_ASC-STRING+10(120).
ENDLOOP.
ENDFORM. " FORMAT_ASC_DATA

*&---------------------------------------------------------------------*
*& Form error_processing
*&---------------------------------------------------------------------*
* To process the error records
*----------------------------------------------------------------------*
FORM ERROR_PROCESSING USING F_IT_DATA
F_MESG.
G_ERROR = G_ERROR + 1.
IT_ERROR = F_IT_DATA.
IT_ERROR-MESSAGE = F_MESG.
APPEND IT_ERROR.
CLEAR IT_ERROR.
ENDFORM. " ERROR_PROCESSING
*&---------------------------------------------------------------------*
*& Form READ_INPUT_DATA
*&---------------------------------------------------------------------*
* To Read the input file data
*----------------------------------------------------------------------*
FORM READ_INPUT_FILE_DATA.

*--- Splitting the filename and its extension
PERFORM SPLIT_FILENAME_EXT.
CASE G_FILEEXT.
WHEN 'XLS'.

*--- Perform to convert the Excel data into an internal table
PERFORM CONVERT_XLS_ITAB.
WHEN 'TXT'.
IF P_FTYPE = 'ASC'.

*--- Uploading the data from server
PERFORM READ_INPUTFILE TABLES I_INFILE_ASC
USING P_FILE P_FTYPE.
*--- Perform Formating ASC type data
PERFORM FORMAT_ASC_DATA.
ELSEIF P_FTYPE = 'DAT'.

*--- Uploading the data from server
PERFORM READ_INPUTFILE TABLES IT_DATA
USING P_FILE P_FTYPE.
ENDIF.
WHEN OTHERS.
G_MESG = 'Invalid Operation'(008).
MESSAGE I001(Z_MSGCLASS) WITH G_MESG.
CLEAR G_MESG.
FG_STOP = 'X'.
STOP.
ENDCASE.
IF NOT IT_DATA[] IS INITIAL.

*--- Perform to delete Header lines
PERFORM DELETE_HEADER_EMPTY_RECS.
ENDIF.
ENDFORM. " READ_INPUT_FILE_DATA
*&---------------------------------------------------------------------*
*& Form SPLIT_FILENAME_EXT
*&---------------------------------------------------------------------*
* To split the filename and the extension
*----------------------------------------------------------------------*
FORM SPLIT_FILENAME_EXT.
MOVE P_FILE TO G_SFILE.
*--- To get the extensions of the file
CALL FUNCTION 'CV120_SPLIT_FILE'
EXPORTING
PF_FILE = G_SFILE
IMPORTING
* PFX_FILE =
PFX_EXTENSION = G_FILEEXT
* PFX_DOTEXTENSION =
.
*--- Checking the case of file extension
IF G_FILEEXT NA SY-ABCDE.
TRANSLATE G_FILEEXT TO UPPER CASE.
ENDIF.
ENDFORM. " SPLIT_FILENAME_EXT
*&---------------------------------------------------------------------*
*& Form MOVE_DATA
*&---------------------------------------------------------------------*
* To move the input file data to an internal table
*----------------------------------------------------------------------*
FORM MOVE_DATA.
DATA : LV_INDEX TYPE I.
FIELD-SYMBOLS .
*--- Sorting the internal table
SORT IT_INTERN BY ROW COL.
CLEAR IT_INTERN.
LOOP AT IT_INTERN.
MOVE IT_INTERN-COL TO LV_INDEX.
*--- Assigning the each record to an internal table row
ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO .
IF SY-SUBRC = 0.
*--- Asigning the field value to a field symbol
MOVE IT_INTERN-VALUE TO .
ENDIF.
AT END OF ROW.
APPEND IT_DATA.
CLEAR IT_DATA.
ENDAT.
ENDLOOP.
ENDFORM. " MOVE_DATA
*&---------------------------------------------------------------------*
*& Form CONVER_XLS_ITAB
*&---------------------------------------------------------------------*
* To convert the excel data into an internal table
*----------------------------------------------------------------------*
FORM CONVERT_XLS_ITAB.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = P_BEGCOL
I_BEGIN_ROW = P_BEGROW
I_END_COL = P_ENDCOL
I_END_ROW = P_ENDROW
TABLES
INTERN = IT_INTERN
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0. "#EC *
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF NOT IT_INTERN[] IS INITIAL.
*--- Perform to move the data into an internal data
PERFORM MOVE_DATA.
ELSE.
G_MESG = 'No values found'(009).
MESSAGE I001(Z_MSGCLASS) WITH G_MESG.
CLEAR G_MESG.
FG_STOP = 'X'.
STOP.
ENDIF.
ENDFORM. " CONVERT_XLS_ITAB

*&---------------------------------------------------------------------*
*& Form DELETE_HEADER_EMPTY_RECS
*&---------------------------------------------------------------------*
* To delete the Header and empty records
*----------------------------------------------------------------------*
FORM DELETE_HEADER_EMPTY_RECS.

DATA: LV_TABIX LIKE SY-TABIX. " Table Index
CLEAR IT_DATA.

*--- To delete the empty lines from internal table
LOOP AT IT_DATA.
LV_TABIX = SY-TABIX.
IF IT_DATA IS INITIAL.
G_EMPTY = G_EMPTY + 1.
DELETE IT_DATA INDEX LV_TABIX..
ENDIF.
ENDLOOP.
CLEAR IT_DATA.

*--- Total no of recs in file
DESCRIBE TABLE IT_DATA LINES G_TOTAL.
IF G_TOTAL = 0.
G_MESG = 'No records in the file'(010).
MESSAGE I001(Z_MSGCLASS) WITH G_MESG.
CLEAR G_MESG.
FG_STOP = 'X'.
STOP.
ENDIF.
ENDFORM. " DELETE_HEADER_EMPTY_RECS

*&---------------------------------------------------------------------*
*& Form DISPLAY_SUCCESS_ERROR_DATA
*&---------------------------------------------------------------------*
* To display the no.of records,success and error records
*----------------------------------------------------------------------*
FORM DISPLAY_SUMMARY_REPORT.
SKIP 3.
FORMAT COLOR COL_HEADING INTENSIFIED ON.

WRITE :/1(132) SY-ULINE.
WRITE :/1(1) SY-VLINE,
65 'SUMMARY REPORT'(019) CENTERED,
132(1) SY-VLINE.
FORMAT INTENSIFIED OFF.
PERFORM FILL_COLOR.
WRITE :/1(132) SY-ULINE.
WRITE :/1(1) SY-VLINE,
2(24) 'Processed Records'(020),
27(2) ' : ',
30 G_TOTAL,
132(1) SY-VLINE.
PERFORM FILL_COLOR.
WRITE :/1(1) SY-VLINE,
2(24) 'Successfully Uploaded'(021),
27(2) ' : ',
30 G_SUCCESS,
132(1) SY-VLINE.
PERFORM FILL_COLOR.
WRITE :/1(1) SY-VLINE,
2(24) 'Error Records'(022),
27(2) ' : ',
30 G_ERROR,
132(1) SY-VLINE.
PERFORM FILL_COLOR.
WRITE :/1(1) SY-VLINE,
2(24) 'Empty Records'(023),
27(2) ' : ',
30 G_EMPTY,
132(1) SY-VLINE.
WRITE :/1(132) SY-ULINE.
ENDFORM. " DISPLAY_SUMMARY_REPORT

*----------------------------------------------------------------------*
* Form : session_report
*----------------------------------------------------------------------*
* To display the list of sessions created
*----------------------------------------------------------------------*
FORM SESSION_REPORT .
IF NOT I_SESSION[] IS INITIAL.
FORMAT COLOR COL_HEADING.

WRITE :/01(132) SY-ULINE.
WRITE :/01(01) SY-VLINE,
65 'SESSIONS CREATED'(024) CENTERED,
132(01) SY-VLINE.
WRITE :/01(132) SY-ULINE.

FORMAT INTENSIFIED OFF.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

WRITE :/01(132) SY-ULINE.
LOOP AT I_SESSION.
WRITE : /1 SY-VLINE.

AT FIRST.
WRITE : 5 'Session names'(O25).
ENDAT.

WRITE : 27 ':', 30 I_SESSION-NAME,
132 SY-VLINE.
ENDLOOP.
WRITE : /01(132) SY-ULINE.
ENDIF.
ENDFORM. " session_report

*&---------------------------------------------------------------------*
*& Form FILL_COLOR
*&---------------------------------------------------------------------*
* To display the background color
*----------------------------------------------------------------------*
FORM FILL_COLOR.
IF FG_COLOR = SPACE.
FORMAT COLOR 2.
FG_COLOR = 'X'.
ELSE.
FORMAT COLOR 4.
CLEAR FG_COLOR.
ENDIF.
ENDFORM. " FILL_COLOR

*&---------------------------------------------------------------------*
*& Form UPDATE_TABLE
*&---------------------------------------------------------------------*
* To Update the Table with the Input data
*----------------------------------------------------------------------*
FORM UPDATE_TABLE.
IF NOT IT_DATA IS INITIAL.

LOOP AT IT_DATA.
*--- Modify table with the values from table IT_ZEMPLOYEES
MODIFY ZROIDIM FROM IT_DATA.
IF SY-SUBRC <> 0.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " UPDATE_TABLE

*&---------------------------------------------------------------------*
*& Form PROCESS_DATA
*&---------------------------------------------------------------------*
* To Process the Internal Table to remove empty records
*----------------------------------------------------------------------*
FORM PROCESS_DATA .
DATA: LV_TABIX LIKE SY-TABIX. " Table Index
IF NOT P_HEADER IS INITIAL.
LOOP AT IT_DATA.
IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.
DELETE IT_DATA FROM 1 TO P_HEADER.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR IT_DATA.

*--- To delete the empty lines from internal table
LOOP AT IT_DATA.
LV_TABIX = SY-TABIX.
IF IT_DATA IS INITIAL.
G_EMPTY = G_EMPTY + 1.
DELETE IT_DATA INDEX LV_TABIX..
ENDIF.
ENDLOOP.

*--- Sort table IT_ZEMPLOYEES by EID and NAME
SORT IT_DATA ASCENDING BY ZDIMID.

*--- Get the Total Number of Records in the internal table
DESCRIBE TABLE IT_DATA LINES G_TOTAL.
IF G_TOTAL = 0.
FG_STOP = 'X'.
STOP.
ENDIF.
IF SY-SUBRC <> 0.

**--- Display message if error occurs in getting file
* G_MESG = 'Error in getting the Filename'(002).
* MESSAGE I001(Z_MSGCLASS) WITH G_MESG.
ENDIF.
ENDFORM. " validate_input_file

Info about adding fields in the standard stru

Info about adding fields in the standard structure in order to change the existing standard layout of the standard transaction.

RFPOsx - struc to add the fields from any table with the new domain and dataelement as required

RFPOSXEXTEND - program to execute in se38 after you add the fields to the above structure.

RFPOSXEXT - Structure to view the fields which are added in the above structure(RFPOsx).

Note: We have to run the RFPOSXEXTEND program, in which ever server it is moved.
for eg: Quality and Production Server a part from the development server.

Wednesday, July 25, 2007

SAP Transaction Codes

SPRO - DEFINE ITEM CATEGORY
MM01 - CREATE MATERIAL
MM02 - MODIFY MATERIAL
MM03 - DISPLAY MATERIAL
MMS1 - CREATE MATERIAL MASTER
MMS2 - CHANGE MATERIAL MASTER
MMS3 - DISPLAY MATERIAL MASTER
MB1C - MAINTAIN STOCK
MMPI - INITIALISE PERIOD FOR MASTER MATERIAL RECORDFROM CO CODE
MMBE - CREATE STOCK
MM60 - MATERIAL LIST
E070 - Table forTransport Request
XD01 - CREATE CUSTOMER
XD02 - MODIFY CUSTOMER
XD03 - DISPLAY CUSTOMER
VA01 - CREATE ORDER
VA02 - CHANGE ORDER
VA03 - DISPLAY ORDER
VA11 - CREATE INQUIRY
VA12 - CHANGE INQUIRY
VA13 - DISPLAY INQUIRY
VA21 - CREATE QUOTATION
VA22 - CHANGE QUOTATION
VA23 - DISPLAY QUOTATION
VD02 - CHANGE SALES PROSPECT
VD03 - DISPLAY SALES PROSPECT
VD04 - DISPLAY CHANGES
VD06 - FLAG FOR DELETION
VK11 - MAINTAINING PRICING
VK0A - ASSIGN G/L ACCOUNT GENERAL
VOK0 - PRICING
VOR1 - DEF COMMON DIST CHANEL
VOR2 - DEF COMMON DIV
VOV6 - DEFINE SCHEDULE LINES
VOV8 - DEFINE SALES DOC TYPE
VOFA - CREATE/OR CHANGE BILLING TYPES CONFIGURATION
V129 - DEFINE INCOMPLETENESS SCHEMAS FOR FOREIGN TRADE
V149 - ASSIGN INCOMPLETENESS SCHEMAS FOR COUNTRY CODE
CA01 - CREATE ROUTING
CA02 - EDIT ROUTING
CA03 - DISPLAY ROUTING
CS01 - CREATE BOM
CS02 - CHANGE BOM
CS03 - DISPLAY BOM
OVK1 - DEFINE TAX DET RULES
OVK3 - DEF TAX REL OF MASTER RECORDS CUSTOMER TAXES
OVK4 - DEF TAX REL OF MASTER RECORDS MATERIAL TAXES
OVR6 - DEF LEGAL STATUSES
OVS9 - DEF CUSTOMER GRP
OVRA - MAINT STATISTICS GRPS FOR CUSTOMERS
OVRF - MAINT STATISTICS GRPS FOR MATERIAL
OVXC - ASSIGN SHIIPING POINT TO PLANT
OVX6 - ASSIGN PLANT TO S.O AND DIST CHANEL
OVLK - DEFINE DELIVERY TYPE
OVSG - DEFINE INCOTERMS
OVLH - DEFINE ROUTES
OVXM - ASSIGN SALES OFF TO SALES AREA
OVXJ - ASSIGN SALES GRP TO SALES OFFICE
OMS2 - MATERAIL UPDATE
OVLP - DEFINE ITEM CATEGORY FOR DELIVERY
OX10 - ASSIGN DEL PLANTS FOR TAX DET
O/S2 - DEFINE SERIAL NO PROFILE
O/S1 - DEFINE CENTRAL CONTROL PARAMETERS FOR SR NO
OBB8 - DEFINE TERMS OF PAYMENT
OKKP - ACTIVATION OF COMPONENETS
VB01 - CREATE REBATE AGGREMENTS
VB02 - CHANGE REBATE AGREMENT
VB03 - DISPLAY REBATE AGGREMENT
VB31 - CREATE PROMOTION
VB32 - CHANGE PROMOTION
VB33 - DISPLAY PROMOTION
VB21 - CREATE SALES DEAL
VB22 - CHANGE SALES DEAL
VB23 - DISPLAY SALES DEAL
VB25 - LIST OF SALES DEAL
VB35 - PROMOTION LIST
VKA4 - CREATE ARCHIVE ADMINISTRATION
VKA5 - DEL ARCHIVE ADMINISTRATION
VKA6 - RELOAD ARCHIVE ADMINISTRATION
VC/1 - CUSTOMER LIST
VC/2 - CREATE SALES SUMMARY
VDH2 - DISPLAY CUSTOMER HIERARCHY
VF01 - CREATE PROFORMA INVOICE
VF02 - CHANGE PROFORMAINVOICE
VF03 - DISPLAYPROFORMA INVOICE
VF07 - DISPLAY FROM ARCHIVE
VF11 - CANCEL BILL
VFX3 - BLOCKED BILLING DOC
VFRB - RETRO BILLING
VF04 - MAINTAIN BILL DUE LIST
VF06 - BACKGROUND PROCESSING
VF21 - CREATE INVOICE LIST
VF22 - CHANGE INVOICE LIST
VF23 - DISPLAY INVOICE LIST
VF44 - MAINT REVENUE LIST
VF45 - REVENUE REPORTS
VF46 - MAINT CANCELLATION LIST
VF31 - ISSUE BILLING DOC
VFP1 - SET BILLING DATE
VARR - ARCHIVE DOCUMENTS
VL01N - CREATE DELIVERY
VL02N - TO CHANGE DELIVERY WHICH IS ALREADY CREATED
VL03N - DISPLAY DELIVERY
V/08 - TO CHANGE CONDITION (PR PROCEDURE)
V/30 - DEFINE PRINT PARAMETERS
FD32 - SETTING CREDIT LIMIT FOR CUSTOMER
/NSM12 - TO REMOVE LOCK ENTRY
SM30 - MAINTAIN TABLE VIEWS
SE75 - SAP SCRIPT SETTINGS FOR TEXT IDS AND OBJECTS,GRAPHIC OBJECTS AND IDS,STANDARD SYMBOLS.
SMARTFORMS - TO CREATE FORMS
ND59 - LIST CUSTOMER MATERIAL INFO
VB0F - UPDATE BILL DOC

SAP Production Planning Table

Demand Management

PBED Independent Requirements Data
PBIM Independent Requirements by Material

Repetitive Manufacturing

SAFK RS Header Master Data
S025 LIS -- Run Schedule Quantities
S026 LIS -- Material Usage
S028 LIS -- Reporting Point Statistics
CEZP Reporting Point Document Logs
CPZP Reporting Points - Periodic Totals

MRP Records

MDKP MRP Document Header Data
MDTB MRP Table Structure (no data)
PLSC Planning Scenario (Long-term Planning)
MDFD MRP Firming Dates
MDVM Planning File Entries
S094 LIS -- Stock/Requirements Analysis

Reservations

RESB Reservations/Dependent Requirements

Planned Orders

PLAF Planned Orders

Discrete Production

AFKO Order Header
AFPO Order Item Detail
AFVC Order Operations Detail
AFFL Order Sequence Details
AFFH Order PRT Assignment
AFBP Order Batch Print Requests
AFRU Order Completion Confirmations
AFFW Confirmations -- Goods Movements with Errors
AFRC Confirmations -- Incorrect Cost Calculations
AFRD Confirmations -- Defaults for Collective Confirmation
AFRH Confirmations -- Header Info for Confirmation Pool
AFRV Confirmation Pool
AFWI Confirmations -- Subsequently Posted Goods Movements

Classification

KLAH Class Detail
CABN Characteristic Detail
AUSP Characteristic Values
CAWN Characteristic Values
CAWNT Characteristic Value Texts
KSML Characteristic Allocation to Class
KSSK Material Allocation to Class

Work center

CRHH Work center hierarchy
CRHS Hierarchy structure
CRHD Work center header
CRTX Text for the Work Center or Production Resource/Tool
CRCO Assignment of Work Center to Cost Center
KAKO Capacity Header Segment
CRCA Work Center Capacity Allocation
TC24 Person responsible for the workcenter
CRCO Allocation of costcentre to workcentre
S022 Order Operation Data for Work Center

Routings/operations

MAPL Allocation of task lists to materials
PLAS Task list - selection of operations/activities
PLFH Task list - production resources/tools
PLFL Task list - sequences
PLKO Task list - header
PLKZ Task list: main header
PLPH Phases / suboperations
PLPO Task list operation / activity
PLPR Log collector for tasklists
PLMZ Allocation of BOM - items to operations

Bill of material

STKO BOM - header
STPO BOM - item
STAS BOMs - Item Selection
STPN BOMs - follow-up control
STPU BOM - sub-item
STZU Permanent BOM data
PLMZ Allocation of BOM - items to operations
MAST Material to BOM link
KDST Sales order to BOM link

Production orders

AUFK Production order headers
AFIH Maintenance order header
AUFM Goods movement for prod. order
AFKO Order header data PP orders
AFPO Order item
RESB Order componenten
AFVC Order operations
AFVV Quantities/dates/values in the operation
AFVU User fields of the operation
AFFL Work order sequence
AFFH PRT assignment data for the work order(routing)
JSTO Status profile
JEST Object status
AFRU Order completion confirmations
PRT’s voor production orders
AFFH PRT assignment data for the work order
CRVD_A Link of PRT to Document
DRAW Document Info Record
TDWA Document Types
TDWD Data Carrier/Network Nodes
TDWE Data Carrier Type

Planned orders
PLAF Planned orders

KANBAN

PKPS Kanban identification, control cycle
PKHD Kanban control cycle (header data)
PKER Error log for Kanban containers

Reservations

RESB Material reservations
RKPF header

Capacity planning

KBKO Header record for capacity requirements
KBED Capacity requirements records
KBEZ Add. data for table KBED (for indiv. capacities/splits)

Planned independent requirements

PBIM Independent requirements for material
PBED Independent requirement data
PBHI Independent requirement history
PBIV Independent requirement index
PBIC Independent requirement index for customer req.

Important PP tables are..

Master Data:
CRHD Work center header
MAPL Allocation of task lists to materials
PLAS Task list - selection of operations/activities
PLFH Task list - production resources/tools
PLFL Task list - sequences
PLKO Task list - header
PLKZ Task list: main header
PLPH Phases / suboperations
PLPO Task list operation / activity
PLPR Log collector for tasklists
PLMZ Allocation of BOM - items to operations

Production Orders:
STKO BOM - header
STPO BOM - item
STAS BOMs - Item Selection
STPN BOMs - follow-up control
STPU BOM - sub-item
STZU Permanent BOM data
PLMZ Allocation of BOM - items to operations
MAST Material to BOM link
KDST Sales order to BOM link
AUFK Production order headers
AFIH Maintenance order header
AUFM Goods movement for prod. order
AFKO Order header data PP orders
AFPO Order item
RESB Order componenten
AFRU Order completion confirmations

Planned orders and Independent requirements:
PLAF Planned orders
RESB Material reservations
PBIM Independent requirements for material
PBED Independent requirement data
PBHI Independent requirement history
PBIV Independent requirement index
RKPF header

Capacity Planning:
KBKO Header record for capacity requirements
KBED Capacity requirements records
KBEZ Add. data for table KBED (for indiv. capacities/splits)

Important Transcation:

CA – usually reserved for routing type transactions. This includes reference rate routings and rate routings.

CA31, CA32, CA33: Reference Rate Routing Creationg
CA21, CA22, CA23: Rate Routing Creationg
CA63, CA64 – Change documents for Routings
CA80, CA85, CA90, CA95, CA98: Where Used, Replacing Routings, etc.

CR – Usually reserved for work center type transactions.
CR01, CR02, CR03: Work Center Creation
CR05, CR07, etc. – Work Centers analysis, etc.

CS – Usually reserved for BOM type transactions.
CS01, CS02, CS03 – Bill of Materials
CS07, CS08, CS09: Extend Bill of materials
CS11, CS12, CS13: Explode Bill of materials

F – Usually reserved for financial type transactions
A – Usually reserved for financial type transactions.

LM – Label Management type transactions

MB – Usually reserved for inventory type transactions
MB51 – Material document history
MB1A – Goods Issue for Scrap
MB1B – Goods transfer

MD – Usually reserved for MRP type transactions
MD01, MD02, MD03, MDBT - MRP Run
MD04, MD07: Stock/Requirements List
MD05, MD06: MRP List (static)
MD11, MD12, MD13, MD16: Planned Order creation, etc
MD20, MD21: Planning file

ME – Usually reserved for Purchasing Type Transactions
ME01, ME03, ME05 – Source Lists
ME11, ME12, ME13 – Info Records
ME21N, ME22N, ME23N: Purchase Order creation
ME31L, ME32L, ME33L: Scheduling Agreement Creation
ME51, ME57 – Purchase Requisitions
ME38, ME38: Schedule Line display
ME37: Stock Transport Scheduling Agreements
ME27: Stock Transport Orders

MM – Usually reserved for material master type transactions:
MM01, MM02, MM03: Material Master Creation
MM04 – Change Documents
MM06: Mark for Deletion
MM60: Materials List

V – Usually reserved for Sales and Distribution type transactions
VA – Sales Orders
VL – Deliveries
VT – Shipments
VD – Customer Master for Sales
VK – Condition Records


PFCG: Role Maintenance (Profile Generator)
Simple and composite roles can be created using this transaction. You can describe the functions (such as Create/Edit/Delete/and many more) that the role is to include. You can assign transactions to the role on the menu tab. The menu options selected in this step are displayed in the session manager and on the 'SAP easy access logon screen as the User menu for all users who are assigned to the role.

Using PFCG - A Sample Scenario:
1. Write a name, for example ZTWS, in Role Name.
2. Click on Create Role and write a description for the role, such as "Role for the TWS user".
3. Save the role.
4. Select the Authorizations tab.
5. Click on Change Authorization Data.
6. In the ensuing pop-up select Templates.
7. Manually add the authorization objects.
8. Fill the authorization values accordingly.
9. Save the authorizations.
10. Generate a profile. Use the same name you wrote in Role Name.
11. Exit the authorization management window and select the User tab.
12. Add the Tivoli Workload Scheduler user to the role.
13. Save the role.

SUIM: User Information System

SM12: Select Lock Entries
There are times when the R/3 connection gets too slow and we ABAPers face problems because of the programs getting locked for editing. We see messages like " is currently editing the code" while we are not. This is when SM12 comes into action.

Using SM12
1. Go to SM12
2. Specify Client & Username (yours)
3. Execute and you will see a lock entry list
4. Simply select the item and delete lock... thats it!

SE75: SAPscript settings
We come across situations where we would have to create/modify existing text-ids. Trust me, it's real simple... thanks to transaction SE75

Using SE75 - Creating text-ids

1. Go to SE75
2. Select textobjects and ids radiobutton
3. Click on change button
4. Double click textobject for which u want to create TextID
5. Click create button

ABAP Tips and Programs

http://www.henrikfrank.dk/abaptips/abapindex.htm
http://www.sapdevelopment.co.uk/tips/tipshome.htm
http://www.kabai.com/abaps/q.htm
http://www.onestopsap.com/
http://www.planetsap.com/Tips_and_Tricks.htm




BAPI Step by Step

This article demonstrates in a step-by-step process to write ABAP Reports that use BAPI function modules.
BOR Definition
All SAP Business Object types and SAP Interface Types and their methods are defined and described in the R/3 Business Object Repository (BOR). The Business Object Repository was introduced in R/3 Release 3.0, at the same as time as SAP Business Objects and SAP Business Workflow. Presently, the BOR is mainly used by SAP Business Workflow.
The BOR has two essential functions:

It defines and describes SAP Business Objects and SAP Interface Types and their BAPIs.

It creates instances of SAP Business Objects
BAPI programming
BAPIs are defined in the Business Object Repository (BOR) as methods of SAP Business Objects or SAP Interface Types and are implemented as function modules. The separation of a BAPI definition from its actual implementation enables you to access a BAPI in two ways:
You can call the BAPI in the BOR through object-oriented method calls
You can make RFC calls to the function module on which the BAPI is based
Some Standard BAPI’S
GetList
Delivers a list of key fields objects that satisfies certain selection Criteria
GetDetail
Delivers detailed information of an object, whose complete key has been Specified
CreateFromData
Generates new objects in R3 from key fields and returns information.

The code to illustrate the steps involved when the BAPI ActiveX Control is used to access BAPIs .
­ Creating a BAPI ActiveX Control object
Set oBAPICtrl = CreateObject(“SAP.BAPI.1”)
­ Creating a logon control object:
Set oLogonCtrl = CreateObject(“SAP.Logoncontrol.1")
­ Creating a connection object to the R/3 System:
Set oBAPICtrl.Connection = oLogonCtrl.NewConnection
­ Logging on to R/3 System by calling the logon method of the connection object:
If oBAPICtrl.Connection.Logon(frmStart.hwnd,FALSE) = FALSE then MsgBox"R/3 Connection failed" End Endif
Selecting the BAPI
1. Give Transaction BAPI
Now based on you requirement you have to search for BAPI, Here we are going to search for BAPI related to Purchase Order. Purchase order is in MM so we select that from the list.
We have to get purchase order detail, So Double click on the ‘GetDetail’. The right frame will show the BAPI name.

Now Expand The GetList. you will get the screen as below
We need Purchase Order Header detail, so double Click Header; you will get Right Frame with the Dictionary Reference. The Dictionary Reference is BAPIEKKO; Note that you have to use that in Report. Double click that BAPIEKKO to see the fields that can be displayed in Report.



Note down the Fields name from the Components Column that you need in the Report output.
Frequently used BAPI:
Sales and Distribution
Customer Material Info BAPI_CUSTMATINFO_GETDETAILM
Sales order BAPI_SALESORDER_GETLIST
Sales order BAPI_SALESORDER_GETSTATUS
Material Management
Purchase Req Item BAPI_REQUIREMENT_GET_LIST
Purchase order BAPI_PO_GETDETAIL
Purchase order BAPI_PO_GETITEMS
Purchase order BAPI_PO_GETITEMSREL
Purchase order BAPI_PO_GET_LIST
Purchasing info BAPI_INFORECORD_GETLIST
Production and Planning
Planned order BAPI_PLANNEDORDER_GET_DETAIL
Planned order BAPI_PLANNEDORDER_GET_DET_LIST
Planned Indep Reqmt BAPI_REQUIREMENTS_GETDETAIL
Finance
AP Account BAPI_AP_ACC_GETOPENITEMS
AP Account BAPI_AP_ACC_GETOPENITEMS
Debtor Credit Account BAPI_CR_ACC_GETDETAIL
AR Account BAPI_AR_ACC_GETOPENITEMS
AR Account BAPI_AR_ACC_GETPERIODBALANCES
AR Account BAPI_AR_ACC_GETSTATEMENT
ABAP Report using BAPI
Now in The ABAP editor (SE38) create a new report and write the Code
*&---------------------------------------------------------------------*
*&amp; Report ZBAPI_1
*&
*&---------------------------------------------------------------------*
*&
*& BAPI TO GET PO ITEM DETAILS
*&---------------------------------------------------------------------*
REPORT ZBAPI_1.
DATA : BEGIN OF I_POITEM OCCURS 0.
INCLUDE STRUCTURE BAPIEKPO. “Include the Structure of dictionary Ref.
DATA : END OF I_POITEM.
PARAMETERS P_EBELN LIKE EKKO-EBELN default '4500012164'.. “ Input .
CALL FUNCTION 'BAPI_PO_GETDETAIL'
EXPORTING
PURCHASEORDER = P_EBELN
* ITEMS = 'X'
* ACCOUNT_ASSIGNMENT = ' '
* SCHEDULES = ' '
* HISTORY = ' '
* ITEM_TEXTS = ' '
* HEADER_TEXTS = ' '
* SERVICES = ' '
* CONFIRMATIONS = ' '
* SERVICE_TEXTS = ' '
* EXTENSIONS = ' '
* IMPORTING
* PO_HEADER =
* PO_ADDRESS =
TABLES
* PO_HEADER_TEXTS =
PO_ITEMS = I_POITEM. “ Assign the Internal Table
* PO_ITEM_ACCOUNT_ASSIGNMENT =
* PO_ITEM_SCHEDULES =
* PO_ITEM_CONFIRMATIONS =
* PO_ITEM_TEXTS = .
* PO_ITEM_HISTORY =
* PO_ITEM_HISTORY_TOTALS =
* PO_ITEM_LIMITS =
* PO_ITEM_CONTRACT_LIMITS =
* PO_ITEM_SERVICES =
* PO_ITEM_SRV_ACCASS_VALUES =
* RETURN =
* PO_SERVICES_TEXTS =
* EXTENSIONOUT =
LOOP AT I_POITEM.
WRITE :/ 'PO NUMBER = ' , I_POITEM-PO_NUMBER COLOR COL_HEADING,
/ 'ITEM = ' , I_POITEM-PO_ITEM,
/ 'MATERIAL NAME = ' , I_POITEM-MATERIAL,
/ 'MATERIAL = ' , I_POITEM-PUR_MAT,
/ 'CHANGED ON = ', I_POITEM-CHANGED_ON,
/ 'SHORT TEXT = ' , I_POITEM-SHORT_TEXT,
/ 'COMPANY CODE = ' , I_POITEM-CO_CODE,
/ 'PLANT = ' , I_POITEM-PLANT,
/ 'MATERIAL GROUP = ' , I_POITEM-MAT_GRP,
/ 'QUANTITY = ' , I_POITEM-QUANTITY LEFT-JUSTIFIED,
/ 'UNIT = ' , I_POITEM-UNIT,
/ 'NET PRICE = ' , I_POITEM-NET_PRICE LEFT-JUSTIFIED.
ULINE.
ENDLOOP.

Note: You can write any no fields from the Dictionary BAPIEKPO in the output, just
Note the field and give that in the Write statement within LOOP…ENDLOOP
Execute to view the output
Testing the Report:
Give transaction ME23 and give the Purchase order no, you can see the details of the report there.

BDC Session method: Step by Step Method

BDC Session method: Step by Step Method

For a BDC upload you need to write a program which created BDC sessions.

Steps:

  • Work out the transaction you would use to create the data manually.
  • Use transaction SHDB to record the creation of one material master data. Click the New recording button or the Menu - Recording - Create
  • Save the recording, and then go back a screen and go to the overview.
  • Select the recording and click on Edit - Create Program. Give the program a Z name, and select transfer from recording.
  • 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:
  • After the start-of-selection, Call ws_upload to upload the file (the excel file needs to be saved as TAB separated).
  • 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

An overview idea about Adobe Forms

>> Adobe Forms - Example Program

An overview idea about Adobe Forms

Using SFP , first you need to create a interface . in interface you can declare the import and export parameters and also the declaration part, coding etc : This is nothing but similar to Function module interface.

And now we have to create the Form which is interactive. Create the form and enter the interface name which you have created in first step, so that the parameters , declarations of fields etc : will be copied and available in the form layout. So that you can drag and drop these declared fields ( dclared fields of interface ) to the layout.

Create the context and layout in the form.
The layout generated can be previewed and saved as PDF output.
Now we need to integrate the driver program and the PDF form to get the final output as per the requirement.

On activating and executing the form you will get a function module name just similar to smartforms.

The driver program needs to call this FM.


Refer to the below sample code :

DATA : is_customer TYPE scustom.
DATA : it_bookings TYPE ty_bookings.
DATA : iv_image_url TYPE string.
DATA : iv_sending_country TYPE adrc-country.
DATA : it_sums TYPE TABLE OF flprice_t.
DATA : docparams TYPE sfpdocparams.
DATA : formoutput TYPE fpformoutput.
DATA : outputparams TYPE sfpoutputparams.
PARAMETERS : pa_cusid TYPE scustom-id.

SELECT SINGLE * FROM scustom INTO is_customer
WHERE id = pa_cusid.

SELECT * FROM sbook
INTO CORRESPONDING FIELDS OF TABLE it_bookings
WHERE customid = pa_cusid.

outputparams-nodialog = 'X'.
outputparams-getpdf = 'X'.
*outputparams-adstrlevel = '02'.

CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

docparams-langu = 'E'.
docparams-country = 'US'.
docparams-fillable = 'X'.

CALL FUNCTION '/1BCDWB/SM00000043'
EXPORTING
/1bcdwb/docparams = docparams
is_customer = is_customer
it_bookings = it_bookings
* IV_IMAGE_URL =
iv_sending_country = 'US'
* IT_SUMS =
IMPORTING
/1bcdwb/formoutput = formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Table Maintenance in SAP – A Step by Step Guide

  1. Step 1: Create & Maintain Table (SE11)
  2. Screen 101: ABAP Dictionary: Initial Screen

Screen 102: Maintain Table -> Delivery and Maintenance

Screen 103: Maintain Table -> Fields

  1. [] SE11: Enter Table Name -> Create
  2. Enter Table Description (Mandatory Field)
  3. Select Delivery Class
  4. Set maintenance level
  5. Enter Fields, Assign Data Elements
  6. Save Entries
  7. Check Inconsistencies
  8. Activate Table
  9. Go To Technical Settings (SCREEN 104)

Delivery Class: The delivery class controls the transport of table data wheninstalling or upgrading, in a client copy and when transporting between customersystems. The delivery class is also used in the extended tablemaintenance.

There are the following delivery classes:

A: Application table (master and transaction data).

C: Customer table, data is maintained by the customer only.

L: Table for storing temporary data.

G: Customer table. The customer namespace must be defined in table TRESC. (UseReport RDDKOR54 here).

E: System table with its own namespaces for customer entries.

S: System table, data changes have the same status as program changes.

W: System table (e.g. table of the development environment) whosedata is transported with its own transport objects (e.g. R3TR PROG, R3TR TABL,etc.).

Data Browser/Table View Maint.: This indicator specifies whether it is possible to display/maintain a table or view using the maintenance tools Data Browser (transaction SE16) and table view maintenance (transactionsSM30 and SM31).

MANDT field is mandatory for Client dependant tables

Technical Settings: The technical settings control, for example, table buffering.

Indexes: To speed up data selection, you can create secondary indexes for the table

Append Structure: Append structures are used for enhancements that are not included in the standard.

Screen 104: Maintain Technical Settings

  1. Select Data Class (Mandatory) [APPL0]
  2. Select Size Category (Table size - No. of records - Mandatory) [1 to 6]
  3. Specify Buffering [allowed / not allowed]
  4. Save
  5. Check Inconsistencies
  6. Activate & Go Back to “Maintain Table Screen”

Data Class: The data class defines the physical area of the database (for ORACLEthe TABLESPACE) in which your table is logically stored. If you choose a dataclass correctly, your table will automatically be assigned to the correct areawhen it is created on the database.

The most important data classes are (other than the system data):

APPL0 Master data

APPL1 Transaction data

APPL2 Organizational and customizing data

Size category: The size category determines the probable space requirement for a table in the database.

Buffering: The buffering status specifies whether or not a table may be buffered.Screen 105: Maintain Table

Screen 105: Maintain Table

Screen 106: Maintain Enhancement Category (ECC 6.0 onwards)


  1. -> Extras -> Enhancement Category
  2. Select Enhancement Category


Enhancement Category: Structures and tables that were defined by SAP in the ABAPDictionary can be enhanced subsequently by customers using Customizing includesor append structures. The enhancements do not only refer to structures/ tablesthemselves, but also to dependent structures that adopt the enhancement as aninclude or referenced structure. Append structures that only take effect at theend of the original structure can also cause shifts - in the case of dependentstructures - even within these structures.

Screen 107: Maintain Table -> Table Maintenance Generator

In this screen go to utilities menu and select Table Mai8ntenence generator

Screen 108: Generate Table Maintenance Dialog: Generation Environment

  1. -> Utilities -> Table Maintenance Generator OR [] SE54
  2. Specify Authorization Group [&NC&]
  3. Select Maintenance type [One Step/Two Step]
  4. Mention Screen Numbers [1/2]
  5. Save & Go Back

Single step: Only overview screen is created i.e. the Table Maintenance Program will have only one screen where you can add, delete or edit records.Two step: Two screens namely the overview screen and Single screen are created. The user can see the key fields in the first screen and can further go on to edit further details.

Step 2: Generate Table Maintenance (SE54)

Screen 201: Generate Table Maintenance Dialog: Initial Table/View Screen

Screen 202: Generate Table Maintenance Dialog: Initial Table/View Screen


  1. Enter Table/View name
  2. -> Edit View Cluster
  3. -> Create View


The Table Maintenance Generator: Used to a create table maintenance program to add, modify or delete records in the database table. This can be accessed using transaction SE54 or in SE11 using the menu Utilities->Table Maintenance Generator.

Screen 203: Change View “Header Entry”: Details

Screen 204: Change View “Object Structure”: Overview

  1. -> Header Entry -> Enter Short text -> Activate View
  2. -> Object Structure -> Enter Table name & description
  3. -> Field-dependence -> Generate -> Header entry -> Activate View

Step 3: Create & Maintain Transaction (SE93)
Screen 301: Maintain Transaction

Screen 302: Create Transaction

  1. [] SE93 Enter Transaction name -> Create
  2. Enter Short text
  3. -> Transaction with parameters

Why Select “Transaction with parameters”? Parameter transactions allow youto pre-assign values to the fields on the initial screen.

If you supply all of the necessary entries for the initial screen in this way, you can suppressthe screen when the transaction is executed.

Screen 303: Create Parameter Transaction


  1. Enter Transaction text
  2. Enter default transaction [SM34]
  3. -> Skip Initial Screen
  4. Enter Names of Screen fields and values [VCLDIR-VCLNAME = SHOW = 'X']

And we are DONE! Maintain your Table/View
Screen 401: Change View “View description”: Overview

Screen 402: New Entries: Overview of Added Entries
  1. -> New Entries
  2. Go on adding new entries

Development Guidelines

1.1. General

  • Only one statement per line
  • Use a template for creation of ABAP programs with the standard includes
  • Indent the program for readability

  • Creation of variables
  1. Parameter – P_
  2. Select option – S_
  3. Radio button – RB_
  4. Ranges – R_
  5. Checkbox – PX_
  6. Constants – C_
  7. Counters – N_
  8. Internal tables – IT_
  9. Sorted – IS_
  10. Hashed – IH_
  11. Structure – X_
  12. Flags – FG_
  13. Global variables – G_
  14. Local variables – L_
  15. All literals that are displayed on a report must use Text Elements
  16. Use GUI_UPLOAD and GUI_DOWNLOAD to upload or download data

1.2. Guidelines for Internal tables
  • Read internal table WITH KEY particularly for sorted and hashed
  • Read only the needed fields thru TRANSPORTING
  • Use the BINARY search wherever possible
  • Avoid nested looping
  • Avoid COLLECT statement
  • Specify the sort fields
  • Use COMPARING for deleting duplicate data in the internal tables
  • Do not use index operations while populating sorted tables
  • Do not resort a sorted type of an internal table
  • Index operations cannot be used on hashed tables
  • Do not use OCCURS 0 in the declaration unless less than 8K data is stored.
  • Use CLEAR to initialize the header record
  • Use REFRESH to clear the contents of the internal table. This statement does not clear the header record
  • Use FREE to free the resources used by the internal table

1.3. Optimization

  • Remove all code and variables that are not used in the program
  • Perform the Extended Program Check
  • Use selection criteria to effectively select and limit the number of database reads
  • Select only those columns that are needed – Do not use a SELECT * unless necessary
  • Use aggregate functions wherever required
  • To update table entries, specify the columns
  • Use a SELECT SINGLE if the primary keys are known, otherwise SELECT UPTO 1 ROWS
  • Do not use nested SELECTs – Use views, joins or the FOR ALL ENTRIES option
  • Do not use SELECTs in loops
  • Restrict the database access by using the WHERE clause – do not use a CHECK
  • Use indexes wherever available
  • Avoid NOT in the WHERE condition
  • Do not select the same data more than once
  • To populate an internal table thru a SELECT, use the INTO addition
  • Use sort on the internal table for small amounts of data and database ORDER BY for larger amount

Popular SAP Function modules

This is an article where I have listed few of the SAP function Modules,which are available in the system and can be used for various purposes,Some of them are left undocumented, which are left for further exploration.User may explore them and find out how useful they can be for their purposes.

1 .WS_DOWNLOAD: File transfer from internal table into presentation server file.

2. WS_UPLOAD: File transfer from presentation server file to internal table. This function Module transfers file from workstation to SAP System. Pass on the name of ASCII file user wants to upload and that gets uploaded in memory.

3. WS_EXECUTE: This function can be used to execute any executable program from your presentation server to SAP Server.

4. WS_FILE_COPY: This function takes destination file name and source file name as parameters and then copies existing file to the new file.

5. TH_CREATE_MODE: This function creates another session in your system with the transaction passed as parameter to the function module.

6. SYSTEM_DEBUG_BREAKPOINTS / RS_DELETE_BREAKPOINT: The First function module returns the number of breakpoint there in the Program with the line number on which the break point is set. Another Function uses the earlier Function Module.

7. EDITOR_SYNTAX_CHECK: This can be used to check if they're in any syntax error in the program code.

8. SAPWL_REPORT_TCODE_TEXT_COPY: the Function module returns the Description / text for transaction or report name passed as an input parameter.

9. RS_DYNPRO_UPLOAD/DOWNLOAD: We can upload and download screens also the way we upload and download reports With the help of these functions.

10. RS_HELP_SELSCREEN: This function calls the specified help screen.

11. RS_ALL_SELECTIONSCREENS: This function returns the selection screen for the report program.

12. RS_WARNING_BOX: This function displays pop-up warning window for the situation gives and with the text. If situation = ' ' it displays the text passed by user otherwise it takes the text specified in the function module. It displays the message after the user selects either of the condition YES/NO/CANCEL.

13. RSPO_PROCESS_FRONTEND_JOBS: The function Module processes the entire spool request for the foreground jobs for any terminal.

14. SOUND_CREATE

15. SOUND_PLAY

16. SOUND_STOP

17. SO_DYNP_SHORT_MESSAGE: This function initiates the E-mail sender window and sends the mail to user passed as a parameter.

18. SO_DYNP_OBJECT_SEND/SO_GOTO_SEDN_DYNP: the function calls the screen where user selects the user name from the drop down menu and sends the message.

19. SO_INBOX_ENTRIES_COUNT: SAPuser whose inbox is to be viewed has to passed as a parameter and this function counts read/unread/Total messages in the inbox.

20. SO_FAX_DATA_DYNPRO: This function module is used to send fax via SAP System.

21. SO_OFFICE_USER_INSERT:

22. SO_RECEIVER_CHECK: The function checks if the user exists or not.

23. SO_USER_INSERT_ASYNCHRON:

24. SO_USER_DELETED_CHANGE:

25. SO_USER_AUTOMATIC_INSERT:

26. SO_USER_SO_KEY_GENERATE:

27. SO_USER_ADDR_REFERENCE_CHANGE:

28. SO_USER_USRADR_UPDATE:

29. POPUP_WITH_WARNING: The Function can be used to display a warning and continue the job with 2 lines of display text and an option button to continue.

30. POPUP_FOR_INTERACTION: The popup gives user 3 option buttons and 6 lines of text for display on the screen and the advantage is user can change the display Icon according to Requirement (W: Warning, I: Information, E: Error) etc.

31. POPUP_TO_DECIDE: User gets 3 lines of text and 3 options to choose from (YES/NO/CANCEL).

32. POPUP_TO_DECIDE_WITH_MESSAGE: user gets 6 lines of message to be displayed on the screen with 3 option button same as above.

33. POPUP_TO_GET_ONE_VALUE/POPUP_TO_FETCH_ONE_VALUE: using this function module user can pass on any string value to the program with 3 lines of text and 2 options.

34. POPUP_TO_GET_VALUE: This function can be used in a program to return some value to user through a popup on the screen.

35. POPUP_TO_CONFIRM_STEP/POPUP_TO_DECIDE_INFO: This function gives 2 lines of text and 2 option buttons for confirmation.

36. POPUP_TO_CONFIRM_DATA_LOSS: the function can be used as information window with a system defined message text.

37. CHANGEDOCUMENT_READ_POSITIONS: The function module is used to return the old/new values of the amended purchase order by passing the change no. / Table name (that's Modified) and the Table Key (Concatenated Field that had client id + Purchase Order no + Purchase Item etc). It will return all the changes made if we pass on the change no only. Look at table CDPOS / CDHDR for the values to be passed.

38. Z_BATCH_CHAR: The function module returns most of the batch characteristics passing the material and batches no. The function is used in many reports to improve their performances.

39. SAPGUI_PROGRESS_INDICATOR / Z_PROGRESS: These function modules can be used to display a Progress bar while the Program is in execution.

40. SAPGUI_SET_FUNCTIONCODE: Set a function code and continue processing (To be explored)

41. SAPGUI_EXPLORER_INPUT / OUTPUT: Has to be explored (not activated in our system) May be of vital importance for Programming.

41: CUSL_BATCH_HAS_VALUES: (To be explored further)

Import parameter Ref. field/struc
MATERIAL MARA-MATNR *
PLANT MARC-WERKS
BATCH MCHA-CHARG
BATCH_CUOBJ INOB-CUOBJ
CLASSTYPE KLAH-KLART *
BATCH_TABLE TCLA-OBTAB *
LANGUAGE SY-LANGU (EN)

(*) Is mandatory entry.

42. CLSE_SELECT_AUSP: Database access for table AUSP

Import parameter Ref. field/struc
KLART AUSP-KLART
OBJEK AUSP-OBJEK
ATINN AUSP-ATINN
MAFID AUSP-MAFID
KEY_DATE RMCLS-KEY_DATE
ATCOD AUSP-ATCOD

43. CLSE_SELECT_CABN:

44. CLSE_SELECT_CABNT: Read and buffer CABNT entries for classification system

45. CLSE_SELECT_KLAH:

46. CLSE_SELECT_KSSK:

47. CLSE_SELECT_CAWN:

48. CLSE_SELECT_CAWNT:

49. REQUIREMENTS_DISPLAY_CHAR: Display of characteristic values in plnd indep. Reqmts /purchasing

50. WS_FILENAME_GET: This function makes the windows browsing utility opened through SAP Program and user can browse through the presentation server to locate any file, providing the extension mask.

51. WS_FILE_DELETE: The function can be used to delete files from the presentation layer with windows operating system, providing the file name to be deleted.

52.Dealing with Currency / Amounts...
Rounding off Amounts:

CALL FUNCTION 'J_1I6_ROUND_TO_NEAREST_AMT'
EXPORTING
I_AMOUNT = V_KWERT “ Amount to convert
* I_AMOUNT1 =
* I_AMOUNT2 =
* I_AMOUNT3 =
* I_AMOUNT4 =
* I_AMOUNT5 =
* I_EXADDTAX1_AMOUNT =
* I_EXADDTAX2_AMOUNT =
* I_EXADDTAX3_AMOUNT =
IMPORTING
E_AMOUNT = V_AMOUNT “ Rounded Amount
* E_AMOUNT1 =
* E_AMOUNT2 =
* E_AMOUNT3 =
* E_AMOUNT4 =
* E_AMOUNT5 =
* E_EXADDTAX1_AMOUNT =
* E_EXADDTAX2_AMOUNT =
* E_EXADDTAX3_AMOUNT =

53.Spell Amount:

CALL FUNCTION 'HR_IN_CHG_INR_WRDS'

EXPORTING
AMT_IN_NUM = V_STOTAL “ Amount to spell

IMPORTING
AMT_IN_WORDS = V_TOTWORDS “ Amount spelt
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING
AMOUNT = V_AMOUNT " Amount to be spelt
CURRENCY = PWAERS " Currency
FILLER = SPACE " Space filler
LANGUAGE = 'E' " Language

IMPORTING
IN_WORDS = V_SPELL " Amount Spelt
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.

54. F4 Help for Date:

CALL FUNCTION 'F4_DATE'
EXPORTING
DATE_FOR_FIRST_MONTH = DATE
DISPLAY = HELPDISP
IMPORTING
SELECT_DATE = DATE
EXCEPTIONS
OTHERS = 4.

55. HAZMAT_GET_PREVIOUS_DAY - to get previous day
56. DATE_TO_DAY - To get the day of the date
57. AZMAT_GET_PREVIOUS_DAY - to get previous day
58. DATE_TO_DAY - To get the day of the date
59. HR_IN_CHG_INR_WRDS - Conver amount in words
60. F4_DATE - f4 help for date
61. FTR_CORR_SWIFT_DELETE_ENDZERO - To compress the decimals
62. HR_SGPBS_YRS_MTHS_DAYS - to calculate no days,months and years

Eg:
REPORT z_noof_days_months_years .
PARAMETERS:p_bdate TYPE sy-datum, " Begin Date
p_cdate TYPE sy-datum DEFAULT sy-datum. " Curent Date
DATA:v_months TYPE i,
v_days TYPE i,
v_years TYPE i,
v_tdays TYPE i.
CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
EXPORTING
beg_da = p_bdate
end_da = p_cdate
IMPORTING
no_day = v_days
no_month = v_months
no_year = v_years
no_cal_day = v_tdays.
write:/ 'Age: ',v_years ,'Years ',v_months, 'Months ', v_days ,'Days.'.