cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the record from reports to display in smartforms

Former Member
0 Kudos

Hi All,

I have a report where i display the sales order in the ALV format. i have also used checkbox as one of the columns in ALV display.

now i want to know , how to get the data when a particular checkbox is checked. and i want to display that particular record in smartforms.

let me know how to go further on this?

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

Step1 : First Check the Check box is Selected or not. If it get Selected then Copy that Record into another internal table. Like this way Collect all Checked Rows into another Internal table.

Step 2 : If you work with Push button Go to That Push Button Corresponding coding and there Call The Smart form . For that first you create A smart Form by giving the same internal table type in TABLE tab of Form interface of Smart form.(if Required Create that internal table type as Structure in DDIc bcoz only DDIC structures are allowed to give in Smart Form Tables Tab of Form Interface).

Step 3 : Then Assign your required rows internal table to that internal table of Smart form.

Former Member
0 Kudos

hi,

i am getting this error:

Only table types may be used as the reference type for a table parameter.

my structure is custom type.

keerthy_k
Active Participant
0 Kudos

Hi Poonam,

In smartform , it takes only DDIC structures ...so u need to create a structure in DDIC and create a tbale type in se11. And in the table type u need to just add the structure which u have created as the line type. And this table type u can use to declare the intrenal table in smartforms.

Keerthi.

Former Member
0 Kudos

Try this program same like your requirement.

IF p_report EQ c_x.

PERFORM f_display_report_output. " It is for ALV output.

ELSEIF p_print EQ c_x.

PERFORM f_process_form.

ENDIF.

&----


*& Form f_process_form

&----


FORM f_process_form .

DATA: lf_fm_name TYPE rs38l_fnam,

ls_composer_param TYPE ssfcompop,

lf_formname TYPE tdsfname VALUE 'ZDR056',

l_index TYPE sy-tabix,

l_tabix_next TYPE sy-tabix,

l_lines TYPE i,

wa_control TYPE ssfctrlop.

SORT i_invoice STABLE BY konto budat xblnr.

DESCRIBE TABLE i_final LINES l_lines.

LOOP AT i_invoice.

READ TABLE i_final WITH KEY bukrs = i_invoice-bukrs

belnr = i_invoice-belnr

budat = i_invoice-budat

xblnr = i_invoice-xblnr

konto = i_invoice-konto.

IF sy-subrc EQ c_0.

l_index = sy-tabix + 1.

MOVE-CORRESPONDING i_final TO it_pos.

APPEND it_pos.

CLEAR: i_final,it_pos.

LOOP AT i_final FROM l_index WHERE xblnr NE space AND

xref2 EQ space AND

blart EQ 'DI'.

l_tabix_next = sy-tabix - 1.

EXIT.

ENDLOOP.

IF sy-subrc NE c_0.

l_tabix_next = l_lines.

ENDIF.

LOOP AT i_final FROM l_index TO l_tabix_next.

IF i_final-konto EQ i_invoice-konto.

MOVE-CORRESPONDING i_final TO it_pos.

APPEND it_pos.

ELSE.

EXIT.

ENDIF.

CLEAR: i_final,it_pos.

ENDLOOP.

CLEAR: l_index,l_tabix_next,i_invoice.

ENDIF.

ENDLOOP.

IF it_pos[] IS INITIAL.

MESSAGE s003.

EXIT.

ENDIF.

  • Determine smartform function module for invoice

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = lf_formname

IMPORTING

fm_name = lf_fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

wa_control-no_dialog = ''.

wa_control-preview = 'X'.

wa_control-no_open = 'X'.

wa_control-no_close = 'X'.

  • PARAMETERS FOR POP UP WINDOW

CALL FUNCTION 'SSF_OPEN'

EXPORTING

control_parameters = wa_control

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

  • error handling

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT.

ENDIF.

  • CALLING THE SMARTFORM

CALL FUNCTION lf_fm_name

EXPORTING

control_parameters = wa_control

output_options = ls_composer_param

v_from_date = s_budat-low

v_to_date = s_budat-high

v_days = p_days

TABLES

t_final = it_pos

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.

CALL FUNCTION 'SSF_CLOSE'

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

  • error handling

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " f_process_form

Regards,

Joan

Former Member
0 Kudos

