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: 

call transaction issue

Former Member
0 Kudos

Hi all,

Iam using call transaction for t-code MB1A.

Though i commented out the perform statment for storage location even then i see the storage location value in when i execute the program.

This is my code

perform bdc_field using 'RM07M-BWARTWA' "movement type

w_mov_type.

perform bdc_field using 'RM07M-WERKS'

w_werks.

  • perform bdc_field using 'RM07M-LGORT'

  • w_lgort.

you can i commented out the storage location even then my i can see avalue for storage location when i execute the program.

Please let me know if iam wrong anywhere

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

I changed the code to as suggested

perform bdc_field using 'RM07M-LGORT'

' '. "" w_lgort.

i DON'T SEE ANY STORAGE LOCATION IN MY INTIAL SCREEN.

wHEN I PASSED STORAGE LOCATION IN SECOND SCREEN AND I WANT THE STORAGE LOCATION TO BE DISPLAYED I DON'T SEE ANY STORAGE LOCATION IN MY SECOND SCREEN TOO.Intially it was showing up in both the screens.

Please let me know

15 REPLIES 15

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

This might be coming from a parameter id. You can clear this field out by passin space.



perform bdc_field using 'RM07M-BWARTWA' ""movement type
w_mov_type.
perform bdc_field using 'RM07M-WERKS'
w_werks.
<b> perform bdc_field using 'RM07M-LGORT'
 ' '.  "" w_lgort.</b>


Regards,

Rich Heilman

0 Kudos

comment out in this way

<b>* perform bdc_field using 'RM07M-LGORT' " w_lgort.</b>

Manohar2u
Active Contributor
0 Kudos

Might be coming from parameter id. If this should not come, then you need to again set the parameter id to blank.

Then continue with your BDC.

Regds

Manohar

Former Member
0 Kudos

Hi,

I changed the code to as suggested

perform bdc_field using 'RM07M-LGORT'

' '. "" w_lgort.

i DON'T SEE ANY STORAGE LOCATION IN MY INTIAL SCREEN.

wHEN I PASSED STORAGE LOCATION IN SECOND SCREEN AND I WANT THE STORAGE LOCATION TO BE DISPLAYED I DON'T SEE ANY STORAGE LOCATION IN MY SECOND SCREEN TOO.Intially it was showing up in both the screens.

Please let me know

0 Kudos

How are you passing the storage location on the second screen? If I am not wrong, here you will be entering the line details. So are passing the storage location with its line index?

Also, can you not use BAPI_GOODSMVT_CREATE instead of writing a BDC?

Message was edited by: Srinivas Adavi

0 Kudos

Right, it was coping from the first, but you said that you didn't want it in the first screen. So that means that it will not copy to second screen. Which means that you BDC code will need to enter it. So if you don't want it on the first screen, but you do on your second screen, the re-record the transaction, and put the lgort on the second screen.

Not really sure what the point it though.

REgards,

Rich Heilman

0 Kudos

As Srinivas has pointed out, BAPI is a better way to go when doing goods movements. HEre is a sample program.

In this example, it is actually doing a 971 movement type, not sure what movement type you are using.



report zrich_0001.


* Structures for BAPI
data: gm_header  type bapi2017_gm_head_01.
data: gm_code    type bapi2017_gm_code.
data: gm_headret type bapi2017_gm_head_ret.
data: gm_item    type table of
                 bapi2017_gm_item_create with header line.
data: gm_return  type bapiret2 occurs 0 with header line.
data: gm_retmtd  type bapi2017_gm_head_ret-mat_doc.

clear: gm_return, gm_retmtd. refresh gm_return.

* Setup BAPI header data.
gm_header-pstng_date = sy-datum.
gm_header-doc_date   = sy-datum.
gm_code-gm_code      = '06'.    " MB11

* Write 971 movement to table
clear gm_item.
move '971'                 to gm_item-move_type     .
move '000000000040000100'  to gm_item-material.
move '1'     to gm_item-entry_qnt.
move 'EA'    to gm_item-entry_uom.
move '0004'  to gm_item-plant.
move '4999'  to gm_item-stge_loc.
move '0901'   to gm_item-move_reas.


append gm_item.

