Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

smartforms

Former Member
0 Kudos

could u tell me how to write a loop in smartforms,,,

4 REPLIES 4

Former Member
0 Kudos

Hi Zuber,

You have an option to create a loop in the Smartform, right click on anything like the 'Main Page', 'Code Block' goto option 'Flow Logic' and there you will find option for a loop.

Also can you specify what for do you want this loop.

Regards,

Aditya.

Former Member
0 Kudos

Hi Zuber,

Right click on the MAIN WINDOW and the select CREATE and the select FLOW LOGIC and then select LOOP.Then ur problem is solved..

In that LOOP ,In that select DATA tabstrip and in operand place mention ur INTERNAL TABLE NAME and in the INTO place mention WORK AREA OR HEADER LINE and write logic ok...

Award points if helpful.

Kiran Kumar.G

Have a Nice Day..

Edited by: KIRAN KUMAR on Jan 7, 2008 7:24 AM

Former Member
0 Kudos

Hi,

1. Go with a transaction code : smartforms

2. Enter the form name like : ysmart_forms1

3. Create

4. Enter the Description for the form

5. From the left side window there will be a form interface to provide table .....

6. Go for tables option

7. ugyfel like ugyfel(ref.type)

8. Pages and window-> page1-> main window

9. Go to the form painter adjust the main window.

10. Select main window and right click --> go for create loop

11. Name: loop1, desc: display loop.

12. Internal table ktab into ktab.

13. select loop right click -> create a text

14. name : text1, desc: display text.

15. Go to change editor.

16. Write the mater what ever you want and if you want to display data from the table write the table fields as follows:

&ktab-<field1>& &ktab-<field2>&

save & activate then execute ,, scripts will generate a function module like : '/ibcdw/sf0000031' copy this function module and call in executable program...

For that

1. go with abap editor se38.

2. table: ugyfel.

3. parameters: test like ugyfel-<field1>.

4. data itab like ugyfel occurs 0 with header line.

5. select * from ugyfel into table itab where field1 = test1.

6. call function '/ibcdw/sf0000031'

7. tables

ktab = itab.

With Regards

Madhu

Former Member
0 Kudos

Hi

see this code

-


Parameters p_belnr like bkpf-belnr default '0100000236'.

*Get last SA type document posted to build document key

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

NR_RANGE_NR = '01'

OBJECT = 'RF_BELEG'

  • QUANTITY = '1'

SUBOBJECT = '4000' "company code

TOYEAR = '2005'

  • IGNORE_BUFFER = '2005'

IMPORTING

NUMBER = docnum

  • QUANTITY =

  • RETURNCODE =

  • EXCEPTIONS

  • INTERVAL_NOT_FOUND = 1

  • NUMBER_RANGE_NOT_INTERN = 2

  • OBJECT_NOT_FOUND = 3

  • QUANTITY_IS_0 = 4

  • QUANTITY_IS_NOT_1 = 5

  • INTERVAL_OVERFLOW = 6

  • BUFFER_OVERFLOW = 7

  • OTHERS = 8

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

    • Begin to populate docnument header.

*obj_key contains new document no.

CONCATENATE docnum '4000' sy-datlo(4) INTO doc_header-obj_key.

doc_header-obj_type = 'BKPFF'.

*obj_key_r contains document no. needed to reverse

CONCATENATE p_belnr '4000' sy-datlo(4) INTO doc_header-obj_key_r.

doc_header-obj_sys = 'A1DMD011'.

*doc_header-OBJ_KEY_R = 'AWREF_REV'.

*doc_header-AC_DOC_NO = '8'.

*doc_header-header_txt = 'TEST BOC BAPI POSTING'.

doc_header-comp_code = '4000'.

doc_header-REASON_REV = '02'.

doc_header-pstng_date = '20050517'.

doc_header-FIS_PERIOD = '05'.

  • All tables filled - now call BAPI.

CALL FUNCTION 'BAPI_ACC_GL_POSTING_REV_POST'

EXPORTING

REVERSAL = doc_header

IMPORTING

OBJ_TYPE = doc_header-obj_type

OBJ_KEY = doc_header-obj_key

OBJ_SYS = doc_header-obj_sys

TABLES

RETURN = return

.

LOOP AT return WHERE type = 'E'.

EXIT.

ENDLOOP.

IF sy-subrc EQ 0.

WRITE: / 'BAPI call failed - debug and fix!'.

LOOP AT return.

WRITE: / .

WRITE:

return-TYPE,

'|',

return-ID,

'|',

return-NUMBER,

'|',

return-MESSAGE.

ENDLOOP.

ELSE.

LOOP AT return.

WRITE: / .

WRITE:

return-TYPE,

'|',

return-ID,

'|',

return-NUMBER,

'|',

return-MESSAGE.

ENDLOOP.

CLEAR return.

REFRESH return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT = 'X'

IMPORTING

return = return.

WRITE: / 'BAPI call worked!!'.

WRITE: / doc_header-obj_key, ' posted'.

ENDIF.

with regards,

sowjanya gosala.

please reward if it is helpful.