Skip to Content
author's profile photo Former Member
Former Member

How to split Smart forms at Item level??

Hi,

We have developed a smarform for printing customer statements.right Now it is working fine .

As we went live globaly there might be statements in differeent currencies.

My item table holds the currency field and i want split the statements with respective currencies..

How can we do this?

Present logic is like this in my driver program.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = P_FORM

IMPORTING

FM_NAME = FM_NAME

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.

LS_COMPOSER_PARAM-TDNEWID = 'X'.

LS_CONTROL_PARAM-PREVIEW = ''.

SORT T_HEADER BY NAME1 KUNNR.

LOOP AT T_HEADER INTO WA_HEADER.

REFRESH ITEM_ITAB.

LOOP AT T_ITEM WHERE KUNRG = WA_HEADER-KUNNR.

APPEND T_ITEM TO ITEM_ITAB.

ENDLOOP.

SORT ITEM_ITAB BY FKDAT.

CALL FUNCTION FM_NAME

EXPORTING

ARCHIVE_INDEX = TOA_DARA

ARCHIVE_INDEX_TAB = ARC_IND_TAB

ARCHIVE_PARAMETERS = ARC_PARAMS

CONTROL_PARAMETERS = LS_CONTROL_PARAM

MAIL_APPL_OBJ = LS_RECIPIENT

MAIL_RECIPIENT = LS_RECIPIENT

MAIL_SENDER = LS_SENDER

OUTPUT_OPTIONS = LS_COMPOSER_PARAM

USER_SETTINGS = SPACE

WA_ITAB = WA_HEADER

IMPORTING

DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO

JOB_OUTPUT_INFO = JOB_OUTPUT_INFO

JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS

TABLES

WA_DEP = ITEM_ITAB

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4.

IF SY-SUBRC <> 0.

WRITE: / 'ERROR in passing vars to the smartforms '.

ENDIF.

LS_COMPOSER_PARAM-TDNEWID = SPACE.

LS_CONTROL_PARAM-NO_DIALOG = 'X'.

LS_CONTROL_PARAM-PREVIEW = ''.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2006 at 06:41 PM

    Hi,

    Check this code..The changes are marked in bold...I have mentioned CURRENCY_FIELD for the currency field name..If it is WAERS..replace the currency_field with waers..

    <b>DATA: ITEM_TAB_TMP LIKE ITEM_ITAB OCCURS 0 WITH HEADER LINE.

    DATA: V_PREV_CUR LIKE ITEM_ITAB-CURRENCY_FIELD.</b>

    LOOP AT T_HEADER INTO WA_HEADER.

    REFRESH ITEM_ITAB, ITEM_TAB_TMP.

    LOOP AT T_ITEM WHERE KUNRG = WA_HEADER-KUNNR.

    APPEND T_ITEM TO ITEM_ITAB.

    ENDLOOP.

    <b>SORT ITEM_ITAB BY CURRENCY_FIELD.</b>

    LOOP AT ITEM_TAB.

    <b>IF SY-TABIX <> 1.

    IF V_PREV_CURR <> ITEM_ITAB-CURRENCY_FIELD.</b>

    <b>SORT ITEM_ITAB_TMP BY FKDAT.</b>

    CALL FUNCTION FM_NAME

    EXPORTING

    ARCHIVE_INDEX = TOA_DARA

    ARCHIVE_INDEX_TAB = ARC_IND_TAB

    ARCHIVE_PARAMETERS = ARC_PARAMS

    CONTROL_PARAMETERS = LS_CONTROL_PARAM

    MAIL_APPL_OBJ = LS_RECIPIENT

    MAIL_RECIPIENT = LS_RECIPIENT

    MAIL_SENDER = LS_SENDER

    OUTPUT_OPTIONS = LS_COMPOSER_PARAM

    USER_SETTINGS = SPACE

    WA_ITAB = WA_HEADER

    IMPORTING

    DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO

    JOB_OUTPUT_INFO = JOB_OUTPUT_INFO

    JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS

    TABLES

    WA_DEP = <b>ITEM_ITAB_TMP</b>

    EXCEPTIONS

    FORMATTING_ERROR = 1

    INTERNAL_ERROR = 2

    SEND_ERROR = 3

    USER_CANCELED = 4.

    IF SY-SUBRC <> 0.

    WRITE: / 'ERROR in passing vars to the smartforms '.

    ENDIF.

    LS_COMPOSER_PARAM-TDNEWID = SPACE.

    LS_CONTROL_PARAM-NO_DIALOG = 'X'.

    LS_CONTROL_PARAM-PREVIEW = ''.

    <b> REFRESH ITEM_TAB_TMP.

    ELSE.

    MOVE ITEM_TAB TO ITEM_TAB_TMP.

    APPEND ITEM_TAB_TMP.

    ENDIF.

    ENDIF.</b>

    <b>AT LAST.

    CALL FUNCTION FM_NAME

    EXPORTING

    ARCHIVE_INDEX = TOA_DARA

    ARCHIVE_INDEX_TAB = ARC_IND_TAB

    ARCHIVE_PARAMETERS = ARC_PARAMS

    CONTROL_PARAMETERS = LS_CONTROL_PARAM

    MAIL_APPL_OBJ = LS_RECIPIENT

    MAIL_RECIPIENT = LS_RECIPIENT

    MAIL_SENDER = LS_SENDER

    OUTPUT_OPTIONS = LS_COMPOSER_PARAM

    USER_SETTINGS = SPACE

    WA_ITAB = WA_HEADER

    IMPORTING

    DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO

    JOB_OUTPUT_INFO = JOB_OUTPUT_INFO

    JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS

    TABLES

    WA_DEP = <b>ITEM_ITAB_TMP</b>

    EXCEPTIONS

    FORMATTING_ERROR = 1

    INTERNAL_ERROR = 2

    SEND_ERROR = 3

    USER_CANCELED = 4.

    IF SY-SUBRC <> 0.

    WRITE: / 'ERROR in passing vars to the smartforms '.

    ENDIF.

    LS_COMPOSER_PARAM-TDNEWID = SPACE.

    LS_CONTROL_PARAM-NO_DIALOG = 'X'.

    LS_CONTROL_PARAM-PREVIEW = ''.

    ENDAT.

    V_PREV_CUR = ITEM_TAB-CURRENCY_FIELD.</b>

    ENDLOOP.

    Message was edited by: Narendran Muthukumaran

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2006 at 06:30 PM

    Hi,

    Do you want to group the currencies in the line item..

    THanks,

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2006 at 06:40 PM

    Hi Vara,

    what I understood is you want to display different statements depending on the currencies..

    For this you can validate the currency value before displaying.

    For example, If you are displaying your items in the main area of your item table in the main window, in the text node where you are displaying the statement, validate the currency value in the condition tab..

    Hope this helps you...

    Regards,

    Vinod.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.