Skip to Content
avatar image
Former Member

Function groups

Hi,

Can any one help me in creating a function group from program as i need a join which is not there in the table relations, I tried with query also which is not working.

so I would like to create using from program

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    May 23, 2006 at 10:41 AM

    hi

    generally v create Fn,grps like this.

    goto se37->goto->function groups-> create group

    but what do u mean by creating a Fn grp from Abap program ??

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 23, 2006 at 10:42 AM

    Go to Se80, choose the function group tab and click on create button.

    Then you can use this function group in your program.

    Thanks,

    Susmitha

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      sorry by function groups here I mean Infosets, which we create in sq02.

      Which will be further used to create SAP Query in sq01.

      Thanks

  • avatar image
    Former Member
    May 23, 2006 at 10:44 AM

    You can only create function modules and function groups using the Function Builder in the ABAP Workbench.

    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm

    Refer to the above link

    For creating new FM http://help.sap.com/saphelp_nw04/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 23, 2006 at 10:44 AM

    Hai Srikanth

    goto se37->

    gotoMenu 'Goto'->select function groups-> click on create Group

    Thanks & regards

    Sreeni

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 23, 2006 at 10:45 AM

    Hi Sri kanth,

    Here is one example program just check out if it helps

    REPORT (SY-REPID)

    NO STANDARD PAGE HEADING

    LINE-SIZE 132

    LINE-COUNT 55.

    TABLES:TRDIR.

    SELECT-OPTIONS: PGMNAME FOR TRDIR-NAME.

    PARAMETERS:

    HEADING AS CHECKBOX DEFAULT 'X',

    FGROUP AS CHECKBOX,

    USER LIKE TRDIR-CNAM DEFAULT 'TDEMPSEY',

    DOWNLOAD AS CHECKBOX,

    TEXTPOOL AS CHECKBOX,

    DOWNDIR(20) DEFAULT 'C:\ABAP\'.

    DATA:

    W_TEXT(128),

    W_FILENAME(128),

    W_PROGRAM_LOW(8),

    W_PROGRAM_HIGH(8).

    DATA:

    BEGIN OF TEXTTAB OCCURS 0,

    ID(1),

    KEY(8),

    ENTRY(70),

    END OF TEXTTAB,

    BEGIN OF ABAPTAB OCCURS 500,

    LINE(72),

    END OF ABAPTAB,

    BEGIN OF TRTAB OCCURS 0,

    NAME LIKE TRDIR-NAME,

    ENTRY LIKE TEXTTAB-ENTRY,

    CDAT LIKE TRDIR-CDAT,

    UDAT LIKE TRDIR-UDAT,

    END OF TRTAB,

    BEGIN OF TRFTAB OCCURS 0,

    NAME LIKE TRDIR-NAME,

    ENTRY LIKE TEXTTAB-ENTRY,

    CDAT LIKE TRDIR-CDAT,

    UDAT LIKE TRDIR-UDAT,

    END OF TRFTAB.

    START-OF-SELECTION.

    IF FGROUP = ' '.

    PERFORM LOAD_TRDIR_PROGRAM.

    PERFORM PROCESS_PROGRAM.

    ELSE.

    PERFORM LOAD_TRDIR_FGROUP.

    PERFORM PROCESS_FGROUP.

    ENDIF.

    &----


    *& form load_trdir_program.

    &----


    FORM LOAD_TRDIR_PROGRAM.

    SELECT * FROM TRDIR

    WHERE NAME IN PGMNAME.

    IF USER <> '*'.

    CHECK TRDIR-UNAM = USER OR TRDIR-CNAM = USER.

    ENDIF.

    CLEAR: TEXTTAB.

    REFRESH: TEXTTAB.

    CLEAR: TRTAB.

    READ TEXTPOOL TRDIR-NAME INTO TEXTTAB LANGUAGE 'E'.

    IF SY-SUBRC = 0.

    READ TABLE TEXTTAB WITH KEY 'R'.

    MOVE TEXTTAB-ENTRY TO TRTAB-ENTRY.

    ENDIF.

    MOVE TRDIR-NAME TO TRTAB-NAME.

    MOVE TRDIR-CDAT TO TRTAB-CDAT.

    MOVE TRDIR-UDAT TO TRTAB-UDAT.

    APPEND TRTAB.

    CLEAR: TEXTTAB.

    ENDSELECT.

    ENDFORM. " load_trdir_program

    &----


    *& Form load_trdir_fgroup

    &----


    FORM LOAD_TRDIR_FGROUP.

    SELECT * FROM TRDIR

    WHERE NAME BETWEEN 'SAPLYYYY' AND 'SAPLZZZZ'.

    CHECK TRDIR-UNAM = USER OR TRDIR-CNAM = USER.

    CLEAR: TEXTTAB.

    CLEAR: TRTAB.

    REFRESH: TEXTTAB.

    READ TEXTPOOL TRDIR-NAME INTO TEXTTAB LANGUAGE 'E'.

    IF SY-SUBRC = 0.

    READ TABLE TEXTTAB WITH KEY 'R'.

    MOVE TEXTTAB-ENTRY TO TRTAB-ENTRY.

    ENDIF.

    MOVE TRDIR-NAME TO TRTAB-NAME.

    MOVE TRDIR-CDAT TO TRTAB-CDAT.

    MOVE TRDIR-UDAT TO TRTAB-UDAT.

    APPEND TRTAB.

    CLEAR: TEXTTAB.

    ENDSELECT.

    LOOP AT TRTAB.

    MOVE-CORRESPONDING TRTAB TO TRFTAB.

    APPEND TRFTAB.

    MOVE TRTAB-NAME+3(5) TO W_PROGRAM_LOW.

    MOVE '%' TO W_PROGRAM_LOW+5(1).

    MOVE TRTAB-NAME+3(5) TO W_PROGRAM_HIGH.

    MOVE 'MMMMMMMM' TO W_PROGRAM_HIGH.

    SELECT * FROM TRDIR

    WHERE NAME LIKE W_PROGRAM_LOW.

    • where name between w_program_low and w_program_high.

    CHECK TRDIR-NAME+5(1) <> '$'.

    CHECK TRDIR-NAME(5) = TRTAB-NAME+3(5).

    READ TEXTPOOL TRDIR-NAME INTO TEXTTAB LANGUAGE 'E'.

    READ TABLE TEXTTAB WITH KEY 'R'.

    MOVE TEXTTAB-ENTRY TO TRFTAB-ENTRY.

    MOVE TRDIR-NAME TO TRFTAB-NAME.

    MOVE TRDIR-CDAT TO TRFTAB-CDAT.

    MOVE TRDIR-UDAT TO TRFTAB-UDAT.

    APPEND TRFTAB.

    ENDSELECT.

    ENDLOOP.

    ENDFORM. " load_trdir_fgroup.

    ----


    • FORM PROCESS_PROGRAM

    ----


    • ........ *

    ----


    FORM PROCESS_PROGRAM.

    LOOP AT TRTAB.

    READ REPORT TRTAB-NAME INTO ABAPTAB.

    IF DOWNLOAD = 'X'.

    PERFORM DOWNLOAD_PROGRAMS USING TRTAB-NAME.

    ELSE.

    PERFORM LIST_PROGRAMS USING TRTAB-NAME.

    ENDIF.

    IF TEXTPOOL = 'X'.

    READ TEXTPOOL TRTAB-NAME INTO TEXTTAB LANGUAGE 'E'.

    IF SY-SUBRC = 0 AND DOWNLOAD = 'X'.

    PERFORM DOWNLOAD_TEXTPOOL USING TRTAB-NAME.

    ENDIF.

    LOOP AT TEXTTAB.

    WRITE:/

    TEXTTAB-ID,

    TEXTTAB-KEY,

    TEXTTAB-ENTRY.

    ENDLOOP.

    ENDIF.

    ENDLOOP.

    ENDFORM.

    ----


    • FORM PROCESS_fgroup

    ----


    • ........ *

    ----


    FORM PROCESS_FGROUP.

    LOOP AT TRFTAB.

    READ REPORT TRFTAB-NAME INTO ABAPTAB.

    IF DOWNLOAD = 'X'.

    PERFORM DOWNLOAD_PROGRAMS USING TRFTAB-NAME.

    ELSE.

    PERFORM LIST_PROGRAMS USING TRFTAB-NAME.

    ENDIF.

    IF TEXTPOOL = 'X'.

    READ TEXTPOOL TRFTAB-NAME INTO TEXTTAB LANGUAGE 'E'.

    IF SY-SUBRC = 0 AND DOWNLOAD = 'X'.

    PERFORM DOWNLOAD_TEXTPOOL USING TRFTAB-NAME.

    LOOP AT TEXTTAB.

    WRITE:/

    TEXTTAB-ID,

    TEXTTAB-KEY,

    TEXTTAB-ENTRY.

    ENDLOOP.

    ENDIF.

    ENDIF.

    ENDLOOP.

    ENDFORM.

    &----


    *& Form DOWNLOAD_PROGRAMS

    &----


    FORM DOWNLOAD_PROGRAMS USING NAME.

    W_TEXT = 'Downloading'.

    W_TEXT+15(8) = NAME.

    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

    EXPORTING

    TEXT = W_TEXT

    EXCEPTIONS

    OTHERS = 1.

    MOVE DOWNDIR TO W_FILENAME(20).

    MOVE NAME TO W_FILENAME+20(8).

    MOVE '.txt' TO W_FILENAME+28(4).

    CONDENSE W_FILENAME NO-GAPS.

    CALL FUNCTION 'WS_DOWNLOAD'

    EXPORTING

    FILENAME = W_FILENAME

    FILETYPE = 'ASC'

    TABLES

    DATA_TAB = ABAPTAB

    EXCEPTIONS

    FILE_OPEN_ERROR = 1

    FILE_WRITE_ERROR = 2

    INVALID_FILESIZE = 3

    INVALID_TABLE_WIDTH = 4

    INVALID_TYPE = 5

    NO_BATCH = 6

    UNKNOWN_ERROR = 7

    OTHERS = 8.

    ENDFORM. " DOWNLOAD_PROGRAMS

    &----


    *& Form LIST_PROGRAMS

    &----


    FORM LIST_PROGRAMS USING NAME.

    LOOP AT ABAPTAB.

    WRITE:/ NAME, ABAPTAB-LINE.

    ENDLOOP.

    ENDFORM. " LIST_PROGRAMS

    &----


    *& Form DOWNLOAD_TEXTPOOL

    &----


    FORM DOWNLOAD_TEXTPOOL USING NAME.

    W_TEXT = 'Textpool...'.

    W_TEXT+15(8) = NAME.

    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

    EXPORTING

    TEXT = W_TEXT

    EXCEPTIONS

    OTHERS = 1.

    MOVE DOWNDIR TO W_FILENAME(20).

    MOVE TRTAB-NAME TO W_FILENAME+20(8).

    MOVE '.tpl' TO W_FILENAME+28(4).

    CONDENSE W_FILENAME NO-GAPS.

    CALL FUNCTION 'WS_DOWNLOAD'

    EXPORTING

    FILENAME = W_FILENAME

    FILETYPE = 'ASC'

    TABLES

    DATA_TAB = TEXTTAB

    EXCEPTIONS

    FILE_OPEN_ERROR = 1

    FILE_WRITE_ERROR = 2

    INVALID_FILESIZE = 3

    INVALID_TABLE_WIDTH = 4

    INVALID_TYPE = 5

    NO_BATCH = 6

    UNKNOWN_ERROR = 7

    OTHERS = 8.

    ENDFORM. " DOWNLOAD_TEXTPOOL

    TOP-OF-PAGE.

    IF HEADING = 'X'.

    • Place your heading here:

    • call function 'Z_WRITE_HEADER_FOOTER'

    • exporting

    • type = 'H'

    • exceptions

    • others = 1.

    • skip 1.

    ENDIF.

    Regards

    Laxmi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 23, 2006 at 10:46 AM

    hi

    try this FM

    <b>IQAPI_CREATE_INFOSET</b>

    Add comment
    10|10000 characters needed characters exceeded