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: 

BDC

Former Member
0 Kudos

hi,

My program is a BDC using call transaction for T.code sm30. Here i am maintaining the data which is displayed in the list using call transaction.

report Z_CHANGE_FI_SL

no standard page heading line-size 255.

include zfi_restatement_top.

----


  • Data

----


data: j_final2 type standard table of ty_final.

data: wa_final2 type ty_final.

data: bdcdata like bdcdata occurs 0 with header line,

messtab like bdcmsgcoll occurs 0 with header line.

data: v_counter type n value '0',

n type i,

k type n value '0',

v_tarnbr(120) type c,

v_wbs_mask like zupi5a-rzzps_posid,

  • v_relation like query_tab-relation,

  • v_bool like query_tab-bool.

v_relation(20) type c,

v_bool(20) type c.

start-of-selection.

import i_final2 to j_final2 from memory id 'table'.

describe table j_final2 lines n.

perform bdc_dynpro using 'SAPMSVMA' '0100'.

perform bdc_field using 'BDC_CURSOR'

'VIMDYNFLDS-LTD_DTA_AR'.

perform bdc_field using 'BDC_OKCODE'

'=UPD'.

perform bdc_field using 'VIEWNAME'

'zfi_sl'.

perform bdc_field using 'VIMDYNFLDS-LTD_DTA_NO'

' ' .

perform bdc_field using 'VIMDYNFLDS-LTD_DTA_AR'

'X'.

perform bdc_dynpro using 'SAPLSVIX' '0210'.

perform bdc_field using 'BDC_CURSOR'

'MARK_CHECKBOX(02)'.

perform bdc_field using 'BDC_OKCODE'

'=OKAY'.

perform bdc_field using 'MARK_CHECKBOX(02)'

'X'.

loop at j_final2 into wa_final2.

v_counter = v_counter + 1.

k = v_counter - 1.

call function 'CONVERSION_EXIT_ABPSN_OUTPUT'

exporting

input = wa_final2-rzzps_posid

importing

output = v_wbs_mask.

if ( v_counter EQ 1 ).

if n EQ 1.

perform bdc_dynpro using 'SAPLSVIX' '0100'.

perform bdc_field using 'BDC_CURSOR'

'D0100_FIELD_TAB-LOWER_LIMIT (01)'.

perform bdc_field using 'BDC_OKCODE'

'=OKAY'.

perform bdc_field using 'D0100_FIELD_TAB- LOWER_LIMIT(01)'

v_wbs_mask.

exit.

else.

perform bdc_dynpro using 'SAPLSVIX' '0100'.

perform bdc_field using 'BDC_CURSOR'

'D0100_FIELD_TAB-LOWER_LIMIT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=FSEL'.

perform bdc_field using 'D0100_FIELD_TAB-LOWER_LIMIT(01)'

v_wbs_mask.

perform bdc_dynpro using 'SAPLSVIX' '0200'.

perform bdc_field using 'BDC_CURSOR'

'QUERY_TAB-RELATION(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ANHG'.

perform bdc_dynpro using 'SAPLSVIX' '0210'.

perform bdc_field using 'BDC_CURSOR'

'MARK_CHECKBOX(02)'.

perform bdc_field using 'BDC_OKCODE'

'=OKAY'.

perform bdc_field using 'MARK_CHECKBOX(02)'

'X'.

continue.

endif.

  • endat.

endif.

perform bdc_dynpro using 'SAPLSVIX' '0200'.

concatenate 'D0200_FIELD_TAB-BUFFER(' v_counter ')' into v_tarnbr.

perform bdc_field using 'BDC_CURSOR'

v_tarnbr.

perform bdc_field using 'BDC_OKCODE'

'=ANHG'.

concatenate 'QUERY_TAB-RELATION(' v_counter ')' into v_relation.

perform bdc_field using v_relation

'='.

perform bdc_field using v_tarnbr

v_wbs_mask.

concatenate 'QUERY_TAB-BOOL(' k ')' into v_bool.

perform bdc_field using v_bool

'OR'.

perform bdc_dynpro using 'SAPLSVIX' '0210'.

perform bdc_field using 'BDC_CURSOR'

'MARK_CHECKBOX(02)'.

perform bdc_field using 'BDC_OKCODE'

'=OKAY'.

perform bdc_field using 'MARK_CHECKBOX(02)'

'X'.

  • at last.

if ( v_counter EQ n ).

perform bdc_dynpro using 'SAPLSVIX' '0200'.

concatenate 'D0200_FIELD_TAB-BUFFER(' v_counter ')' into v_tarnbr.

perform bdc_field using 'BDC_CURSOR'

v_tarnbr.

perform bdc_field using 'BDC_OKCODE'

'=OKAY'.

concatenate 'QUERY_TAB-RELATION(' v_counter ')' into v_relation.

perform bdc_field using v_relation

'='.

perform bdc_field using v_tarnbr

v_wbs_mask.

concatenate 'QUERY_TAB-BOOL(' k ')' into v_bool.

perform bdc_field using v_bool

'OR'.

perform bdc_dynpro using 'SAPLSVIX' '0100'.

perform bdc_field using 'BDC_CURSOR'

'D0100_FIELD_TAB-LOWER_LIMIT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=OKAY'.

  • endat.

endif.

endloop.

perform bdc_dynpro using 'SAPLZFI_SL' '0100'.

perform bdc_field using 'BDC_CURSOR'

'ZFI_SL-FAMENBR(01)'.

perform bdc_field using 'BDC_OKCODE'

'=SAVE'.

perform bdc_dynpro using 'SAPLZFI_SL' '0100'.

perform bdc_field using 'BDC_CURSOR'

'ZFI_SL-FAMENBR(01)'.

perform bdc_field using 'BDC_OKCODE'

'=BACK'.

perform bdc_dynpro using 'SAPMSVMA' '0100'.

perform bdc_field using 'BDC_OKCODE'

'/EBACK'.

perform bdc_field using 'BDC_CURSOR'

'VIEWNAME'.

call transaction 'SM30'

using bdcdata

mode 'A'

update 'S'

messages into messtab.

----


  • Start new screen *

----


form bdc_dynpro using program dynpro.

clear bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

append bdcdata.

endform.

----


  • Insert field *

----


form bdc_field using fnam fval.

if fval <> ' '.

clear bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

append bdcdata.

endif.

endform.

Actally the requirement is client dont want all the screens to be viewed they want only the last screen to be viewed where the data gets updated and they want to skip all the screens except the last screen .By using 'N' mode we cant view any of the screens and by using 'A' screen mode we can view all the screens but they dont want that. Is there any way to do that. If there is please help me in resolving the issue.

Thanks&Regards,

Ramya

3 REPLIES 3

Former Member
0 Kudos

Hi Ramya

you can use "SKIP FIRST SCREEN" along with call transaction provided you have the PID for all the fields that you are populating....

Instead... with the scenario you are working with I believe that program will be run only in Fore ground. so try the logig below.

Set the Mode for call transaction as 'E' and do not give the BDC OKCODE for the last screen of the transaction... this will force the program to stop at the last screen and the user will then upload the details and save the transaction...

-

Santosh

0 Kudos

hi santosh,

Program works fine even in no screen mode but the problem is i want to update the data only in all screen mode and i want only one screen to be viewed that too the last screen where all the line items get updated in the table and then i should save the table.

And the logic which u told is not working.please suggest me some more.

0 Kudos

You are updating a client table (Z). Do you realy need to do it in SM30 ?

Why don't you put in a internal table the values to update and show them in a ALV. In the status put de SAVE button.

If the user press save update de z table, with OpenSQL.