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

Call Transaction using BDC data

Former Member
0 Likes
2,164

Hi guys,

I am trying to create a program with a functionality to redirect the user to tcode FBL5N. I am using CALL TRANSACTION tcode USING it_bdcdata.

For my BDC data, I do something like the code below:

CLEAR: it_bdcdata, wa_bdcdata.

wa_bdcdata-program = 'RFITEMAR'. "program name of FBL5N

wa_bdcdata-dynpro = '1000'.

wa_bdcdata-dynbegin = 'X'.

APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.

wa_bdcdata-fnam = 'BDC_CURSOR'.

wa_bdcdata-fval = 'DD_KUNNR-LOW'. "customer number field

APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.

wa_bdcdata-fnam = 'DD_KUNNR-LOW'.

wa_bdcdata-fval = s_kunnr. "data from my selection screen parameter

APPEND wa_bdcdata TO it_bdcdata.

My problem is how can I pass a value to Special G/L ind. field of FBL5N. You can find this field if you go to tcode FBL5N > click the dynamic selection button (third button from the left of the application toolbar) > and under the Dynamic Selection area, there you can find the Special G/L ind. field.

I want to pass the value 'A' to that field, I don't know how because that field is on a subscreen. I tried the code below but it doesn't work.

CLEAR wa_bdcdata.

wa_bdcdata-fnam = 'BDC_CURSOR'.

wa_bdcdata-fval = '%%DYN009-LOW'.

APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.

wa_bdcdata-fnam = '%%DYN009-LOW'.

wa_bdcdata-fval = 'A'.

APPEND wa_bdcdata TO it_bdcdata.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,515

Hi Richard,

This will not work for you because in the BDC you haven't processed the click of the third button....

just copy and paste the code.....

I have added two records to the bdc data.....

CLEAR: it_bdcdata, wa_bdcdata.
wa_bdcdata-program = 'RFITEMAR'. "program name of FBL5N
wa_bdcdata-dynpro = '1000'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=DYNS'.
APPEND wa_bdcdata TO it_bdcdata.

these are the two records which are added.... where and how to add just see below.... I have written the complete code which you have given and also the place where the above two records have to be added...

CLEAR: it_bdcdata, wa_bdcdata.
"   here is the place where these two records are supposed to be added.....
" This will for sure resolve your issue.... :)
wa_bdcdata-program = 'RFITEMAR'. "program name of FBL5N
wa_bdcdata-dynpro = '1000'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=DYNS'.
APPEND wa_bdcdata TO it_bdcdata.

wa_bdcdata-program = 'RFITEMAR'. "program name of FBL5N
wa_bdcdata-dynpro = '1000'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = 'DD_KUNNR-LOW'. "customer number field
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'DD_KUNNR-LOW'.
wa_bdcdata-fval = s_kunnr. "data from my selection screen parameter
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = '%%DYN009-LOW'.
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = '%%DYN009-LOW'.
wa_bdcdata-fval = 'A'.
APPEND wa_bdcdata TO it_bdcdata.

Regards,

Siddarth

9 REPLIES 9
Read only

Former Member
0 Likes
1,515

Hi Richard,

Are you using call recording method...! for BDC..

Firts record your Transaction from SHDB(Call ecording method)

then look for the source code..! it contains both session 7 Call transaction method...!

there you can see clearly how to pass the data to sub screen or dynamic selection scree,,, anything...

If any problem revert back...

Thanks & regards,

Dileep .C

Read only

0 Likes
1,515

I did record the transaction and followed the suggested abap codes, but when I try to run my program it always say "Field %%DYN009-LOW does not exist in the screen RFITEMAR 1000"

My recording shows this code:

perform bdc_field using 'BDC_CURSOR'

'%%DYN009-LOW'.

perform bdc_field using '%%DYN009-LOW'

'A'.

Read only

0 Likes
1,515

Hi Richard,

The problem is simple Richard,

My recording shows this code:

perform bdc_field using 'BDC_CURSOR'

'%%DYN009-LOW'.

perform bdc_field using '%%DYN009-LOW'

'A'.

This is because...! In the field '%%DYN009-LOW'. %%DYN-009 denotes the position of the dynamic selection screen,,

Example,,,!

Special G/L ind. Above this field there might be 8 fields selected,,, so the field name is '%%DYN009'..

If you select one more field above then it will become '%%DYN010'...!..!

If selected below no change...!

