Loop in smartform

Hello All,
I am having a problem with smartforms and loop. I have a code defined in the smartform that call a function module and fetches data into a table in smartform, now this table is NOT a part of standard form interface, I have defined as a global paramter but not in standard form interface, now i want to loop in that table, what i think is that i can use loop only if the table i want to loop is in standard interace of form, please advise if thats the case and alternative solutions would be great,
thanks,
RS

HI reena,
U hav no restrictions like that. We usually use a form interface to pass internal tables or other values from the driver pgm bcoz that is what SAP recommends. u can also do it the other way ie by calling a FM within pgm lines so as to get the data. Once u have the data fetched using this method, u can use it like any other internal table that u fetch using the form interface.

Similar Messages

  • 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

  • Loop in smartforms

    hi all,
    ive just stuck with a problem in smartforms, ive created a smartform for purchase requisistion(pr) , in that im fetching the pr items in main window (main) and service line items in a loop in mainwindow, the problem is if the pr doesn't have a service line items a single empty line is displaying after the header data, i ve just tried by giving the conditions in the conditions tab" if itab or workarea is not initial" , but its stopping the loop and displaying only header data with out service line items. can any one give me the solution to this.
    regards
    venkat.

    Hi,
    if you want to dispaly the service line items even though there is no entry in line items table,  then create the service line item table after the PR line item table in main window not in (loop..endloop).
    In this case first line items of the PR will be printed and then service line items will be printed.
    If the service line items are related to the PR line items then the form is correct, because there are no line items for PR's.
    Regards,
    Raju.

  • Loop in smartform - how to make values valid in all pages

    Hi All.
    I have a smartforms with several pages (9). I must print these 9 pages once for each line in the internal table ITAB. When I put a loop in the first page, the data under that loop is printed correctly, but every text node outside the loop always prints the last line of ITAB.
    Do any of you know how to make the data in the loop valid throughout the other pages?
    any help will be welcome.
    thanks,
    Hermes.

    I got it. The main window must be the first one in the first page. The loop must be inside the main window, and bellow the loop there must be a page-break command.

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

  • Error in looping in smartform

    hai all
    iam new to smartforms iam trying a simple scenario
    where iam getting data from kna1 based on customer
    <b>in form interface</b>
    i declared as
    itab like kna1
    <b>in global definitions</b>
    wa_kna1 like kna1
    <b>in table section</b>
    when i gave
    itab into wa_kna1
    the error is
    itab is neither defined under tables nor defined as an internal table
    can any one help me how to solve and creat a form

    Hi Pavan,
    Check the following Code
    SELECT SINGLE A~ADRNR
                  B~NAME1
                  B~CITY1
                  B~POST_CODE1
                  B~STREET
                  B~COUNTRY
          B~P_O_BOX
           INTO CORRESPONDING FIELDS OF ADRC
           FROM KNA1 AS A
           INNER JOIN ADRC AS B
           ON
           BADDRNUMBER = AADRNR
           WHERE
           A~KUNNR = X_VBRK-KUNAG.
    here ADRC is used in Input parameters side.
    Here ADRC is define in Global Definitions Section Like this way
    ADRC     LIKE     ADRC
    and the above selected fields are used in some window 
    &ADRC-name1&
    &ADRC-city1&
    &ADRC-post_code1&
    &ADRC-street&
    here ADRC and V_LANDX is used in Input parameters side.
    where as ouput parameters side use V_LANDX only
    Getting Country Description.
    SELECT SINGLE LANDX INTO V_LANDX
                        FROM T005T
                        WHERE LAND1 = ADRC-COUNTRY AND
                              SPRAS = SY-LANGU.
    &v_landx&
    Regards
    Sreeni

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

  • SMARTFORMS LOOP

    How to write "Do 5 times" loop in smartforms.

    Hi,
    Whats sf_example ... where to search it.
    Condition is working well , only problem i am facing is loop is not iterating if I dont take help of Internal Table.
    I am looking is there any other option to run loop 5 times other than INTERNAL TABLE.
    Thanks & Regards.

  • In smartform table data is repeating

    in smartform table, data is repeating and filling the page...
    actual data is only 3 rows...
    but it repeats and fills the page...how can i stop this...

    Hi Rajkamal
    You can easily debug the smartform; try hardcoding the break-point for your user ID.  (Break <ID>)
    Please check the number of entries in your table.
    If the number of entries are correct it can be only some loop in smartform - happy hunting !!
    Neer

  • Repeating the loop in ecc 6.0

    hiii,
    can any one of you help me out with how can i use the reapeted processing of a loop in smart form in version ecc 6.0.
    because in the older versions when we create the loop we find this option on the general attribute button. but in ecc 6.0 is not being shown..
    so how can i use this because without it the loop is only taking up the last availavle data.
    thank you.

    LOOP IN SMARTFORM:- to display the contents in the smartform first u have to create table in
    the navigation tree.
    on the main window if u right click you will get a menu if u click on CREATE option we can
    find TABLE.
    TABLE is a combination of a template and loop in smartforms.
    go to global definitions and create a work area for the internal table. you can also pass
    the table in form interface using table tab. if you do like this there will be no need of 
    an explicit work area.
    now go to DATA TAB of the table node and mark it as internal table.
    Enter the name of the internal table which has been passed in the form interface.
    now give the assignment type either as INTO or ASSIGNING and specify a work area name over
    there. care should be take that this work area which we used now must already be declared in
    the globaldefinitions tab.
    now all the contents in the internal table gets into work area which has been specified now
    and gets displayed in the smartform.
    if we want to specify any conditions on this internal table we can use WHERE condition group
    box.
    PLEASE CORRECT ME IF IAM WRONG.
    Cheers,

  • Displaying multiple  rows of  a table using smartforms

    hi,
    how to get multiple  rows on a  form from a  table using smartforms.I succeded in getting only the first row of the table on the main window of the page .In order to display more than one record on the page what i have to do.

    You have to use LOOPS / TEMPLATES to achieve this
    Here is a very good code sample for using Template,Table,Loop in smartforms with screen shot
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    Please do not post multiple threads. Kindly close them rewarding point for helpful answers,
    extracting multiple records
    to display multiple records in smart form
    Re: extracting multiple records
    Kindly reward point and close the duplicates.
    Regards
    Kathirvel

  • To display multiple records in smart form

    hi,
    In the smartform how to use  the LOOP option to display the multiple records .

    Two possible reasons,
    Here is a very good code sample for using Template,Table,Loop in smartforms with screen shot
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    Please do not post multiple threads. Kindly reward point and close the duplicates.
    Regards
    Kathirvel

  • Print spool immediately

    In an ABAP program, we call the function for a SMARTFORM,  within a loop.
    For each occurrence in the loop, the SMARTFORM generates an entry in the spool (transaction SP01) with ststus waiting.
    Only when the program finishes, does the spool send the SMARTFORMS layout to the printer.
    How can we cause the printing to start immediately for each occurrence in the loop without waiting for the program to finish?

    W_CONTROL_PARAMETERS-NO_DIALOG  =  'X'.   "skip dialog
      W_OUTPUT_OPTIONS-TDDEST    = 'FRT'.     "print
      W_OUTPUT_OPTIONS-TDIMMED  = 'X'.       "immed print
      W_OUTPUT_OPTIONS-TDNEWID  = 'X'.       "create new spool request
      W_OUTPUT_OPTIONS-TDCOPIES  = 001.      "copies
    besides above ,you can check the user setting by Tr-code SU3
    choose Defaults ,then check the [Output Immediately]

  • Note in FB70

    Hi All,
    I have a requirement to fetch long text in FB70 transaction through smartform.
    1.  Key text in "Notes" tab of FB70 transaction. But there is no F1 help available for "Notes" tab in FB70. I don not know how to fetch it.
    2. I configure some Document text by T-code OBT8, and use FM READ TEXT with
        lv_id = '0006'. "
        lv_name = gs_vbrk-vbeln. " Document number
        lv_object = 'BELEG'.
        REFRESH lt_lines.
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
            id                            = lv_id
            language                      = sy-langu
            name                          = lv_name
            object                        = lv_object
          TABLES
            lines                         = lt_lines
         EXCEPTIONS
           id                            = 1
           language                      = 2
           name                          = 3
           not_found                     = 4
           object                        = 5
           reference_check               = 6
           wrong_access_to_archive       = 7
           OTHERS                        = 8.
    gt_lines[] = lt_lines[].
    I create Loop in smartform and Loop gt_lines into gs_line and create text to show &gs_line-tdline&
    But nothing is show.
    Can anyone help me solve it ?
    Thank you.

    Hi
    The note text should be placed in the customer item (if you try to post a document you can verify it), the keys of the text are:
    1 -
    TDNAME   = BUKRSBELNRGJAHR+BUZEI (The keys of BSEG)
    TDSPRAS = the language depends on your setting
    TDID          = 0001
    TDOBJECT = DOC_ITEM
    2 - You don't need any loop in your smartform, but you need to call the text directly
    Max

  • IW32 Operations problem

    Hi Experts,
      I got a requirement of smartform in whuch user want OPERATIONS and its corresponding COMPONENTS to be displayedfor a particular service order in IW32 or IW33.In our system material is not maintained for all operations.But the user wants to display that operations also to be displayed in smartofrom.
       Can anyone guide me with respect to tables or function module to fetch this data.
    Regards,
    Sany..

    Arthur,
    I do have some good knowledge of Looping and Smartform. I have no where in my earlier thread asked for logic .
    My  question was:
    Can anyone guide me with respect to tables or function module to fetch this data.
    If you want u can answer in report purpestive I wont mind but it would be greatful if i get the relevant tables or function module for the same.
    Sany..

Maybe you are looking for