cancel
Showing results for 
Search instead for 
Did you mean: 

how to print multiple smart forms for different 'sales order number '(vbeln).....?

former_member220286
Participant
0 Kudos

i am using  'sales order number' as a  select-options in my driver program , according to the entered  values in its low and high parameters  by user , i want to print smart form for all the sales order number lies  between low and high parameters exclusively.

select-options : order for vbak-vbeln.

now i am calling smart form function module but the smart form is printed only for higher value of sales order.

let say low-5100 high-5104 then smart form which is printed only for sales order no 5104 i.e only for higher value printed on the form and the below corresponding line items are shown for all of the sales order  from 5100 to 5104.

i want that after executing the driver  program for  smart form , then select-option comes i gave low and high value that is range

,print preview  comes and then i must get 5100 order on one page and 5101 on next page and so on till higher value..

plzz help ..... if anyone having   any idea....

Accepted Solutions (1)

Accepted Solutions (1)

raymond_giuseppi
Active Contributor
0 Kudos

For multiple spool : Change your driver program

  • selection-screen
  • start-of-selection 
    • read every selected sales order header in an internal table
  • end-of-selection
    • get FM name SSF_FUNCTION_MODULE_NAME
    • LOOP at internal table
      • call FM with current the sales order number
    • ENDLOOP.

For reference for Smartforms, read some documentation like Integrating the Smart Form into the Application. Also use the search tool for wiki guide at scn on Smartforms.

To get a single spool generated use SSF_OPEN and SSF_CLOSE as described in Printing Several Forms in One Print Request.

Regards,

Raymond

former_member220286
Participant
0 Kudos

hi raymond ,

i have used this concept and it is working

fine

but now my new requirement  is that while printing  smart form  that is printpreview, i am unable to go back and forth .

let say i am printing order no from 5100 -5102 .

so i am unable to see the preview of  previous orders once i saw preview of 5102.

navigation to back and forth is not working.

that is pg up and page dwn functionality is not possible in your  concept.

please have a look to this attached smart form.

run it at ur end..

Answers (13)

Answers (13)

Former Member
0 Kudos

Hi,

Please check this program

SF_EXAMPLE_03

Regards,

Suman

former_member220286
Participant
0 Kudos

PLZZ CHK THIS PDF .. OF SMART FORM FINAL OUTPUT..

MY LAST PAGE IS COMING BLANK..

I HAVE USED PAGE BREAK AT END OF TABLE ...

AFTER FOOTER OF TABLE..

MY TABLE HAS HEADER , MAIN AND FOOTER AREAS DEFINED IN SMART FORM..

AFTER FOOTER THERE IS A PAGE BREAK,,

WHY THE LAST PAGE COMING BLANK.................?

WHEN I PASS SELECT-OPTIONS WITH LOW ORDER NO AS -->5100 AND HIGH ORDER NO AS--->5102

PLZZ HEL1.JPGP..?

LAST PAGE IS BLANK BUT WITH OTHER DETAILS AND NO MAIN WINDOW CONTENT... I WANT THE PAGES TO BE PRINT ONLY 3 ... PAGES


former_member225688
Participant
0 Kudos

On every page you are printing Total. After total is there any thing printed or coded in main window please check that .

former_member220286
Participant
0 Kudos

HI DNYANESHWAR...

i am using table  and used a loop on table to print line items in main window  ..

in table i have used

the header , main and footer.

header--> my header details

main--> line item values are printed

and in footer---> final calculation

     SUB_TOTAL:

TAX           :

Net amt:

Cash disc:

TOTAL_AMOUNT:

kk  after that i have used command break to trigger the ouput of next sales order on next page..

former_member183073
Active Participant
0 Kudos

Hi Deepak,

please add a command line below the footer(this should be last item in the heirarchy) and write the code to delete the record relevant to the current document number from your main internal table.

this should resolve you problem.

former_member220286
Participant
0 Kudos

hi syed ghulam..

i dnt understand it clearly bro...

i have used command break after footer that is below footer....

chk my tree of smart form

suggest me... in this scenario my last page coming blank with//........other contents such as logo and  adress etc...... but not the content of table.. on this last page..

means i want to say that from order no 5100-5102 if i am printng

4 pages are printed ..... but this is not correct bcoz only 3 pages must pe printed .. from 5100 to 5102.

my fouth page do not have main window content but other details... which are shown in previous printed pages...

plzz suggest...?

former_member183073
Active Participant
0 Kudos

Hi Deepak,

a snapshot of your page layout would be helpfull i guess because i cannot understand the arrangement of windows and also tell where you have fetched the data and what you are doing in "select_record".

former_member183073
Active Participant
0 Kudos

or you can change the smart form.

1. declare all the variables, workareas, iternal table required and a variable flag with initial value 'X'

