Campo WAERS generalmente se encuentra en la cabecera
la descripcion de este campo esta en la tabla tCURC
iCesaralonso's Abap
Monday, November 15, 2010
Leer en el servidor
*-------------------------------------------------------------*
PARA LEER EN EL SERVIDOR
*-------------------------------------------------------------*
REPORT zdataset04 MESSAGE-ID zbc420_04.
TYPES: BEGIN OF gty_data,
texto(100) TYPE c,
END OF gty_data.
DATA: gti_data TYPE TABLE OF gty_data WITH HEADER LINE.
DATA: infile2 LIKE epsf-epsdirnam.
DATA: infile1 LIKE epsf-epsdirnam.
infile1 = '/tmp/prueba1.txt'.
infile2 = '/tmp/prueba_04_otra2.txt'.
OPEN DATASET infile1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
DO.
READ DATASET infile1 INTO gti_data.
CASE sy-subrc.
WHEN '0'.
APPEND gti_data.
WHEN '4'.
EXIT.
WHEN '8'.
MESSAGE e000 WITH 'No se puede'.
ENDCASE.
ENDDO.
ELSE.
MESSAGE e000 WITH 'No se puede leer archivo ' infile1.
ENDIF.
CLOSE DATASET infile1.
PARA LEER EN EL SERVIDOR
*-------------------------------------------------------------*
REPORT zdataset04 MESSAGE-ID zbc420_04.
TYPES: BEGIN OF gty_data,
texto(100) TYPE c,
END OF gty_data.
DATA: gti_data TYPE TABLE OF gty_data WITH HEADER LINE.
DATA: infile2 LIKE epsf-epsdirnam.
DATA: infile1 LIKE epsf-epsdirnam.
infile1 = '/tmp/prueba1.txt'.
infile2 = '/tmp/prueba_04_otra2.txt'.
OPEN DATASET infile1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
DO.
READ DATASET infile1 INTO gti_data.
CASE sy-subrc.
WHEN '0'.
APPEND gti_data.
WHEN '4'.
EXIT.
WHEN '8'.
MESSAGE e000 WITH 'No se puede'.
ENDCASE.
ENDDO.
ELSE.
MESSAGE e000 WITH 'No se puede leer archivo ' infile1.
ENDIF.
CLOSE DATASET infile1.
Escribir en el servidor
FORM write_server .
DATA: ls_root TYPE char100,
ls_dir TYPE char100,
ls_num_file(8) TYPE n,
ls_rango TYPE inri-nrrangenr VALUE '01',
ls_mensaje TYPE char50.
field-symbols: TYPE gty_archivo.
"ls_dir = '/interface/400/pos/salida'.
ls_dir = '/interface/'.
* Obtner numero correlativo de archivo
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = ls_rango
object = 'ZTABDM'
IMPORTING
number = ls_num_file.
CONCATENATE ls_dir 'ZTABDM' ls_num_file '.txt' INTO ls_root.
OPEN DATASET ls_root FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
IF sy-subrc EQ 0.
CATCH SYSTEM-EXCEPTIONS dataset_read_error = 11
OTHERS = 12.
LOOP AT gtd_archivo ASSIGNING.
TRANSFER-linea TO ls_root.
ENDLOOP.
ls_mensaje = 'Archivo creado'.
CLOSE DATASET ls_root.
ENDCATCH.
ELSE.
ls_mensaje = 'No se pudo crear el archivo'.
ENDIF.
ENDFORM.
DATA: ls_root TYPE char100,
ls_dir TYPE char100,
ls_num_file(8) TYPE n,
ls_rango TYPE inri-nrrangenr VALUE '01',
ls_mensaje TYPE char50.
field-symbols:
"ls_dir = '/interface/400/pos/salida'.
ls_dir = '/interface/'.
* Obtner numero correlativo de archivo
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = ls_rango
object = 'ZTABDM'
IMPORTING
number = ls_num_file.
CONCATENATE ls_dir 'ZTABDM' ls_num_file '.txt' INTO ls_root.
OPEN DATASET ls_root FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
IF sy-subrc EQ 0.
CATCH SYSTEM-EXCEPTIONS dataset_read_error = 11
OTHERS = 12.
LOOP AT gtd_archivo ASSIGNING
TRANSFER
ENDLOOP.
ls_mensaje = 'Archivo creado'.
CLOSE DATASET ls_root.
ENDCATCH.
ELSE.
ls_mensaje = 'No se pudo crear el archivo'.
ENDIF.
ENDFORM.
programa y crear tx
Con la tx se93 se mira que programa esta ligado a una tx.
Para crear la transacción se crea con la 2da opción delos radio buttons.
Para crear la transacción se crea con la 2da opción delos radio buttons.
Diferencia entre screen exit, field exit user exit badi
http://www.sap-basis-abap.com/abap/difference-between-user-exits-screen-exits-field-exits.html
Difference Between User Exits, Screen Exits and Field Exits
What are the differences between user, screen and field exits?
Let me answer this question for you:
The basic rule in SAP as far as ABAP workbench developments are concerned is "Do not modify the source code of the program"
Since needs and requirements keep on changing from client to client and for various business scenarios, there is a need to customise the programs as per client requirement.
For this purpose, SAP has provided numerous list of user-exits also known as enhancements, which is nothing but a program which will deal with the client additional requirement, without modifying the source code of the program. These exits are already provided by SAP. You can see the list of user-exits provided by using the transaction code SMOD. If you cannot find an user exit which match with client requirements, then you can tell SAP to create a new user exit.
On the other hand, field exit is nothing but where you write a small program, to control the properties of an existing field in a particular screen. Hence creation of a field exit is controlled by Program name, screen no. and the field name.
To give you an example, if you want to prevent a particular payment method to be executed via transaction FBZ5 or F-58, such that if the user enter a particular payment method while executing the transaction FBZ5 or F-58, the system should restrict the user from proceeding further, u can write a field exit for field RZAWE (payment method).
The program which controls the creation of field exit is RSMODORF
As far as screen exit is concerned, as per the client requirement if the user wants a separate screen to appear on execution of a particular task, which deviates from the standard sap provided flow of transactions, you write a screen exit. In such case you first prepare the screen using the screen painter and define it as to after which sap screen you want this screen to appear for processing the transaction further.
Tips by : Rakesh Jain
Difference Between User Exits, Screen Exits and Field Exits
What are the differences between user, screen and field exits?
Let me answer this question for you:
The basic rule in SAP as far as ABAP workbench developments are concerned is "Do not modify the source code of the program"
Since needs and requirements keep on changing from client to client and for various business scenarios, there is a need to customise the programs as per client requirement.
For this purpose, SAP has provided numerous list of user-exits also known as enhancements, which is nothing but a program which will deal with the client additional requirement, without modifying the source code of the program. These exits are already provided by SAP. You can see the list of user-exits provided by using the transaction code SMOD. If you cannot find an user exit which match with client requirements, then you can tell SAP to create a new user exit.
On the other hand, field exit is nothing but where you write a small program, to control the properties of an existing field in a particular screen. Hence creation of a field exit is controlled by Program name, screen no. and the field name.
To give you an example, if you want to prevent a particular payment method to be executed via transaction FBZ5 or F-58, such that if the user enter a particular payment method while executing the transaction FBZ5 or F-58, the system should restrict the user from proceeding further, u can write a field exit for field RZAWE (payment method).
The program which controls the creation of field exit is RSMODORF
As far as screen exit is concerned, as per the client requirement if the user wants a separate screen to appear on execution of a particular task, which deviates from the standard sap provided flow of transactions, you write a screen exit. In such case you first prepare the screen using the screen painter and define it as to after which sap screen you want this screen to appear for processing the transaction further.
Tips by : Rakesh Jain
Subscribe to:
Posts (Atom)