Welcome To My BLOG
This site is to give a brief idea for the abap learners who are looking for some real time programs .It consists of collection of programs from my side . I hope these programs are very much used for all of the learners. Please check the links for any information in ABAP.
Please vote for my Blog. And please input me on this mail addrssess.Email me
Please vote for my Blog. And please input me on this mail addrssess.Email me
Share this link with your friends
http://www.rebtel.com/u/15163104576
Tuesday, April 19, 2011
Monday, April 18, 2011
Upload Images in SE78 using SE38
REPORT ZINHP_UPLOAD_SIGNATURE .
Description..............: UPLOAD IMAGES .
**********************************************************************
TYPE-POOLS TRUXS.
DATA L_V_RAW TYPE TRUXS_T_TEXT_DATA.
*===Data declaration
DATA : " L_filname type rlgrap-filename,
" l_name TYPE stxbitmaps-tdname,
L_OBJECT TYPE STXBITMAPS-TDOBJECT,
L_ID TYPE STXBITMAPS-TDID,
L_BTYPE TYPE STXBITMAPS-TDBTYPE,
L_FORMAT TYPE DAPPL,
" L_title like bapisignat-prop_value,
L_RESIDENT TYPE STXBITMAPS-RESIDENT,
L_AUTOHEIGHT TYPE STXBITMAPS-AUTOHEIGHT,
* l_bmcomp TYPE stxbitmaps-bmcomp,
L_DOCID TYPE STXBITMAPS-DOCID,
L_RESOLUTION TYPE STXBITMAPS-RESOLUTION.
*=== Internal table
DATA: BEGIN OF G_TY_UPLOAD OCCURS 0,
F_NAME LIKE RLGRAP-FILENAME,
T_NAME LIKE STXBITMAPS-TDNAME,
DESC LIKE BAPISIGNAT-PROP_VALUE,
END OF G_TY_UPLOAD.
*=== Internal table for output
DATA G_T_FINAL LIKE TABLE OF G_TY_UPLOAD WITH HEADER LINE.
*===selection screen for input
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE HEADER.
PARAMETERS : L_FILNAM LIKE RLGRAP-FILENAME.
* l_name like stxbitmaps-tdname,
* l_title LIKE bapisignat-prop_value.
SELECTION-SCREEN: END OF BLOCK B1.
*===initilization
INITIALIZATION.
MOVE TEXT-002 TO HEADER.
*===selection screen for F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR L_FILNAM.
*===F4 help for getting file name
PERFORM F4_HELP.
*===start-of-selection
START-OF-SELECTION.
*=== To convert XLS to SAP
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR = 'X'
* I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = L_V_RAW
I_FILENAME = L_FILNAM
TABLES
I_TAB_CONVERTED_DATA = G_T_FINAL.
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
*===Passing values to upload images in SE78
LOOP AT G_T_FINAL.
L_OBJECT = 'GRAPHICS'.
L_ID = 'BMAP'.
L_BTYPE = 'BCOL'. " To set Color or B/w
L_FORMAT = 'BMP'. " File format always " BMP".
L_AUTOHEIGHT = 'X'.
* l_name = g_t_final-desc."l_title.
*=== Importing bitmap images to SAP
PERFORM IMPORT_BITMAP_BDS IN PROGRAM SAPLSTXBITMAPS
USING G_T_FINAL-F_NAME
G_T_FINAL-T_NAME
L_OBJECT
L_ID
L_BTYPE
L_FORMAT
G_T_FINAL-DESC
L_RESIDENT
L_AUTOHEIGHT
* l_bmcomp
CHANGING L_DOCID
L_RESOLUTION.
*==Clear internal tables
CLEAR : G_T_FINAL, L_DOCID , L_DOCID, L_RESIDENT ,L_RESOLUTION.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form F4_HELP
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM F4_HELP.
DATA : LT_FT TYPE FILETABLE.
DATA : LS_FT TYPE FILE_TABLE.
DATA : LV_RC TYPE I.
DATA : LV_ACTION TYPE I.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Filename'
DEFAULT_EXTENSION = 'XLS'
CHANGING
FILE_TABLE = LT_FT
RC = LV_RC
USER_ACTION = LV_ACTION
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 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.
ELSE.
*== if user chooses cancel , do nothing.
IF LV_ACTION = 9.
EXIT.
*== if user chooses Ok , read the filename user choose
ELSEIF LV_ACTION = 0.
READ TABLE LT_FT INTO LS_FT INDEX 1.
IF SY-SUBRC EQ 0.
L_FILNAM = LS_FT-FILENAME.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "F4_HELP
Description..............: UPLOAD IMAGES .
**********************************************************************
TYPE-POOLS TRUXS.
DATA L_V_RAW TYPE TRUXS_T_TEXT_DATA.
*===Data declaration
DATA : " L_filname type rlgrap-filename,
" l_name TYPE stxbitmaps-tdname,
L_OBJECT TYPE STXBITMAPS-TDOBJECT,
L_ID TYPE STXBITMAPS-TDID,
L_BTYPE TYPE STXBITMAPS-TDBTYPE,
L_FORMAT TYPE DAPPL,
" L_title like bapisignat-prop_value,
L_RESIDENT TYPE STXBITMAPS-RESIDENT,
L_AUTOHEIGHT TYPE STXBITMAPS-AUTOHEIGHT,
* l_bmcomp TYPE stxbitmaps-bmcomp,
L_DOCID TYPE STXBITMAPS-DOCID,
L_RESOLUTION TYPE STXBITMAPS-RESOLUTION.
*=== Internal table
DATA: BEGIN OF G_TY_UPLOAD OCCURS 0,
F_NAME LIKE RLGRAP-FILENAME,
T_NAME LIKE STXBITMAPS-TDNAME,
DESC LIKE BAPISIGNAT-PROP_VALUE,
END OF G_TY_UPLOAD.
*=== Internal table for output
DATA G_T_FINAL LIKE TABLE OF G_TY_UPLOAD WITH HEADER LINE.
*===selection screen for input
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE HEADER.
PARAMETERS : L_FILNAM LIKE RLGRAP-FILENAME.
* l_name like stxbitmaps-tdname,
* l_title LIKE bapisignat-prop_value.
SELECTION-SCREEN: END OF BLOCK B1.
*===initilization
INITIALIZATION.
MOVE TEXT-002 TO HEADER.
*===selection screen for F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR L_FILNAM.
*===F4 help for getting file name
PERFORM F4_HELP.
*===start-of-selection
START-OF-SELECTION.
*=== To convert XLS to SAP
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR = 'X'
* I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = L_V_RAW
I_FILENAME = L_FILNAM
TABLES
I_TAB_CONVERTED_DATA = G_T_FINAL.
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
*===Passing values to upload images in SE78
LOOP AT G_T_FINAL.
L_OBJECT = 'GRAPHICS'.
L_ID = 'BMAP'.
L_BTYPE = 'BCOL'. " To set Color or B/w
L_FORMAT = 'BMP'. " File format always " BMP".
L_AUTOHEIGHT = 'X'.
* l_name = g_t_final-desc."l_title.
*=== Importing bitmap images to SAP
PERFORM IMPORT_BITMAP_BDS IN PROGRAM SAPLSTXBITMAPS
USING G_T_FINAL-F_NAME
G_T_FINAL-T_NAME
L_OBJECT
L_ID
L_BTYPE
L_FORMAT
G_T_FINAL-DESC
L_RESIDENT
L_AUTOHEIGHT
* l_bmcomp
CHANGING L_DOCID
L_RESOLUTION.
*==Clear internal tables
CLEAR : G_T_FINAL, L_DOCID , L_DOCID, L_RESIDENT ,L_RESOLUTION.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form F4_HELP
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM F4_HELP.
DATA : LT_FT TYPE FILETABLE.
DATA : LS_FT TYPE FILE_TABLE.
DATA : LV_RC TYPE I.
DATA : LV_ACTION TYPE I.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Filename'
DEFAULT_EXTENSION = 'XLS'
CHANGING
FILE_TABLE = LT_FT
RC = LV_RC
USER_ACTION = LV_ACTION
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 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.
ELSE.
*== if user chooses cancel , do nothing.
IF LV_ACTION = 9.
EXIT.
*== if user chooses Ok , read the filename user choose
ELSEIF LV_ACTION = 0.
READ TABLE LT_FT INTO LS_FT INDEX 1.
IF SY-SUBRC EQ 0.
L_FILNAM = LS_FT-FILENAME.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "F4_HELP
Used to limit user commands on selection-screen
* Used to limit user commands on selection-screen
INCLUDE RSDBC1XX.
* Selection Screen
PARAMETERS: P_CHECK TYPE C.
* Events
AT SELECTION-SCREEN OUTPUT.
APPEND 'PRIN' TO CURRENT_SCR-EXCL.
APPEND 'ONLI' TO CURRENT_SCR-EXCL.
INCLUDE RSDBC1XX.
* Selection Screen
PARAMETERS: P_CHECK TYPE C.
* Events
AT SELECTION-SCREEN OUTPUT.
APPEND 'PRIN' TO CURRENT_SCR-EXCL.
APPEND 'ONLI' TO CURRENT_SCR-EXCL.
Subscribe to:
Posts (Atom)