1. In Global Definition: Fetch all the data for every order number passed.

2. dummy window: set a condition if 'flag' is equal to 'X'.

               program lines: 

        • pass all itabs using input parameters.
        • read the table containg order numbers at index '1'(always index 1 is needed to be read).
        • read all data(data required in sold to party, information, additional information windows) with order number into respective work areas and clear the "flag" here.
        • also read all the item level data needed to displayed in "table" into an internal table
        • use output parameters to export so that the work areas are available to the remaining form.

3. sold to party window: is dispalyed with the respective data in workarea.

4. info window: is dispayed in dispalyed with the respective data in workarea.

5. additional data window: is dispalyed with the respective data in workarea.

6. table: this should be in main window. use the internal table that has item level data and also use the current logic that you have used  calculating the subtotal and tax etc..

7. dummy window2: check the checkbox "After Main Window".

        • clear all workarea and itabs
        • delete the record from order table which was used in first dummy window and set the flag to 'X'.

This was the logic i used when i made one of the similar forms so i told hope that this would be helpfull to you.

former_member220286
Participant
0 Kudos

hi syed ghulam ,

thanks for ur suggestions..

in driver progarm

select-options : order for vbak-vbeln.

select * from vbak into  corresponding fields of table itab_vbak where vbeln in order.

as we know  that internal table with name order is created with  fields

sign , option , low and high ..kk

in LOW AND HIGH parameters .

ie order-low

          order-high

i am pasing this entry when calling smart form

like this ..

SSF_FUNCTION_MODULE_NAME

AND THEN

CALL FNAME..

PASSING LOW AND HIGH VALUES HERE WHILE CALLING .

NOW THESE VALUES WILL RECEIVED BY  SMART FORM FORM

CAPTURING  these values in form interface parametrs

low  type vbak-vblen.

high type vbak-vbeln.

kk

then

in this sf  in select record program lines

i am fetching  data from vbak , vbap , konv , vbkd tables in an internal table ..

all itab and their wa are declared in global parametrs ..

kk

after select_record

main loop is to loop the internal table itab_vbak that is header table with sales order no.

then in table  loop of line item table  let say itab_vbap

printing all line items value in main area

header details print in header area of table

finally calculative part in footer area of table.

after footer i have used a page break  command the other secondary window such as sold to party

etc,,,,,,

i think my tree structure maintained in smart form is mistaken somewhere

i am getting my last page without main window content .....but with pther deatils ..logo adress info , additional info windows signature and all..

this page must not come...

i am unable  to omit this page.....

former_member183073
Active Participant
0 Kudos

Sir in that case i have two requests,

1. Clear the work areas which contain data for sold to party, information and additional information details after the main folder has finished processing. i think you can do it in the place where you are breaking the page for next order.

2. check the number of records available for the order 5102 at item level there might be more records.

your problem should resolve if you follow the first step. the reason is your workareas have the data even when the table has finished printing the item level data thats the reason i guess only the header data is getting printed.

points if helpfull

former_member220286
Participant
0 Kudos

hi syed ghulam ali.

i have cleared the work area  variables ,

so values in wa are cleared , but the windows still exist.. bro

WHAT t o do for that....

former_member183073
Active Participant
0 Kudos

are the variable values getting printed?

if the values are there then you have not cleared it in correct place and also try adding the contion for the initial workareas.

former_member220286
Participant
0 Kudos

hi please check this smartr form..

sort out the matter of last page ..coming blank..

go through it..

and suggest me..

former_member183073
Active Participant
0 Kudos

Hi Deepak,

double click on folder 'SOLD TO PARTY' --> conditions --> wa = initial.

do this for all three folders.

sorry wa NE initial.

Regards,

Syed Ghulam Ali.

Former Member
0 Kudos

Hi Deepak,

Use parameter CONTROL_PARAMETERS while calling the smartform.

Example,

loop at T_VBAK .

* Initially set both the properties to 'X' as given below,

     control_parameters-no_open = 'X'.

    control_parameters-no_close = 'X'.

AT FIRST.

         control_parameters-no_open = ' '.       "open form

        control_parameters-no_close = 'X'.      "dont close form


ENDAT.

AT LAST.

         control_parameters-no_close = ' '.      "close form

ENDAT.      "AT LAST.

CALL FUNCTION fname

           EXPORTING

             control_parameters = control_parameters.

endloop.

Thanks & Regards,

Tushar

former_member220286
Participant
0 Kudos

FINALLY I GOT IT...... CORRECTLY.. HERE IS MY CODE

REPORT  ZSMARTFM.

TABLES : VBAK, VBAP.

DATA: IT_VBAK TYPE STANDARD TABLE OF VBAK WITH HEADER LINE,

       IT_VBAP TYPE STANDARD TABLE OF VBAP WITH HEADER LINE.

