‎2008 Dec 12 2:36 PM
Hi Experts,
I am working on smartforms.
In that my printprogram contains 2 radio buttons like
1) Header
2) ItemsIf I select Header Radio button in selection screen , I want to display header related data in "Main window" and if I press Items Radio button in selection screen, I want to display Item Related data in the same "Main window".
Can anybody help me in this issue,
Thanks in Advance........
Regards
Ganesh Reddy
‎2008 Dec 12 3:39 PM
Hi Gani.
Go to Samrtform.
Give the Name.
Press Create button.
Go to Interface.
Provide two input parameters like
i_r1 type char1
i_r2 type char2.
Go to Global Definitions.
Goto TYPES tab.
Provide data types for the two internal tables like.
Types: begin of ty_vbak,
vbeln type vbak-vbeln,
erdat type vbak-erdat,
erzet type vbak-erzet,
ernam type vbak-ernam,
end of ty_vbak,
begin of ty_vbap,
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
end of ty_vbap.
Go to Global Data Tab.
Provide Data objects.
WA_VBAK TYPE TY_VBAK
IT_VBAK TYPE TABLE OF TY_VBAK
WA_VBAP TYPE TY_VBAP
IT_VBAP TYPE TABLE OF TY_VBAP
Go to Initialization tab.
Provide two import parameters as a Input Parameters.
I_R1
I_r2
Output Parameter.
IT_VBAK
IT_VBAP
IF I_R1 = 'X'.
SELECT VBELN ERDAT ERZET ERNAM
FROM VBAK
INTO TABLE IT_VBAK UP TO 10 ROWS.
ENDIF.
IF I_R2 = 'X'.
SELECT VBELN POSNR MATNR
FROM VBAP
INTO TABLE IT_VBAP UP TO 10 ROWS.
ENDIF.
Save it.
Go to Main Window.
Create a Loop.
In that loop go to Condition Tab.
Provide name as IT_VBAK != initial.
Go to Data Tab in the Loop.
Write IT_VBAK into WA_VBAK.
Create a Text.
Give the Text what u want in VBAK like.
&WA_VBAK-VBELN&
&WA_VBAK-ERDAT&
&WA_VBAK-ERZET&
&WA_VBAK-ERNAM&
So create another Loop for VBAP.
Go to Condition provide the Condition as a IT_VBAP != Initial.
Go to Data Tab in the Loop.
Write IT_VBAP into WA_VBAP.
Create a Text.
Give the Text what u want in VBAP like.
&WA_VBAP-VBELN&
&WA_VBAP-POSNR&
&WA_VBAP-MATNR&
Save, Check, Activate.
Create a Program in SE38.
Provide two radio buttons.
write code like this.
===============
PARAMETERS: P_R1 TYPE CHAR1 RADIOBUTTON GROUP R1,
P_R2 TYPE CHAR1 RADIOBUTTON GROUP R1.
CALL FUNCTION '/1BCDWB/SF00000208'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
I_R1 = P_R1
I_R2 = P_R2
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 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.
=================
Save, check, activate.
So if u execute it ask for the Radio buttons.
Select one and execute it.
Give LP01.
Printpriview.
Then u got according to ur requirment.
Ok.
Bye.
‎2008 Dec 12 2:45 PM
In the same MAIN window keep data for both item and Header.
Say u do so in a TEXT Module. Now add condition based on your radio-button. This would ensure that when rb 1 = 'X' Text Module '1' gets printed else Text Module '2'
so eventually u have data for either for Header or Item as per ur radiobutton.
‎2008 Dec 12 2:49 PM
how can I get the printprogram radio button value into smartform?
‎2008 Dec 12 2:57 PM
Pass it from your Driver Program.. as an independent variable in Form Interface...
Revert ASAP if still in any doubt
‎2008 Dec 12 3:11 PM
‎2008 Dec 12 3:18 PM
From your Driver program at the time of calling your smartform you can pass tables and variables like any function module.
You certainly have your radio-button in Driver Program. Pass this as a variable to indicate which data has to be output : Header or Item..
Do your data fetching accordingly. In your smartform all output windows will have a Conditions tab. There you can mention the value of this passed variable as a check. whichever window will not meet the condition will not be processed.
This is the best I could explain.
All The Best !
‎2008 Dec 12 3:39 PM
Hi Gani.
Go to Samrtform.
Give the Name.
Press Create button.
Go to Interface.
Provide two input parameters like
i_r1 type char1
i_r2 type char2.
Go to Global Definitions.
Goto TYPES tab.
Provide data types for the two internal tables like.
Types: begin of ty_vbak,
vbeln type vbak-vbeln,
erdat type vbak-erdat,
erzet type vbak-erzet,
ernam type vbak-ernam,
end of ty_vbak,
begin of ty_vbap,
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
end of ty_vbap.
Go to Global Data Tab.
Provide Data objects.
WA_VBAK TYPE TY_VBAK
IT_VBAK TYPE TABLE OF TY_VBAK
WA_VBAP TYPE TY_VBAP
IT_VBAP TYPE TABLE OF TY_VBAP
Go to Initialization tab.
Provide two import parameters as a Input Parameters.
I_R1
I_r2
Output Parameter.
IT_VBAK
IT_VBAP
IF I_R1 = 'X'.
SELECT VBELN ERDAT ERZET ERNAM
FROM VBAK
INTO TABLE IT_VBAK UP TO 10 ROWS.
ENDIF.
IF I_R2 = 'X'.
SELECT VBELN POSNR MATNR
FROM VBAP
INTO TABLE IT_VBAP UP TO 10 ROWS.
ENDIF.
Save it.
Go to Main Window.
Create a Loop.
In that loop go to Condition Tab.
Provide name as IT_VBAK != initial.
Go to Data Tab in the Loop.
Write IT_VBAK into WA_VBAK.
Create a Text.
Give the Text what u want in VBAK like.
&WA_VBAK-VBELN&
&WA_VBAK-ERDAT&
&WA_VBAK-ERZET&
&WA_VBAK-ERNAM&
So create another Loop for VBAP.
Go to Condition provide the Condition as a IT_VBAP != Initial.
Go to Data Tab in the Loop.
Write IT_VBAP into WA_VBAP.
Create a Text.
Give the Text what u want in VBAP like.
&WA_VBAP-VBELN&
&WA_VBAP-POSNR&
&WA_VBAP-MATNR&
Save, Check, Activate.
Create a Program in SE38.
Provide two radio buttons.
write code like this.
===============
PARAMETERS: P_R1 TYPE CHAR1 RADIOBUTTON GROUP R1,
P_R2 TYPE CHAR1 RADIOBUTTON GROUP R1.
CALL FUNCTION '/1BCDWB/SF00000208'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
I_R1 = P_R1
I_R2 = P_R2
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 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.
=================
Save, check, activate.
So if u execute it ask for the Radio buttons.
Select one and execute it.
Give LP01.
Printpriview.
Then u got according to ur requirment.
Ok.
Bye.