Application Development 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: 

How to read Screen Field value while running BDC ?

former_member197071
Participant
0 Kudos

Hello,

I came to a requirement where I wanted to read existing values present in screen fields and make it available to my Z report where I am writing BDC code.

I came across but that did not work. According to given link, we need to maintain a variable same as the given name of Field.

This means if there is a value for KSCHL, then we need to declare a work area RV13A (this is as per the output of pressing F1 > Technical properties on the field).

Example:

data: Begin of RV13A,

             KSCHL type RV13A-KSCHL,

          End of RV13A.

So I created the same but it did not fill the value in RV13A-KSCHL

By the way here is my code:



REPORT  ZBDC1.

DATA : gt_bdcdata  LIKE TABLE OF bdcdata,

       gs_bdcdata  LIKE bdcdata,

       mode TYPE c,

       t_msg TYPE TABLE OF bdcmsgcoll,   " Collecting Error messages

       w_msg TYPE bdcmsgcoll,

       KONP TYPE TABLE OF KONP,

       KOMG TYPE KOMG,

       BEGIN OF RV13A,

         KSCHL  TYPE KSCHL,

       END OF RV13A.

START-OF-SELECTION.

  PERFORM RUN.

FORM fill_bdc USING value(param_program)

                    value(param_dynpro)

                    value(param_dynbegin)

                    value(param_fnam)

                    value(param_fval).

  CLEAR gs_bdcdata.

  IF param_dynbegin = 'X' .

    gs_bdcdata-program = param_program .

    gs_bdcdata-dynpro  = param_dynpro .

    gs_bdcdata-dynbegin = param_dynbegin .

    APPEND gs_bdcdata TO gt_bdcdata.

  ELSE.

    gs_bdcdata-fnam = param_fnam.

    gs_bdcdata-fval = param_fval.

    CONDENSE gs_bdcdata-fval.

    APPEND gs_bdcdata TO gt_bdcdata.

  ENDIF.

ENDFORM.

FORM RUN.

  BREAK-POINT.

  PERFORM fill_bdc USING 'SAPMV13A' '0100' 'X' ' ' ' '.

  PERFORM fill_bdc USING '' '' '' 'BDC_CURSOR' 'RV13A-KSCHL'. "  RC13A

  PERFORM fill_bdc USING '' '' '' 'RV13A-KSCHL' 'ZXYZ'.

  PERFORM fill_bdc USING '' '' '' 'BDC_OKCODE' '/00'.

  PERFORM fill_bdc USING 'RV13A501' '1000' 'X' ' ' ' '.

  PERFORM fill_bdc USING '' '' '' 'BDC_CURSOR' 'F002-LOW'.

  PERFORM fill_bdc USING '' '' '' 'BDC_OKCODE' '=ONLI'.

  PERFORM fill_bdc USING '' '' '' 'SEL_DATE' '18.08.2016'.

  PERFORM fill_bdc USING '' '' '' 'F001' '1100'.

  PERFORM fill_bdc USING '' '' '' 'F002-LOW' '3180404XXXXX'.

  PERFORM fill_bdc USING 'SAPMV13A' '1501' 'X' ' ' ' '.

  PERFORM fill_bdc USING '' '' '' 'BDC_CURSOR' 'KONP-KBETR(01)'. "  RC13A

  PERFORM fill_bdc USING '' '' '' 'KONP-KBETR(01)' '11000'.

  PERFORM fill_bdc USING '' '' '' 'BDC_OKCODE' '=SICH'.

  BREAK-POINT.

*  Search for KONP table and KOMG

  CLEAR : t_msg, w_msg.

    CALL TRANSACTION 'VK12' USING gt_bdcdata

        MODE 'A'

        UPDATE 'S'

        MESSAGES INTO t_msg.

ENDFORM.

In this report, nowhere I am able to read data from screen fields.

Thanks

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
0 Kudos

This thread you mention just contains rubbish. People just didn't understand the question.

You can't interact with BDC, you fill initially the table and run the BDC, that's all.

2 REPLIES 2

former_member196331
Active Contributor
0 Kudos

You are calling vk12 then doing some kind of Transaction .

After calling the Vk12. Find is there any enhancement point,

I hope manually adding vk12 or Through the background adding vk12 is both are same (sequence of executions). but it is executing background. what we are doing in front end.

First find out the trace after calling vk12. is there any enhancement point. Get the value and pass what you are expecting. 

Sandra_Rossi
Active Contributor
0 Kudos

This thread you mention just contains rubbish. People just didn't understand the question.

You can't interact with BDC, you fill initially the table and run the BDC, that's all.