DATA : wa_cparam TYPE ssfctrlop,

        wa_output TYPE ssfcompop.

wa_cparam-preview = 'X'.

wa_cparam-no_dialog = 'X'.

wa_output-tddest = 'LP01'.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS : ORDER FOR VBAK-VBELN ."NO INTERVALS NO-EXTENSION.

SELECTION-SCREEN END OF BLOCK B1.

INITIALIZATION .

ORDER-LOW = '5100'.

ORDER-HIGH = '5102'.

APPEND  ORDER.

START-OF-SELECTION.

*

*SELECT  p~vbeln

*       f~netwr f~posnr f~fkimg f~gsber

*        b~name1 b~kunnr

*  INTO  CORRESPONDING FIELDS OF TABLE itab

*  FROM  ( ( vbrk AS p

*            INNER JOIN vbrp AS f ON p~vbeln = f~vbeln   )

*            INNER JOIN kna1   AS b ON p~kunrg = b~kunnr   ).

DATA : FNAME TYPE RS38L_FNAM.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

   EXPORTING

     FORMNAME                 'ZNEW_FORM'

*   VARIANT                  = ' '

*   DIRECT_CALL              = ' '

  IMPORTING

    FM_NAME                  FNAME

* 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  fname   "'/1BCDWB/SF00000451'

   EXPORTING

*   ARCHIVE_INDEX              =

*   ARCHIVE_INDEX_TAB          =

*   ARCHIVE_PARAMETERS         =

    CONTROL_PARAMETERS         = wa_cparam

*   MAIL_APPL_OBJ              =

*   MAIL_RECIPIENT             =

*   MAIL_SENDER                =

    OUTPUT_OPTIONS             = WA_OUTPUT

    USER_SETTINGS              = ' '

     LOW1                       order-low

     HIGH1                      order-high

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

instead of passing the data from driver program to smartform with select queries and calling then function module,,, ,,,,,i straight way in driver program pass low and high values and  calling my function module and then  sf is called and in form interface capturing low and high values of select options and all the data declared in types and global defination finally  doing manipulation with inner and outer loops in sf  and displaying content in smart form... i think this will be helpful for all who faced such problemss earlier also.....  ..

thanks all for ur suggestions guys..

former_member220286
Participant
0 Kudos

any other suggestions if any..........

former_member183073
Active Participant
0 Kudos

Hi Deepak,

Thats the same thing i tried to explain you but i think it was not clear..

gurunathkumar_dadamu
Active Contributor
0 Kudos

Hi Deepak,

try to change the your piece of code like this.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

              EXPORTING

                FORMNAME                 = 'ZSALES_ORDER'

*              VARIANT                  = ' '

*              DIRECT_CALL              = ' '

             IMPORTING

              FM_NAME                  = FNAME

             EXCEPTIONS

               NO_FORM                  = 1

               NO_FUNCTION_MODULE       = 2

               OTHERS                   = 3

call FM CALL FUNCTION 'SSF_OPEN'.

loop at t_vbak.

CALL FUNCTION   FNAME

* EXPORTING

*   ARCHIVE_INDEX              =

*   ARCHIVE_INDEX_TAB          =

*   ARCHIVE_PARAMETERS         =

*   CONTROL_PARAMETERS         =

*   MAIL_APPL_OBJ              =

*   MAIL_RECIPIENT             =

*   MAIL_SENDER                =

*   OUTPUT_OPTIONS             =

*   USER_SETTINGS              = 'X'

wa_vbak                                    = wa_vbak

* IMPORTING

*   DOCUMENT_OUTPUT_INFO       =

*   JOB_OUTPUT_INFO            =

*   JOB_OUTPUT_OPTIONS         =

   TABLES

     VBAK1                      = T_VBAK

     VBAP1                      = T_VBAP

     VAT1                       = T_J_1IMOCUST

     VBKD1                       = T_VBKD

     VBRP1                       = T_VBRP

     T685T1                       = T_T685T

     KONV1                       = T_KONV

     new_table                   = 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.

endloop.

SSF_CLOSE.

also check this link http://scn.sap.com/thread/526988

Regards,

Gurunath




former_member220286
Participant
0 Kudos

hi all,

here is my code driver program ...

*&---------------------------------------------------------------------*

*& Report  ZSALES_ORDER_PROG

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT  ZSALES_ORDER_PROG.

TABLES : VBKD.

  TABLES : VBAK.

   TABLES VBEP,

            J_1IMOCUST.

      tables : vbap.

   TABLES : KONV.

*"--------------------------------------------------------------------*

* Internal Table to Hold SALES ORDER DOCUMENT  *

*"--------------------------------------------------------------------*

*DATA : ITAB_VBAK LIKE  STANDARD TABLE OF VBAK WITH HEADER LINE.

