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

unwanted elements shown in screen !!

Former Member
0 Likes
1,015

Hi,

I have done a BDC recording of FB12 and pasted the code of its program in my report program. Functionality wise everything is working fine but I am getting some extra screen elements in my screen and they seem to be related to the BDC recording ...I dont understand what they are for and how to remove them !!

Steps I followed:

1. Using SHDB did BDC for FB12.

2. Copied the perform statements to be Z report program and edited to include them in a loop iterating an itable which supplies the data.

""""" BTW, how do i attach screen shots for this issue in the forum ?? """"""

code is as shown below...

REPORT ZFB12TEST.

TABLES: BKPF.

Data : v_gjahr(10) type c.

DATA: BEGIN OF bkpf_rec OCCURS 0,

bukrs LIKE BKPF-BUKRS,

blart LIKE BKPF-BLART,

cpudt LIKE BKPF-CPUDT,

budat LIKE BKPF-budat,

belnr LIKE BKPF-BELNR,

gjahr LIKE BKPF-GJAHR,

END OF bkpf_rec.

SELECT-OPTIONS: so_bukrs FOR BKPF-BUKRS,

so_blart FOR BKPF-BLART,

so_cpudt FOR BKPF-CPUDT,

so_budat FOR BKPF-budat,

so_belnr FOR BKPF-BELNR,

so_gjahr FOR BKPF-GJAHR.

include bdcrecx1.

start-of-selection.

SELECT bukrs blart cpudt budat belnr gjahr into table bkpf_rec from bkpf

where bukrs IN

so_bukrs and blart in so_blart and cpudt in so_cpudt and budat in

so_budat and belnr in so_belnr and gjahr in so_gjahr.

loop at bkpf_rec.

perform open_group.

perform bdc_dynpro using 'SAPMF05M' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF022-BUKRS'.

perform bdc_field using 'BDC_OKCODE'

'=SEL'.

perform bdc_field using 'RF022-BUKRS'

bkpf_rec-bukrs.

perform bdc_dynpro using 'SAPMSSY0' '0120'.

perform bdc_field using 'BDC_CURSOR'

'19/07'.

perform bdc_field using 'BDC_OKCODE'

'=PICK'.

perform bdc_dynpro using 'SAPLF022' '1001'.

perform bdc_field using 'BDC_CURSOR'

'RF022-GJAHR'.

perform bdc_field using 'BDC_OKCODE'

'=GO'.

perform bdc_field using 'RF022-BELNR'

bkpf_rec-belnr.

Write BKPF_REC-GJAHR to v_gjahr.

perform bdc_field using 'RF022-GJAHR'

v_gjahr.

perform bdc_transaction using 'FB12'.

perform close_group.

endloop.

Hi,

I have done a BDC recording of FB12 and pasted the code of its program in my report program. Functionality wise everything is working fine but I am getting some extra screen elements in my screen and they seem to be related to the BDC recording ...I dont understand what they are for and how to remove them !!

Steps I followed:

1. Using SHDB did BDC for FB12.

2. Copied the perform statements to be Z report program and edited to include them in a loop iterating an itable which supplies the data.

""""" BTW, how do i attach screen shots for this issue in the forum ?? """"""

code is as shown below...

REPORT ZFB12TEST.

TABLES: BKPF.

Data : v_gjahr(10) type c.

DATA: BEGIN OF bkpf_rec OCCURS 0,

bukrs LIKE BKPF-BUKRS,

blart LIKE BKPF-BLART,

cpudt LIKE BKPF-CPUDT,

budat LIKE BKPF-budat,

belnr LIKE BKPF-BELNR,

gjahr LIKE BKPF-GJAHR,

END OF bkpf_rec.

SELECT-OPTIONS: so_bukrs FOR BKPF-BUKRS,

so_blart FOR BKPF-BLART,

so_cpudt FOR BKPF-CPUDT,

so_budat FOR BKPF-budat,

so_belnr FOR BKPF-BELNR,

so_gjahr FOR BKPF-GJAHR.

include bdcrecx1.

start-of-selection.

SELECT bukrs blart cpudt budat belnr gjahr into table bkpf_rec from bkpf

where bukrs IN

so_bukrs and blart in so_blart and cpudt in so_cpudt and budat in

so_budat and belnr in so_belnr and gjahr in so_gjahr.

loop at bkpf_rec.

perform open_group.

perform bdc_dynpro using 'SAPMF05M' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF022-BUKRS'.

perform bdc_field using 'BDC_OKCODE'

'=SEL'.

perform bdc_field using 'RF022-BUKRS'

bkpf_rec-bukrs.

perform bdc_dynpro using 'SAPMSSY0' '0120'.

perform bdc_field using 'BDC_CURSOR'

'19/07'.

perform bdc_field using 'BDC_OKCODE'

'=PICK'.

