cancel
Showing results for 
Search instead for 
Did you mean: 

AT user command in interactive list(basic) is not calling smartform

Former Member
0 Kudos

Hi,

I am facing a problem, which will be strange for all i think.

in a basic list (not ALV) simple interactive report i am using

a at user-command. my concern is to collect the checked

box in the first output report display and store it into the

internal table and call a smart form when user

enter 'SHOW' command.

the problem is when i am entering a show command and

debugging it, it collects all the checked checkbox in the

internal table and it even call the smartform print popup

window, when i give print or printpreview it leave the

program with out throughing any error.

here is the code.

at user-command.
  case sy-ucomm.
    when 'SHOW'.
      do mline times.
        READ LINE SY-INDEX FIELD VALUE itab_item-chkbox.
        if itab_item-chkbox eq 'X'.
*          write:/ itab_item-banfn,30 itab_item-bnfpo.
          perform extract_final_data using itab_item-bnfpo itab_item-banfn.
        endif.
      enddo.

      refresh: itab, itab_ser.
      clear:   itab, itab_ser.
* move all data to structure (itab) of form .
      loop at iitab_wa1.
        Move :  iitab_wa1-matnr  to itab-matnr,
                iitab_wa1-meins  to itab-meins,
                iitab_wa1-ebeln  to itab-ebeln,
                iitab_wa1-ebelp  to itab-ebelp,
                iitab_wa1-menge  to itab-ktmng,
                iitab_wa1-lfdat  to itab-eindt,
                iitab_wa1-typ    to itab-typ.
        append itab.
        clear  itab.
      endloop.
* display the selected item in the report screen.
      if sy-subrc is initial.

* sorting the table according to RFQ no and item no.
        sort itab by ebeln ebelp.

* including sr.no in table itab
        clear icnt.
        loop at itab.
          icnt  =  icnt  +  1.
          itab-srno = icnt.
          modify itab.
          clear  itab.
        endloop.

* Call the output form.
* YSF_MEDRUCK_RFQ_PR_ser_SAE is in 300
* for pr to rfq material and service in single form.

        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            FORMNAME = 'YSF_MEDRUCK_RFQ_PR_MAT_SAE'
          IMPORTING
            FM_NAME  = V_FM.

        CALL FUNCTION '/1BCDWB/SF00000037'
          EXPORTING
            ser_flg          = ser_flag
            material         = p_mat
            services         = p_ser
          TABLES
            itab             = 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.

      else.
        write: ' Some error has occurred'.
      endif.

  endcase.

<MOVED BY MODERATOR TO THE CORRECT FORUM>

Edited by: Alvaro Tejada Galindo on Aug 22, 2008 6:16 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

Instead of the below function ,call like this .

CALL FUNCTION '/1BCDWB/SF00000037'

EXPORTING

ser_flg = ser_flag

material = p_mat

services = p_ser

TABLES

itab = itab

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

CALL FUNCTION v_fm

EXPORTING

ser_flg = ser_flag

material = p_mat

services = p_ser

TABLES

itab = itab

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

Answers (5)

Answers (5)

Former Member
0 Kudos

Thank you for giving me the solutions, I appreciate you all.

I have found the solution, the reason why i am not getting a output after a print pop up window is clear to me. i think it will be useful to you guys also...

1> i have used at user-command event.

2> while calling a smart form FM it calls the print pop up window (MP)

3> after the input of printer detail it store the data in stack and execute the command leave screen.

4> because i m in at user command event it leaves the event and leave the track of it and exit to the sap easy access main screen.

Solution which i have used is.

at user-command.
  case sy-ucomm.
    when 'SHOW'.
      do mline times.
        READ LINE SY-INDEX FIELD VALUE itab_item-chkbox.
        if itab_item-chkbox eq 'X'.
*          write:/ itab_item-banfn,30 itab_item-bnfpo.
          perform extract_final_data using itab_item-bnfpo itab_item-banfn.
        endif.
      enddo.

      refresh: itab, itab_ser.
      clear:   itab, itab_ser.
* move all data to structure (itab) of form .
      loop at iitab_wa1.
        Move :  iitab_wa1-matnr  to itab-matnr,
                iitab_wa1-meins  to itab-meins,
                iitab_wa1-ebeln  to itab-ebeln,
                iitab_wa1-ebelp  to itab-ebelp,
                iitab_wa1-menge  to itab-ktmng,
                iitab_wa1-lfdat  to itab-eindt,
                iitab_wa1-typ    to itab-typ.
        append itab.
        clear  itab.
      endloop.

* display the selected item in the report screen.
      if sy-subrc is initial.
