Skip to Content
author's profile photo
Former Member

adding a push button on the report toolbar

adding a save button on the report toolbar, so that after clicking the button, the data fetched on the report will be stored in the application server.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 10:30 AM

    Hi

    to automate this process ,best way is to create a Z rport and there u can submit this sap standard report and get its output into an Internal table and then u can write this internal table to application server via following demo code -

    this is code for both (download /upload),u can not use CG3y and CG3z as u want to do it as a background job ..

    &----


    *& Report ZGILL_AS *

    *& *

    &----


    *& *

    *& *

    &----


    REPORT ZGILL_AS message-id rp .

    tables: pa0001,pa0002.

    select-options s_pernr for pa0001-pernr no intervals MODIF ID XYZ.

    parameters: p_dwnld AS CHECKBOX ,

    p_upld AS CHECKBOX DEFAULT 'X'.

    parameters: P_DSNI(75) TYPE C MODIF ID ABG DEFAULT

    '/usr/local/sapdata/amit.dat' LOWER CASE.

    data: begin of itab occurs 0,

    pernr(8),

    sp1(1) value ',',

    werks(4),

    sp2(1) value ',',

    persg(1),

    sp3(1) value ',',

    persk(2),

    end of itab.

    data: s_eof(3).

    start-of-selection.

    if p_upld = 'X'.

    OPEN DATASET P_DSNI FOR OUTPUT IN LEGACY TEXT MODE.

    PERFORM FETCH_DATA.

    STOP.

    elseif p_dwnld = 'X'.

    OPEN DATASET P_DSNI FOR INPUT IN LEGACY TEXT MODE.

    IF SY-SUBRC NE 0.

    MESSAGE E016 WITH

    'Error opening seq. file, RC:' SY-SUBRC.

    EXIT.

    ENDIF.

    CLEAR S_EOF.

    DO.

    PERFORM FETCH_file.

    IF S_EOF EQ 'YES'. stop. ENDIF.

    ENDDO.

    endif.

    END-OF-SELECTION.

    if itab[] is not initial.

    perform print_file1 tables itab.

    else.

    write:/ 'No records exists'.

    endif.

    &----


    *& Form FETCH_DATA

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM FETCH_DATA .

    SELECT * FROM PA0001 WHERE PERNR IN S_PERNR.

    MOVE-CORRESPONDING PA0001 TO ITAB.

    TRANSFER ITAB TO P_DSNI.

    APPEND ITAB.

    ENDSELECT.

    CLOSE DATASET P_DSNI.

    ENDFORM. " FETCH_DATA

    &----


    *& Form FETCH_file

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM FETCH_file .

    READ DATASET P_DSNI INTO itab.

    append itab.

    clear itab.

    IF SY-SUBRC NE 0.

    S_EOF = 'YES'. EXIT.

    ENDIF.

    ENDFORM. " FETCH_file

    &----


    *& Form print_file1

    &----


    • text

    ----


    • -->P_ITAB text

    ----


    FORM print_file1 tables P_ITAB structure itab .

    write:/2 'EmpNo',

    14 'Personnel Area',

    34 'Emp Group',

    47 'Emp SubGroup'.

    skip 1.

    loop at p_itab.

    write:2 p_itab-pernr,

    14 p_itab-werks,

    34 p_itab-persg,

    47 p_itab-persk.

    skip 1.

    endloop.

    ENDFORM. " print_file1

    <b>Reward if usefull</b>

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 10:32 AM

    There are already default buttons available on the classic report..

    just go on to the debugging [/h] mode and press save button u will get the sy-ucomm triggered.. and code accord.

    still if they are not there you can create Your own stats.. and apply them.. by command..

    set pf-status '<status_name>'.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 10:33 AM

    Hi Abdul,

    Use SSCRFIELDS table to get buttons on report tool bar.

    Check this sample report <b>DEMO_SEL_SCREEN_FUNCTION_KEY to</b> create a push buttons on report tool bar.

    Thanks,

    Vinay

    Add comment
    10|10000 characters needed characters exceeded