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

GL create with BDC

Former Member
0 Likes
1,795

I have recorded the transaction FS00 for creating a GL for a company code. When I run the BDC the create screen is not coming. When I manually click on create button then the whole BDC program is running fine.

please help.

Regards,

Sriram

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,629

You forget/lost an OK_CODE like ACC_CRE in your SHDB before/after generating the report.

The report should begin with

perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
perform bdc_field       using 'BDC_CURSOR'
                              'GLACCOUNT_SCREEN_KEY-BUKRS'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ACC_CRE'. " should be missing
perform bdc_field       using 'GLACCOUNT_SCREEN_KEY-SAKNR'
                              record-<account>.
perform bdc_field       using 'GLACCOUNT_SCREEN_KEY-BUKRS'
                              record-<company>.

Regards,

Raymond

10 REPLIES 10
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,630

You forget/lost an OK_CODE like ACC_CRE in your SHDB before/after generating the report.

The report should begin with

perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
perform bdc_field       using 'BDC_CURSOR'
                              'GLACCOUNT_SCREEN_KEY-BUKRS'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ACC_CRE'. " should be missing
perform bdc_field       using 'GLACCOUNT_SCREEN_KEY-SAKNR'
                              record-<account>.
perform bdc_field       using 'GLACCOUNT_SCREEN_KEY-BUKRS'
                              record-<company>.

Regards,

Raymond

Read only

0 Likes
1,629

Thanks for the reply. But if I include the following code, it gives message as enter GL account. Again, once I manually click on create button the BDC program is running. I don't know what is the code to click on create button or copy button.

perform bdc_field       using 'BDC_OKCODE'
                              '=ACC_CRE'.

Read only

0 Likes
1,629

My whole BDC code is as follows. Where should I make changes.

perform open_group.

  LOOP AT T_XK01 INTO W_XK01.
      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=%_GC 120 1'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_KEY-SAKNR'.
      

      perform bdc_dynpro      using 'SAPLSPO4' '0300'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'SVALD-VALUE(01)'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=FURT'.
      perform bdc_field       using 'SVALD-VALUE(01)'
                                    W_XK01-COCD.

      perform bdc_dynpro      using 'SAPLSPO4' '0300'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'SVALD-VALUE(02)'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=FURT'.
      perform bdc_field       using 'SVALD-VALUE(01)'
                                    W_XK01-GLNO.
      perform bdc_field       using 'SVALD-VALUE(02)'
                                    W_XK01-COCD.
      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=2102_BS_PL'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_COA-XBILK'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-XPLACCT'
                                    W_XK01-XPLACCT.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-XBILK'
                                    W_XK01-XBILK.
      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=2102_GROUP'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_COA-KTOKS'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-KTOKS'
                                    W_XK01-KTOKS.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-XBILK'
                                    W_XK01-XBILK.
      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=TAB02'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-KTOKS'
                                    W_XK01-KTOKS.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-XBILK'
                                    W_XK01-XBILK.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_COA-TXT50_ML'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-TXT20_ML'
                                    W_XK01-TXT20_ML.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-TXT50_ML'
                                    W_XK01-TXT50_ML.
      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=TAB03'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-WAERS'
                                    W_XK01-WAERS.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XSALH'
                                    W_XK01-XSALH.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XMWNO'
                                    W_XK01-XMWNO.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_CCODE-ZUAWA'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XKRES'
                                    W_XK01-XKRES.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-ZUAWA'
                                    W_XK01-ZUAWA.
      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=SAVE'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-FSTAG'
                                    W_XK01-FSTAG.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XGKON'
                                    W_XK01-XGKON.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_CCODE-ZINRT'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-ZINRT'
                                    W_XK01-ZINRT.
      perform bdc_transaction using 'FS00'.

ENDLOOP.

perform close_group.

Read only

0 Likes
1,629

You report must begin with tbe five statements i wrote above, this is the initial screen where account and company are input, cursor is set and ok_code for creation is activated.

For the OK_CODE, run a SHDB session or look at status MAIN of SAPLGL_ACCOUNT_MASTER_MAINTAIN (via system/status) - ACC_CRE for create and ACC_CRER for create with template.