DATA : T_KONV LIKE STANDARD TABLE OF KONV WITH HEADER LINE.

  DATA :

   T_VBAK LIKE

STANDARD TABLE

       OF VBAK WITH HEADER LINE.

DATA T_J_1IMOCUST LIKE TABLE OF J_1IMOCUST WITH HEADER LINE.

DATA:

   T_VBAP type table of vbap with header line.

*STANDARD TABLE

*      OF VBAP.

DATA : T_VBKD LIKE TABLE OF VBKD WITH HEADER LINE.

  DATA : lt TYPE TABLE OF  konv WITH HEADER LINE.

"-------------------------------------------------------

"       SELECTION SCREEN ELEMENTS

  selection-screen begin of block b1 with frame.

SELECT-OPTIONS : SALES_NO FOR VBAK-VBELN ." NO INTERVALS NO-EXTENSION.

*PARAMETERS: s_order TYPE vbak-VBELN.

selection-screen end of block b1.

INITIALIZATION.

SALES_NO-LOW = '5100'.

SALES_NO-HIGH = '5104'.

APPEND SALES_NO.

*AT SELECTION-SCREEN.

*  SELECT SINGLE VBELN FROM VBAK INTO CORRESPONDING FIELDS OF TABLE ITAB_NEW WHERE VBELN IN SALES_NO-LOW .

START-OF-SELECTION.

     SELECT * FROM VBAK INTO CORRESPONDING FIELDS OF TABLE

   T_VBAK WHERE VBELN IN   SALES_NO.

"-----------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------

SELECT * FROM VBAP INTO CORRESPONDING FIELDS OF TABLE T_VBAP FOR ALL ENTRIES IN T_VBAK WHERE

   VBELN EQ T_VBAK-VBELN.

SELECT * FROM J_1IMOCUST INTO TABLE T_J_1IMOCUST FOR ALL ENTRIES IN T_VBAK

   WHERE KUNNR = T_VBAK-KUNNR.

SELECT * FROM VBKD INTO CORRESPONDING FIELDS OF TABLE T_VBKD FOR ALL ENTRIES IN T_VBAP

    WHERE VBELN = T_VBAP-VBELN.

SELECT * FROM KONV INTO CORRESPONDING FIELDS OF TABLE T_KONV FOR ALL ENTRIES IN T_VBAK

   WHERE KNUMV = T_VBAK-KNUMV.

PERFORM SMART.

" DRIVER PROGRAM FOR ZSALES_ORDER

  FORM SMART.

loop at T_VBAK .

     DATA:fname TYPE rs38l_fnam.

            CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

              EXPORTING

                FORMNAME                 = 'ZSALES_ORDER'

*              VARIANT                  = ' '

*              DIRECT_CALL              = ' '

             IMPORTING

              FM_NAME                  = FNAME

             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   FNAME

* 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

     VBAK1                      = T_VBAK

     VBAP1                      = T_VBAP

     VAT1                       = T_J_1IMOCUST

     VBKD1                       = T_VBKD

      KONV1                       = T_KONV

   

  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.


ENDLOOP.

  ENDFORM.

gurunathkumar_dadamu
Active Contributor
0 Kudos

Hi,

while calling the FM pass the final table which is having the sales order no.check the below link.

http://scn.sap.com/thread/526988

Regards,

Gurunath

former_member225688
Participant
0 Kudos

Hi deepak,

Please refer the below link as it is already answered.

http://scn.sap.com/message/5369249

former_member183073
Active Participant
0 Kudos

Below things are to be done in smart form after passing the data from the driver program

1. get all the sales order values between low and high EG: lt_orders.

2. fetch all item level data for the sales order in another table lt_itemdata.

then,

loop at lt_order in wa_order. ********* this is to be done using loop node in create--> flow logic-->loop.

create a program line node in flow logic and read the data relating to wa_order-order.

print it.

endloop.

you have to design the item level data display inside the loop.

Former Member
0 Kudos

Hi Deepak Bishat,

                      You can make loop for the vbeln number (header and item) inside the loop you can call your smartform function module it may print multiple sales orders.

i think this may hep you.

thanks and regards,

vijay

Abhijit74
Active Contributor
0 Kudos

Hello,

Are you passing the sales order in a table to the smartform from your driver program? If so, I think your desire output should come.

Call the function module generated from SSF_FUNCTION_MODULE_NAME and pass your table.

"i want that after executing the driver  program for  smart form "

Then how you will pass all the sales order to smartform?

Thanks,

Abhijit

former_member203305
Active Contributor
0 Kudos

Hello.

do a loop and inside call the smartform. The IT_VBELN table contains the data that will be show on the smartform.

LOOP AT IT_VBELN.
CALL smartform
ENDLOOP.

Regards

Former Member
0 Kudos

Hi,

below link will definitely help you,

http://scn.sap.com/message/5369249

Thanks,

Nikita