* Call goods movement BAPI
call function 'BAPI_GOODSMVT_CREATE'
     exporting
          goodsmvt_header  = gm_header
          goodsmvt_code    = gm_code
     importing
          goodsmvt_headret = gm_headret
          materialdocument = gm_retmtd
     tables
          goodsmvt_item    = gm_item
          return           = gm_return.

if not gm_retmtd is initial.
  commit work and wait.
  call function 'DEQUEUE_ALL'.
else.
  commit work and wait.
  call function 'DEQUEUE_ALL'.
endif.

write:/ gm_retmtd.

loop at gm_return.
  write:/ gm_return.
endloop.


Regards,

Rich Heilman

0 Kudos

For MB1A, GMCODE is 03.

0 Kudos

Hi ,

i have a seperate recording for both i have perform statement called first screen

This my code take a look at it

perform create_first_screen.

loop at itab_update.

clear w_erfmg.

w_erfmg = itab_update-zmenge.

perform bdc_dynpro using 'SAPMM07M' '0421'.

perform bdc_field using 'BDC_OKCODE'

'=NLE'.

perform bdc_field using 'MSEG-MATNR(01)' "Material number

itab_update-matnr.

perform bdc_field using 'MSEG-ERFMG(01)' "Quantity

w_erfmg.

perform bdc_field using 'MSEG-ERFME(01)' "UoM

itab_update-meins.

perform bdc_field using 'MSEG-WERKS' "PLANT

ITAB_UPDATE-WERKS.

perform bdc_field using 'MSEG-LGORT' "STORAGE LOCATION

ITAB_UPDATE-WERKS.

perform bdc_field using 'BDC_SUBSCR' 'SAPMM07M 2400BLOCK1'.

perform bdc_field using 'BDC_SUBSCR' 'SAPLKACB 9000BLOCK'.

if not itab_update-kostl is initial.

perform bdc_field using 'BDC_CURSOR' 'COBL-KOSTL'.

perform bdc_field using 'COBL-KOSTL' itab_update-kostl.

elseif not itab_update-aufnr is initial.

  • itab_update-kostl.

perform bdc_field using 'BDC_CURSOR' 'COBL-AUFNR'.

perform bdc_field using 'COBL-AUFNR' itab_update-aufnr.

endif.

endloop.

This form for first screen

form create_first_screen.

data: w_date(10),

w_mov_type(3) value '201',

w_txt(19) value '340B Replenishment'.

w_werks = 'abc'.

write sy-datum to w_date mm/dd/yyyy.

perform bdc_dynpro using 'SAPMM07M' '0400'.

perform bdc_field using 'BDC_CURSOR'

'RM07M-XNAPR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MKPF-BLDAT'

w_date.

perform bdc_field using 'MKPF-BUDAT'

w_date.

perform bdc_field using 'MKPF-BKTXT'

w_txt.

perform bdc_field using 'RM07M-BWARTWA' "movement type

w_mov_type.

perform bdc_field using 'RM07M-WERKS'

w_werks.

perform bdc_field using 'RM07M-LGORT'

' '.

perform bdc_field using 'XFULL'

' '.

  • perform bdc_field using 'RM07M-XNAPR' ' X'. "print flag

perform bdc_field using 'RM07M-WVERS3'

'X'.

endform. " create_first_screen

pls let me know if iam wrong anywhere

0 Kudos

Are you sure this is right?

perform bdc_field using 'MSEG-LGORT' ""STORAGE LOCATION
ITAB_UPDATE-<b>WERKS</b>.

Regards,

Rich Heilman

0 Kudos

It should be


perform bdc_field using 'MSEG-LGORT<b>(01)</b>' "STORAGE LOCATION
ITAB_UPDATE-<b>LGORT</b>.

0 Kudos

You have to change the MSEG-WERKS also to MSEG-WERKS(01).

0 Kudos

Hi all,

I got that solved .

All i needed was have to change the MSEG-WERKS also to MSEG-WERKS(01),as srinivas suggested.

I would like to thank all for there efforts and time especially Srinivas and Rich,and all others.

Thanks

0 Kudos

You are quite welcome

Reards,

Rich Heilman

0 Kudos

Glad to be of help. What you enter in the initial screen will be copied automatically to all the items in the subsequent screen. But if you want to change individual line's plant and/or storage location value or even the movement type, you have to use the index of that particular line. That is the theory behind it.