perform bdc_dynpro using 'SAPLF022' '1001'.

perform bdc_field using 'BDC_CURSOR'

'RF022-GJAHR'.

perform bdc_field using 'BDC_OKCODE'

'=GO'.

perform bdc_field using 'RF022-BELNR'

bkpf_rec-belnr.

Write BKPF_REC-GJAHR to v_gjahr.

perform bdc_field using 'RF022-GJAHR'

v_gjahr.

perform bdc_transaction using 'FB12'.

perform close_group.

endloop.

6 REPLIES 6
Read only

Former Member
0 Likes
954

Do you mean on the selection screen of your report? They are from the include.

Rob

Read only

0 Likes
954

yes on my report !!

but i dont want them to be displayed...they are fields such as user name, session name, two radio buttons, two check boxes, a field called SMALL LOG etc. i think they r related to BDC session....but then how do i remove them ?? I want my selection screen to accept a range of values from user and then i want to invoke the BDC and pass the values to it !!

Read only

0 Likes
954

Copy the performs from the include <b>bdcrecx1</b> into your report!

Copy all the corresponding data declarations.

Then remove the include <b>bdcrecx1</b> from your report.

You can define your own selection screen now!

Read only

0 Likes
954

Two things you could do:

The simplest would be to copy the relevant parts of the include into your program. Make the parameters data and the select-options ranges. You would still have to fill them in though.

Or leave them in and then at selection-screen output, make the fields no-display.

But, again you still have to fill them in though.

Rob

Message was edited by: Rob Burbank

Read only

0 Likes
954

This is a modified version of your code...without the standard include.....



*&---------------------------------------------------------------------*
*& Report  ZFB12TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZFB12TEST.

TABLES: bkpf.


*----------------------------------------------------------------------*
*   data definition
*----------------------------------------------------------------------*
*       Batchinputdata of single transaction
DATA:   bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
*       messages of call transaction
DATA:   messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
*       error session opened (' ' or 'X')
DATA:   e_group_opened.
*       message texts


DATA : v_gjahr(10) TYPE c.

DATA: BEGIN OF bkpf_rec OCCURS 0,
bukrs LIKE bkpf-bukrs,
blart LIKE bkpf-blart,
cpudt LIKE bkpf-cpudt,
budat LIKE bkpf-budat,
belnr LIKE bkpf-belnr,
gjahr LIKE bkpf-gjahr,
END OF bkpf_rec.

SELECT-OPTIONS: so_bukrs FOR bkpf-bukrs,
so_blart FOR bkpf-blart,
so_cpudt FOR bkpf-cpudt,
so_budat FOR bkpf-budat,
so_belnr FOR bkpf-belnr,
so_gjahr FOR bkpf-gjahr.


CONSTANTS: nodata VALUE '/'.          "nodata

DATA: session,
      user(12),
      group(12),
      e_hdate LIKE sy-datum,
      e_user(12),
      e_group(12),

      cupdate LIKE ctu_params-updmode VALUE 'L',
      ctumode LIKE ctu_params-dismode VALUE 'N'.


START-OF-SELECTION.

  SELECT bukrs blart cpudt budat belnr gjahr INTO TABLE bkpf_rec FROM bkpf
  WHERE bukrs IN
  so_bukrs AND blart IN so_blart AND cpudt IN so_cpudt AND budat IN
  so_budat AND belnr IN so_belnr AND gjahr IN so_gjahr.


  session = 'X'. " Leave blank for call transaction
  user    = sy-uname.
  group   = 'XXXXXXXX'. "Give a group name
  e_hdate = sy-datum.
  e_user  = sy-uname.
  e_group = 'E_XXXXXX'. "Give a name for error session

  LOOP AT bkpf_rec.

    PERFORM open_group.

    PERFORM bdc_dynpro USING 'SAPMF05M' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF022-BUKRS'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=SEL'.
    PERFORM bdc_field USING 'RF022-BUKRS'
    bkpf_rec-bukrs.
    PERFORM bdc_dynpro USING 'SAPMSSY0' '0120'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    '19/07'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=PICK'.
    PERFORM bdc_dynpro USING 'SAPLF022' '1001'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF022-GJAHR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=GO'.
    PERFORM bdc_field USING 'RF022-BELNR'
    bkpf_rec-belnr.

    WRITE bkpf_rec-gjahr TO v_gjahr.

    PERFORM bdc_field USING 'RF022-GJAHR'
    v_gjahr.
    PERFORM bdc_transaction USING 'FB12'.

    PERFORM close_group.

  ENDLOOP.


*----------------------------------------------------------------------*
*   create batchinput session                                          *
*   (not for call transaction using...)                                *
*----------------------------------------------------------------------*
FORM open_group.
  IF session = 'X'.
    SKIP.
    WRITE: /(20) 'Create group'(i01), group.
    SKIP.
