cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with table LTAP when used in sapscript form

Former Member
0 Kudos

Hi gurus,

I have a strange problem that I don't understand. I am modifying a customer form that prints a Picking List Delivery, for the pickers to know where to fetch the materials and in which pallet to put them. I can find all that information in table LTAP, so in that way no problem.

The problem comes when I am trying to find out if there is more than one material repeated, to put a mark * in front of the material number to make it easier for the picker. I call an external subroutine in the MAIN window of my form. See example below:


/*   Checking recurrences for every material in the pick list       
/:   PERFORM GET_RECURRENCE IN PROGRAM Z_PICK_DEL                   
/:   USING &LTAK-TANUM&                                             
/:   USING &LTAK-LGNUM&                                             
/:   USING &LTAP-MATNR&                                             
/:   CHANGING &RECURRENCE&                                          
/:   ENDPERFORM                                                     
Z4   &RECURRENCE(3)&  &LTAP-MATNR&,,    &LTAP-VLTYP& / &LTAP-VLPLA&,

And then the subroutine does this:


FORM get_recurrence TABLES   in STRUCTURE itcsy
                                                out STRUCTURE itcsy.
  DATA: w_tanum LIKE ltak-tanum,
        w_lgnum LIKE ltak-lgnum,
        w_matnr LIKE ltap-matnr,
        w_vbeln LIKE lips-vbeln.
  DATA: l_flag(1) TYPE C.

* Get first parameter in input table
  READ TABLE in INDEX 1.
  w_tanum = in-value.

* Get second parameter in input table
  READ TABLE in INDEX 2.
  w_lgnum = in-value.

* Get third parameter in input table
  READ TABLE in INDEX 3.
  w_matnr = in-value.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
       EXPORTING
            input  = w_matnr
       IMPORTING
            output = w_matnr.

  SELECT COUNT(*) FROM ltap
  WHERE lgnum = w_lgnum AND
        tanum = w_tanum AND
        matnr = w_matnr.

  if SY-DBCNT > 1.
    l_flag = '*'.
  else.
    l_flag = SPACE.
  endif.

  READ TABLE out INDEX 1.
  WRITE l_flag TO out-value.

  MODIFY out INDEX 1.

ENDFORM.                    " get_recurrence

What I don't understand is why when I do the SELECT over the LTAP table it finds nothing, because apparently it has not been updated yet... But then in the form I can print things like &LTAP-MATNR& and so on and they have data...

Can anybody give me a clue on this? I´m totally lost, I think the LTAP table should be updated by the time I do this but in fact it is not.

Regards. Elena

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

hi,

Can you do this for the field lgnum

-> Declare a variable

DATA:L_LGNUM(3) TYPE N.

-> MOVE THE VARIABLE W_LGNUM TO

L_LGNUM = W_LGNUM.

and check the result

Thanks,

Nethaji.

Former Member
0 Kudos

The solution was to import that information from the ABAP memory.

Former Member
0 Kudos

Thank you SaiRam but the problem is still there because the table does not have yet the data I am trying to fetch. Anyway, thank you very much for the optimization tip.

Regards. Elena

Former Member
0 Kudos

Hi,

Try creating Transfer Order for a particular material (I don't remember T.code to create T.O,functional consultant can guide)

Once the T.O is confirmed u can retrieve the data from LTAP.

Hope it may resolve your problem.

Reward points if helpful..

Former Member
0 Kudos

The problem is solved now, a senior collegue helped me but thanks everybody anyeay. The trick was to take that information from the ABAP memory, because when I need it is not yet in table LTAP. Here is an extract of the code and it works!!


  SELECT COUNT(*) FROM ltap
  WHERE lgnum = w_lgnum AND
        tanum = w_tanum AND
        matnr = w_matnr.

  IF NOT sy-subrc = 0.
    IMPORT tap FROM MEMORY ID druck_id.
    IF sy-subrc = 0.
      CLEAR sy-dbcnt.
      LOOP AT tap WHERE lgnum = w_lgnum
                  AND   tanum = w_tanum
                  AND   matnr = w_matnr.
        sy-dbcnt = sy-dbcnt + 1.
      ENDLOOP.
    ENDIF.
  ENDIF.

BR. Elena

Former Member
0 Kudos

Yes I checked in the layout and the data is there, that is why I don´t understand that when I do the SELECT it cannot find it because table LTAP should already contain the data. When I do the debugging I also check via SE11 and the items of the TO haven´t been registered yet.

If it helps, the way i create this picking list is via tcode VL06O and button "For picking" and then I chose a delivery and I click on button "TO in backgr.".

Elena

former_member196280
Active Contributor
0 Kudos

Try like this( it also improves performance)

<b> SELECT Single * FROM ltap

WHERE lgnum = w_lgnum AND

tanum = w_tanum AND

matnr = w_matnr.

if SY-subrc EQ 0.

l_flag = '*'.

else.

l_flag = SPACE.

endif.</b>

instead of this

<i> SELECT COUNT(*) FROM ltap

WHERE lgnum = w_lgnum AND

tanum = w_tanum AND

matnr = w_matnr.

if SY-DBCNT > 1.

l_flag = '*'.

else.

l_flag = SPACE.

endif.</i>

Regards,

SaiRam

Former Member
0 Kudos

HI,

Check whether the data is coming in the layout, if the Material number is available in the SAPSCRIPT then the data should be available in LTAP table, your code is correct

Regards

Sudheer