Application Development and Automation 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: 
Read only

About Smartforms

former_member532868
Participant
0 Likes
266

Hi Guys

I am executing driver program using smartforms.Actually my requirement is getting total no of records each record will display in single page only.

I am using Loop in Main window.

Loop. table name itab1.

after complete one record i use one variable var1

initially var1 = 1. After complete each record var1 will increase +1.

Initially I am getting total no of records into variable var

Ex total no of records var = 14.

now I am using page break condition

In Command I use this condition If Var1 <= var. Then only page break will require.

Same code I used in my smartform.But I am getting each page in Main Window getting two times how can I avoid duplicates.

Please send me the solution as early as posible.It is very urgent requirement.

Regards

Hari

1 REPLY 1
Read only

Former Member
0 Likes
252

hi do like this,

i had done this ...

form interface >tables> I_VBAP LIKE VBAP

global def..>WA_VBAP TYPE VBAP

V_VBELN type VBAP-VBELN

main window-->table >mainarea>row1-->cell1>&wa_vbap-vbeln&

create code for this

code

if v_vbeln <> wa_vbap-vbeln.

v_vbeln = wa_vbap-vbeln.

new-page.

endif.

cell2>wa_vbap-matnr&

cell3>wa_vbap-netwr&

cel4>wa_vbap-posnr&

tables >data>loop loop>I_VBAP INTO WA_VBAP

REPORT zpr_17

NO STANDARD PAGE HEADING LINE-SIZE 255.

TABLES: vbak.

DATA: BEGIN OF it_vbak OCCURS 0,

vbeln LIKE vbak-vbeln,

vkorg LIKE vbak-vkorg,

spart LIKE vbak-spart,

END OF it_vbak,

BEGIN OF it_vbap OCCURS 0,

vbeln LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

matnr LIKE vbap-matnr,

END OF it_vbap,

BEGIN OF it_final OCCURS 0,

vbeln LIKE vbap-vbeln,

vkorg LIKE vbak-vkorg,

spart LIKE vbak-spart,

posnr LIKE vbap-posnr,

matnr LIKE vbap-matnr,

END OF it_final.

SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.

START-OF-SELECTION.

PERFORM get_data.

PERFORM print_data.

&----


*& Form get_data

&----


  • text

----


FORM get_data .

SELECT vbeln vkorg spart INTO TABLE it_vbak

FROM vbak WHERE vbeln IN s_vbeln.

IF NOT it_vbak[] IS INITIAL.

SELECT vbeln posnr matnr INTO TABLE it_vbap

FROM vbap

FOR ALL ENTRIES IN it_vbak

WHERE vbeln = it_vbak-vbeln.

ENDIF.

LOOP AT it_vbap.

READ TABLE it_vbak WITH KEY vbeln = it_vbap-vbeln.

IF sy-subrc = 0.

it_final-vbeln = it_vbak-vbeln.

it_final-vkorg = it_vbak-vkorg.

it_final-spart = it_vbak-spart.

ENDIF.

it_final-posnr = it_vbap-posnr.

it_final-matnr = it_vbap-matnr.

APPEND it_final.

CLEAR: it_final,

it_vbak,

it_vbap.

ENDLOOP.

ENDFORM. " get_data

&----


*& Form print_data

&----


  • text

----


FORM print_data .

CALL FUNCTION '/1BCDWB/SF00000858'

  • EXPORTING

  • ARCHIVE_INDEX = ARCHIVE_INDEX

  • ARCHIVE_INDEX_TAB = ARCHIVE_INDEX_TAB

  • ARCHIVE_PARAMETERS = ARCHIVE_PARAMETERS

  • CONTROL_PARAMETERS = CONTROL_PARAMETERS

  • MAIL_APPL_OBJ = MAIL_APPL_OBJ

  • MAIL_RECIPIENT = MAIL_RECIPIENT

  • MAIL_SENDER = MAIL_SENDER

  • OUTPUT_OPTIONS = OUTPUT_OPTIONS

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO

  • JOB_OUTPUT_INFO = JOB_OUTPUT_INFO

  • JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS

TABLES

it_final = it_final

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

regards,

venkat.