Regards,

Raymond

Read only

0 Likes
1,629

Please see the following code. When I execute the program I get the message "Enter Account".

perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=ACC_CRE'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_KEY-SAKNR'.

      perform bdc_field       using 'GLACCOUNT_SCREEN_KEY-SAKNR'
                                    W_XK01-GLNO.
      perform bdc_field       using 'GLACCOUNT_SCREEN_KEY-BUKRS'
                                     W_XK01-COCD.

      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=2102_BS_PL'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_COA-XBILK'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-XPLACCT'
                                    W_XK01-XPLACCT.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-XBILK'
                                    W_XK01-XBILK.
      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=2102_GROUP'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_COA-KTOKS'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-KTOKS'
                                    W_XK01-KTOKS.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-XBILK'
                                    W_XK01-XBILK.
      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=TAB02'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-KTOKS'
                                    W_XK01-KTOKS.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-XBILK'
                                    W_XK01-XBILK.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_COA-TXT50_ML'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-TXT20_ML'
                                    W_XK01-TXT20_ML.
      perform bdc_field       using 'GLACCOUNT_SCREEN_COA-TXT50_ML'
                                    W_XK01-TXT50_ML.
      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=TAB03'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-WAERS'
                                    W_XK01-WAERS.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XSALH'
                                    W_XK01-XSALH.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XMWNO'
                                    W_XK01-XMWNO.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_CCODE-ZUAWA'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XKRES'
                                    W_XK01-XKRES.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-ZUAWA'
                                    W_XK01-ZUAWA.
      perform bdc_dynpro      using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=SAVE'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-FSTAG'
                                    W_XK01-FSTAG.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-XGKON'
                                    W_XK01-XGKON.
      perform bdc_field       using 'BDC_CURSOR'
                                    'GLACCOUNT_SCREEN_CCODE-ZINRT'.
      perform bdc_field       using 'GLACCOUNT_SCREEN_CCODE-ZINRT'
                                    W_XK01-ZINRT.
      perform bdc_transaction using 'FS00'.

Read only

0 Likes
1,629

Thanks for the help. I used FS01 and recorded. Now its working.

Read only

Former Member
0 Likes
1,629

Hi sriram,

I think u have made mistake in recording .

first four lines should be like this.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=ACC_CRE'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_KEY-SAKNR'.

perform bdc_field using 'GLACCOUNT_SCREEN_KEY-SAKNR'

record-SAKNR_001. *here u can replace ur value i.e gl account IN UR CASE W_XK01-SAKNR

perform bdc_field using 'GLACCOUNT_SCREEN_KEY-BUKRS'

record-BUKRS_002. * here u can replace with company code in run time.W_XK01-BUKRS

ENTER SOME VALUE IN FIELD AND PRESS CREATE BUTTON.

i have a small doubt u had a ok code like

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE' '=%_GC 120 1'.

WAT OK_CODE IS THIS .

Regards,

vinod.

Neccessity is the mother of invention.

Read only

0 Likes
1,629

Thanks very much for your reply. I got the recording from my FI consultant. So I created the program with that code. I don't know what OK-Code is '=%_GC 120 1'.

The code you have given should I still click the create button manually? What if I want to run it as background processing.

Is there a way to copy GL from one company code to another.

Thanks & Regards,

Sriram.

Read only

0 Likes
1,629

For you question on "copy GL from one company code to anothe", look at transaction FS15 and FS16. You can export a range of account from one company, an re-import those in another or multiple other companies.

Regards,

Raymond

Read only

Former Member
0 Likes
1,629

The OKCODE = '%_GC 120 1' you get is when you perform recording in FS00 / FSP0 / FSS0 where your display is in the form of a navigation tree.

The OKCODE = 'ACC_CRE' you get is when you perform recording in FS00 / FSP0 / FSS0 where your display is NOT in the form of a navigation tree.

Perform your recording where your default display of FS00 / FSP0 / FSS0 is NOT in the form of a navigation tree.