SmartForms: How to loop inside smartforms?

Hi All,
I have the following scenario below:
kindly check the screenshot of my smartForm first: http://img10.imageshack.us/img10/9456/sflayout6cells.jpg
In the screenshot, in the right side is the screenshot of my SAP output, while on the left is the smartforms.
Let's say I have ITAB.
LOOP AT itab.
ENDLOOP.
In my SF, i have 6 big cells, i want to pass itab-matnr in each of the 6 cells.
Now, if the number of rows in my ITAB is 12, I should pass 12 matnr in each of the cells but it should trigger my SF to produce a 2nd page to contain next set of 6 matnr.
How can I loop the page of my SF to contain the next loop pass from my ITAB?
Thanks.

U want that after every six iteration the page no should be changed and the next six matnr's should print on the next page. Please correct me if I am wrong?
In that case u do these things in main window. Create a template in main window to hold six rows.
rigt clk and create loop lines .
Now put one program line there and  loop the internal table upto 6 rows.
take a local variable for storing the index no.
and write a case statement there
declare six global variables of type string
pass each of the matnr's in each of these six variables according to the index nos.
after the itab has looped six times.delete itab from 1 to 6.
and increase the page no by 1 everytime at the end. In this way u need not worry how many rows ur internal table contains.It will keep printing in multiples of six.
See the sample code below
DATA LV_INDEX.
CLEAR LV_INDEX.
CLEAR:GWA_VBAP,GV_STRING,GV_STRING1,GV_STRING2,GV_STRING3.
LOOP AT GIT_VBAP INTO GWA_VBAP FROM 1 TO 4.
CASE LV_INDEX.
  WHEN 0.
   GV_STRING = GWA_VBAP-MATNR.
   CONDENSE GV_STRING.
  WHEN 1.
   GV_STRING1 = GWA_VBAP-MATNR.
   CONDENSE GV_STRING1.
  WHEN 2.
   GV_STRING2 = GWA_VBAP-MATNR.
   CONDENSE GV_STRING2.
  WHEN 3.
   GV_STRING3 = GWA_VBAP-MATNR.
   CONDENSE GV_STRING3.
ENDCASE.
ADD 1 TO LV_INDEX.
ENDLOOP.
DELETE GIT_VBAP FROM 1 TO 4.
SFSY-PAGE = SFSY-PAGE + 1.

