2008 Jan 15 12:35 PM
i have created two radio button on button which is showing
internal table data and another radio button is to store that
data into application server , i have also used one parameter option that is
(parameter : file type filename-fileintern)
which shows logical file through which the data should place automatically place in application serve . plz give the logic for
the second radio button its urgent , if possible code also
regards
sarfaraz
2008 Jan 15 12:41 PM
Hi,
Use the code as below:
dsn(20) TYPE C VALUE '/usr/test.dat'. "in your case this will come from selection screen
OPEN DATASET dsn FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
LOOP AT itab.
TRANSFER itab TO dsn.
ENDLOOP.
ENDIF.
CLOSE DATASET dsn.
Regards,
Pankaj
2008 Jan 15 1:17 PM
hi pankaj,
when doing this
data : dsn(20) TYPE C VALUE '/usr/test.dat'. "in your case this will come from selection screen
OPEN DATASET dsn FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
LOOP AT itab.
TRANSFER itab TO dsn.
ENDLOOP.
ENDIF.
CLOSE DATASET dsn.
when iam specifying the path in value
giving the internal table itab.
it is giving error in the statements
TRANSFER itab TO dsn.
plz do reply
2008 Jan 15 1:21 PM
Hi,
Please tell me the error message its throwing.
Regards,
Pankaj
2008 Jan 15 1:28 PM
my code is
&----
*& Report ZECS_FORMAT
*&
&----
*&
*&
&----
REPORT ZECS_FORMAT_EXCEL MESSAGE-ID (ZMSG).
******************TABLE DECLARATION***********************************
TABLES : DPAYH . " tables declaration
*****************INTERNAL TABLE DECLARATION***************************
DATA : BEGIN OF I_DPAYH OCCURS 0,
ECS_TCODE TYPE N LENGTH 2 VALUE '66',
XVORL TYPE DPAYH-XVORL,
ZBKON TYPE DPAYH-ZBKON,
ZBNKN TYPE DPAYH-ZBNKN,
ZNME1 TYPE DPAYH-ZNME1,
MICR TYPE N LENGTH 9 VALUE '40021102',
USER_NO TYPE N LENGTH 7 VALUE '4009175',
DESP TYPE STRING VALUE 'MAHANAGAR GAS LTD',
MASTR TYPE DPAYH-MASTR,
RBETR TYPE DPAYH-RBETR,
LAUFI TYPE DPAYH-LAUFI,
ORIGN TYPE DPAYH-ORIGN,
END OF I_DPAYH.
data : dsn(20) TYPE C VALUE 'file'.
******************MULTIPLE SELECT INPUT PARAMETERS**********************
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME.
PARAMETERS : S_Date LIKE DPAYH-LAUFD OBLIGATORY, " multiple selection for Payment program
S_RUNID LIKE DPAYH-LAUFI matchcode OBJECT ZECS OBLIGATORY.
SELECTION-SCREEN END OF BLOCK A.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-101.
PARAMETERS : RB1 RADIOBUTTON GROUP G1,
RB2 RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
parameter: file type filename-fileintern.
******************START OF SELECTION************************************
START-OF-SELECTION.
PERFORM POP_I_DPAYH. " populating the table with general item data
PERFORM OPTIONS.
&----
*& Form OPTIONS
&----
text
----
--> p1 text
<-- p2 text
----
FORM OPTIONS .
IF RB1 = 'X'.
PERFORM PRINT.
ELSE.
IF RB2 = 'X'.
OPEN DATASET dsn FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
LOOP AT I_DPAYH.
TRANSFER I_DPAYH TO dsn.
ENDLOOP.
ENDIF.
CLOSE DATASET dsn.
ENDIF.
ENDIF.
ENDFORM. " OPTIONS
*&----
**& Form POP_I_DPAYH
*&----
*
*text
*----
*
*--> p1 text
*<-- p2 text
*----
FORM POP_I_DPAYH.
*SY-SUBRC = 0.
SELECT ZBKON ZBNKN ZNME1 MASTR RBETR LAUFI ORIGN
FROM DPAYH INTO CORRESPONDING FIELDS OF
I_DPAYH .
where laufd EQ S_Date
AND LAUFI EQ S_RUNID.
APPEND I_DPAYH.
ENDSELECT.
ENDFORM. " POP_I_DPAYH
&----
*& Form PRINT
&----
text
----
--> p1 text
<-- p2 text
----
FORM PRINT .
LOOP AT H_DPAYH.
WRITE : / H_DPAYH-LAUFD,
H_DPAYH-ECS_TCODE1 ,
H_DPAYH-SPONSOR ,
H_DPAYH-DATE,
H_DPAYH-DESP1 ,
H_DPAYH-MICR1 ,
H_DPAYH-ACOUNT_NO ,
H_DPAYH-USER_ID ,
H_DPAYH-VAR ,
H_DPAYH-AUSFD .
ENDLOOP.
LOOP AT I_DPAYH.
WRITE : / I_DPAYH-ECS_TCODE,
I_DPAYH-ZBKON ,
I_DPAYH-ZBNKN ,
I_DPAYH-ZNME1,
I_DPAYH-MICR ,
I_DPAYH-USER_NO ,
I_DPAYH-DESP ,
I_DPAYH-MASTR ,
I_DPAYH-RBETR ,
I_DPAYH-LAUFI ,
I_DPAYH-ORIGN.
ENDLOOP.
ENDFORM. " PRINT
2008 Jan 15 1:33 PM
Hi Shaik
Everything looks fine, but i feel the only problem is with your structure declaration. You can use only Character type data with "TRANSFER" statement. So please make sure you change all your structure I_DPAYH fields to have only character data type.
Cheers
~ Ranganath
2008 Jan 15 1:35 PM
2008 Jan 15 1:39 PM
Numerics i think it should be Ok, but not more than that. Not even Date, P, Currency, Quan, ... etc
~ Ranganath