*   open batchinput group
    CALL FUNCTION 'BDC_OPEN_GROUP'
      EXPORTING
        client = sy-mandt
        group  = group
        user   = user
        keep   = 'X'.
*        holddate = holddate.

    WRITE: /(30) 'BDC_OPEN_GROUP'(i02),
            (12) 'returncode:'(i05),
                 sy-subrc.
  ENDIF.
ENDFORM.                    "

*----------------------------------------------------------------------*
*   end batchinput session                                             *
*   (call transaction using...: error session)                         *
*----------------------------------------------------------------------*
FORM close_group.
  IF session = 'X'.
*   close batchinput group
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    WRITE: /(30) 'BDC_CLOSE_GROUP'(i04),
            (12) 'returncode:'(i05),
                 sy-subrc.
  ELSE.
    IF e_group_opened = 'X'.
      CALL FUNCTION 'BDC_CLOSE_GROUP'.
      WRITE: /.
      WRITE: /(30) 'Fehlermappe wurde erzeugt'(i06).
      e_group_opened = ' '.
    ENDIF.
  ENDIF.
ENDFORM.                    "CLOSE_GROUP

*----------------------------------------------------------------------*
*        Start new transaction according to parameters                 *
*----------------------------------------------------------------------*
FORM bdc_transaction USING tcode.
  DATA: l_mstring(480).
  DATA: l_subrc LIKE sy-subrc.
* batch input session
  IF session = 'X'.
    CALL FUNCTION 'BDC_INSERT'
      EXPORTING
        tcode     = tcode
      TABLES
        dynprotab = bdcdata.

*    IF smalllog <> 'X'.
    WRITE: / 'BDC_INSERT'(i03),
             tcode,
             'returncode:'(i05),
             sy-subrc,
             'RECORD:',
             sy-index.
*    ENDIF.

* call transaction using
  ELSE.
    REFRESH messtab.
    CALL TRANSACTION tcode USING bdcdata
                     MODE   ctumode
                     UPDATE cupdate
                     MESSAGES INTO messtab.
    l_subrc = sy-subrc.
**    IF smalllog <> 'X'.
*    WRITE: / 'CALL_TRANSACTION',
*             tcode,
*             'returncode:'(i05),
*             l_subrc,
*             'RECORD:',
*             sy-index.
*
*    LOOP AT messtab.
*
*      SELECT SINGLE * FROM t100 WHERE sprsl = messtab-msgspra
*                                AND   arbgb = messtab-msgid
*                                AND   msgnr = messtab-msgnr.
*      IF sy-subrc = 0.
*        l_mstring = t100-text.
*        IF l_mstring CS '&1'.
*          REPLACE '&1' WITH messtab-msgv1 INTO l_mstring.
*          REPLACE '&2' WITH messtab-msgv2 INTO l_mstring.
*          REPLACE '&3' WITH messtab-msgv3 INTO l_mstring.
*          REPLACE '&4' WITH messtab-msgv4 INTO l_mstring.
*        ELSE.
*          REPLACE '&' WITH messtab-msgv1 INTO l_mstring.
*          REPLACE '&' WITH messtab-msgv2 INTO l_mstring.
*          REPLACE '&' WITH messtab-msgv3 INTO l_mstring.
*          REPLACE '&' WITH messtab-msgv4 INTO l_mstring.
*        ENDIF.
*        CONDENSE l_mstring.
*        WRITE: / messtab-msgtyp, l_mstring(250).
*      ELSE.
*        WRITE: / messtab.
*      ENDIF.
*    ENDLOOP.

    SKIP.

*    ENDIF.
** Erzeugen fehlermappe ************************************************
    IF l_subrc <> 0 AND e_group <> space.
      IF e_group_opened = ' '.
        CALL FUNCTION 'BDC_OPEN_GROUP'
          EXPORTING
            client   = sy-mandt
            group    = e_group
            user     = e_user
            keep     = 'X'
            holddate = e_hdate.
        e_group_opened = 'X'.
      ENDIF.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          tcode     = tcode
        TABLES
          dynprotab = bdcdata.
    ENDIF.
  ENDIF.
  REFRESH bdcdata.
ENDFORM.                    "BDC_TRANSACTION

*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
  CLEAR bdcdata.
  bdcdata-program  = program.
  bdcdata-dynpro   = dynpro.
  bdcdata-dynbegin = 'X'.
  APPEND bdcdata.
ENDFORM.                    "BDC_DYNPRO

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
  IF fval <> nodata.
    CLEAR bdcdata.
    bdcdata-fnam = fnam.
    bdcdata-fval = fval.
    APPEND bdcdata.
  ENDIF.
ENDFORM.                    "BDC_FIELD

Read only

Former Member
0 Likes
954

Hi I think it should be firing the include program selection screen. Try not to include BDCRECX1 in your program and write your own performs there in Z program.