venerdì 29 febbraio 2008

The UPDATE Parameter

The UPDATE Parameter

You use the UPDATE parameter to specify how updates produced by a transaction should be processed. You can select between these modes:

A Asynchronous updating. In this mode, the called transaction does not wait for any updates it produces to be completed. It simply passes the updates to the SAP update service. Asynchronous processing therefore usually results in faster execution of your data transfer program.

Asynchronous processing is NOT recommended for processing any larger amount of data. This is because the called transaction receives no completion message from the update module in asynchronous updating. The calling data transfer program, in turn, cannot determine whether a called transaction ended with a successful update of the database or not.

If you use asynchronous updating, then you will need to use the update management facility (Transaction SM12) to check whether updates have been terminated abnormally during session processing. Error analysis and recovery is less convenient than with synchronous updating.



S Synchronous updating. In this mode, the called transaction waits for any updates that it produces to be completed. Execution is slower than with asynchronous updating because called transactions wait for updating to be completed. However, the called transaction is able to return any update error message that occurs to your program. It is much easier for you to analyze and recover from errors.

L Local updating. If you update data locally, the update of the database will not be processed in a separate process, but in the process of the calling program. (See the ABAP keyword documentation on SET UPDATE TASK LOCAL for more information.)

venerdì 22 febbraio 2008

BAPI_ENTRYSHEET_CREATE

Here you can download an useful tutorial, explain how to use the Bapi for creation of Entrysheet.



DOWNLOAD

Read file in a local directory

Hi abappers,
How to read file in a local directory from sap?
Here a short example using the method DIRECTORY_LIST_FILES of class 'CL_GUI_FRONTEND_SERVICES'.
This method returns the number of file, name end properties.


DATA: wa_file_table TYPE file_info,
tab TYPE STANDARD TABLE OF file_info,
count TYPE i.

CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = 'C:\DownloadDirector'
CHANGING
file_table = tab
count = count.

giovedì 21 febbraio 2008

Report Find Exit

Hi. This is a useful report that find the SAP enhancement for transaction name:

*&---------------------------------------------------------------------*
*& Enter the transaction code that you want to search through in order
*& to find which Standard SAP User Exits exists.
*&
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Tables
*&---------------------------------------------------------------------*
TABLES : tstc, "SAP Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts
*&---------------------------------------------------------------------*
*& Variables
*&---------------------------------------------------------------------*

DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.
*&---------------------------------------------------------------------*
*& Selection Screen Parameters
*&---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK a01.
*&---------------------------------------------------------------------*
*& Start of main program
*&---------------------------------------------------------------------*

START-OF-SELECTION.
* Validate Transaction Code
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
* Find Repository Objects for transaction code
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
MOVE : tadir-devclass TO v_devclass.

IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.

IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir
WHERE pname = tstc-pgmna.
SELECT SINGLE * FROM enlfdir
WHERE funcname = tfdir-funcname.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name = enlfdir-area.
MOVE : tadir-devclass TO v_devclass.
ENDIF.
ENDIF.
* Find SAP Modifactions
SELECT * FROM tadir
INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object = 'SMOD'
AND devclass = v_devclass.
SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.

FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
SKIP.

IF NOT jtab[] IS INITIAL.
WRITE:/(95) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
WRITE:/(95) sy-uline.

LOOP AT jtab.
SELECT SINGLE * FROM modsapt
WHERE sprsl = sy-langu AND
name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
ENDLOOP.
WRITE:/(95) sy-uline.
DESCRIBE TABLE jtab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of Exits:' , sy-tfill.

ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'No User Exit exists'.
ENDIF.

ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'Transaction Code Does Not Exist'.
ENDIF.
* Take the user to SMOD for the Exit that was selected.
AT LINE-SELECTION.
GET CURSOR FIELD field1.
CHECK field1(4) EQ 'JTAB'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

PROCESS ON VALUE-REQUEST( F4 ) statement

Hi All. Below the code for demonstrate how to perform a manual value help(F4) on a particular field using "PROCESS ON VALUE-REQUEST" statement and how to return values back to I/O field on your screen.

* Screen flow logic........
PROCESS BEFORE OUTPUT.

*MODULE PBO_MODULE.

PROCESS AFTER INPUT.

*MODULE PAI_MODULE.

PROCESS ON VALUE-REQUEST. "F4

FIELD zzautfor MODULE help_autfor.



*&---------------------------------------------------------------------*
*& Module help_autfor INPUT
*&---------------------------------------------------------------------*

MODULE help_autfor INPUT.

DATA: t_return LIKE ddshretval OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF t_value OCCURS 0 ,
zzautfor LIKE eban-zzautfor.
DATA: END OF t_value.

t_value = 'SI'.
APPEND t_value.

t_value = 'NO'.
APPEND t_value.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'ZZAUTFOR'
value_org = 'S'
TABLES
value_tab = t_value
return_tab = t_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.

IF sy-subrc = 0.

READ TABLE t_return INDEX 1.

MOVE t_return-fieldval TO zzautfor.

ENDIF.

ENDMODULE. "