Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How will i get the subcode?

Hi,

Please help me for below logic.

IF RDSTDCover = 'ST' do the following:

If PA0001-BURKS='1009' go to Table

Z_LegCode to retrieve previous Company Code Text for PA0002-PERID and send

the corresponding Sub Code according to ST Translation Table 2.

Else if no value is found Lookup

PA0001-BURKS along with Report Number '100525'

and send Sub Code value from ST Translation Table 1

Else, send blanks.

IF RDSTDCover = 'LT' do the following:

If PA0001-BURKS='1009' go to Table

Z_LegCode to retrieve previous Company Code Text for

PA0002-PERID and send

the corresponding subcode according to LT Translation Table 2

Else if If no value is found Lookup

PA0001-BURKS along with Report Number '98340'

and send Payoint value from LT Translation Table 1

Else, send blanks.

IF RDSTDCover = 'LT' do the following:

If PA0001-BURKS='1009' go to Table

Z_LegCode to retrieve previous Company Code Text for

PA0002-PERID and send

the corresponding Paypoint according to LT Translation Table 2

Else if If no value is found Lookup

PA0001-BURKS along with Report Number '98340'

and send Payoint value from LT Translation Table 1

Else, send blanks.

I was created one translation table(ST Translation Table 1,ST Translation Table 2,LT Translation Table 1,LT Translation Table 2) for above all fileds ZGTBA_TL_SUBCODE.The table is having Report number & Company code text & Bukrs & Subcode and paypoint as a fields.

And I was written the code

if w_MetLife_detail-rdstdcover = u2018STu2019.
        
       if p0001-bukrs = u20181009u2019.
         read table t_ Z_LegCode into w_ Z_LegCode with key perid = p0002-perid.
          if sy-subrc eq 0.
            w_MetLife_detail-rdstdsubcde = ZGTBA_TL_SUBCODE-zsubcode.
          elseif
            select single HIST_BUKRS from ZGTBA_TL_SUBCODE
                                into   l_bukrs
                                where ZREPORTNO  = u2018100525u2019.

            w_MetLife_detail-rdstdsubcde = ZGTBA_TL_SUBCODE-zsubcode.
            else.
            w_MetLife_detail-rdstdsubcde  = ' '.
          endif.
        endif.
      endif.
      if w_MetLife_detail-rdstdcover =u2019STu2019.
        if p0001-bukrs = u20181009u2019.
          read table t_ Z_LegCode into w_ Z_LegCode with key perid = p0002-perid.
          if sy-subrc eq 0.
            w_MetLife_detail-rdstdsubpoint = ZGTBA_TL_SUBCODE-zpaypoint.
          elseif
            select single HIST_BUKRS from ZGTBA_TL_SUBCODE
                                into   l_bukrs
                                where ZREPORTNO  = u2018100525u2019.

            w_MetLife_detail-rdstdsubpoint = ZGTBA_TL_SUBCODE-zpaypoint.
           else.
           w_MetLife_detail-rdstdsubpoint  = ' '.
          endif.
        endif.
      endif.
    endif.
if w_MetLife_detail-rdstdcover = u2018LTu2019.
        if p0001-bukrs = u20181009u2019.
    .          read table t_ Z_LegCode into w_ Z_LegCode with key perid = p0002-perid.
          if sy-subrc eq 0.
            w_MetLife_detail-rdLtdsubcde = ZGTBA_TL_SUBCODE-zsubcode.
          elseif
            select single HIST_BUKRS from ZGTBA_TL_SUBCODE
                                into   l_bukrs
                                where ZREPORTNO  = u201898340u2019.

            w_MetLife_detail-rdLtdsubcde = ZGTBA_TL_SUBCODE-zsubcode.
          endif.
        endif.
      endif.
      if w_MetLife_detail-rdstdcover =u2019LTu2019.
        if p0001-bukrs = u20181009u2019.
          read table t_ Z_LegCode into w_ Z_LegCode with key perid = p0002-perid.
          if sy-subrc eq 0.
            w_MetLife_detail-rdstdsubpoint = ZGTBA_TL_SUBCODE-zpaypoint.
          elseif
            select single HIST_BUKRS from ZGTBA_TL_SUBCODE
                                into   l_bukrs
                                where ZREPORTNO  = u201898340u2019.

            w_MetLife_detail-rdLtdsubpoint = ZGTBA_TL_SUBCODE-zpaypoint.
          endif.
        endif.
      endif.
    endif.

Please suggest me is it correct code?or any changes are required in the code for above requirement?

Regards.

Sujan

Former Member
Not what you were looking for? View more on this topic or Ask a question