If one field removed form above this field then it changes to '%%DYN008'..! And so on.,..!

By keeping this in mind now trace the error...!

Thanks & regards,

Dileep .C

Read only

0 Likes
1,515

Hi Richard,

Apart from Recording the Transaction with the Recorder you can also manually note down the fields. This can be achieved by pressing the F1 Function Key on the Screen Fields and then in the Performance Assistance you can navigate to the Technical Details.

As you already figured out that Field name is not proper you can change the fieldnames which you will get from technical details for fields and can try executing the program.

Hope this helps.

Thanks,

Samantak.

Read only

venkat_o
Active Contributor
0 Likes
1,515

Hi Richard, Why don't you try this way ? 1. Select the fields which you want dynamically. 2. Create one variant by saving the selection-screen. 3. Go to SHDB transaction to record FBL5N transaction code. 4. When you start recording, select variant first and click on Dynamic selection button then you can see selected fields. 5. Now pass data to the fields on the selection-screen. I believe that it works. Thanks Venkat.O

Read only

Former Member
0 Likes
1,515

Hello Richard,

First of all, FBL5N is Enjoy-Transaction. The funda is we cannot use BDCs for Enjoy-Transactions.

Please check for any BAPI.

Regards,

-Syed.

Read only

Former Member
0 Likes
1,516

Hi Richard,

This will not work for you because in the BDC you haven't processed the click of the third button....

just copy and paste the code.....

I have added two records to the bdc data.....

CLEAR: it_bdcdata, wa_bdcdata.
wa_bdcdata-program = 'RFITEMAR'. "program name of FBL5N
wa_bdcdata-dynpro = '1000'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=DYNS'.
APPEND wa_bdcdata TO it_bdcdata.

these are the two records which are added.... where and how to add just see below.... I have written the complete code which you have given and also the place where the above two records have to be added...

CLEAR: it_bdcdata, wa_bdcdata.
"   here is the place where these two records are supposed to be added.....
" This will for sure resolve your issue.... :)
wa_bdcdata-program = 'RFITEMAR'. "program name of FBL5N
wa_bdcdata-dynpro = '1000'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=DYNS'.
APPEND wa_bdcdata TO it_bdcdata.

wa_bdcdata-program = 'RFITEMAR'. "program name of FBL5N
wa_bdcdata-dynpro = '1000'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = 'DD_KUNNR-LOW'. "customer number field
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'DD_KUNNR-LOW'.
wa_bdcdata-fval = s_kunnr. "data from my selection screen parameter
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = '%%DYN009-LOW'.
APPEND wa_bdcdata TO it_bdcdata.

CLEAR wa_bdcdata.
wa_bdcdata-fnam = '%%DYN009-LOW'.
wa_bdcdata-fval = 'A'.
APPEND wa_bdcdata TO it_bdcdata.

Regards,

Siddarth

Read only

0 Likes
1,515

Thank you very much Siddarth and Faisal! Your input solved my problem!

Also thank you to all who tried to help me. Very well appreciated.

Read only

faisalatsap
Active Contributor
0 Likes
1,515

Hi, Richard

Please Test the following Sample Code Hope will solve out your problem,

DATA: it_bdcdata TYPE TABLE OF bdcdata,
      wa_it_bdcdata like LINE OF it_bdcdata.

DATA opt TYPE ctu_params.

CLEAR wa_it_bdcdata.
wa_it_bdcdata-program  = 'RFITEMAR'.
wa_it_bdcdata-dynpro   = '1000'.
wa_it_bdcdata-dynbegin = 'X'.
APPEND wa_it_bdcdata TO it_bdcdata.

CLEAR wa_it_bdcdata.
wa_it_bdcdata-fnam = 'BDC_OKCODE'.
wa_it_bdcdata-fval = '=DYNS'.
APPEND wa_it_bdcdata TO it_bdcdata.

CLEAR wa_it_bdcdata.
wa_it_bdcdata-program  = 'RFITEMAR'.
wa_it_bdcdata-dynpro   = '1000'.
wa_it_bdcdata-dynbegin = 'X'.
APPEND wa_it_bdcdata TO it_bdcdata.

CLEAR wa_it_bdcdata.
wa_it_bdcdata-fnam = '%%DYN009-LOW'.
wa_it_bdcdata-fval = 'B'.
APPEND wa_it_bdcdata TO it_bdcdata.

Best Regards,

Faisal