hi poonam...

when you chek something on alv output

first u need to retrieve wht you have checked

this you can achieve using ....selfield type SLIS_SELFIELD

now when you can able to read what u have checked...

you can pass this data via smart form function module...

you can do this in the same program...

in FORM_USER_COMMAND.

Former Member
0 Kudos

how to define in selfield??? i mean as checked?

Former Member
0 Kudos

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = GD_REPID

I_CALLBACK_USER_COMMAND = 'HANDLE_USER_COMMAND'

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

IS_LAYOUT = IT_LAYOUT

IT_FIELDCAT = FIELDCATALOG[]

  • IS_VARIANT = G_VARIANT

IT_EVENTS = IT_EVENTS[]

I_SAVE = 'X'

TABLES

T_OUTTAB = IT_JEST.

FORM HANDLE_USER_COMMAND USING P_UCOMM LIKE SY-UCOMM P_SELFIELD TYPE SLIS_SELFIELD.

DATA REF1 TYPE REF TO CL_GUI_ALV_GRID.

this selfield stores the information checked in alv

keerthy_k
Active Participant
0 Kudos

Hi,

In the driver program of the smartform where u will be calling the smartform FM, before calling the smartform FM, just loop the internal table.

like:

Loop at itab into wa where chk = 'X'.

append wa to itab2.

endloop.

Where itab2 is the same structure as itab.

After the loop, u will get the new table itab2 filled with the entries which has the checkbox checked.

And u can pass the new intrenal table to the smartform FM.

Keerthi.

Former Member
0 Kudos

ok . thanks . let me check on this.

keerthy_k
Active Participant
0 Kudos

Hi,

If u need the code for calling the FM...here is it..

DATA sfname TYPE rs38l_fnam.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZFORMNAME'--->this is ur smartform name

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = sfname

  • EXCEPTIONS

  • NO_FORM = 1

  • NO_FUNCTION_MODULE = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION sfname

  • EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

itab1 = itab1-->this is the new itab

  • 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.

Keerthi.

Former Member
0 Kudos

hi,

where to pass the internal table to smartorm function module?

keerthy_k
Active Participant
0 Kudos

Hi Poonam,

I dont know how u are coding for the driver program for the smartform.

1) Craete a smartform and declare the internal table in the tables parameter.

2) check for syntax errors and activate it.

3) Now execute the samrtform...

4) U will get a smart form function module in a number format(like /1BCDWB/SF00000026).

5) copy the number and goto ur report pgm and in the pattern give the number for calling this FM.

6) now do ur coding before calling this FM for the data to be filled in the internal table.

7) now u can pass the internal table to this FM.

😎 later u can change the FM name(from format /1BCDWB/SF00000026 ) using the FM as below

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZFORMNAME'-->ur form name

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = SFNAME

  • EXCEPTIONS

  • NO_FORM = 1

  • NO_FUNCTION_MODULE = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

This will give the FM name (/1BCDWB/SF00000026) in the variable SFNAME. And u can change the smartform FM from

CALL FUNCTION '/1BCDWB/SF00000026'

to

CALL FUNCTION SFNAME.

hope this will help u..

Keerthi.

Former Member
0 Kudos

ok i dint not mention the internal table in smartforms. i have defined in print program.

do i need to define in smartforms as well??

actually the requirement is to have pushbuttons and when u click on one of them u need to display smartforms as print preview.

keerthy_k
Active Participant
0 Kudos

Hi Poonam,

U have to declare the internal table in the smartform also. And if u want to have a pushbutton, then u have to code for that..and u have to check for the sy-ucomm value. And can call the smart form FM if the sy-ucomm is equal to the function code of the pushbutton.

Keerthi.

Former Member
0 Kudos

whatever you are passing through function module need not again defined in smartforms.

they were automatically retrieved in smartforms.

Former Member
0 Kudos

yes i have defined internal table which is of type structure.

i am getting error for this.

in form interface i have defined as:

it_final1 type table of s_final1.

and s_final1 i have defined in global definitions as types.

Former Member
0 Kudos

HI,

check the data which is checked in your ALV through program and send that internal table data through your program to the smart form

so you can achieve the required output.

regards

sarves

Former Member
0 Kudos

how to achieve that ? can you tell me in detail?