*************************************************
        wa_control_parameters-no_dialog = 'X'.
        wa_control_parameters-PREVIEW   = 'X'.
*************************************************
        perform send_to_output_structure tables itab.

      else.
      endif.

  endcase.


FORM SEND_TO_OUTPUT_STRUCTURE  TABLES   ITAB1 STRUCTURE itab.
  "Insert correct name for <...>.
* sorting the table according to RFQ no and item no.
  sort itab1 by ebeln ebelp.

* including sr.no in table itab
  clear icnt.
  loop at itab1.
    icnt  =  icnt  +  1.
    itab1-srno = icnt.
    modify itab1.
    clear  itab1.
  endloop.

* Call the output form.
* YSF_MEDRUCK_RFQ_PR_ser_SAE is in 300
* for pr to rfq material and service in single form.

  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      FORMNAME = 'YSF_MEDRUCK_RFQ_PR_MAT_SAE'
    IMPORTING
      FM_NAME  = V_FM.

  CALL FUNCTION V_FM
    EXPORTING
      ser_flg            = ser_flag
      material           = p_mat
      services           = p_ser
      CONTROL_PARAMETERS = wa_control_parameters  " declared here  "like the table in smart form.
      OUTPUT_OPTIONS     = wa_output_options      " declared 
    IMPORTING
*      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO    = wa_JOB_OUTPUT_INFO
      JOB_OUTPUT_OPTIONS = wa_job_output_options
    TABLES
      itab               = itab1
    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.


ENDFORM.                    " SEND_TO_OUTPUT_STRUCTURE

And i think Mr. Pratik Mallick solution also will work..any how thank you very much.

Former Member
0 Kudos

hi...

this shouldnt be happening..ne ways.u may try this..

put the smartform calling code in a report porgram and then use submit program and return command.

write this part of code in the report program....you will get all ur variables from stack....

Report y_call_sf.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'YSF_MEDRUCK_RFQ_PR_MAT_SAE'

IMPORTING

FM_NAME = V_FM.

CALL FUNCTION v_fm

EXPORTING

ser_flg = (calling_prog)ser_flag --> declare like this fro stack access

material = (calling_prog)p_mat

services = (calling_prog)p_ser

TABLES

itab = (calling_prog)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.

else.

write: ' Some error has occurred'.

endif.

calling prog is program from where u r submitting.......

so ur code will look like this....

at user-command.

case sy-ucomm.

when 'SHOW'.

do mline times.

READ LINE SY-INDEX FIELD VALUE itab_item-chkbox.

if itab_item-chkbox eq 'X'.

  • write:/ itab_item-banfn,30 itab_item-bnfpo.

perform extract_final_data using itab_item-bnfpo itab_item-banfn.

endif.

enddo.

refresh: itab, itab_ser.

clear: itab, itab_ser.

  • move all data to structure (itab) of form .

loop at iitab_wa1.

Move : iitab_wa1-matnr to itab-matnr,

iitab_wa1-meins to itab-meins,

iitab_wa1-ebeln to itab-ebeln,

iitab_wa1-ebelp to itab-ebelp,

iitab_wa1-menge to itab-ktmng,

iitab_wa1-lfdat to itab-eindt,

iitab_wa1-typ to itab-typ.

append itab.

clear itab.

endloop.

  • display the selected item in the report screen.

if sy-subrc is initial.

  • sorting the table according to RFQ no and item no.

sort itab by ebeln ebelp.

  • including sr.no in table itab

clear icnt.

loop at itab.

icnt = icnt + 1.

itab-srno = icnt.

modify itab.

clear itab.

endloop.

  • Call the output form.

  • YSF_MEDRUCK_RFQ_PR_ser_SAE is in 300

  • for pr to rfq material and service in single form.

submit y_call_sf and return. -->plz check the syntax

endcase.

Former Member
0 Kudos

i have tried it .. but its not working.. it calls till smartform

print pop up window and in back end

FM-> SSFCOMP_OPEN

and it exits in FM -> POSS_UIREQ_OPT_SUBMIT

This is the flow.

it goes to this program : LSTXBCFOP

in this line 124 -> perform display_printer_dialog using

p_pr_buttons.

and goes to line no-> 1087 case fcode..

when prev it goes to the FM

->POSS_UIREQ_OPT_SUBMIT

then execute lin no:. 1193. set screen 0. leave screen.

-


i really appriciate you guys and hope will provide solution for me.thanx in advance.

Former Member
0 Kudos

Please check this .I am not getting in you code why u used that may be if you remove check then it will work

  • display the selected item in the report screen.

IF sy-subrc IS INITIAL.

Former Member
0 Kudos

yes i have called the v_fm only while copying i have copied other..