Similar Messages

  • Looping inside Smartform with PWB data

    Hi,
    I'm trying to access the field belzart and inside the following path:
    PWB_DATA-> T_BBP_HEADER->T_BI_HEADER->T_BI_ITEM-> WA_BI_ITEM.
    can anyone please tell how shoul i loop the table so that I can access the data?
    If I loop
    PWB_DATA-T_BBP_HEADER-T_BI_HEADER-T_BI_ITEM into SU_BI_BILL_S_BI_ITEM, it gives the error:
    "No component exists in PWB_DATA with name T_BBP_HEADER-T_BI_HEADER-T_BI_ITEM".
    Awaiting early response.
    Thanks & Regards,
    Anshumita Baksi.

    Hi,
    In the initialazition tab copy the data of ts_customer into anther internal table like as follows.
    data:it_cust type table of ts_customer.
    it_cust[] = ts_customer[].
    sort it_cust by kunnr.
    delete adjacent duplicates it_cust comparing kunnr.
    now your internal table contains no duplicate kunnr.
    first loop the it_cust.
    then loop the ts_cust where kunnr = it_cust-kunnr.
    after this loop create a command node
    select the go to and give the next page .
    now it will give multiple letters for each customers.
    Tnks,
    NN.

  • How to use loop in smartforms???

    hi experts,
                  I have an internal table with three values .i am passing it into new itab inside smartforms .while displaying it is displaying only the third data .i think i must use loop condition .but i dont know where to use it .pls help me.if i select only one data it is coming .if i select multiple data using select statement .only the final thing is coming .

    On your smartform, you should have a table set up.  Go to transaction SMARTFORMS, enter your form name, and display it.  Now navigate to the table on your form and double-click it.  Go to the Data tab.  Under "LOOP", make sure that you have checked "Internal table".  Next to that should be the name of your internal table, then "Into", then a work area.  The work area needs to be defined under "Global Definitions" (under Global Settings, check the tree for your form).  Your work area should be defined as TYPE, with the associated type being your internal table.  Your internal table should actually be defined as a structure where each component is one item that you want to include in your row.  I hope this helps.
    - April King

  • HOW TO CALL FUNCTION MODULE INSIDE SMARTFORM

    PLEASE ANYONE TELL ME, ABOUT  HOW TO CALL FUNCTION MODULE INSIDE SMARTFORM. IT IS VERY URGENT!!!!!!!!!1

    Hi,
      Under Global Definitions, we have 'Form Routines' tab. Under this tab, u can have a dynamic subroutine call. With in FORM and ENDFORM, you can call the Function Module.With in the Program Lines editor, u can define the subroutine........PERFORM. 
    If helpful, reward points.
    Rgds,
    CK

  • How to Attach a Smartform to a BOR method

    Hi Friends,
    I had a query How to Attach a Smartform to BOR method.To attach a customized Smartform to a Customized BOR Object.

    Hi,
    In the BOR object, create a method say display_SF. Now in the ABAP properties for that method give "OTHER" option.
    Now in the BOR object, you can find the program which is used. Inside that program, You need to write the code to fetch the required data (ONLY BASIC REQUIRED DATA WILL BE ENOUGH) and call the smartform by passing all the print parameters and all the required data for that smartform.
    Now inside the smartform, with imported required data, you can write all the logic and data fetch etc for the printouts.
    The following sysntax can be used to fetch the required data into the method and can use to pass the same while calling the smartform.
    SWC_GET_ELEMENT CONTAINER 'Plant' PLANT.
    Regards,
    Harish

  • How to comment in smartform for text value in abap

    how to comment in smartform for text value in abap.
    i want to comment text value which is coming in output
    From drag and drop option i had dropped an item text in text window and now i dont want to delete it i just want to comment it so can any one help me in commenting the text value.
    Advance Thanks for your help

    hi
    open the text element in the smartform.
    on the left corner, we have text editor button.
    open that and change the editor (goto-->change editor)
    on the new line, give the format as comment line /*. and you can write the comments as required.
    such lines doesnt reflect in the output layout.
    thanks
    pavan

  • How do we call smartforms in abap program or web services

    how do we call smartforms in abap program or web services
    How many types of smartforms are there?
    points will be rewarded

    Hi
    See this sample program
    Using the fun module smartform is called from the program
    Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    <b>call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'</b>
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function <b>FM_NAME</b>
    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
    GS_MKPF = INT_MKPF
    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.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • How to design a smartform with below tables and table-fields??

    How to design a smartform  and driver program using this tables and table fields
    FIELD DESCRIPTION     TABLE-FIELD                                   
    Tax Invoice No:     vbrk-vbeln                    
    Code     vbpa-kunnr where parvw = RG                                   
    Ship To     vbpa-kunnr where parvw = WE                                   
    PAN No     J_1IMOCUST-J_1IPANNO for WE                              
    ECC     ,,                                   
    Range     ,,                                   
    Div     ,,                                   
    Excise Reg No     ,,                                   
    LST No     ,,                                   
    CST No     ,,                                   
    Invoice No:      vbrk-vbeln                                   
    Do No:     vbfa-vbelv where vbeln = inv no and vbtyp_v = C get the vbeln where vbak-auart = 'ZDO'           
    Sales Doc Num:     vbfa-vbelv where vbeln = inv no and vbtyp_v = C get the vbeln where vbak-auart = 'ZSO'                             
    PO:     vbkd-bstkd where vbeln = sales doc no                                   
    Delivery No:     select vbelv from vbfa where vbeln = inv no and vbtyp_v = J                             
    Goods Removal Dt&Time:     select vbeln from vbfa where vbelv = dlv no and vbtyp_v = R Put this vbeln in mkpf and get BUDAT and CPUTM     
    Selection screen parameter should be : vbrk-vbeln.

    Hi,
    First design your form interface, this is the set of fields that you need to display in your form and create this as a structure in SE11.  In your print program code the logic to extract the data into this structure, this is just regular ABAP, nothing special here.
    When you have your data call function module SSF_FUNCTION_MODULE_NAME to determine the name of the generated smartform function module.  Then call this function module, passing the data collected into your structure.  If necessary you will need to find the print parameters required and pass these too.
    In your smartform you will need to use the data structure you created in SE11 as the smartform interface and design the layout required to display these fields.
    Regards,
    Nick

  • In the smartform how to change the company adress in the standard form

    Dear experts,
    In the smartform how to change the company adress in the standard form.
    Regards,
    Balakrishna R.V

    Hi,
    Go through this link below:
    change in SAP Standard Address
    Hope it helps
    Regards
    Mansi

  • I have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    i have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    Hi fais,
    Following through with what JB suggested. The steps involved in replacing the inner for loop with a while loop are outlined below.
    You can replace the inner for loop with a while by doing the following.
    1) Right-click of the for loop and select "Repalce" then navigate to the "while loop".
    2) Make sure the tunnels you where indexing on with the for loop are still indexing.
    3) Drop an "array size" node on your diagram. Wire the array that determines the number of iterations your for loop executes into this "array size".
    4) Wire the output of the array size into the new while loop.
    5) Set the condition terminal to "stop if true".
    6)Drop an "OR" gate inside the while loop and wire its output to the while loops condition terminal.
    7) C
    reate a local of the boolean "stop" button, and wire it into one of the inputs of your OR gate. This will allow you to stop the inner loop.
    8) Drop a "less than" node inside the inner while loop.
    9) Wire your iteration count into the bottom input of the "less than".
    10) Wire the count (see step 4 above) into the top input of the less than. This will stop the inner loop when ever the inner loop has processed the last element of your array.
    Provided I have not mixed up my tops and bottoms this should accomplish the replacement.
    I will let others explain how to takle this task using the "case solution".
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to send a smartform result through mail?

    How to send a smartform result through mail?

    HI,
    YOu can convert the output of Smartform into a attachment say PDF file & then send it across through mail.
    Refer following program:
    <a href="http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm">http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm</a>
    Best regards,
    Prashant

  • How do I break a for loop (inside) and a while loop (outside) at the same time by a control button

    I have a while loop (outside) and a for loop (inside) and a control button within the for loop.  I want to stop the program by click the botton without finishing the for loop.  How can I do that?
    Thank you in advance.

    HI Please find attached snapshot Regards, Santosh
    Message Edited by SanRac on 12-17-2009 05:12 AM
    Message Edited by SanRac on 12-17-2009 05:13 AM
    Attachments:
    Snap1.png ‏4 KB

  • How to upload a smartform which is in .xml format

    hi,
    i have downloaded the smartform into .xml file. Now i need to upload it into a new smartform . how do i do it.

    Hi,
    Goto T-code smartforms , there Utilities --->  upload form
    It will ask for the form name give your Z form name then it will ask for the XML file specify the file . THE FORM IS CREATED.
    Regards,
    Vinod.
    Assign points if the answer is useful

  • SMARTFORM: how to create 3 copy (each copy can print more than one page)

    SMARTFORM: how to create 3 copy (each copy can print more than one page)
    Hello everyone.
    my user want to have form that print 3 copy.
    such as 1 copy description = master,  2 copy description = copy 1 ,3 copy description = copy 2.
    so i create 3 page . I copy from page 1.
    and in each page there is main window which can have data more than 1 page.(such as have a lot of sale data ,it's take 2 page for show output .so it's take 2 page in each copy)
    please help me.
    how to set page and window in each page for print 3 copy and each page can have main window that print more than 1 page

    Hello Vinit.
    thank you very much for your help.
    could you help me more please.
    in below code
      DO NAST_ANZAL TIMES.
    l_counter = l_counter + 1.  " << pass this to FM and use for the TEXT to print
    CALL FUNCTION LF_FM_NAME
               EXPORTING
                         COUNTER = l_COUNTER   " USE this to derive the text into PRINTOUT
    enddo.
    Now i out of office .so i cannot test.
    where do i set NAST_ANZAL for 3 ?
    can i input ?
    NAST_ANZAL = 3.
      DO NAST_ANZAL TIMES.
    l_counter = l_counter + 1.  " << pass this to FM and use for the TEXT to print
    CALL FUNCTION LF_FM_NAME
               EXPORTING
                         COUNTER = l_COUNTER   " USE this to derive the text into PRINTOUT
    enddo.
    Edited by: dittaporn nanasilp on Mar 12, 2011 3:33 PM

  • In PM or QM modules how to link the smartforms to standard transections.

    Hi ABAP gurus,
         i am facing the problem how to link the smartforms to Standard transections, like
         QGA3 in this T-code i am give the Inspection lot no only, then this Lot number go to the smartforms
        it will pick the total data relavent to lot no, my problem is how to link between the T-Code to smartforms, 
    thanks.
    raj.

    hi,
    you have to configure in NACE. first identify the application type in NACE.
    thanks,
    anupama.

Maybe you are looking for